Sunday, October 8, 2017

Translating a patch from one episode to a similar one

I recently wanted to patch Keen 2 to always allow Keen to pogo, even if the "have pogo" flag wasn't set. (In the original Keen 2, Keen starts with the pogo, but a side effect of another patch removed that.) Conveniently, that patch already existed, but only for Keen 1 and 3. Since it looked pretty simple, I decided to translate it myself.

I started by loading a Keen 1 dump into XVI32 and jumping to one of the two relevant addresses. Starting at $3B16, the original bytes are $83 $3E $9A $AA. Searching for that string in a Keen 2 dump unfortunately turns up nothing. However, since I knew that the code has something to do with the pogo variable, I consulted the game stats table. $9A $AA refers to the data location $AA9A. The analogous location in Keen 2 is $9AB0. Searching for $83 $3E $B0 $9A finds two locations in Keen 2: $6958 and $6BD0.

So I replaced the Keen 1 patch locations with those and ran it and it appeared to work, but it didn't quite feel right. Careful observation showed that the pogo only worked if Keen wasn't in the air, but it should work either way. We'll pick it up next time to see what went wrong.

No comments:

Post a Comment