endian fixes

svn-id: r10192
This commit is contained in:
Oliver Kiehl 2003-09-12 18:52:53 +00:00
parent c805e260a9
commit 9dc282f1d5
8 changed files with 176 additions and 62 deletions

View File

@ -349,7 +349,7 @@ int32 AnimateMouse(void) {
if (++mouseFrame == mouseAnim->noAnimFrames) if (++mouseFrame == mouseAnim->noAnimFrames)
mouseFrame = MOUSEFLASHFRAME; mouseFrame = MOUSEFLASHFRAME;
mouseSprite = (uint8 *) mouseAnim + *(mouseOffsets + mouseFrame); mouseSprite = (uint8 *) mouseAnim + (int32)READ_LE_UINT32(mouseOffsets + mouseFrame);
if (mouseFrame != prevMouseFrame) if (mouseFrame != prevMouseFrame)
DrawMouse(); DrawMouse();

View File

@ -698,7 +698,7 @@ int32 Sword2Sound::OpenFx(int32 id, uint8 *data) {
while (i < 100) { while (i < 100) {
if (*data == 'd') { if (*data == 'd') {
data32 = (uint32*)data; data32 = (uint32*)data;
if (*data32 == 'atad') if (READ_LE_UINT32(data32) == 'atad')
break; break;
} }
i += 1; i += 1;

View File

@ -1139,7 +1139,7 @@ int32 InitialiseBackgroundLayer(_parallax *p) {
memset(memchunk, 0, p->w * p->h); memset(memchunk, 0, p->w * p->h);
for (i = 0; i < p->h; i++) { for (i = 0; i < p->h; i++) {
if (p->offset[i] == 0) if (FROM_LE_32(p->offset[i]) == 0)
continue; continue;
line = (_parallaxLine *) ((uint8 *) p + FROM_LE_32(p->offset[i])); line = (_parallaxLine *) ((uint8 *) p + FROM_LE_32(p->offset[i]));

View File

@ -367,6 +367,13 @@ _frameHeader* FindChar( uint8 ch, uint8 *charSet )
if( (ch<FIRST_CHAR) ) // if 'ch' out of range if( (ch<FIRST_CHAR) ) // if 'ch' out of range
// if( (ch<FIRST_CHAR) || (ch>LAST_CHAR) ) // if 'ch' out of range // if( (ch<FIRST_CHAR) || (ch>LAST_CHAR) ) // if 'ch' out of range
ch = DUD; // then print the 'dud' character (chequered flag) ch = DUD; // then print the 'dud' character (chequered flag)
// FIXME: HACK!!!! remapping ' and ! because they cause FetchFrameHeader to crash....
#ifdef MACOSX
if (ch == '\'')
ch = ' ';
if (ch == '!')
ch = ' ';
#endif
// address of char = address of charSet + offset to char // address of char = address of charSet + offset to char
//return (charSet + *(int32 *)(charSet + sizeof(_header) + 4 + 4*(ch - FIRST_CHAR))); //return (charSet + *(int32 *)(charSet + sizeof(_header) + 4 + 4*(ch - FIRST_CHAR)));

View File

@ -1252,13 +1252,13 @@ int32 FN_register_mouse(int32 *params) //Tony29Oct96
Con_fatal_error("ERROR: mouse_list full [%s line %u]",__FILE__,__LINE__); Con_fatal_error("ERROR: mouse_list full [%s line %u]",__FILE__,__LINE__);
#endif #endif
mouse_list[cur_mouse].x1 = ob_mouse->x1; mouse_list[cur_mouse].x1 = FROM_LE_32(ob_mouse->x1);
mouse_list[cur_mouse].y1 = ob_mouse->y1; mouse_list[cur_mouse].y1 = FROM_LE_32(ob_mouse->y1);
mouse_list[cur_mouse].x2 = ob_mouse->x2; mouse_list[cur_mouse].x2 = FROM_LE_32(ob_mouse->x2);
mouse_list[cur_mouse].y2 = ob_mouse->y2; mouse_list[cur_mouse].y2 = FROM_LE_32(ob_mouse->y2);
mouse_list[cur_mouse].priority = ob_mouse->priority; mouse_list[cur_mouse].priority = FROM_LE_32(ob_mouse->priority);
mouse_list[cur_mouse].pointer = ob_mouse->pointer; mouse_list[cur_mouse].pointer = FROM_LE_32(ob_mouse->pointer);
//----------------------------------------------- //-----------------------------------------------
// (James17jun97) // (James17jun97)

View File

@ -40,7 +40,7 @@ uint8 *FetchPalette(uint8 *screenFile) // Chris 04Oct96
_multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader)); _multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader));
palette = (uint8 *)mscreenHeader + FROM_LE_32(mscreenHeader->palette); palette = (uint8 *)mscreenHeader + mscreenHeader->palette;
palette[0] = 0; // always set colour 0 to black palette[0] = 0; // always set colour 0 to black
palette[1] = 0; // because most background screen palettes have a bright colour 0 palette[1] = 0; // because most background screen palettes have a bright colour 0
@ -57,7 +57,7 @@ uint8 *FetchPaletteMatchTable(uint8 *screenFile) // James 09dec96
{ {
_multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader)); _multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader));
return (uint8 *) mscreenHeader + FROM_LE_32(mscreenHeader->paletteTable); return (uint8 *) mscreenHeader + mscreenHeader->paletteTable;
} }
//----------------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------------
@ -67,13 +67,7 @@ _screenHeader *FetchScreenHeader(uint8 *screenFile) //Chris 04Oct96
{ {
// Get the table // Get the table
_multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader)); _multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader));
_screenHeader *screenHeader = (_screenHeader*) ((uint8 *) mscreenHeader + FROM_LE_32(mscreenHeader->screen)); _screenHeader *screenHeader = (_screenHeader*) ((uint8 *) mscreenHeader + mscreenHeader->screen);
#if defined(SCUMM_BIG_ENDIAN)
screenHeader->width = SWAP_BYTES_16(screenHeader->width);
screenHeader->height = SWAP_BYTES_16(screenHeader->height);
screenHeader->noLayers = SWAP_BYTES_16(screenHeader->noLayers);
#endif
return screenHeader; return screenHeader;
} }
@ -92,16 +86,7 @@ _layerHeader *FetchLayerHeader(uint8 *screenFile, uint16 layerNo) //Chris 04Oct9
_multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader)); _multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader));
_layerHeader *layerHeader = (_layerHeader *) ((uint8 *) mscreenHeader + FROM_LE_32(mscreenHeader->layers) + (layerNo * sizeof(_layerHeader))); _layerHeader *layerHeader = (_layerHeader *) ((uint8 *) mscreenHeader + mscreenHeader->layers + (layerNo * sizeof(_layerHeader)));
#if defined(SCUMM_BIG_ENDIAN)
layerHeader->x = SWAP_BYTES_16(layerHeader->x);
layerHeader->y = SWAP_BYTES_16(layerHeader->y);
layerHeader->width = SWAP_BYTES_16(layerHeader->width);
layerHeader->height = SWAP_BYTES_16(layerHeader->height);
layerHeader->maskSize = SWAP_BYTES_32(layerHeader->maskSize);
layerHeader->offset = SWAP_BYTES_32(layerHeader->offset);
#endif
return layerHeader; return layerHeader;
} }
@ -114,7 +99,7 @@ uint8 *FetchShadingMask(uint8 *screenFile) // James 08apr97
{ {
_multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader)); _multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader));
return (uint8 *) mscreenHeader + FROM_LE_32(mscreenHeader->maskOffset); return (uint8 *) mscreenHeader + mscreenHeader->maskOffset;
} }
//----------------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------------
@ -126,15 +111,6 @@ _animHeader *FetchAnimHeader(uint8 *animFile) // (25sep96JEL)
_animHeader *animHead; _animHeader *animHead;
animHead = (_animHeader *) (animFile + sizeof(_standardHeader)); animHead = (_animHeader *) (animFile + sizeof(_standardHeader));
#if defined(SCUMM_BIG_ENDIAN)
animHead->noAnimFrames = SWAP_BYTES_16(animHead->noAnimFrames);
animHead->feetStartX = SWAP_BYTES_16(animHead->feetStartX);
animHead->feetStartY = SWAP_BYTES_16(animHead->feetStartY);
animHead->feetEndX = SWAP_BYTES_16(animHead->feetEndX);
animHead->feetEndY = SWAP_BYTES_16(animHead->feetEndY);
animHead->blend = SWAP_BYTES_16(animHead->blend);
#endif
return animHead; return animHead;
} }
@ -157,12 +133,6 @@ _cdtEntry *FetchCdtEntry(uint8 *animFile, uint16 frameNo) // Chris 09Oct96
_cdtEntry *cdtEntry; _cdtEntry *cdtEntry;
cdtEntry = (_cdtEntry *) ( (uint8 *)animHead + sizeof(_animHeader) + frameNo * sizeof(_cdtEntry) ); cdtEntry = (_cdtEntry *) ( (uint8 *)animHead + sizeof(_animHeader) + frameNo * sizeof(_cdtEntry) );
#if defined(SCUMM_BIG_ENDIAN)
cdtEntry->x = (int16)SWAP_BYTES_16(cdtEntry->x);
cdtEntry->y = (int16)SWAP_BYTES_16(cdtEntry->y);
cdtEntry->frameOffset = SWAP_BYTES_32(cdtEntry->frameOffset);
#endif
return cdtEntry; return cdtEntry;
} }
@ -176,12 +146,6 @@ _frameHeader *FetchFrameHeader(uint8 *animFile, uint16 frameNo) // James 31oct96
// required address = (address of the start of the anim header) + frameOffset // required address = (address of the start of the anim header) + frameOffset
_frameHeader *frameHeader = (_frameHeader *) (animFile + sizeof(_standardHeader) + (FetchCdtEntry(animFile,frameNo)->frameOffset) ); _frameHeader *frameHeader = (_frameHeader *) (animFile + sizeof(_standardHeader) + (FetchCdtEntry(animFile,frameNo)->frameOffset) );
#if defined(SCUMM_BIG_ENDIAN)
frameHeader->compSize = SWAP_BYTES_32(frameHeader->compSize);
frameHeader->width = SWAP_BYTES_16(frameHeader->width);
frameHeader->height = SWAP_BYTES_16(frameHeader->height);
#endif
return frameHeader; return frameHeader;
} }
//--------------------------------------------------------------- //---------------------------------------------------------------
@ -192,12 +156,13 @@ _parallax *FetchBackgroundParallaxLayer(uint8 *screenFile, int layer) // Chris 0
_multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader)); _multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader));
#ifdef _SWORD2_DEBUG #ifdef _SWORD2_DEBUG
if (FROM_LE_32(mscreenHeader->bg_parallax[layer]) == 0) if (mscreenHeader->bg_parallax[layer] == 0)
Con_fatal_error("FetchBackgroundParallaxLayer(%d) - No parallax layer exists (%s line %u)",layer,__FILE__,__LINE__); Con_fatal_error("FetchBackgroundParallaxLayer(%d) - No parallax layer exists (%s line %u)",layer,__FILE__,__LINE__);
#endif #endif
_parallax *parallax = (_parallax *) ((uint8 *) mscreenHeader + FROM_LE_32(mscreenHeader->bg_parallax[layer])); _parallax *parallax = (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->bg_parallax[layer]);
// FIXME: this shouldn't be here
#if defined(SCUMM_BIG_ENDIAN) #if defined(SCUMM_BIG_ENDIAN)
parallax->w = SWAP_BYTES_16(parallax->w); parallax->w = SWAP_BYTES_16(parallax->w);
parallax->h = SWAP_BYTES_16(parallax->h); parallax->h = SWAP_BYTES_16(parallax->h);
@ -211,17 +176,18 @@ _parallax *FetchBackgroundLayer(uint8 *screenFile) // Chris 04Oct96
_multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader)); _multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader));
#ifdef _SWORD2_DEBUG #ifdef _SWORD2_DEBUG
if (FROM_LE_32(mscreenHeader->screen) == 0) if (mscreenHeader->screen == 0)
Con_fatal_error("FetchBackgroundLayer (%d) - No background layer exists (%s line %u)",__FILE__,__LINE__); Con_fatal_error("FetchBackgroundLayer (%d) - No background layer exists (%s line %u)",__FILE__,__LINE__);
#endif #endif
_parallax *parallax = (_parallax *) ((uint8 *) mscreenHeader + FROM_LE_32(mscreenHeader->screen) + sizeof(_screenHeader)); _parallax *parallax = (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->screen + sizeof(_screenHeader));
// FIXME: this shouldn't be here
#if defined(SCUMM_BIG_ENDIAN) #if defined(SCUMM_BIG_ENDIAN)
parallax->w = SWAP_BYTES_16(parallax->w); parallax->w = SWAP_BYTES_16(parallax->w);
parallax->h = SWAP_BYTES_16(parallax->h); parallax->h = SWAP_BYTES_16(parallax->h);
#endif #endif
return parallax; return parallax;
} }
//--------------------------------------------------------------- //---------------------------------------------------------------
@ -230,12 +196,13 @@ _parallax *FetchForegroundParallaxLayer(uint8 *screenFile, int layer) // Chris 0
_multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader)); _multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader));
#ifdef _SWORD2_DEBUG #ifdef _SWORD2_DEBUG
if (FROM_LE_32(mscreenHeader->fg_parallax[layer]) == 0) if (mscreenHeader->fg_parallax[layer] == 0)
Con_fatal_error("FetchForegroundParallaxLayer(%d) - No parallax layer exists (%s line %u)",layer,__FILE__,__LINE__); Con_fatal_error("FetchForegroundParallaxLayer(%d) - No parallax layer exists (%s line %u)",layer,__FILE__,__LINE__);
#endif #endif
_parallax *parallax = (_parallax *) ((uint8 *) mscreenHeader + FROM_LE_32(mscreenHeader->fg_parallax[layer])); _parallax *parallax = (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->fg_parallax[layer]);
// FIXME: this shouldn't be here
#if defined(SCUMM_BIG_ENDIAN) #if defined(SCUMM_BIG_ENDIAN)
parallax->w = SWAP_BYTES_16(parallax->w); parallax->w = SWAP_BYTES_16(parallax->w);
parallax->h = SWAP_BYTES_16(parallax->h); parallax->h = SWAP_BYTES_16(parallax->h);
@ -256,19 +223,18 @@ uint8 *FetchTextLine(uint8 *file, uint32 text_line) //Tony24Oct96
_textHeader *text_header = (_textHeader *) (file + sizeof(_standardHeader)); _textHeader *text_header = (_textHeader *) (file + sizeof(_standardHeader));
if (text_line>=FROM_LE_32(text_header->noOfLines)) // (James08aug97) if (text_line>=text_header->noOfLines) // (James08aug97)
{ {
fileHeader = (_standardHeader*)file; fileHeader = (_standardHeader*)file;
sprintf ((char*)errorLine, "xxMissing line %d of %s (only 0..%d)", text_line, fileHeader->name, FROM_LE_32(text_header->noOfLines)-1); sprintf ((char*)errorLine, "xxMissing line %d of %s (only 0..%d)", text_line, fileHeader->name, text_header->noOfLines-1);
errorLine[0]=0; // first 2 chars are NULL so that actor-number comes out as '0' errorLine[0]=0; // first 2 chars are NULL so that actor-number comes out as '0'
errorLine[1]=0; errorLine[1]=0;
return(errorLine); return(errorLine);
// GOT RID OF CON_FATAL_ERROR HERE BECAUSE WE DON'T WANT IT TO CRASH OUT ANY MORE! // GOT RID OF CON_FATAL_ERROR HERE BECAUSE WE DON'T WANT IT TO CRASH OUT ANY MORE!
// Con_fatal_error("FetchTextLine cannot get %d, only 0..%d avail (%s line %u)", text_line, FROM_LE_32(text_header->noOfLines)-1,__FILE__,__LINE__); // Con_fatal_error("FetchTextLine cannot get %d, only 0..%d avail (%s line %u)", text_line, text_header->noOfLines-1,__FILE__,__LINE__);
} }
point=(uint32*) text_header+1; //point to the lookup table point=(uint32*) text_header+1; //point to the lookup table
return( (uint8*) (file + READ_LE_UINT32(point+text_line)) ); return( (uint8*) (file + READ_LE_UINT32(point+text_line)) );
@ -279,7 +245,7 @@ uint8 CheckTextLine(uint8 *file, uint32 text_line) // (James26jun97)
{ {
_textHeader *text_header = (_textHeader *) (file + sizeof(_standardHeader)); _textHeader *text_header = (_textHeader *) (file + sizeof(_standardHeader));
if (text_line>=FROM_LE_32(text_header->noOfLines)) if (text_line>=text_header->noOfLines)
return(0); // out of range => invalid return(0); // out of range => invalid
else else
return(1); // valid return(1); // valid

View File

@ -368,6 +368,10 @@ uint8 *resMan::Res_open(uint32 res) { //BHTony30May96
//close the cluster //close the cluster
file.close(); file.close();
#ifdef SCUMM_BIG_ENDIAN
convertEndian((uint8 *) resList[res]->ad);
#endif
} else { } else {
// Zdebug("RO %d, already open count=%d", res, count[res]); // Zdebug("RO %d, already open count=%d", res, count[res]);
} }
@ -386,6 +390,142 @@ uint8 *resMan::Res_open(uint32 res) { //BHTony30May96
return (uint8 *) resList[res]->ad; return (uint8 *) resList[res]->ad;
} }
void resMan::convertEndian(uint8 *file) {
_standardHeader *hdr = (_standardHeader *)file;
hdr->compSize = SWAP_BYTES_32(hdr->compSize);
hdr->decompSize = SWAP_BYTES_32(hdr->decompSize);
switch(hdr->fileType) {
case ANIMATION_FILE: {
_animHeader *animHead = (_animHeader *) (file + sizeof(_standardHeader));
animHead->noAnimFrames = SWAP_BYTES_16(animHead->noAnimFrames);
animHead->feetStartX = SWAP_BYTES_16(animHead->feetStartX);
animHead->feetStartY = SWAP_BYTES_16(animHead->feetStartY);
animHead->feetEndX = SWAP_BYTES_16(animHead->feetEndX);
animHead->feetEndY = SWAP_BYTES_16(animHead->feetEndY);
animHead->blend = SWAP_BYTES_16(animHead->blend);
int i;
for (i = 0; i < animHead->noAnimFrames; i++) {
_cdtEntry *cdtEntry = (_cdtEntry *) ( (uint8 *)animHead + sizeof(_animHeader) + i * sizeof(_cdtEntry) );
cdtEntry->x = (int16)SWAP_BYTES_16(cdtEntry->x);
cdtEntry->y = (int16)SWAP_BYTES_16(cdtEntry->y);
cdtEntry->frameOffset = SWAP_BYTES_32(cdtEntry->frameOffset);
_frameHeader *frameHeader = (_frameHeader *) (file + sizeof(_standardHeader) + cdtEntry->frameOffset);
frameHeader->compSize = SWAP_BYTES_32(frameHeader->compSize);
frameHeader->width = SWAP_BYTES_16(frameHeader->width);
frameHeader->height = SWAP_BYTES_16(frameHeader->height);
}
break;
}
case SCREEN_FILE: {
_multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (file + sizeof(_standardHeader));
mscreenHeader->palette = SWAP_BYTES_32(mscreenHeader->palette);
mscreenHeader->bg_parallax[0] = SWAP_BYTES_32(mscreenHeader->bg_parallax[0]);
mscreenHeader->bg_parallax[1] = SWAP_BYTES_32(mscreenHeader->bg_parallax[1]);
mscreenHeader->screen = SWAP_BYTES_32(mscreenHeader->screen);
mscreenHeader->fg_parallax[0] = SWAP_BYTES_32(mscreenHeader->fg_parallax[0]);
mscreenHeader->fg_parallax[1] = SWAP_BYTES_32(mscreenHeader->fg_parallax[1]);
mscreenHeader->layers = SWAP_BYTES_32(mscreenHeader->layers);
mscreenHeader->paletteTable = SWAP_BYTES_32(mscreenHeader->paletteTable);
mscreenHeader->maskOffset = SWAP_BYTES_32(mscreenHeader->maskOffset);
// screenHeader
_screenHeader *screenHeader = (_screenHeader*) ((uint8 *) mscreenHeader + mscreenHeader->screen);
screenHeader->width = SWAP_BYTES_16(screenHeader->width);
screenHeader->height = SWAP_BYTES_16(screenHeader->height);
screenHeader->noLayers = SWAP_BYTES_16(screenHeader->noLayers);
// layerHeader
_layerHeader *layerHeader;
int i;
for (i = 0; i < screenHeader->noLayers; i++) {
layerHeader = (_layerHeader *) ((uint8 *) mscreenHeader + mscreenHeader->layers + (i * sizeof(_layerHeader)));
layerHeader->x = SWAP_BYTES_16(layerHeader->x);
layerHeader->y = SWAP_BYTES_16(layerHeader->y);
layerHeader->width = SWAP_BYTES_16(layerHeader->width);
layerHeader->height = SWAP_BYTES_16(layerHeader->height);
layerHeader->maskSize = SWAP_BYTES_32(layerHeader->maskSize);
layerHeader->offset = SWAP_BYTES_32(layerHeader->offset);
}
// FIXME: byte swapping should be done here instead of in protocol.cpp
/*
// backgroundParallaxLayer
_parallax *parallax;
parallax = (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->bg_parallax[0]);
parallax->w = SWAP_BYTES_16(parallax->w);
parallax->h = SWAP_BYTES_16(parallax->h);
parallax = (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->bg_parallax[1]);
parallax->w = SWAP_BYTES_16(parallax->w);
parallax->h = SWAP_BYTES_16(parallax->h);
// backgroundLayer
parallax = (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->screen + sizeof(_screenHeader));
parallax->w = SWAP_BYTES_16(parallax->w);
parallax->h = SWAP_BYTES_16(parallax->h);
// foregroundParallaxLayer
parallax = (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->fg_parallax[0]);
parallax->w = SWAP_BYTES_16(parallax->w);
parallax->h = SWAP_BYTES_16(parallax->h);
parallax = (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->fg_parallax[1]);
parallax->w = SWAP_BYTES_16(parallax->w);
parallax->h = SWAP_BYTES_16(parallax->h);
*/
break;
}
case GAME_OBJECT: {
_object_hub *objectHub = (_object_hub *) ((_standardHeader *)file+1);
objectHub->type = (int)SWAP_BYTES_32(objectHub->type);
objectHub->logic_level = SWAP_BYTES_32(objectHub->logic_level);
int i;
for (i = 0; i < TREE_SIZE; i++) {
objectHub->logic[i] = SWAP_BYTES_32(objectHub->logic[i]);
objectHub->script_id[i] = SWAP_BYTES_32(objectHub->script_id[i]);
objectHub->script_pc[i] = SWAP_BYTES_32(objectHub->script_pc[i]);
}
break;
}
case WALK_GRID_FILE: {
_walkGridHeader *walkGridHeader = (_walkGridHeader *)file;
walkGridHeader->numBars = SWAP_BYTES_32(walkGridHeader->numBars);
walkGridHeader->numNodes = SWAP_BYTES_32(walkGridHeader->numNodes);
break;
}
case GLOBAL_VAR_FILE:
break;
case PARALLAX_FILE_null:
break;
case RUN_LIST:
break;
case TEXT_FILE: {
_textHeader *textHeader = (_textHeader *) (file + sizeof(_standardHeader));
textHeader->noOfLines = SWAP_BYTES_32(textHeader->noOfLines);
break;
}
case SCREEN_MANAGER:
break;
case MOUSE_FILE:
break;
case ICON_FILE:
break;
}
}
uint8 resMan::Res_check_valid(uint32 res) { // James 12mar97 uint8 resMan::Res_check_valid(uint32 res) { // James 12mar97
// returns '1' if resource is valid, otherwise returns '0' // returns '1' if resource is valid, otherwise returns '0'
// used in startup.cpp to ignore invalid screen-manager resources // used in startup.cpp to ignore invalid screen-manager resources

View File

@ -44,6 +44,7 @@ class resMan
void Res_close(uint32 res); //decrements the count void Res_close(uint32 res); //decrements the count
//---- //----
void convertEndian(uint8 *ad);
uint8 Res_check_valid( uint32 res ); // returns '0' if resource out of range or null, otherwise '1' for ok uint8 Res_check_valid( uint32 res ); // returns '0' if resource out of range or null, otherwise '1' for ok