Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Many fixes by Krzysztof Nowaczyk #50

Merged
merged 8 commits into from
Aug 25, 2024
Prev Previous commit
Next Next commit
Fix demo signatures never being appended
When recording a demo I found that if a signature is present in myspsig.txt it is never appended to the demo. That's because the file the game is trying to open is actually MYSPSIG.TXT, all uppercase, which caused a file open to fail. Another issue: when the signature is about to be written to the output file, the code tries to write to a wrong file handle. It tries to write to the signature file (which is open in read-only mode) instead of the demo file. One last bug: there was an "off by one" error when writing the signature to the output file and the last terminating 0xFF byte was not written to the file.

Fixed by Krzysztof Nowaczyk, thank you! ❤️
  • Loading branch information
sergiou87 committed Aug 25, 2024
commit 1277e7e0d826bc232ba1810019ab6a4fbd070120
4 changes: 2 additions & 2 deletions src/supaplex.c
Original file line number Diff line number Diff line change
Expand Up @@ -4483,7 +4483,7 @@ void stopRecordingDemo() // somethingspsig proc near ; CODE XREF: runLeve
fileWriteUInt8(gDemoCurrentInput, gCurrentRecordingDemoFile);
if (byte_5A19B != 0)
{
FILE *sigFile = openWritableFileWithReadonlyFallback("MYSPSIG.TXT", "rb");
FILE *sigFile = openWritableFileWithReadonlyFallback("myspsig.txt", "rb");
if (sigFile != NULL)
{
if (fseek(sigFile, 0, SEEK_END) == 0)
Expand Down Expand Up @@ -4516,7 +4516,7 @@ void stopRecordingDemo() // somethingspsig proc near ; CODE XREF: runLeve
sigFileSize = idx;

//loc_4941C: ; CODE XREF: stopRecordingDemo+BCj
fileWriteBytes(signature, sigFileSize, sigFile);
fileWriteBytes(signature, sigFileSize + 1, gCurrentRecordingDemoFile);
}
}
}
Expand Down