Skip to content

Instantly share code, notes, and snippets.

@Najip
Last active April 14, 2025 03:57
Show Gist options
  • Save Najip/1812ec80cef70207c2fb5f2694ace619 to your computer and use it in GitHub Desktop.
Save Najip/1812ec80cef70207c2fb5f2694ace619 to your computer and use it in GitHub Desktop.
MW2MERCS_FUEL_PATCH.md

Patch to Fix Jump Jet Fuel in MechWarrior 2: Mercenaries for DOS


Overview

This patch addresses an issue in MechWarrior 2: Mercenaries where, at frame rates higher than 45.5 FPS, jump jet fuel does not recharge correctly. This is the same problem that affects all DOS versions of MechWarrior 2. The original fix was created for MechWarrior 2: 31st Century Combat v1.1 by Alex Page (available here), and later I adapted it for Ghost Bear's Legacy (see here).

This version adapts the same concept for MechWarrior 2: Mercenaries v1.06 for DOS, as the Windows 95 version suffers from numerous compatibility issues on modern systems (Windows 8 and newer), including crashes and unplayability. Additionally, MechVM no longer functions reliably on Windows 8 and later (see details here and here).

Given these limitations, the DOS version of MechWarrior 2: Mercenaries also benefits from this treatment.


Patch

Download .IPS Patch
Apply using Lunar IPS


How to Patch

If you are using a v1.0 or v1.05 CD, you must first update your installation to v1.06 before applying the patch.

To check your version, open the PRODUCT.INI file located either at the root of your CD or inside the SPLASH directory:

v1.0 CD

ProductName=Mercenaries
ProductMajorVersion=1
ProductMinorVersion=0

v1.05 CD

ProductName=Mercenaries
ProductMajorVersion=1
ProductMinorVersion=05

Upgrade Downloads


Special Note on EXE Compression

Unlike 31st Century Combat and Ghost Bear's Legacy, Mercenaries’ MW2.EXE is compressed using Causeway 3.25 and must be unpacked before patching.

Required Tools

Step-by-Step Instructions

  1. Update your Mercenaries installation to v1.06 in a DOSBox or real DOS environment.

  2. Copy CW349.EXE and UNPCWC349.EXE into your Mercs installation folder (e.g., C:\MERCS\).

  3. In DOSBox or real DOS, back up your original executable:

    copy MW2.EXE MW2.BAK
    
  4. Upgrade the Causeway stub:

    CW349 -b +u MW2.EXE
    
  5. In Windows CMD, unpack the upgraded EXE:

    UNPCWC349 MW2.EXE

    This will create a file named MW2.x (approx. 2 MB).
    Alternatively, you can drag MW2.EXE onto UNPCWC349.EXE in File Explorer.

  6. Delete or rename MW2.EXE, then rename the unpacked MW2.x to MW2.EXE.

  7. Finally, apply the .IPS patch using Lunar IPS.


How the Patch Works

The patch intercepts the jump jet fuel logic at a specific hook offset, calls external functions to retrieve elapsed time and record refuel ticks, and then returns to the game’s normal fuel accumulation logic.


Assembly Code

; Insert at 0x89A57 in MW2.EXE
START:
    PUSH 0x82
    CALL 0xFFFFCC88 ; Get elapsed ticks into EAX
    ADD ESP, 0x4
    CMP EAX, 182    ; Filter out huge values
    JA TOO_BIG
    SHR EAX, 0x2    ; Divide by 4
    JZ RETURN       ; If 0, skip
    PUSH EAX
    PUSH 0x82
    CALL 0xFFFFCCC8 ; Record last refuel tick
    ADD ESP, 0x4
    POP EAX
RETURN:
    JMP 0xFFFB805F  ; Jump to normal fuel update logic
TOO_BIG:
    PUSH 0x82
    CALL 0xFFFFCCC8 ; Record last refuel tick
    ADD ESP, 0x4
    XOR EAX, EAX
    JMP RETURN
; Overwrite at 0x41AA9 in MW2.EXE
    JMP 0x47FAE

Note: Offsets assume an unpacked MW2.EXE (v1.06) after applying the Causeway unpacking process above.


Conclusion

This patch preserves the original fuel-update logic with only minor adjustments to support MechWarrior 2: Mercenaries. The mechanism remains unchanged—only the addresses of key external functions are updated. This allows the game to behave as intended while resolving the jump jet fuel issue that occurs at high frame rates.


Thanks


THIS DOCUMENT AND THE PATCH WITHIN ARE PROVIDED WITHOUT WARRANTY.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment