Have the LocalMP modules read their addresses and offsets from the build

wto_ws.dll no longer scans aces.exe or carries structure offsets of a game
build. It reads the values the patcher resolved (wto_ws.cfg native.* lines)
into g_lmp through one table that names, per module, which value fills which
field (local_mp_values.c), and installs each module whose values are all
present, in dependency order, instead of giving up on the whole bridge when
one subsystem is missing. When the settings were resolved for another
executable (PE time stamp and image size differ), the bridge stays off.

local_mp_offsets.h keeps the existing names so the module code reads as
before; only Dagor library layouts (dag::Vector, DataBlock), protocol enums,
the reflection buffer size and the two change request members with no reader
in the client remain constants. A few fields are derived where the client has
no instruction of its own for them (local_mp_values.c derive_values). The
signatures moved to patches/native, and the header-based check-offsets
command is gone: record-game-version and the launcher's patch check resolve
the native modules now.

Shared sites moved to local_mp_core (mission customBots, the player's unit
eid) so modules do not depend on each other for them.

Checked: DLL build (no warnings outside MinHook); root and launcher type
checks; check-patches on 2.61.0.37; version records for 2.61.0.37 and
2.61.0.43 (10 native modules each); a lab run of the 2.61.0.37 copy logs
239 native values and "9 of 9 LocalMP modules installed". Battles were not
played in this run.
This commit is contained in:
N0VAN0M4LY committed 2026-11-29 12:26:11 +08:00
1 parent ddec5c59c0
commit 6ce93ee962
23 files changed
+721 -805

No files matched your search

-16
View File
@@ -1,7 +1,6 @@
"""Commands that work on the game executable.
wtotools check-patches --exe <aces.exe> [--patches patches/exe]
wtotools check-offsets --exe <aces.exe> [--header native/wto-net/src/local_mp_offsets.h]
wtotools patch-exe --exe <aces.exe> --out <aces.exe> [--patches patches/exe] [--force]
The input executable is only ever read. `patch-exe` refuses to write over its input and
@@ -16,11 +15,9 @@ from pathlib import Path
from ..exepatch import apply_writes, changed_ranges, load_patches, plan_patches
from ..exepatch.assemble import disagreement, needs_site
from ..offset_check import parse_offset_header, verify_offsets
from ..pe import PeImage
DEFAULT_PATCHES = Path("patches/exe")
DEFAULT_OFFSET_HEADER = Path("native/wto-net/src/local_mp_offsets.h")
def register(commands: argparse._SubParsersAction) -> None:
@@ -28,11 +25,6 @@ def register(commands: argparse._SubParsersAction) -> None:
_add_common(check)
check.set_defaults(handler=_check_patches)
offsets = commands.add_parser("check-offsets", help="verify native LocalMP signatures and anchor strings")
offsets.add_argument("--exe", type=Path, required=True, help="the game executable to read")
offsets.add_argument("--header", type=Path, default=DEFAULT_OFFSET_HEADER, help="C header with LMP_SIG_* and @anchor tags")
offsets.set_defaults(handler=_check_offsets)
patch = commands.add_parser("patch-exe", help="apply every patch to a copy of the executable")
_add_common(patch)
patch.add_argument("--out", type=Path, required=True, help="where to write the patched copy")
@@ -75,14 +67,6 @@ def _source_problems(definitions, plan) -> list[str]:
return problems
def _check_offsets(args: argparse.Namespace) -> int:
spec = parse_offset_header(args.header)
ok, lines = verify_offsets(PeImage(args.exe.read_bytes()), spec)
for line in lines:
print(line)
return 0 if ok else 1
def _patch_exe(args: argparse.Namespace) -> int:
if args.out.resolve() == args.exe.resolve():
print("refusing to write over the input executable; choose a different --out", file=sys.stderr)