chore(battle): snapshot the LocalMP rework baseline

Records the uncommitted battle-session work exactly as it was left
(local service matchmaking, settlement, chat, native LocalMP hooks,
battle gui/exe patches) so the following review and rework commits
show every correction as a diff against this state.

This commit is not reviewed and is known to be incomplete: in-game
testing reported wrong settlement rewards, single-country teams,
missing random/fixed supplement slots, misattributed hit messages and
other regressions. Do not merge this branch before the rework lands.
This commit is contained in:
N0VAN0M4LY committed 2026-11-28 03:15:47 +08:00
1 parent 5c9204c031
commit b260d2899e
97 files changed
+7676 -396

No files matched your search

+16
View File
@@ -1,6 +1,7 @@
"""Commands that work on the game executable.
wtotools check-patches --exe <aces.exe> [--patches exe-patches]
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 exe-patches] [--force]
The input executable is only ever read. `patch-exe` refuses to write over its input and
@@ -15,9 +16,11 @@ from pathlib import Path
from ..exepatch import apply_writes, changed_ranges, load_patches, plan_patches
from ..exepatch.assemble import disagreement
from ..offset_check import parse_offset_header, verify_offsets
from ..pe import PeImage
DEFAULT_PATCHES = Path("exe-patches")
DEFAULT_OFFSET_HEADER = Path("native/wto-net/src/local_mp_offsets.h")
def register(commands: argparse._SubParsersAction) -> None:
@@ -25,6 +28,11 @@ 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")
@@ -55,6 +63,14 @@ def _check_patches(args: argparse.Namespace) -> int:
return 0 if plan.complete and not mismatched else 1
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)