From 3e6414a55fb05fa733248574f8305c0f716415d8 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 12 Nov 2006 19:05:51 +0000 Subject: 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 --- engines/sword1/resman.h | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'engines/sword1/resman.h') 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 -- cgit v1.2.3