Public Commander Keen Forum
    > Other Keen Stuff
        > Keen 1-6 patch-loading utilities
New Topic    Add Reply

Page 1 2

<< Prev Topic | Next Topic >>
Author Comment
Admiral Bob
Grunt
(12/1/01 8:50:50 pm)
Reply
Keen 1-6 patch-loading utilities
Ok, here's something that's probably going to be at least slightly more interesting/useful than Andy's latest offering :p

CKPatch binaries (67k)
CKPatch sources (28k)

They're patch-loading utilites, which work by loading the Keen game executable into memory, patching it in memory using a script file, then running the game (effectively modifying the game without having to modify the game executable or data files on disk). The utilities allow for patching of various strings in the executables (such as the names of levels in Keen 4-6 and the hints that the yorp statues give in Keen 1), as well as data resources (like maphead/egahead etc. for Keen 4-6), as well as getting the game itself to read game level files from alternate file locations (so you don't have to mess around with renaming of files).

I'm putting these utilties forward also as a way of being able to load Keen 4-6 maps that have been created/modified with TED5 into the game - I've tested this by making some modifications to the Keen4/5 maps and they load fine in the game without any side-effects.

Please keep in mind that these utilities are still beta status and are still somewhat unfinished, so don't be surprised if there are quirks here/there. As of now they only support the versions of Keen I've got, which should be the latest ones available for Keen 1-5. For Keen 6, I've only got version 1.0, so I'm going to need help from someone out there with any later versions to help locate the file offsets for the various strings/resources (the documentation states what I'm looking for). Keen 6 full version level loading may or may not be working properly as well because I can't get TED5 to load the levels (I need to know how to create the gfxinfoe file, theoddone33 should have documented how he did it for Keen 4-5), so it's untested for now.


These utilites are eventually going to be part of a larger Keen editing pack that I'm contemplating working on (which includes Keen 1-3 and 4-6 editors and possibly a few other small utilites), however I'm wanting to know how much interest there is in going ahead with this idea.


As with the editing in TED, you need to unpack the game executables using UNLZEXE or UNP first (Grab UNP here). Please can you read the README.TXT and CKPATCH.TXT files before you dive into things!

To get the game to read maphead files created by TED5, you'll need to use a hex editor to cut the first 122 bytes off the ck?mhead.obj file that TED5 generates when saving/carmackizing levels. Here's ZapIt which can do this. As far as I can tell, TED5 and the game can't agree on the format of maphead, and the maphead file that TED5 saves seems to cause "Level too tall" errors when loaded into Keen 4-6.


Anyways, have fun... :)

