diff options
author | Eugene Sandulenko | 2006-11-12 19:05:51 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2006-11-12 19:05:51 +0000 |
commit | 3e6414a55fb05fa733248574f8305c0f716415d8 (patch) | |
tree | 69caf27d39f14c373a9d652a89b1a0fe60d376db /engines/sword1/resman.h | |
parent | 6e66bf505128a276abede415c94213271e0c3f30 (diff) | |
download | scummvm-rg350-3e6414a55fb05fa733248574f8305c0f716415d8.tar.gz scummvm-rg350-3e6414a55fb05fa733248574f8305c0f716415d8.tar.bz2 scummvm-rg350-3e6414a55fb05fa733248574f8305c0f716415d8.zip |
Slighty modified Patch #1571787: "Support for Mac Broken Sword 1". sword1macdemo
target was commented out until existence of the demo is confirmed.
svn-id: r24697
Diffstat (limited to 'engines/sword1/resman.h')
-rw-r--r-- | engines/sword1/resman.h | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/engines/sword1/resman.h b/engines/sword1/resman.h index e2920b0a81..05cc54f92f 100644 --- a/engines/sword1/resman.h +++ b/engines/sword1/resman.h @@ -26,6 +26,7 @@ #include "sword1/memman.h" #include "common/file.h" #include "sword1/sworddefs.h" +#include "common/endian.h" namespace Sword1 { @@ -62,7 +63,7 @@ struct Prj { class ResMan { public: - ResMan(const char *fileName); + ResMan(const char *fileName, bool isMacFile); ~ResMan(void); void flush(void); void resClose(uint32 id); @@ -74,6 +75,36 @@ public: Header *lockScript(uint32 scrID); void unlockScript(uint32 scrID); FrameHeader *fetchFrame(void *resourceData, uint32 frameNo); + + uint16 getUint16(uint16 value) { + return (_isBigEndian) ? FROM_BE_16(value): FROM_LE_16(value); + } + uint32 getUint32(uint32 value) { + return (_isBigEndian) ? FROM_BE_32(value): FROM_LE_32(value); + } + uint16 getLEUint16(uint16 value) { + return FROM_LE_16(value); + } + uint32 getLEUint32(uint32 value) { + return FROM_LE_32(value); + } + uint16 readUint16(const void *ptr) { + return (_isBigEndian) ? READ_BE_UINT16(ptr): READ_LE_UINT16(ptr); + } + uint32 readUint32(const void *ptr) { + return (_isBigEndian) ? READ_BE_UINT32(ptr):READ_LE_UINT32(ptr); + } + uint32 readLEUint32(const void *ptr) { + return READ_LE_UINT32(ptr); + } + uint16 toUint16(uint16 value) { + return (_isBigEndian) ? TO_BE_16(value): TO_LE_16(value); + } + uint32 toUint32(uint32 value) { + return (_isBigEndian) ? TO_BE_32(value): TO_LE_32(value); + } + + private: uint32 resLength(uint32 id); MemHandle *resHandle(uint32 id); @@ -82,6 +113,8 @@ private: void openCptResourceBigEndian(uint32 id); void openScriptResourceBigEndian(uint32 id); + void openCptResourceLittleEndian(uint32 id); + void openScriptResourceLittleEndian(uint32 id); void loadCluDescript(const char *fileName); void freeCluDescript(void); @@ -91,6 +124,7 @@ private: static uint32 _srIdList[29]; Clu *_openCluStart, *_openCluEnd; int _openClus; + bool _isBigEndian; }; } // End of namespace Sword1 |