How are Patches Found?

Anything related to Keen Modding.
Post Reply
Mink
Posts: 192
Joined: Sat Nov 03, 2007 4:08 pm
Location: Providence, RI, US

How are Patches Found?

Post by Mink »

I am wondering how patches are found. I know how to make patch files and use preexisting patches, but how do I find new ones? Take for example the patch that makes Keen unable to stomp yorps in Keen 1

Code: Select all

%patch $18A5 $90
or the patch that makes Keen shoot slugs in Keen 4.

Code: Select all

%patch 0x000305A8 0x40 0x01 0x3B 0x01
%patch 0x000305C6 0x41 0x01 0x3C 0x01
%patch 0x000305E4 0x40 0x01 0x3B 0x01
%patch 0x00030602 0x41 0x01 0x3C 0x01
How are these hexadecimal numbers found? Can anyone explain patching to me? Any help would be appreciated. Thanks!
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

Righty, where to start?

The first thing you will need to do is get yourself a disassembler; some program to look at all the hex numbers in a file. I use Xi32. With this you can open any file and see all its hex numbers and where they are.

Next you'll need a dump of the Keen you want to edit. To do this, make a patch file with the command %dump "FILENAME.EXT' This will create a file of that name in the Keen directory that contains the Keen file you want to edit with the CKPatch header and all that jazz.

Now comes the hard part. You will need to know what it is you want to do. For example, shooting slugs. For that we know we want to turn the sprites of Keen's shot into slug sprites.

Now comes the real hard part, finding out where the changes need to be made, and what to do. For the slugs, this is easy, we know that all sprites in the game use their bitmaps +124, so we look at the Keen graphics, and find that the bullet sprites are 50-54. Therefore, *somewhere* in our dump file will be the hex string '$AE $00' (The hex value of 50 + 124) If we know that each sprite uses TWO bitmaps, one for left, one for right, we can be more specific and look for '$AE $00 $AE $00' (Hoping that this is right.)

Your program should have some sort of searching tools, so all you'll need to do is search for that string, which gives us the address $305A8. If we look up the slug's sprites, we see they are around 190 and we can thus replace the original string to give us the first bullet/slug patch. The rest are done similarly.

Sadly, it is likely that you will NOT know where to make your changes, or what to change them to. This is why Andy made the Keen 4 disassembly, so the uninitiated could see where things are and how they work. Sadly, even this can be complicated. Take for example the Yorp patch, I do not know how it works. I do not know how it was found. All I know is that someone who knows how Keen1's sprites work knew that they should look there and do that. Unless you are willing to figure out how Keen works, maybe ask around and try things out, you probably won't get far. (Though Levellord's random $90 stuff and see what happens' approach did her some good.)

On the upside, the patch index lists not only all (Or most) of the patches ever made, but also some basic instructions on how to modify them to make new ones. And once someone has made a patch, we can try to understand it and modify it to make new patches.

For example, now that we know the bullet/slug patch works by changing the images the bullet uses, we can now make Keen shoot anything we wish, such as say, licks (Sprite 345)

Code: Select all

%patch $305A8 $D9 $01 $D5 $01
%patch $305C6 $DC $01 $D8 $01
%patch $305E4 $D9 $01 $D5 $01
%patch $30602 $DC $01 $D8 $01
Until you figure out your way around Keen, I suggest the patch index and asking others how things work. In general, if you want a patch, it can be got here soon enough by our team of dedicated patchers and aides. Good luck, and good patching!
Mink
Posts: 192
Joined: Sat Nov 03, 2007 4:08 pm
Location: Providence, RI, US

Post by Mink »

Thanks for your help! I've already got XVI32 and the dump files and am now looking up the addresses of other patches to see how they work/what they change.
This is why Andy made the Keen 4 disassembly, so the uninitiated could see where things are and how they work.
What is this, and where do I find it?

Again, thanks for all the help.
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

I think you have to ask Andy for it via email, but maybe it was placed on this site in the Keen 4 section. It's very useful, it's a total disassembly of Keen 4, with notes on how a lot of stuff works. It can be a bit technical, but once you figure out a few basic things, there's no problem.

If you can't figure out what a patch does, do ask, I'm sure somebody will know!
Post Reply