(BTW I'm Admiral_Bob from the 3DRBB)

Edited by: Admiral Bob at: 12/5/01 12:56:55 pm
XkyRauh2001 
Vortininja
(12/1/01 9:53:42 pm)
Reply
Cool, but...
"Ok, here's something that's probably going to be at least slightly more interesting/useful than Andy's latest offering" ... true as it may be, it sounds a little arrogant :-(

Sounds like you (and whoever else contributed to this) have placed another stone in the bridge we're building towards (user-friendly) Level Design and Editing for Keens 4-6 :-) thanks for the news flash and all!

It's just a matter of time before we get something as fun as the good ol' DOS KeenEdit ^_^

--Xky

Admiral Bob
Grunt
(12/2/01 4:37:11 am)
Reply
Re: Cool, but...
I was only joking about the "better than andy's offering bit anyway", if you notice the :p next to it (I was referring to the mouse-control program, I haven't tried it yet anyway).

You can download the source code to this if you want. The programs were written entirely by me, though if you're wanting credits, I used the source code that theoddone33 and relnev released some months ago to get the file offsets for the data resources (maphead etc) in the Keen 4-5 executables. I've had to work out the Keen 6 offsets by myself, so I can't guarantee if they're valid yet...

I'm hoping I haven't overlooked any other obvious way to get TED5-edited levels loading in Keen 4-6, my suggested way is what I've found out from experimentation with TED5.

Anyways, let me know if these utilities work for you or not, I'm presuming that there are still quite a number of small bugs that need fixing.


Edited by: Admiral Bob at: 12/2/01 4:40:02 am
KeenCommander
Vortininja
(12/2/01 5:58:31 pm)
Reply
Sweeeet!
Thanx Admiral Bob! I'm off to check it out now!

adurdin
Vortininja
(12/4/01 5:46:18 am)
Reply
Re: Cool, but...
Quote:

I was only joking about the "better than andy's offering bit anyway", if you notice the :p next to it (I was referring to the mouse-control program, I haven't tried it yet anyway).



I hadn't considered the possibility of patching the exe in memory... It's actually a very neat idea, and as you say would save a lot of mess.

My Keen editor development has slowed down somewhat, mainly because I've been diverted/distracted into a different task which the "mouse-control program" was a development of: I've been spending some time decompiling Keen 4 -- I've got a fair way, and learnt stuff I never new before, such as:



  • If you run Keen 4, 5, or 6 with the "-DEMO" option, it'll avoid the menu and run in a demo mode where you can only play the first two or three levels, until you exit with Ctrl+Q.

  • If you use the F10+P pause option, and press Enter, Keen will unload its keyboard drivers so that a not-so-smart screen-capture utility can get a screenshot; you then press Esc to exit Keen. Of course, this is unnecessary with screenthief.

  • The config file format for Keen4 v1.4 -- while experimenting with this I found out that you could use the mouse to control Keen, or edit it to let you IP with just one key.
  • The only keys that you can't assign to movement or buttons are left shift and escape -- though this info isn't too useful

  • Nothing in Keen updates more frequently than 70 times per second.

  • Many of the random aspects of the game are controlled by a table of pseudo-random numbers. Suitable editing of this table can make the game much more challenging, so that slugs lay continous trails of poison, arachnuts head for you more often, berkeloids continually hurl fire, and other interesting things




The NEW spaz 
Vortininja
(12/4/01 9:43:21 am)
Reply
What if..
If you guys work together, wouldn't it be finished way faster? Maybe a good idea..

Admiral Bob
Grunt
(12/4/01 1:08:17 pm)
Reply
Re: Cool, but...
Quote:

I hadn't considered the possibility of patching the exe in memory... It's actually a very neat idea, and as you say would save a lot of mess.



The trick basically relies on a undocumented DOS API call, which sets up the executable in memory but doesn't run it. It also hooks the DOS interrupt handler (int 21h) while the game is running in order to redirect the opening of files.

I need to know how well this technique works on all DOS-capable platforms (as it uses an undocumented feature that may not be as reliably implemented on other platforms), and also how well does it get along with background virus scanners (some brain-damaged or over-paranoid virus scanners may pick it up as possible virus activity, since it does use similar API calls that a virus would).

I've only been able to test these utilities out under MS-DOS 6.22 and Win98 DOS box since that's what I have here. I espescially want to know how well these utilities work under the WinNT-based OSes (Windows NT/2000/XP), so if you're a user of one of these can you please post here if it works properly or not.

Edited by: Admiral Bob at: 12/4/01 1:09:14 pm
jazzie40
Grunt
(12/4/01 11:25:07 pm)
Reply
TED5
"As far as I can tell, TED5 and the game can't agree on the format of maphead, and the maphead file that TED5 saves seems to cause "Level too tall" errors when loaded into Keen 4-6."

Probably because that version of TED was modified for use with ROTT

Admiral Bob
Grunt
(12/5/01 12:59:45 pm)
Reply
Updates
I've added support for Keen1-3 v1.31 and Keen6 v1.4, and some other bits and pieces to the documentation. Just redownload them from the links above.

Frenkel
Vortininja
(12/8/01 4:47:24 am)
Reply
Re: Updates
How do you decompile Keen4?

Groeten van Frenkel
Visit us at The Official S&F PROD. Homepage

adurdin
Vortininja
(12/8/01 7:30:57 am)
Reply
Re: Decompiling
The same way you'd decompile any program :)

I can explain the process in detail if you want, but it'd be best by email. So mail me: adurdin@yahoo.com

Admiral Bob
Grunt
(12/8/01 2:10:16 pm)
Reply
Re: Decompiling
Yep, good ol' 80x86 dissassembly. The only way you can do it - I've been there before...

Anyway, can I please have a response from any of you out there if the patching utilities are working/not working properly for you? It's extremely difficult for me to debug these utilities (especially Keen 4-6, because the memory overhead of the TP7 IDE prevents me from running the game under it), and if I don't receive any feedback, I'll have to move on and assume that there are no bugs whatsoever (I intend to distribute these utilities with my level editors). Thanks.

ChargingMoose 
Vortininja
(12/8/01 4:25:51 pm)
Reply
-
This is really nifty! I didn't do anything besides trying to get alternate map files to load, but I did it, and it works. I wrote a little utility to fix the maphead without having to use a hex editor. I don't have any decent web space, but I'll send it to you, bob, if you give me your e-mail and you can put it up on your space.

Great work Admiral Bob!

Forge315 
Vortininja
(12/8/01 5:37:52 pm)
Reply
Re: -
Will it ever be possible to increase the res.?

Quote:
I espescially want to know how well these utilities work under the WinNT-based OSes (Windows NT/2000/XP), so if you're a user of one of these can you please post here if it works properly or not.
I got XP, so I may gather together all these programs I’ve been hearing about and play around with them.

Admiral Bob
Grunt
(12/8/01 8:32:46 pm)
Reply
Re: -
I was expecting the profile view option of this message board to list my email address on it - apparently it doesn't. My email address is rodgersb@ses.curtin.edu.au

There's no web page on my webspace at the moment (it's currently in the design-in-my-head phase :D ), it's just a loose clump of files/directories right now, so any download links will have to be placed here in this thread. Perhaps eK, Flaose and Cho'gall might like to temporarily house your utility and mine on CC314?

Admiral Bob
Grunt
(12/8/01 8:40:01 pm)
Reply
Re: -
Quote:
Will it ever be possible to increase the res.?


As in the game? Not likely without major code patching (or a full rewrite!). The game was simply never designed for multiple resolutions.

chogall
Vorticon Elder
(12/10/01 6:10:01 am)
Reply
Community Supporter
Re: -
I have added these utilities to the Downloads section on CC314.

The location of the files is:
CKPatch executable
CKPatch source code

If there are new files, etc. please e-mail them to me.

By the way, if you want your e-mail address to show up in your profile, enter your control center (link at top of page), go to "edit profile" and select "publicize email address".

Admiral Bob
Grunt
(12/10/01 2:36:21 pm)
Reply
Re: -
Thanks chogall, I'll keep you posted if new versions come out.

I've uploaded ChargingMoose's maphead utility to my webspace. Grab it from here.

ChargingMoose 
Vortininja
(12/17/01 8:36:23 pm)
Reply
Re: -
I just thought of something else that you could add - allow it to load demo files created using F10-D...

Admiral Bob
Grunt
(12/17/01 11:04:08 pm)
Reply
Re: -
Quote:
I just thought of something else that you could add - allow it to load demo files created using F10-D...


That would be quite tricky - the demos are stored inside the EGAGRAPH.CK? file as individual chunks, and redirecting file I/O on a byte by byte level is rather complex and inefficient. I need to keep the size of the patching utilities as small as possible to reduce the memory overhead they create when running the game. This would be better done by writing a utility to repack the EGAGRAPH file with the new demos instead.

Admiral Bob
Grunt
(12/17/01 11:09:41 pm)
Reply
Re: -
Quote:
I got XP, so I may gather together all these programs I’ve been hearing about and play around with them.


So does it work properly under XP (and NT/2k)? If it does, I'll be able to move these utilities out of beta status ready for distribution...

Chogall: You might also like to mention about these programs on the 'Level Downloads' page of CC314 where it explains how to edit Keen 4-6 levels in TED5.

ChargingMoose 
Vortininja
(12/17/01 11:18:21 pm)
Reply
Re: -
That's cool, I didn't know anything about how the demos worked; for all I knew, they were stored in the exe like maphead and egahead. But now that we can patch in an egahead, a utility to work with egagraph shouldn't be too hard, should it? I'm starting to get really excited about the modifications that are becoming possible to keen!

chogall
Vorticon Elder
(12/21/01 11:56:54 am)
Reply
Community Supporter
Re: -
Quote:
I'm starting to get really excited about the modifications that are becoming possible to keen!

So am I! :)

Page 1 2 << Prev Topic | Next Topic >>

Add Reply

Email This To a Friend Email This To a Friend
Topic Control Image Topic Commands (Moderator only)
Subscribe Click to receive email notification of replies
Unsubscribe Click to stop receiving email notification of replies
jump to:

- Public Commander Keen Forum - Other Keen Stuff - Cerebral Cortex 314 -



Powered By ezboard® Ver. 6.6
Copyright ©1999-2001 ezboard, Inc.