Re: Keen 13: The Ultra Omegamatic
Posted: Fri May 22, 2020 13:28
Sorry, but English is not my first language and sometimes I make errors. Thank you for this tutorial because I'm not an expert like youK1n9_Duk3 wrote: ↑Thu May 21, 2020 21:58 I'm sorry, but I can't quite understand what youre trying to say here:Let's go through it again step by step. Your patch script is overwriting parts of the string "Borland C++ - Copyright 1991 Borland Intl." with the following patch command (line 172):This patch command places your new string at offset 0 in the data segment. The Borland C++ library code performs a checksum test on these bytes when exiting back to DOS and if the checksum test fails, it will print the "Null pointer assignment" error message. Because unless you hack the executable with patches, the only reason why this checksum test would fail is that the code tried to write a couple of bytes to a Null pointer (i.e. offset 0 in the data segment).Code: Select all
%patch $30340 "Keen attacks a" $0A "Fuse Quantum" $00
I guess I am repeating myself here, but I'll write it anyway: This error message would normally be a sign of something going terribly wrong while the program was running. If you ever see this message, then there's something wrong with the code and you should not release your product to the public in this state. You should definitely not release it as a "finished" mod.
You might think that since the error occurs because the string was altered by a patch and not by an actual Null pointer problem, you could just leave it alone and tell people to ignore that message. You would be wrong. There are a few bugs in Keen 5 that cause it to read from a Null pointer, so replacing the copyright string with something else may cause some seemingly unrelated parts of the code to start behaving differently. Any way you put it, you're just asking for trouble by doing this.
Okay, now that it's clear that the aforementioned string should not be placed anywhere near offset 0 in the data segment, where do we place it? Well, of course we move it into the area that we have freed up by disabling the EGAGRAPH.CK5 merging code with the patch I gave you. Line 172 of your patch file should be changed to this:This change alone is not enough, though. We also need to update the pointers for this string. To do this, we basically search for any occurence of "$30340000RL" and replace it with "$303400E5RL". Just in case: the line numbers are 106, 111, 118 and 119.Code: Select all
%patch $30425 "Keen attacks a" $0A "Fuse Quantum" $00
On a somewhat related note, the "Protection Gallery" string overwrites parts of the "High Scores" string. The status window would just say "ry" instead of "High Scores" in the high score level. It's not a big deal, since nobody should ever play that level, but just in case, I'll let you know how you can fix it. Change the offset in line 109 from "$201E0" to "$201E3", so the line looks like this:Then change the pointer in line 86 from "$201E0000RL" to "$201E0003RL".Code: Select all
%patch $201E3 "High Scores"