Skip to content

Own values

cech12 edited this page Dec 4, 2026 · 1 revision

Own values

You do not have to wait for an EnginePatch update. Your file can contain its own catalog entries, in the same format as catalog.json. Start your ids with your mod name:

{
	"format" : 1,
	"require" : ["values", "catalog", "occurrence"],
	"catalog" : [
		{
			"id" : "MyMod.bigBasket",
			"type" : "int32",
			"vanilla" : 8,
			"locate" : {
				"anchor" : "Grosse_Holzkiepe",
				"xref" : "last",
				"window" : [0, 160],
				"patterns" : [ { "bytes" : "C7 4? ?? ?? 00 00 00", "at" : 3 } ],
				"occurrence" : 1
			}
		}
	],
	"values" : { "MyMod.bigBasket" : 12 }
}

How the location is found (the same for every exe, also when Windows loads it at a different address):

  1. anchor: a text in the exe that exists exactly once as a whole zero-terminated string, e.g. an object class name or a file name. The address of this text is searched.
  2. xref: the code that uses this address. Code references are numbered in address order: "first" (= 0), "last" (default) or an index.
  3. window: [from, to) bytes, counted from the end of the 4-byte address in that instruction (reference + 4). Negative values search before it.
  4. patterns: up to 4 byte patterns (e.g. one for the CD and one for the Steam exe). Hex bytes separated by spaces: ?? = any byte, 4? = any low half-byte, ?4 = any high half-byte. The value is at bytes after the start of the pattern.
  5. Without "occurrence" the patterns must match exactly once in the window, otherwise nothing is written. "occurrence" : n takes the n-th match on purpose.
  6. vanilla must be found at that position.

For cstring only anchor is used: the text itself is replaced. A longer new text is only possible if zero bytes follow the original. Texts are 8-bit; use \u00e4 for ä and so on.

If no signature is possible, an entry may list fixed addresses per exe instead ("builds"). The signature is tried first:

"builds" : {
	"3BE946EA_00336F33" : { "rva" : "0xE00CA",  "exe" : "Wiggles CD 1.0.844" },
	"5FE4FAC3_002CF39B" : { "rva" : "0x1CDEA8", "exe" : "Diggles Steam 2020" },
	"5FE4ED75_002CF39B" : { "rva" : "0x1CDEA8", "exe" : "Diggles GOG" }
}

The key is the exe id (shown by locate.py and in the exe ... line of enginepatch.log). rva is the address relative to the start of the loaded exe (Ghidra/x64dbg address minus image base), not a file offset. Such an entry works only on the listed exes.

More rules for own entries:

  • Ids of catalog.json cannot be redefined; your definition is ignored.
  • Catalog entries of all mods are read first, then the values. So one mod may use the entry of another mod.
  • If several mods define the same id, all definitions must find the same address, otherwise it is not applied.
  • If two different ids point to the same address and want different values, neither is applied.

How to find the anchor, window and pattern: finding a value.

Clone this wiki locally