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

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());

View File

@ -217,6 +217,12 @@ void writeToFile(File &file, const Hint &obj) {
writeToFile(file, obj.conditions);
}
template<>
void writeToFile(File &file, const PatchAssociation &obj) {
file.writeString(obj.confManID);
writeToFile(file, obj.fileIDs);
}
void writeMultilangArray(File &file, const Common::Array<Common::Array<const char *>> &array) {
Common::Array<uint32> offsets;
uint32 offsetsOffset = file.pos();

View File

@ -94,6 +94,8 @@ template<>
void writeToFile(File &file, const Goodbye &obj);
template<>
void writeToFile(File &file, const Hint &obj);
template<>
void writeToFile(File &file, const PatchAssociation &obj);
void writeMultilangArray(File &file, const Common::Array<Common::Array<const char *>> &array);

Binary file not shown.

View File

@ -617,4 +617,14 @@ const Common::Array<const char *> _nancy2EventFlagNames = {
"empty"
};
// Patch notes:
// - The patch that extends the final timer was originally distributed by HeR.
// - The softlock fix is custom, and works by adding a second inventory dependency
// to the last two ARs in scene S1160. This allows the player to re-enter the
// prop room when they've collected the door knob, but not the wire clippers.
const Common::Array<PatchAssociation> nancy2PatchAssociations {
{ "softlocks_fix", { "S1160" } },
{ "final_timer", { "S1563", "S1564", "S1565" } }
};
#endif // NANCY2DATA

View File

@ -90,4 +90,9 @@ struct SoundChannelInfo {
Common::Array<byte> sfxChannels; // 2
};
struct PatchAssociation {
const char *confManID;
Common::Array<const char *> fileIDs;
};
#endif // CREATE_NANCY_TYPES_H