Heroes 5 Wiki
Heroes 5 Wiki

Deflaktor hex patcher allows for bookkeeping and easy application of hex patches onto Heroes V exe files.

How it works[]

  1. Download Deflaktor Application
  2. put Heroes EXE file, the application and a YML file in one folder
  3. Launch the application
  4. select exe + patch and apply
  5. Rename exe so you know what is been patched with
  6. move to <game folder>/bin and use it

Menu Legend[]

  • A square in the checkbox means the patch is already installed, patching will not do anything regarding this patch.
  • An arrow means there is another version of the patch already installed and patching will overwrite it.
  • A check means this patch will be installed.
  • A patch which was previously installed can be uninstalled by unchecking it.
  • You can right-click a patch to see an overview of which addresses are changed. The (undocumented and messy) source code of the tool is included in the jar file.

YAML Patch Definition example[]

The first commented line which contains text in the yaml file serves as the name of the patch. Comments are initiated with a #.

The second commented line with text will serve as tooltip for the patch. This is however optional.

YAML attributes[]

  • group: Which group this patch belongs to. Can be any string but should be common to the patches which can be applied to the same type of exe file. The patcher checks if it can apply every single patch of the same group to the exe, if not it proceeds to do the same check with the next group.
  • [optional] checkAddress and checkBytes: At this address the patcher will check if the specified bytes are present in order to recognize the right EXE file. If they are not present, the patcher will refuse to apply this patch. The address must be in HEX format. The bytes must also be in HEX format but every single byte must be seperated by a space (" "). At least one per group per patch should be specified or else the patcher will allow to patch any EXE file without any validity checks. Therefore it is strongly recommended to always specify this.
  • patchAddress: The address where to patch. Must also be in HEX format.
  • originalBytes: The unpatched bytes in HEX format which are in the original exe at the patchAddress. Each single byte must be seperated by a space. If only a single byte is specified followed by an *, this will mean this byte will be repeated as many times as there are patch bytes. This is for the special case if new code is written in empty space and the empty space is a single byte value repeated many times. E.g. "01*" will mean "01 01 01 01" if patch bytes has 4 bytes. It is a fill up operator.
  • patchBytes: The bytes to patch at the patchAddress. Each single byte must be in HEX format and seperated by a space. originalBytes and patchBytes must have the same amount of bytes.
  • AND/OR
  • valueType: The type of value this address is. Possible values are Byte, Short, Integer, Long, Float, Double, Ascii, Unicode.
  • originalValue: The original value in the original exe at patchAddress. It's format depends on valueType.
  • patchValue: The new value that will be patched. Here are some examples how different value types can look like:
    • Byte: any value between -128 and 255. This is because it can be either unsigned byte or signed byte, the internal representation is the same and does not matter.
    • Short: 65000
    • Float: -0.005
    • Integer: 250000
    • Long: 100000000
    • Double: -0.00000001
    • Ascii: SomeText
    • Unicode: SomeTextWithStrangeSymbols&%%

One can also mix both approaches using originalBytes and patchValue or originalValue and patchBytes. However, valueType must be specified if either originalValue or patchValue has been used.

Each patch is seperated by ---

Example[]

# Level 2
group: Original
checkAddress:   00B72DE0
checkBytes:     00 00 00 00 00 00 00 00 E8 03 00 00  # check these bytes at 00B72DE0
patchAddress:   00B72DE8
originalBytes:  E8 03 00 00        # 1000 exp (original)
patchBytes:     F4 01 00 00        # 500 exp (patched)
---
# Level 3
group: Original
patchAddress:   00B72DEC
originalBytes:  D0 07 00 00        # 2000 exp (original)
patchBytes:     DC 05 00 00        # 1000 exp (patched)
---
# Level 4
group: Original
patchAddress:   00B72DF0
valueType:      Integer
originalValue:  3200
patchValue:     1700
---
# Level 5
group: Original
patchAddress:   00B72DF4
valueType:      Integer
originalBytes:  F8 11 00 00        # 4600 exp
patchValue:     4000