From 04feab16897e3af3d5689f262b957999e477a35f Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 22 Sep 2007 20:19:55 +0000 Subject: Switch Troll's Tale to booter image svn-id: r29028 --- engines/agi/detection.cpp | 2 +- engines/agi/preagi_troll.cpp | 31 ++++++++++++++++++++++++++++--- engines/agi/preagi_troll.h | 4 ++-- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp index 28f438f811..38dadf296b 100644 --- a/engines/agi/detection.cpp +++ b/engines/agi/detection.cpp @@ -1622,7 +1622,7 @@ static const AGIGameDescription gameDescriptions[] = { { "troll", "", - AD_ENTRY1s("troll.exe", "c594b4d6791e9580d8d5dc9d71760027", 59120), + AD_ENTRY1s("troll.img", "62903f264b3d849be4214b3a5c42a2fa", 184320), Common::EN_ANY, Common::kPlatformPC, Common::ADGF_NO_FLAGS diff --git a/engines/agi/preagi_troll.cpp b/engines/agi/preagi_troll.cpp index ddb3d3de2e..f8fc581112 100644 --- a/engines/agi/preagi_troll.cpp +++ b/engines/agi/preagi_troll.cpp @@ -726,13 +726,38 @@ void Troll::init() { _vm->_picture->setPictureVersion(AGIPIC_V15); //SetScreenPar(320, 200, (char*)ibm_fontdata); + const int gaps[] = { 0x3A40, 0x4600, 0x4800, 0x5800, 0x5a00, 0x6a00, + 0x6c00, 0x7400, 0x7600, 0x7c00, 0x7e00, 0x8e00, + 0x9000, 0xa000, 0xa200, 0xb200, 0xb400, 0xc400, + 0xc600, 0xd600, 0xd800, 0xe800, 0xea00, 0xfa00, + 0xfc00, 0x10c00, 0x10e00, 0x11e00, 0x12000, 0x13000 }; + Common::File infile; if (!infile.open(IDA_TRO_BINNAME)) return; - _gameData = (byte *)malloc(infile.size()); - infile.seek(IDO_TRO_DATA_START); - infile.read(_gameData, infile.size() - IDO_TRO_DATA_START); + _gameData = (byte *)malloc(0xD9C0); + + bool flip = true; + byte *ptr = _gameData; + int diff; + + for (int i = 0; i < ARRAYSIZE(gaps) - 1; i++) { + diff = gaps[i + 1] - gaps[i]; + + if (flip) { + infile.seek(gaps[i]); + infile.read(ptr, diff); + ptr += diff; + } else { + } + flip = !flip; + } + + // One sector is off + infile.seek(0x18470); + infile.read(_gameData + 15632, 592); + infile.close(); fillOffsets(); diff --git a/engines/agi/preagi_troll.h b/engines/agi/preagi_troll.h index db81929b91..aae72a6c89 100644 --- a/engines/agi/preagi_troll.h +++ b/engines/agi/preagi_troll.h @@ -122,9 +122,9 @@ namespace Agi { // offsets -#define IDA_TRO_BINNAME "troll.exe" +#define IDA_TRO_BINNAME "troll.img" -#define IDO_TRO_DATA_START 0x1960 +#define IDO_TRO_DATA_START 0x3A40 #define IDO_TRO_PIC_START 0x3EF5 #define IDO_TRO_LOCMESSAGES 0x1F7C #define IDO_TRO_USERMESSAGES 0x34A4 -- cgit v1.2.3