DEVTOOLS: Add nancy2 patches to create_nancy

Added facilities for embedding game patches into nancy.dat
Added two game patches for nancy2:
- one of the original patches, as distributed by the original
devs. Specifically, only the patch to extend the end-game
timer; there exists another patch that fixes an error when
double-clicking a specific cupboard, but that's caused by
an engine bug that does not exist in ScummVM.
- a new, custom patch that fixes a nasty softlock caused
by incorrect dependencies in a certain scene.
This commit is contained in:
Kaloyan Chehlarski
2023-11-02 11:14:31 +02:00
parent 2f42aade45
commit 82cd37ce34
6 changed files with 46 additions and 0 deletions
+23
View File
@@ -155,6 +155,27 @@ void writeEventFlagNames(File &output, const Common::Array<const char *> &eventF
writeToFile(output, eventFlagNames);
}
void writePatchFile(File &output, const char *filename) {
File file;
if (!file.open(filename, AccessMode::kFileReadMode)) {
return;
}
byte *buf = new byte[file.size()];
file.read(buf, file.size());
output.writeUint32(MKTAG('P', 'A', 'T', 'C'));
output.write(buf, file.size());
file.close();
delete[] buf;
}
void writePatchAssociations(File &output, const Common::Array<PatchAssociation> &patchAssociations) {
output.writeUint32(MKTAG('P', 'A', 'S', 'S'));
writeToFile(output, patchAssociations);
}
int main(int argc, char *argv[]) {
File output;
if (!output.open("nancy.dat", kFileWriteMode)) {
@@ -209,6 +230,8 @@ int main(int argc, char *argv[]) {
WRAPWITHOFFSET(writeRingingTexts(output, _nancy2TelephoneRinging))
WRAPWITHOFFSET(writeEmptySaveTexts(output, _nancy2EmptySaveStrings))
WRAPWITHOFFSET(writeEventFlagNames(output, _nancy2EventFlagNames))
WRAPWITHOFFSET(writePatchFile(output, "files/nancy2_patchtree.dat"))
WRAPWITHOFFSET(writePatchAssociations(output, nancy2PatchAssociations))
// Nancy Drew: Message in a Haunted Mansion data
gameOffsets.push_back(output.pos());