diff options
author | Max Horn | 2006-07-09 13:01:15 +0000 |
---|---|---|
committer | Max Horn | 2006-07-09 13:01:15 +0000 |
commit | f35f4a4d1c41a8d186621b912b985dd5d796632a (patch) | |
tree | 1468779935932e47d32e838458df8d2cf3a5bbe8 | |
parent | 880838514f28fd298e6418f2096d61b3f757e237 (diff) | |
download | scummvm-rg350-f35f4a4d1c41a8d186621b912b985dd5d796632a.tar.gz scummvm-rg350-f35f4a4d1c41a8d186621b912b985dd5d796632a.tar.bz2 scummvm-rg350-f35f4a4d1c41a8d186621b912b985dd5d796632a.zip |
Use START_PACK_STRUCTS / END_PACK_STRUCTS when available, instead of checking for GCC / not GCC
svn-id: r23458
30 files changed, 133 insertions, 79 deletions
diff --git a/common/scummsys.h b/common/scummsys.h index d9fa056729..a76ca494e6 100644 --- a/common/scummsys.h +++ b/common/scummsys.h @@ -70,6 +70,20 @@ #endif +// +// By default we try to use pragma push/pop to ensure various structs we use +// are "packed". If your compiler doesn't support this pragma, you are in for +// a problem. If you are lucky, an equivalent pragma is available, in which +// case you can redefine these two macros appropriately. Or maybe your port +// simply *always* packs everything, in which case you could #undefine them. +// +// If neither is possible, tough luck. Try to contact the team, maybe we can +// come up with a solution, though I wouldn't hold my breath on it :-/. +// +#define START_PACK_STRUCTS pack(push, 1) +#define END_PACK_STRUCTS pack(pop) + + #if defined(_MSC_VER) && !defined(__SYMBIAN32__) && !defined(_WIN32_WCE) #define scumm_stricmp stricmp @@ -357,11 +371,6 @@ // // Fallbacks / default values for various special macros // -#ifndef START_PACK_STRUCTS -#define START_PACK_STRUCTS pack(push, 1) -#define END_PACK_STRUCTS pack(pop) -#endif - #ifndef FORCEINLINE #define FORCEINLINE inline #endif diff --git a/engines/gob/game.h b/engines/gob/game.h index ff4d133800..eaecf5a17f 100644 --- a/engines/gob/game.h +++ b/engines/gob/game.h @@ -31,7 +31,10 @@ namespace Gob { class Game { public: +#if defined(START_PACK_STRUCTS) #pragma START_PACK_STRUCTS +#endif + struct Collision { int16 id; int16 left; @@ -127,7 +130,10 @@ public: int32 frameDataSize; int32 vidBufferSize; } GCC_PACK; + +#if defined(END_PACK_STRUCTS) #pragma END_PACK_STRUCTS +#endif TotResTable *_totResourceTable; Collision *_collisionAreas; diff --git a/engines/gob/goblin.h b/engines/gob/goblin.h index 6058595ece..dc63fdef93 100644 --- a/engines/gob/goblin.h +++ b/engines/gob/goblin.h @@ -37,7 +37,11 @@ namespace Gob { class Goblin { public: + +#if defined(START_PACK_STRUCTS) #pragma START_PACK_STRUCTS +#endif + struct Gob_State { int16 animation;// +0h int16 layer; // +2h @@ -92,7 +96,10 @@ public: char x; char y; } GCC_PACK; + +#if defined(END_PACK_STRUCTS) #pragma END_PACK_STRUCTS +#endif Util::List *_objList; Gob_Object *_goblins[4]; diff --git a/engines/gob/map.h b/engines/gob/map.h index 606af141d0..cc5e2b3432 100644 --- a/engines/gob/map.h +++ b/engines/gob/map.h @@ -43,7 +43,9 @@ public: kDirSE = 0x5100 }; +#if defined(START_PACK_STRUCTS) #pragma START_PACK_STRUCTS +#endif struct Point { int16 x; @@ -59,7 +61,9 @@ public: int8 orient; // ?? } GCC_PACK; +#if defined(END_PACK_STRUCTS) #pragma END_PACK_STRUCTS +#endif int16 _mapWidth; int16 _mapHeight; diff --git a/engines/gob/mult.h b/engines/gob/mult.h index 54c2526a32..18b6b9565b 100644 --- a/engines/gob/mult.h +++ b/engines/gob/mult.h @@ -31,7 +31,11 @@ namespace Gob { class Mult { public: + +#if defined(START_PACK_STRUCTS) #pragma START_PACK_STRUCTS +#endif + struct Mult_AnimData { int8 animation; int8 layer; @@ -156,7 +160,9 @@ public: int16 field_E; } GCC_PACK; +#if defined(END_PACK_STRUCTS) #pragma END_PACK_STRUCTS +#endif // Globals diff --git a/engines/gob/scenery.h b/engines/gob/scenery.h index e8121b9398..9ce1f7eded 100644 --- a/engines/gob/scenery.h +++ b/engines/gob/scenery.h @@ -27,7 +27,11 @@ namespace Gob { class Scenery { public: + +#if defined(START_PACK_STRUCTS) #pragma START_PACK_STRUCTS +#endif + struct PieceDesc { int16 left; //NOTE: int16 right; //These are stored in Little Endian format @@ -70,7 +74,10 @@ public: int16 framesCount; AnimFramePiece *frames; } GCC_PACK; + +#if defined(END_PACK_STRUCTS) #pragma END_PACK_STRUCTS +#endif struct Static { int16 layersCount; diff --git a/engines/gob/video.h b/engines/gob/video.h index 24c331d875..880df95e84 100644 --- a/engines/gob/video.h +++ b/engines/gob/video.h @@ -72,7 +72,9 @@ public: #define RETURN_PRIMARY 0x01 #define DISABLE_SPR_ALLOC 0x20 +#if defined(START_PACK_STRUCTS) #pragma START_PACK_STRUCTS +#endif struct Color { byte red; @@ -80,7 +82,9 @@ public: byte blue; } GCC_PACK; +#if defined(END_PACK_STRUCTS) #pragma END_PACK_STRUCTS +#endif struct PalDesc { Color *vgaPal; diff --git a/engines/lure/res_struct.h b/engines/lure/res_struct.h index ded24f61f9..2dc37f73cd 100644 --- a/engines/lure/res_struct.h +++ b/engines/lure/res_struct.h @@ -37,7 +37,7 @@ extern const char *actionList[]; /* */ /*-------------------------------------------------------------------------*/ -#if !defined(__GNUC__) +#if defined(START_PACK_STRUCTS) #pragma START_PACK_STRUCTS #endif @@ -215,7 +215,7 @@ struct RoomExitIndexedHotspotResource { uint16 hotspotId; }; -#if !defined(__GNUC__) +#if defined(END_PACK_STRUCTS) #pragma END_PACK_STRUCTS #endif diff --git a/engines/queen/queen.h b/engines/queen/queen.h index 1da6176ab7..154c64c64e 100644 --- a/engines/queen/queen.h +++ b/engines/queen/queen.h @@ -49,8 +49,8 @@ FORCEINLINE int16 READ_BE_INT16(const void *ptr) { namespace Queen { -#if !defined(__GNUC__) - #pragma START_PACK_STRUCTS +#if defined(START_PACK_STRUCTS) +#pragma START_PACK_STRUCTS #endif struct GameStateHeader { @@ -60,8 +60,8 @@ struct GameStateHeader { char description[32]; } GCC_PACK; -#if !defined(__GNUC__) - #pragma END_PACK_STRUCTS +#if defined(END_PACK_STRUCTS) +#pragma END_PACK_STRUCTS #endif class BamScene; diff --git a/engines/saga/gfx.h b/engines/saga/gfx.h index 2c0f4df600..04f3d17e71 100644 --- a/engines/saga/gfx.h +++ b/engines/saga/gfx.h @@ -78,14 +78,19 @@ struct ClipData { } }; +#if defined(START_PACK_STRUCTS) #pragma START_PACK_STRUCTS +#endif + struct PalEntry { byte red; byte green; byte blue; } GCC_PACK; +#if defined(END_PACK_STRUCTS) #pragma END_PACK_STRUCTS +#endif struct Color { int red; diff --git a/engines/scumm/akos.cpp b/engines/scumm/akos.cpp index 26ea99d202..4d01f87e57 100644 --- a/engines/scumm/akos.cpp +++ b/engines/scumm/akos.cpp @@ -36,7 +36,7 @@ namespace Scumm { -#if !defined(__GNUC__) +#if defined(START_PACK_STRUCTS) #pragma START_PACK_STRUCTS #endif @@ -54,7 +54,7 @@ struct AkosOffset { uint16 akci; } GCC_PACK; -#if !defined(__GNUC__) +#if defined(END_PACK_STRUCTS) #pragma END_PACK_STRUCTS #endif diff --git a/engines/scumm/base-costume.h b/engines/scumm/base-costume.h index 4fc666e445..516129a564 100644 --- a/engines/scumm/base-costume.h +++ b/engines/scumm/base-costume.h @@ -29,7 +29,7 @@ namespace Scumm { -#if !defined(__GNUC__) +#if defined(START_PACK_STRUCTS) #pragma START_PACK_STRUCTS #endif @@ -39,7 +39,7 @@ struct CostumeInfo { int16 move_x, move_y; } GCC_PACK; -#if !defined(__GNUC__) +#if defined(END_PACK_STRUCTS) #pragma END_PACK_STRUCTS #endif diff --git a/engines/scumm/boxes.cpp b/engines/scumm/boxes.cpp index bb5f490f8c..2e2947c475 100644 --- a/engines/scumm/boxes.cpp +++ b/engines/scumm/boxes.cpp @@ -31,8 +31,8 @@ namespace Scumm { -#if !defined(__GNUC__) - #pragma START_PACK_STRUCTS +#if defined(START_PACK_STRUCTS) +#pragma START_PACK_STRUCTS #endif struct Box { /* Internal walkbox file format */ @@ -81,8 +81,8 @@ struct Box { /* Internal walkbox file format */ } GCC_PACK; } GCC_PACK; -#if !defined(__GNUC__) - #pragma END_PACK_STRUCTS +#if defined(END_PACK_STRUCTS) +#pragma END_PACK_STRUCTS #endif #define BOX_MATRIX_SIZE 2000 diff --git a/engines/scumm/file.cpp b/engines/scumm/file.cpp index 877d1436c4..00393e6274 100644 --- a/engines/scumm/file.cpp +++ b/engines/scumm/file.cpp @@ -1241,7 +1241,10 @@ static ScummNESFile::LFL lfls[] = { { -1, NULL } }; +#if defined(START_PACK_STRUCTS) #pragma START_PACK_STRUCTS +#endif + struct _lfl_index { byte room_lfl[55]; uint16 room_addr[55]; @@ -1252,7 +1255,10 @@ struct _lfl_index { byte sound_lfl[100]; uint16 sound_addr[100]; } GCC_PACK lfl_index; + +#if defined(END_PACK_STRUCTS) #pragma END_PACK_STRUCTS +#endif bool ScummNESFile::generateResource(int res) { diff --git a/engines/scumm/he/intern_he.h b/engines/scumm/he/intern_he.h index 5fe639db4f..dfdaf4fa18 100644 --- a/engines/scumm/he/intern_he.h +++ b/engines/scumm/he/intern_he.h @@ -226,8 +226,8 @@ protected: const char *desc; }; -#if !defined(__GNUC__) - #pragma START_PACK_STRUCTS +#if defined(START_PACK_STRUCTS) +#pragma START_PACK_STRUCTS #endif struct ArrayHeader { @@ -239,8 +239,8 @@ protected: byte data[1]; //14 } GCC_PACK; -#if !defined(__GNUC__) - #pragma END_PACK_STRUCTS +#if defined(END_PACK_STRUCTS) +#pragma END_PACK_STRUCTS #endif const OpcodeEntryV72he *_opcodesV72he; diff --git a/engines/scumm/he/resource_he.h b/engines/scumm/he/resource_he.h index 488a7d5cfc..cc542cfda6 100644 --- a/engines/scumm/he/resource_he.h +++ b/engines/scumm/he/resource_he.h @@ -172,8 +172,8 @@ class Win32ResExtractor : public ResExtractor { * Structures */ -#if !defined(__GNUC__) - #pragma START_PACK_STRUCTS +#if defined(START_PACK_STRUCTS) +#pragma START_PACK_STRUCTS #endif struct WinLibrary { @@ -456,8 +456,8 @@ class Win32ResExtractor : public ResExtractor { uint16 number_of_id_entries; }; -#if !defined(__GNUC__) - #pragma END_PACK_STRUCTS +#if defined(END_PACK_STRUCTS) +#pragma END_PACK_STRUCTS #endif /* diff --git a/engines/scumm/intern.h b/engines/scumm/intern.h index d14c31acd6..d011370739 100644 --- a/engines/scumm/intern.h +++ b/engines/scumm/intern.h @@ -519,9 +519,9 @@ protected: kDwordArray = 6 }; - #if !defined(__GNUC__) - #pragma START_PACK_STRUCTS - #endif +#if defined(START_PACK_STRUCTS) +#pragma START_PACK_STRUCTS +#endif struct ArrayHeader { int16 dim1; @@ -530,9 +530,9 @@ protected: byte data[1]; } GCC_PACK; - #if !defined(__GNUC__) - #pragma END_PACK_STRUCTS - #endif +#if defined(END_PACK_STRUCTS) +#pragma END_PACK_STRUCTS +#endif const OpcodeEntryV6 *_opcodesV6; diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp index 5f4501ecac..db53ecb3c4 100644 --- a/engines/scumm/object.cpp +++ b/engines/scumm/object.cpp @@ -36,8 +36,8 @@ namespace Scumm { -#if !defined(__GNUC__) - #pragma START_PACK_STRUCTS +#if defined(START_PACK_STRUCTS) +#pragma START_PACK_STRUCTS #endif struct BompHeader { /* Bomp header */ @@ -53,8 +53,8 @@ struct BompHeader { /* Bomp header */ } GCC_PACK; } GCC_PACK; -#if !defined(__GNUC__) - #pragma END_PACK_STRUCTS +#if defined(END_PACK_STRUCTS) +#pragma END_PACK_STRUCTS #endif diff --git a/engines/scumm/object.h b/engines/scumm/object.h index edb779b5eb..2e6a0723e5 100644 --- a/engines/scumm/object.h +++ b/engines/scumm/object.h @@ -51,8 +51,8 @@ struct ObjectData { byte flags; }; -#if !defined(__GNUC__) - #pragma START_PACK_STRUCTS +#if defined(START_PACK_STRUCTS) +#pragma START_PACK_STRUCTS #endif struct RoomHeader { @@ -159,8 +159,8 @@ struct ImageHeader { /* file format */ } GCC_PACK; } GCC_PACK; -#if !defined(__GNUC__) - #pragma END_PACK_STRUCTS +#if defined(END_PACK_STRUCTS) +#pragma END_PACK_STRUCTS #endif struct FindObjectInRoom { diff --git a/engines/scumm/player_v2.h b/engines/scumm/player_v2.h index 02a74e7bc0..8feb082154 100644 --- a/engines/scumm/player_v2.h +++ b/engines/scumm/player_v2.h @@ -37,8 +37,8 @@ namespace Scumm { class ScummEngine; -#if !defined(__GNUC__) - #pragma START_PACK_STRUCTS +#if defined(START_PACK_STRUCTS) +#pragma START_PACK_STRUCTS #endif struct channel_data { @@ -66,8 +66,8 @@ struct channel_data { uint16 music_script_nr; // 48 } GCC_PACK; -#if !defined(__GNUC__) - #pragma END_PACK_STRUCTS +#if defined(END_PACK_STRUCTS) +#pragma END_PACK_STRUCTS #endif diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index 6c8fecd2a9..2a67798f83 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -53,8 +53,8 @@ struct SaveGameHeader { char name[32]; }; -#if !defined(__GNUC__) - #pragma START_PACK_STRUCTS +#if defined(START_PACK_STRUCTS) +#pragma START_PACK_STRUCTS #endif struct SaveInfoSection { @@ -69,8 +69,8 @@ struct SaveInfoSection { uint16 time; } GCC_PACK; -#if !defined(__GNUC__) - #pragma END_PACK_STRUCTS +#if defined(END_PACK_STRUCTS) +#pragma END_PACK_STRUCTS #endif #define INFOSECTION_VERSION 2 diff --git a/engines/scumm/thumbnail.cpp b/engines/scumm/thumbnail.cpp index af2052fa87..0008d7539c 100644 --- a/engines/scumm/thumbnail.cpp +++ b/engines/scumm/thumbnail.cpp @@ -31,8 +31,8 @@ namespace Scumm { #define THMB_VERSION 1 -#if !defined(__GNUC__) - #pragma START_PACK_STRUCTS +#if defined(START_PACK_STRUCTS) +#pragma START_PACK_STRUCTS #endif struct ThumbnailHeader { @@ -43,8 +43,8 @@ struct ThumbnailHeader { byte bpp; } GCC_PACK; -#if !defined(__GNUC__) - #pragma END_PACK_STRUCTS +#if defined(END_PACK_STRUCTS) +#pragma END_PACK_STRUCTS #endif diff --git a/engines/simon/vga.h b/engines/simon/vga.h index fe2bbb15f8..192676e443 100644 --- a/engines/simon/vga.h +++ b/engines/simon/vga.h @@ -26,8 +26,8 @@ namespace Simon { -#if !defined(__GNUC__) - #pragma START_PACK_STRUCTS +#if defined(START_PACK_STRUCTS) +#pragma START_PACK_STRUCTS #endif // Feeble Files @@ -94,8 +94,8 @@ struct AnimationHeader_Simon { } GCC_PACK; -#if !defined(__GNUC__) - #pragma END_PACK_STRUCTS +#if defined(END_PACK_STRUCTS) +#pragma END_PACK_STRUCTS #endif enum DrawFlags { diff --git a/engines/sky/sound.cpp b/engines/sky/sound.cpp index 9cd9e7ef72..0a98c7d070 100644 --- a/engines/sky/sound.cpp +++ b/engines/sky/sound.cpp @@ -37,7 +37,7 @@ namespace Sky { #define SFXF_START_DELAY 0x80 #define SFXF_SAVE 0x20 -#if !defined(__GNUC__) +#if defined(START_PACK_STRUCTS) #pragma START_PACK_STRUCTS #endif @@ -53,7 +53,7 @@ struct Sfx { RoomList roomList[10]; } GCC_PACK; -#if !defined(__GNUC__) +#if defined(END_PACK_STRUCTS) #pragma END_PACK_STRUCTS #endif diff --git a/engines/sky/struc.h b/engines/sky/struc.h index 45d1d946ca..3f34aac5ce 100644 --- a/engines/sky/struc.h +++ b/engines/sky/struc.h @@ -36,7 +36,7 @@ struct displayText_t { uint32 textWidth; }; -#if !defined(__GNUC__) +#if defined(START_PACK_STRUCTS) #pragma START_PACK_STRUCTS #endif @@ -166,7 +166,7 @@ struct Compact { MegaSet megaSet3; // } GCC_PACK; -#if !defined(__GNUC__) +#if defined(END_PACK_STRUCTS) #pragma END_PACK_STRUCTS #endif diff --git a/engines/sword1/mouse.h b/engines/sword1/mouse.h index 8512d85791..35b2bc7324 100644 --- a/engines/sword1/mouse.h +++ b/engines/sword1/mouse.h @@ -48,8 +48,8 @@ struct MouseObj { Object *compact; }; -#if !defined(__GNUC__) - #pragma START_PACK_STRUCTS +#if defined(START_PACK_STRUCTS) +#pragma START_PACK_STRUCTS #endif struct MousePtr { @@ -61,8 +61,8 @@ struct MousePtr { uint8 dummyData[0x30]; } GCC_PACK; -#if !defined(__GNUC__) - #pragma END_PACK_STRUCTS +#if defined(END_PACK_STRUCTS) +#pragma END_PACK_STRUCTS #endif class Logic; diff --git a/engines/sword1/object.h b/engines/sword1/object.h index 61727e7abc..e8f80eaf2d 100644 --- a/engines/sword1/object.h +++ b/engines/sword1/object.h @@ -32,8 +32,8 @@ namespace Sword1 { #define O_GRID_SIZE 200 #define EXTRA_GRID_SIZE 20 -#if !defined(__GNUC__) - #pragma START_PACK_STRUCTS +#if defined(START_PACK_STRUCTS) +#pragma START_PACK_STRUCTS #endif struct OEventSlot { //receiving event list in the compact - @@ -120,8 +120,8 @@ struct Object { // mega size = 12340 bytes (+ 8 byte offset table + 20 byte header = 12368) } GCC_PACK; -#if !defined(__GNUC__) - #pragma END_PACK_STRUCTS +#if defined(END_PACK_STRUCTS) +#pragma END_PACK_STRUCTS #endif } // End of namespace Sword1 diff --git a/engines/sword1/router.h b/engines/sword1/router.h index b20a70a481..0d8645c105 100644 --- a/engines/sword1/router.h +++ b/engines/sword1/router.h @@ -27,8 +27,8 @@ namespace Sword1 { -#if !defined(__GNUC__) - #pragma START_PACK_STRUCTS +#if defined(START_PACK_STRUCTS) +#pragma START_PACK_STRUCTS #endif struct BarData { @@ -53,8 +53,8 @@ struct NodeData { int16 dist; } GCC_PACK; -#if !defined(__GNUC__) - #pragma END_PACK_STRUCTS +#if defined(END_PACK_STRUCTS) +#pragma END_PACK_STRUCTS #endif struct FloorData { diff --git a/engines/sword1/sworddefs.h b/engines/sword1/sworddefs.h index 4b057245c5..019cdcb756 100644 --- a/engines/sword1/sworddefs.h +++ b/engines/sword1/sworddefs.h @@ -89,8 +89,8 @@ namespace Sword1 { #define MAX_text_obs 2 //text compacts #define TEXT_sect 149 //text compacts exist in section 149, probably after all the megas -#if !defined(__GNUC__) - #pragma START_PACK_STRUCTS +#if defined(START_PACK_STRUCTS) +#pragma START_PACK_STRUCTS #endif struct Header { @@ -134,8 +134,8 @@ struct WalkGridHeader { int32 numNodes; } GCC_PACK; -#if !defined(__GNUC__) - #pragma END_PACK_STRUCTS +#if defined(END_PACK_STRUCTS) +#pragma END_PACK_STRUCTS #endif enum fileTypes { diff --git a/sound/voc.h b/sound/voc.h index d53fcedcdf..c44f9f4f1a 100644 --- a/sound/voc.h +++ b/sound/voc.h @@ -34,7 +34,7 @@ namespace Audio { class AudioStream; -#if !defined(__GNUC__) +#if defined(START_PACK_STRUCTS) #pragma START_PACK_STRUCTS #endif @@ -52,7 +52,7 @@ struct VocBlockHeader { uint8 pack; } GCC_PACK; -#if !defined(__GNUC__) +#if defined(END_PACK_STRUCTS) #pragma END_PACK_STRUCTS #endif |