From 6b962cda4e97158a7eeeafd399e042feeb7f7053 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Wed, 29 Apr 2009 05:41:44 +0000 Subject: Add support for unpacked data files, in the PC version of PN. svn-id: r40192 --- engines/agos/detection_tables.h | 26 ++++++++++++++++++++++++- engines/agos/res.cpp | 42 ++++++++++++++++++++--------------------- engines/agos/res_snd.cpp | 2 +- 3 files changed, 46 insertions(+), 24 deletions(-) (limited to 'engines') diff --git a/engines/agos/detection_tables.h b/engines/agos/detection_tables.h index 41147b85f8..37ce492773 100644 --- a/engines/agos/detection_tables.h +++ b/engines/agos/detection_tables.h @@ -92,13 +92,14 @@ static const AGOSGameDescription gameDescriptions[] = { GF_OLD_BUNDLE | GF_CRUNCHED | GF_PLANAR }, - // Personal Nightmare 1.1c - EGA English DOS Floppy + // Personal Nightmare 1.1c - EGA English DOS Floppy (Packed) { { "pn", "Floppy", { + { "01.out", GAME_ICONFILE, "3a2a4c3e07dfbc4b309deade0af37baf", -1}, { "icon.out", GAME_ICONFILE, "40d8347c3154bfa8b642d6860a4b9481", -1}, { "night.dbm", GAME_BASEFILE, "177311ae059243f6a2740e950585d786", -1}, { "night.txt", GAME_TEXTFILE, "861fc1fa0864eef585f5865dee52e325", -1}, @@ -114,6 +115,29 @@ static const AGOSGameDescription gameDescriptions[] = { GF_OLD_BUNDLE | GF_CRUNCHED | GF_EGA | GF_PLANAR }, + // Personal Nightmare 1.1c - EGA English DOS Floppy (Unpacked) + { + { + "pn", + "Floppy", + + { + { "01.out", GAME_ICONFILE, "7f3e2a7a3aad016ad1bf540fcbe031ca", -1}, + { "icon.out", GAME_ICONFILE, "40d8347c3154bfa8b642d6860a4b9481", -1}, + { "night.dbm", GAME_BASEFILE, "177311ae059243f6a2740e950585d786", -1}, + { "night.txt", GAME_TEXTFILE, "861fc1fa0864eef585f5865dee52e325", -1}, + { NULL, 0, NULL, 0} + }, + Common::EN_ANY, + Common::kPlatformPC, + ADGF_NO_FLAGS + }, + + GType_PN, + GID_PN, + GF_OLD_BUNDLE | GF_EGA | GF_PLANAR + }, + // Elvira 1 - English Amiga Floppy Demo { { diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp index 54a3fad757..4c8340794a 100644 --- a/engines/agos/res.cpp +++ b/engines/agos/res.cpp @@ -892,29 +892,27 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { dst = allocBlock(dstSize + extraBuffer); if (in.read(dst, dstSize) != dstSize) error("loadVGAVideoFile: Read failed"); + } else if (getGameType() == GType_PN && (getFeatures() & GF_CRUNCHED)) { + Common::Stack data; + byte *dataOut = 0; + int dataOutSize = 0; + + for (uint i = 0; i < srcSize / 4; ++i) + data.push(in.readUint32BE()); + + decompressPN(data, dataOut, dataOutSize); + dst = allocBlock (dataOutSize + extraBuffer); + memcpy(dst, dataOut, dataOutSize); + delete[] dataOut; } else if (getFeatures() & GF_CRUNCHED) { - if (getGameType() == GType_PN) { - Common::Stack data; - byte *dataOut = 0; - int dataOutSize = 0; - - for (uint i = 0; i < srcSize / 4; ++i) - data.push(in.readUint32BE()); - - decompressPN(data, dataOut, dataOutSize); - dst = allocBlock (dataOutSize + extraBuffer); - memcpy(dst, dataOut, dataOutSize); - delete[] dataOut; - } else { - byte *srcBuffer = (byte *)malloc(srcSize); - if (in.read(srcBuffer, srcSize) != srcSize) - error("loadVGAVideoFile: Read failed"); - - dstSize = READ_BE_UINT32(srcBuffer + srcSize - 4); - dst = allocBlock (dstSize + extraBuffer); - decrunchFile(srcBuffer, dst, srcSize); - free(srcBuffer); - } + byte *srcBuffer = (byte *)malloc(srcSize); + if (in.read(srcBuffer, srcSize) != srcSize) + error("loadVGAVideoFile: Read failed"); + + dstSize = READ_BE_UINT32(srcBuffer + srcSize - 4); + dst = allocBlock (dstSize + extraBuffer); + decrunchFile(srcBuffer, dst, srcSize); + free(srcBuffer); } else { dst = allocBlock(dstSize + extraBuffer); if (in.read(dst, dstSize) != dstSize) diff --git a/engines/agos/res_snd.cpp b/engines/agos/res_snd.cpp index 27c669b1e2..60c79b2324 100644 --- a/engines/agos/res_snd.cpp +++ b/engines/agos/res_snd.cpp @@ -390,7 +390,7 @@ bool AGOSEngine::loadVGASoundFile(uint16 id, uint8 type) { } dstSize = srcSize = in.size(); - if (getGameType() == GType_PN) { + if (getGameType() == GType_PN && (getFeatures() & GF_CRUNCHED)) { Common::Stack data; byte *dataOut = 0; int dataOutSize = 0; -- cgit v1.2.3