Preliminary BE/Mac support.

To compile on Mac OSX: edit the Makefile and uncomment the OSX LIBS/CXXFLAGS additions (and comment out the -lGL -lGLU line)
and edit lua/src/lvm.c to use the Big Endian macro.
This commit is contained in:
Joost Peters 2004-03-21 15:16:57 +00:00
parent 6480603d61
commit 617e26091f
9 changed files with 56 additions and 7 deletions

View file

@ -4,8 +4,14 @@ AR = ar rcu
CXXFLAGS = -g -W -Wall -Ilua/include `sdl-config --cflags` -DUNIX \
-Wno-multichar # -O2
LDFLAGS = -g -W -Wall # -O2
LIBS = -Llua/lib -llua -llualib `sdl-config --libs` \
-lGL -lGLU -lz
LIBS = -Llua/lib -llua -llualib `sdl-config --libs` -lz
LIBS += -lGL -lGLU
# For OSX use these instead of -lGL and -lGLU
#LIBS += -framework OpenGL -framework GLUT
#CXXFLAGS += -DOSX
OBJS = main.o lab.o bitmap.o model.o resource.o material.o debug.o \
textsplit.o lua.o registry.o localize.o scene.o engine.o actor.o \
sound.o timer.o keyframe.o costume.o walkplane.o textobject.o \

2
README
View file

@ -5,7 +5,7 @@ Residual: A LucasArts 3D game interpreter Version: 0.02-CVS
What is Residual?
-----------------
Residual is a ScummVM (http://www.scummvm.org/) sub-project to play LucasArts'
LUA-bassed 3D adventures, such as Grim Fandango. Residual is an OpenGL program,
LUA-based 3D adventures, such as Grim Fandango. Residual is an OpenGL program,
and requires a 3D card with working OpenGL support.
The main ScummVM program can run LucasArts 2D SCUMM adventures (among others).

View file

@ -50,13 +50,19 @@ Resource(filename) {
if (codec == 0) {
memcpy(data_[i], data + pos, 2 * width_ * height_);
pos += 2 * width_ * height_ + 8;
} else if (codec == 3) {
} else if (codec == 3) {
int compressed_len = READ_LE_UINT32(data + pos);
decompress_codec3(data + pos + 4, data_[i]);
pos += compressed_len + 12;
}
}
#ifdef SYSTEM_BIG_ENDIAN
for (int j = 0; j < width_ * height_; ++j) {
((uint16 *)data_[i])[j] = SWAP_BYTES_16(((uint16 *)data_[i])[j]);
}
#endif
}
if (format_ == 1) {
num_tex_ = ((width_ + (BITMAP_TEXTURE_SIZE - 1)) / BITMAP_TEXTURE_SIZE) *
((height_ + (BITMAP_TEXTURE_SIZE - 1)) / BITMAP_TEXTURE_SIZE);

View file

@ -645,10 +645,18 @@ static void bompInit(const byte *src) {
}
static void bompDecodeMain(byte *dst, const byte *src, int size) {
int count = size / 2;
byte *start = dst;
bompInit(src);
while (size--) {
*dst++ = bompDecode();
}
#ifdef SYSTEM_BIG_ENDIAN
for (int i = 0; i < count; ++i) {
((uint16 *)start)[i] = SWAP_BYTES_16(((uint16 *)start)[i]);
}
#endif
}
void Blocky16::decode(byte *dst, const byte *src) {
@ -680,6 +688,11 @@ void Blocky16::decode(byte *dst, const byte *src) {
switch(src[18]) {
case 0:
#ifdef SYSTEM_BIG_ENDIAN
for (int i = 0; i < _width * _height; ++i) {
((uint16*)gfx_data)[i] = TO_LE_16(((uint16*)gfx_data)[i]);
}
#endif
memcpy(_curBuf, gfx_data, _frameSize);
break;
case 1:

View file

@ -1084,7 +1084,9 @@ static void NewObjectState() {
if (!unk2)
unk3 = check_int(6); // ?
#ifndef OSX
warning("Stub: newObjectState(%d, %s, %s)", setupID, bitmap, zbitmap);
#endif
// object = scene.addObjectState;
// lua_pushusertag(object, object_tag);
}

View file

@ -28,7 +28,13 @@
#define skip_word(pc) (pc+=2)
/* Little Endian */
#define get_word(pc) (*((unsigned short*)(pc)))
/* Big Endian */
/*#define get_word(pc) ((*((pc)+1)<<8)|(*(pc))) */
#define next_word(pc) (pc+=2, get_word(pc-2))

View file

@ -88,16 +88,24 @@ int main(int argc, char *argv[]) {
Bitmap *splash_bm = ResourceLoader::instance()->loadBitmap("splash.bm");
SDL_Event event;
// For some reason we don't get the SDL_VIDEOEXPOSE event on OSX, so just don't wait for it.
#ifndef OSX
while (SDL_PollEvent(&event)) {
if (event.type == SDL_VIDEOEXPOSE) {
#else
SDL_PollEvent(&event);
#endif
g_driver->clearScreen();
Bitmap::prepareDraw();
splash_bm->draw();
g_driver->flipBuffer();
#ifndef OSX
}
}
#endif
lua_open();

View file

@ -691,7 +691,7 @@ void Model::Mesh::draw() const {
}
if (SCREENBLOCKS_GLOBAL == 1)
screenBlocksAddRectangle( top, right, left, bottom, bestDepth );
screenBlocksAddRectangle( (int)top, (int)right, (int)left, (int)bottom, (int)bestDepth );
}
/*
glDisable(GL_DEPTH_TEST);

View file

@ -63,7 +63,13 @@ void Smush::init() {
_movieTime = 0;
_videoFinished = false;
_videoPause = false;
//HACK: If we don't set it here, it'll never get set at all..
// This is BAD - but until we find the source of the problem, this'll have to do.
#ifndef OSX
_updateNeeded = false;
#else
_updateNeeded = true;
#endif
if (!_surface)
_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, _width, _height, 16, 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000);
if (!_bufSurface)
@ -94,9 +100,11 @@ void Smush::handleWave(const byte *src, uint32 size) {
int16 *dst = new int16[size * _channels];
decompressVima((char *)src, dst, size * _channels * 2, destTable);
#ifndef SYSTEM_BIG_ENDIAN
for (uint32 j = 0; j < size * _channels; j++)
dst[j] = SWAP_BYTES_16(dst[j]);
#endif
int flags = SoundMixer::FLAG_16BITS | SoundMixer::FLAG_AUTOFREE;
// int flags = SoundMixer::FLAG_16BITS | SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_LITTLE_ENDIAN;
if (_channels == 2)