CKPatch

From KeenWiki
(Redirected from KDRPatch)
Jump to: navigation, search

CKPatch
Initial Developer
Developer(s)
Initial release
Latest update2007-11-23
Development statusFinished
Programming languagePascal
PlatformDOS
LicenseGPL
Tool TypePatching Tool
Engine(s)Keen:Vorticons, Keen:Galaxy, Keen:Dreams, Bio Menance, Dangerous Dave, Shadow Knights
Discussion(s)K:M Discussion Thread
DownloadCKPatch v.0.10 newest
KDrPatch v.0.9.0
Source Code
CKPatch is the generic name for a group of Keen patching tools written by Admiral Bob for the 16-bit DOS platform, using Pascal as the programming language. Versions earlier than 0.9.0 were released as public domain, whereas the latest version, was released under the terms of the GNU General Public License (GPL).

Version 0.10.0 was edited by Andrew Durdin in 2007. It adds support for patching 16-bit and 32-bit values directly, and for patching segment-relative addresses.

Currently, there are six official CKPatch-based tools, one for each Keen episode (CK1Patch, CK2Patch, CK3Patch, CK4Patch, CK5Patch and CK6Patch, respectively). Unofficial tools have been released for other games, including Keen Dreams (KDrPatch by MultiMania), and others (by Shadow Master: Bio Menace, Dangerous Dave in the Haunted Mansion, Dangerous Dave's Risky Rescue and Shadow Knights).

Compatibility

CKPatch has a modular design; the Parser, Patcher and Loader units in the source code are completely independent of Commander Keen and can easily be reused to write patching utilities for other 16-bit real mode DOS games.

As a start, Apogee's Bio Menace is based on the same engine as Commander Keen 4-6, so it should be straightforward to adapt CKPatch to work with Bio Menace, once you know the offsets of all the items of interest in the game executables.

CKPatch's in-memory patching methodology can also work well for games that have level data hard-linked into the executable. For example, Apogee's Crystal Caves fits into this category.

Usage

Copy each CKxPATCH.EXE executable to its corresponding Commander Keen episode directory. Unlike previous versions of CKPatch, you no longer need to use UNLZEXE to decompress your game executable.

Next, create a sub-directory and give it a name that describes your level pack. Place all the level files inside this sub-directory.

Create a text file inside this sub-directory called PATCH.PAT.

For levels that work with Keen episodes 1-3, put the following lines in PATCH.PAT (substitute ck1 with your episode extension):

%ext ck1
# These tell CKPatch how to map your level files to game levels.
# You'll need to specify a %level.file command for each of your
# level files; two levels are mapped here in this example.
%level.file 1 mylvl01.ck1
%level.file 2 mylvl02.ck1
%end


For levels that work with Keen episodes 4-6, put the following lines in PATCH.PAT (substitute ck4 with your episode extension):

%ext ck4
# Replace custmaps.ck4 with your own custom GAMEMAPS.CKx file that
# TED5 generates when it Carmackizes the levels.
%gamemaps custmaps.ck4
# This is the CKxMHEAD.OBJ file TED5 generates when Carmackizing the
# levels. It is needed to load the GAMEMAPS file properly.
%ckmhead.obj ck4mhead.obj
%end

Add any documentation files you want inside this sub-directory as well. You should at least include a URL so the end-user can obtain the latest version of CKPatch.

  • Note: Please do NOT include the CKxPATCH.EXE executable itself inside your zipfile. I'd rather not have outdated versions of CKPatch floating about, as end-users may end up overwriting later versions of CKPatch with earlier versions.

Notable Info

All Keen games were written in the C language. In C, strings are represented as null-terminated character arrays. If you patch a string, but change the length of the string, you need to place a null (ASCII 0) byte to mark the new end of the string.

For example:

# This is just a random offset, so don't try it
%patch 0x00001234 "Hello World\n" 0x00