diff options
author | Eugene Sandulenko | 2004-12-15 00:24:12 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2004-12-15 00:24:12 +0000 |
commit | 502b279d243d79f46bb8a151ae610949d30bf757 (patch) | |
tree | 7f17defd563f74aa4944c7f8c6da0bc9ffc81c1a /saga/rscfile.cpp | |
parent | 58eabb6a5fdafed605fcb0cd8f56dbcea8723d46 (diff) | |
download | scummvm-rg350-502b279d243d79f46bb8a151ae610949d30bf757.tar.gz scummvm-rg350-502b279d243d79f46bb8a151ae610949d30bf757.tar.bz2 scummvm-rg350-502b279d243d79f46bb8a151ae610949d30bf757.zip |
Patch #1081904 ITE: MAC demo support
o Endianness-aware resource loading
o Removed ys_dl_list in favor of our object implementation
o Cleanup in actor code
o Partial support for ITE Mac rereleased demo
svn-id: r16051
Diffstat (limited to 'saga/rscfile.cpp')
-rw-r--r-- | saga/rscfile.cpp | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/saga/rscfile.cpp b/saga/rscfile.cpp index 929c1c5f6e..cbfa60b484 100644 --- a/saga/rscfile.cpp +++ b/saga/rscfile.cpp @@ -26,6 +26,8 @@ #include "saga/rscfile_mod.h" #include "saga/rscfile.h" +#include "saga/game_mod.h" +#include "saga/stream.h" namespace Saga { @@ -113,11 +115,11 @@ int RSC_LoadRSC(RSCFILE_CONTEXT *rsc) { if (rsc->rc_file->read(tblinfo_buf, RSC_TABLEINFO_SIZE) != RSC_TABLEINFO_SIZE) { return FAILURE; } + + MemoryReadStreamEndian readS(tblinfo_buf, RSC_TABLEINFO_SIZE, IS_BIG_ENDIAN); - MemoryReadStream readS(tblinfo_buf, RSC_TABLEINFO_SIZE); - - res_tbl_offset = readS.readUint32LE(); - res_tbl_ct = readS.readUint32LE(); + res_tbl_offset = readS.readUint32(); + res_tbl_ct = readS.readUint32(); // Check for sane table offset if (res_tbl_offset != rsc->rc_file->size() - RSC_TABLEINFO_SIZE - RSC_TABLEENTRY_SIZE * res_tbl_ct) { @@ -146,11 +148,13 @@ int RSC_LoadRSC(RSCFILE_CONTEXT *rsc) { return FAILURE; } - MemoryReadStream readS1(tbl_buf, tbl_len); + MemoryReadStreamEndian readS1(tbl_buf, tbl_len, IS_BIG_ENDIAN); + debug(9, "RSC %s", rsc->rc_file_fspec); for (i = 0; i < res_tbl_ct; i++) { - rsc_restbl[i].res_offset = readS1.readUint32LE(); - rsc_restbl[i].res_size = readS1.readUint32LE(); + rsc_restbl[i].res_offset = readS1.readUint32(); + rsc_restbl[i].res_size = readS1.readUint32(); + //debug(9, "#%x Offset:%x Size:%x", i, rsc_restbl[i].res_offset, rsc_restbl[i].res_size); if ((rsc_restbl[i].res_offset > rsc->rc_file->size()) || (rsc_restbl[i].res_size > rsc->rc_file->size())) { free(tbl_buf); free(rsc_restbl); @@ -258,4 +262,18 @@ int RSC_FreeResource(byte *resource_ptr) { return SUCCESS; } +int RSC_ConvertID(int id) { + int res = id; + + if (IS_MAC_VERSION) { + if (res > 1537) + res -= 2; + else if (res == 1535 || res == 1536) { + error ("Wrong resource number %d for Mac ITE"); + } + } + + return res; +} + } // End of namespace Saga |