Take main's base in cheats.py from recomp/layout.py instead of a copy of its value.

tools/cheats.py decodes the pc-relative instructions of a code cheat at main's base and held that base as its own constant, 0x7000000000. It equals recomp/layout.py FIRST_BASE today, where main is the first module of ORDER, but a change of the layout would have left the cheats decoding at the old base, and AGENTS.md has recomp/layout.py alone decide module bases. BASE is now layout.FIRST_BASE. cheats.py is part of the mods' lift key (make_game.py mod_digest), so an install with code cheats lifts once more at its next build; an install without them is not affected.

Not reproduced before the change: no fault today, the two values being equal. Checks that passed: tests/launcher_test.py (218 tests, a new one in which cheats.BASE follows a changed layout.FIRST_BASE, which fails before the change) and tools/check_content.py --staged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-13 17:26:47 -05:00
parent 5f90486cf0
commit a0fd6edc48
2 changed files with 14 additions and 1 deletions

View File

@@ -40,11 +40,12 @@ from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'recomp'))
sys.path.insert(0, str(Path(__file__).resolve().parent))
import flags # noqa: E402
from layout import FIRST_BASE # noqa: E402
from lifter import Lifter, Unsupported # noqa: E402
from nso import Nso # noqa: E402
from mod_files import cheat_files # noqa: E402
BASE = 0x7000000000 # main's base in the layout (recomp/layout.py); only pc-relative decoding sees it
BASE = FIRST_BASE # main's base: recomp/layout.py lays main out first (ORDER); only pc-relative decoding sees it
NOP = 0xD503201F
RET = 0xD65F03C0