A game update used to fail a patch whenever any byte it compared moved, even when only an address in the instruction changed. Patch definitions now say what a change needs and read the rest from the code: - patch.jsonc holds a list of variants, each written for one game build (written_for) with its own locate block and edit; locate.jsonc is merged into it. Exactly one variant must apply, otherwise the patch is left out. GUI script patches use the same variants rule. - expect_original and the bytes to write use the signature syntax, so addresses that differ between builds can be wildcards. - A locate block can capture values at the site (rel32 targets, immediates, displacements); a rel32 fixup fills a hole in the written bytes from a capture. allow-local-host-bot-spawns now jumps to the target of the conditional jump it replaces instead of a stored distance, which makes it apply to 2.61.0.43 as well. - verified_on is gone from the definitions. patches/versions/<version>.jsonc records, per checked game build, which variant of every patch applies and where; scripts/record-game-version.ts writes it and the launcher reads the recorded versions from there. The Python tools (check-patches, patch-exe, check-gui) read the same format; check-patches assembles a variant whose assembly names captures at the site it was located at. Checked: root and launcher type checks; check-patches and check-gui on 2.61.0.37 and 2.61.0.43 (12 exe and 35 GUI patches each); check-patches and check-gui report a deliberately broken patch with a non-zero exit; build-game-copy from 2.61.0.43 into a temporary folder. The computed bytes of allow-local-host-bot-spawns on 2.61.0.37 equal the bytes it stored before.
38 lines
1.3 KiB
Python
38 lines
1.3 KiB
Python
"""Locate and apply the declared changes to aces.exe.
|
|
|
|
The patches themselves live as data under patches/exe/; this package is only the engine.
|
|
Order of work, and the reason for it: find every site and verify every original byte first
|
|
(plan), then write (apply). A site that is missing or ambiguous is reported, never guessed,
|
|
so a game update produces a list of unavailable patches and the features they cover rather
|
|
than a broken executable.
|
|
|
|
`authoring` and `assemble` are development-side only: they need a disassembler and an
|
|
assembler, and are imported explicitly rather than from here.
|
|
"""
|
|
from .apply import apply_writes, changed_ranges
|
|
from .definition import LocateSpec, PatchDefinition, PatchEdit, PatchVariant, load_patches, read_locate
|
|
from .errors import DefinitionError, LocateError, PatchError, VerifyError
|
|
from .plan import PatchFailure, PatchPlan, PlannedWrite, find_site, plan_patches
|
|
from .variants import choose_variant
|
|
|
|
__all__ = [
|
|
"DefinitionError",
|
|
"LocateError",
|
|
"LocateSpec",
|
|
"PatchDefinition",
|
|
"PatchEdit",
|
|
"PatchError",
|
|
"PatchFailure",
|
|
"PatchPlan",
|
|
"PatchVariant",
|
|
"PlannedWrite",
|
|
"VerifyError",
|
|
"apply_writes",
|
|
"changed_ranges",
|
|
"choose_variant",
|
|
"find_site",
|
|
"load_patches",
|
|
"plan_patches",
|
|
"read_locate",
|
|
]
|