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:
parent
6480603d61
commit
617e26091f
9 changed files with 56 additions and 7 deletions
10
Makefile
10
Makefile
|
@ -4,8 +4,14 @@ AR = ar rcu
|
||||||
CXXFLAGS = -g -W -Wall -Ilua/include `sdl-config --cflags` -DUNIX \
|
CXXFLAGS = -g -W -Wall -Ilua/include `sdl-config --cflags` -DUNIX \
|
||||||
-Wno-multichar # -O2
|
-Wno-multichar # -O2
|
||||||
LDFLAGS = -g -W -Wall # -O2
|
LDFLAGS = -g -W -Wall # -O2
|
||||||
LIBS = -Llua/lib -llua -llualib `sdl-config --libs` \
|
LIBS = -Llua/lib -llua -llualib `sdl-config --libs` -lz
|
||||||
-lGL -lGLU -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 \
|
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 \
|
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 \
|
sound.o timer.o keyframe.o costume.o walkplane.o textobject.o \
|
||||||
|
|
2
README
2
README
|
@ -5,7 +5,7 @@ Residual: A LucasArts 3D game interpreter Version: 0.02-CVS
|
||||||
What is Residual?
|
What is Residual?
|
||||||
-----------------
|
-----------------
|
||||||
Residual is a ScummVM (http://www.scummvm.org/) sub-project to play LucasArts'
|
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.
|
and requires a 3D card with working OpenGL support.
|
||||||
|
|
||||||
The main ScummVM program can run LucasArts 2D SCUMM adventures (among others).
|
The main ScummVM program can run LucasArts 2D SCUMM adventures (among others).
|
||||||
|
|
|
@ -55,6 +55,12 @@ Resource(filename) {
|
||||||
decompress_codec3(data + pos + 4, data_[i]);
|
decompress_codec3(data + pos + 4, data_[i]);
|
||||||
pos += compressed_len + 12;
|
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) {
|
if (format_ == 1) {
|
||||||
|
|
13
blocky16.cpp
13
blocky16.cpp
|
@ -645,10 +645,18 @@ static void bompInit(const byte *src) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bompDecodeMain(byte *dst, const byte *src, int size) {
|
static void bompDecodeMain(byte *dst, const byte *src, int size) {
|
||||||
|
int count = size / 2;
|
||||||
|
byte *start = dst;
|
||||||
|
|
||||||
bompInit(src);
|
bompInit(src);
|
||||||
while (size--) {
|
while (size--) {
|
||||||
*dst++ = bompDecode();
|
*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) {
|
void Blocky16::decode(byte *dst, const byte *src) {
|
||||||
|
@ -680,6 +688,11 @@ void Blocky16::decode(byte *dst, const byte *src) {
|
||||||
|
|
||||||
switch(src[18]) {
|
switch(src[18]) {
|
||||||
case 0:
|
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);
|
memcpy(_curBuf, gfx_data, _frameSize);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
|
2
lua.cpp
2
lua.cpp
|
@ -1084,7 +1084,9 @@ static void NewObjectState() {
|
||||||
if (!unk2)
|
if (!unk2)
|
||||||
unk3 = check_int(6); // ?
|
unk3 = check_int(6); // ?
|
||||||
|
|
||||||
|
#ifndef OSX
|
||||||
warning("Stub: newObjectState(%d, %s, %s)", setupID, bitmap, zbitmap);
|
warning("Stub: newObjectState(%d, %s, %s)", setupID, bitmap, zbitmap);
|
||||||
|
#endif
|
||||||
// object = scene.addObjectState;
|
// object = scene.addObjectState;
|
||||||
// lua_pushusertag(object, object_tag);
|
// lua_pushusertag(object, object_tag);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,13 @@
|
||||||
|
|
||||||
|
|
||||||
#define skip_word(pc) (pc+=2)
|
#define skip_word(pc) (pc+=2)
|
||||||
|
|
||||||
|
/* Little Endian */
|
||||||
#define get_word(pc) (*((unsigned short*)(pc)))
|
#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))
|
#define next_word(pc) (pc+=2, get_word(pc-2))
|
||||||
|
|
||||||
|
|
||||||
|
|
8
main.cpp
8
main.cpp
|
@ -88,16 +88,24 @@ int main(int argc, char *argv[]) {
|
||||||
Bitmap *splash_bm = ResourceLoader::instance()->loadBitmap("splash.bm");
|
Bitmap *splash_bm = ResourceLoader::instance()->loadBitmap("splash.bm");
|
||||||
|
|
||||||
SDL_Event event;
|
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)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
if (event.type == SDL_VIDEOEXPOSE) {
|
if (event.type == SDL_VIDEOEXPOSE) {
|
||||||
|
#else
|
||||||
|
SDL_PollEvent(&event);
|
||||||
|
#endif
|
||||||
g_driver->clearScreen();
|
g_driver->clearScreen();
|
||||||
|
|
||||||
Bitmap::prepareDraw();
|
Bitmap::prepareDraw();
|
||||||
splash_bm->draw();
|
splash_bm->draw();
|
||||||
|
|
||||||
g_driver->flipBuffer();
|
g_driver->flipBuffer();
|
||||||
|
#ifndef OSX
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
lua_open();
|
lua_open();
|
||||||
|
|
||||||
|
|
|
@ -691,7 +691,7 @@ void Model::Mesh::draw() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SCREENBLOCKS_GLOBAL == 1)
|
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);
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
|
|
@ -63,7 +63,13 @@ void Smush::init() {
|
||||||
_movieTime = 0;
|
_movieTime = 0;
|
||||||
_videoFinished = false;
|
_videoFinished = false;
|
||||||
_videoPause = 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;
|
_updateNeeded = false;
|
||||||
|
#else
|
||||||
|
_updateNeeded = true;
|
||||||
|
#endif
|
||||||
if (!_surface)
|
if (!_surface)
|
||||||
_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, _width, _height, 16, 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000);
|
_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, _width, _height, 16, 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000);
|
||||||
if (!_bufSurface)
|
if (!_bufSurface)
|
||||||
|
@ -94,8 +100,10 @@ void Smush::handleWave(const byte *src, uint32 size) {
|
||||||
int16 *dst = new int16[size * _channels];
|
int16 *dst = new int16[size * _channels];
|
||||||
decompressVima((char *)src, dst, size * _channels * 2, destTable);
|
decompressVima((char *)src, dst, size * _channels * 2, destTable);
|
||||||
|
|
||||||
|
#ifndef SYSTEM_BIG_ENDIAN
|
||||||
for (uint32 j = 0; j < size * _channels; j++)
|
for (uint32 j = 0; j < size * _channels; j++)
|
||||||
dst[j] = SWAP_BYTES_16(dst[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;
|
||||||
// int flags = SoundMixer::FLAG_16BITS | SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_LITTLE_ENDIAN;
|
// int flags = SoundMixer::FLAG_16BITS | SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_LITTLE_ENDIAN;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue