Patches
© 2018 K1n9_Duk3
Note: If you decide to use any of these patches, you are doing so at your own risk. Always create a backup of your files before applying any paches. Always test modified executables in a safe environment like DOSBox or a virtual machine.
Here are a couple of patches that I've come up with in the past:
- Bio Menace (v1.1 freeware) - Mid-level saves and memory fix
- Duke Nukem II (registered) - God Mode
- Duke Nukem II (registered) - Memory Fix
- Test Drive 1 (EGA) - Custom keyboard handler
- Wolfenstein 3D - Use PC speaker for digitized sounds
- Various - Fix Divide Error in PCX Effects 1.04
Unless stated otherwise, all of the patch scripts listed on this page are supposed to be used with K1n9_Duk3's Patching Utility.
Bio Menace (v1.1 freeware) - Mid-level saves and memory fix
This patch fixes a bug in Bio Menace that causes the game to "leak" memory when starting playback of a new music track, which could lead to "Out of memory" crashes. While this bug is not much of an issue when running the game in DOSBox, it might be useful for people who want to run the game on actual hardware or a different emulator.
Fixing said memory issue also allowed the re-introduction of mid-level saves. This allows the player to save the game at any point in the level and restore the game at the exact same position and state, just like in Commander Keen 4-6 and Keen Dreams.
Note: The saved games are compatible with the unpatched versions, so you won't lose any progress by applying the patch. However, trying to load a saved game that was written using a different version of the patch will cause severe problems and - if you're not running the game in DOSBox - could damage your system! If you have any saved games that were created using a different version of this patch, you need to resize the save file to 131 bytes (keep the first 131 bytes and remove the rest). If you don't have a utility that can truncate the file, load the saved games in the unpatched version of the game, delete the save file and then save again. This will cause you to lose any progress in the level as well as all the weapons and grenades, but it allows the patched executable to load the game without causing damage to your system.
There are also a couple of bonus patches in the scripts, allowing the player to carry weapons and grenades over into the next level.
The patch scripts are too big to list them here, but you can download them.
The scripts in the download are set up for use with BMxPATCH (part of the CKPATCH package). But they can easily be modified for use with K1n9_Duk3's Patching Utility (Version 1.3 or above), which allows you to generate a fully patched standalone executable. The BMxPATCH utility usually takes up about 20k of conventional memory, so using the fully patched executables might be more useful on DOS configurations with little conventional memory.
Duke Nukem II (registered) - God Mode
This patch allows you to toggle god mode (the game calls it "Tec mode") by holding down the G-O-D keys at the same time.
Note: This code only works on the executable from the registered version of the game.
%exefile NUKEM2.EXE $1C1AC # make G-O-D keys toggle god mode ("Tec mode"): %patch $1531A $6A 1 $9A $0741E352RL $90 $90 $90 $90 $90 %end
Duke Nukem II (registered) - Memory Fix
This fix replaces the subroutine for loading a raw screen with a shorter, more efficient subroutine that doesn't need a buffer for temporary storage. The original code used a buffer of 2000 bytes, which caused the game to run out of memory and exit to DOS when playing Episode 2 Level 2 on the hardest difficulty and bringing up the in-game help screens by pressing the H key.
As an added bonus, this also includes a patch that makes the game use all available memory instead of the fixed 390000 bytes, which might be useful for mods. Just keep in mind that this does not change the minimum memory requirements. If there are less than 390000 bytes of far memory available, the game will not start.
Note: This code only works on the executable from the registered version of the game.
%exefile NUKEM2.EXE $1C1AC # load full-screen images directly into video memory without a buffer: %patch $5AEE $C8 4w 0 $56 $57 $FF $76 $08 $FF $76 $06 $8D $46 $FE $50 $9A $03660423RL $BA $3CEw $B8 5w $EF $B8 $FF08w $EF $6A 0 $9A $000002FBRL $59 $BF 4w $BE $100w $BA $3C4w $8B $C6 $B0 2 $EF $8D $46 $FC $50 $68 8000w $68 $A000w $6A 0 $FF $76 $FE $9A $00000E69RL $83 $C4 10 $D1 $E6 $4F $75 $DC $8D $46 $FC $50 $6A 48 $1E $68 $558w $FF $76 $FE $9A $00000E69RL $83 $C4 10 $FF $76 $FE $9A $0366037ERL $6A 0 $9A $00000312RL $59 $5F $5E $C9 $CA 4w # (this leaves 241 unused bytes at $5B6B) # use all available memory, not just 390,000 bytes: %patch $5956 $90 $90 $90 $9A $000019C5RL $89 $16 $29B8w $A3 $29B6w $52 $50 %end
Test Drive 1 (EGA) - Keyboard Handler
This patch removes the code responsible for reading the joystick and replaces it with a custom keyboard handler. The custom keyboard handler allows you hold down multiple keys, letting you to steer while also accelerating or braking.
Note: This code only works on one specific version of the executable. You may have to unpack the executable with UNP before you can apply the patch.
%exefile TDEGA.EXE $13E10 # replace ReadJoystick routine with the new keyboard routines: %patch $A12F $33 $C0 $2E $80 $3E $A1EAw 0 $74 44 $BB $A1AEw $2E $80 $3F 0 $74 2 $0C 1 $83 $C3 3 $2E $80 $3F 0 $74 2 $0C 8 $83 $C3 2 $2E $80 $3F 0 $74 2 $0C 4 $83 $C3 3 $2E $80 $3F 0 $74 2 $0C 2 $C3 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0w 0 $50 $53 $33 $C0 $E4 $60 $8B $D8 $80 $E3 $7F $F6 $D0 $D1 $E0 $2E $88 $A7 $A166w $5B $58 $9C $2E $FF $1E $A1E6w $CF $2E $80 $3E $A1EAw 0 $75 54 $9C $FA $33 $C0 $8E $C0 $26 $A1 $24w $2E $A3 $A1E6w $26 $A1 $26w $2E $A3 $A1E8w $B8 $A1EBw $26 $A3 $24w $8C $C8 $26 $A3 $26w $8E $C0 $BF $A166w $B9 $40w $33 $C0 $F3 $AB $2E $C6 $06 $A1EAw 1 $9D $E9 $5DC7w $2E $80 $3E $A1EAw 0 $74 29 $9C $FA $33 $C0 $8E $C0 $2E $A1 $A1E6w $26 $A3 $24w $2E $A1 $A1E8w $26 $A3 $26w $2E $C6 $06 $A1EAw 0 $9D $E9 $0FE6w %patch $A5A2 $FC64w # call kbstartup instead of main: %patch $B24E $EFF9w # call kbshutdown instead of sub_0_B257: %patch $5C88 $E9 $FFA2w # call ReadKeyboard when we've got a number key %patch $5CB5 $E9 $FF75w # call ReadKeyboard when we've got a cursor key %end
Wolfenstein 3D - Use PC speaker for digitized sounds
This patch edits the config file for Wolfenstein 3D and changes the sound device for digitized sounds to the PC speaker option. There is no code to set this device to PC speaker in the game, editing the config file is the only way to use this setting.
This patch script should work for any DOS version of the game, including all versions of Spear of Destiny. All you need to change is the extension of the config file.
%file CONFIG.WL6 522 %patch $1D2 $01 %end
Various - Fix Divide Error in PCX Effects 1.04
This fixes a divide error that occurs when executing parts of the PCX Effects 1.04 code on systems using a Pentium 133 MHz or faster CPU. The fix prevents the games from crashing, but it does not fix any other speed-related issues in the PCX routines or the actual game. That means the patched game will start, but it might still run way too fast to actually be playable.
Note: These patches work on one specific version of the executable. If you want to try to fix this error in a version that is not listed here, search the uncompressed executable for the hexadecimal sequence 8B C6 F7 E1 B9 64 00 F7 F1
and replace it with the sequence B0 05 F7 E1 73 03 B8 FF FF
.
Arctic Adventure (v2.0 freeware):
%exefile AA1.EXE $22800 %patch $163A4 $B0 $05 $F7 $E1 $73 $03 $B8 $FFFFw %exefile AA2.EXE $22790 %patch $16334 $B0 $05 $F7 $E1 $73 $03 $B8 $FFFFw %exefile AA3.EXE $22780 %patch $16324 $B0 $05 $F7 $E1 $73 $03 $B8 $FFFFw %exefile AA4.EXE $227C0 %patch $16364 $B0 $05 $F7 $E1 $73 $03 $B8 $FFFFw %end
Dark Ages (freeware):
%exefile DA1.EXE $23406 %patch $11D2C $B0 $05 $F7 $E1 $73 $03 $B8 $FFFFw %exefile DA2.EXE $23276 %patch $11CD4 $B0 $05 $F7 $E1 $73 $03 $B8 $FFFFw %exefile DA3.EXE $230C6 %patch $11C36 $B0 $05 $F7 $E1 $73 $03 $B8 $FFFFw %end
Pharaoh's Tomb (v3.0 freeware):
%exefile PTOMB1.EXE $1F730 %patch $122C4 $B0 $05 $F7 $E1 $73 $03 $B8 $FFFFw %exefile PTOMB2.EXE $1F790 %patch $12324 $B0 $05 $F7 $E1 $73 $03 $B8 $FFFFw %exefile PTOMB3.EXE $1F6E0 %patch $12274 $B0 $05 $F7 $E1 $73 $03 $B8 $FFFFw %exefile PTOMB4.EXE $1F6E0 %patch $12274 $B0 $05 $F7 $E1 $73 $03 $B8 $FFFFw %end
The Monuments of Mars! (freeware):
%exefile MARS1.EXE $22A84 %patch $D176 $B0 $05 $F7 $E1 $73 $03 $B8 $FFFFw %exefile MARS2.EXE $22F54 %patch $D32A $B0 $05 $F7 $E1 $73 $03 $B8 $FFFFw %exefile MARS3.EXE $22F54 %patch $D32A $B0 $05 $F7 $E1 $73 $03 $B8 $FFFFw %exefile MARS4.EXE $23144 %patch $D3EC $B0 $05 $F7 $E1 $73 $03 $B8 $FFFFw %end