Dump global scripts too.

svn-id: r24767
This commit is contained in:
Eugene Sandulenko 2006-11-23 06:47:41 +00:00
parent 207ef00754
commit 51a621fe98
3 changed files with 42 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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