diff options
Diffstat (limited to 'engines/cine')
-rw-r--r-- | engines/cine/part.cpp | 20 | ||||
-rw-r--r-- | engines/cine/part.h | 2 | ||||
-rw-r--r-- | engines/cine/prc.cpp | 21 |
3 files changed, 42 insertions, 1 deletions
diff --git a/engines/cine/part.cpp b/engines/cine/part.cpp index 7eb05ff22d..99d1109c2b 100644 --- a/engines/cine/part.cpp +++ b/engines/cine/part.cpp @@ -437,4 +437,24 @@ byte *readFile(const char *filename) { return dataPtr; } +void dumpBundle(const char *fileName) { + char tmpPart[15]; + + strcpy(tmpPart, currentPartName); + + loadPart(fileName); + for (int i = 0; i < numElementInPart; i++) { + byte *data = readBundleFile(i); + + Common::File out; + + debug(0, "%s", partBuffer[i].partName); + out.open(Common::String("dumps/") + partBuffer[i].partName, Common::File::kFileWriteMode); + out.write(data, partBuffer[i].unpackedSize); + out.close(); + } + + loadPart(tmpPart); +} + } // End of namespace Cine diff --git a/engines/cine/part.h b/engines/cine/part.h index ff51f8e307..eeb9d20280 100644 --- a/engines/cine/part.h +++ b/engines/cine/part.h @@ -67,6 +67,8 @@ void readFromPart(int16 idx, byte *dataPtr); byte *readBundleFile(int16 foundFileIdx); byte *readFile(const char *filename); +void dumpBundle(const char *filename); + } // End of namespace Cine #endif diff --git a/engines/cine/prc.cpp b/engines/cine/prc.cpp index 42f251707e..845cec69ad 100644 --- a/engines/cine/prc.cpp +++ b/engines/cine/prc.cpp @@ -83,11 +83,13 @@ void loadPrc(const char *pPrcName) { } else { scriptPtr = readBundleFile(findFileInBundle(pPrcName)); } + assert(scriptPtr); setMouseCursor(MOUSE_CURSOR_DISK); - numScripts = READ_BE_UINT16(scriptPtr); scriptPtr += 2; + numScripts = READ_BE_UINT16(scriptPtr); + scriptPtr += 2; assert(numScripts <= NUM_MAX_SCRIPT); for (i = 0; i < numScripts; i++) { @@ -104,6 +106,23 @@ void loadPrc(const char *pPrcName) { computeScriptStack(scriptTable[i].ptr, scriptTable[i].stack, size); } } + +#ifdef DUMP_SCRIPTS + + { + uint16 s; + char buffer[256]; + + for (s = 0; s < numScripts; s++) { + if (scriptTable[s].size) { + sprintf(buffer, "%s_%03d.txt", pPrcName, s); + + decompileScript(scriptTable[s].ptr, scriptTable[s].stack, scriptTable[s].size, s); + dumpScript(buffer); + } + } + } +#endif } } // End of namespace Cine |