mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-15 19:19:58 -04:00
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:
@@ -5981,6 +5981,18 @@ class ModsTest(Tmp):
|
||||
cheat.write_text('[Moon jump]\n04000000 00000000 D65F03C0\n')
|
||||
self.assertEqual(self.mods.code_waiting(self.game), ['Cheats']) # edited since
|
||||
|
||||
def test_code_cheats_take_mains_base_from_the_layout(self):
|
||||
"""recomp/layout.py alone decides the modules' bases: tools/cheats.py decodes main's pc-relative code at the
|
||||
base the layout gives main, the first module of its order, and follows it when it changes."""
|
||||
import importlib
|
||||
import cheats
|
||||
import layout
|
||||
self.assertEqual(layout.ORDER[0], 'main')
|
||||
self.assertEqual(cheats.BASE, layout.FIRST_BASE)
|
||||
self.addCleanup(importlib.reload, cheats)
|
||||
with mock.patch.object(layout, 'FIRST_BASE', 0x7100000000):
|
||||
self.assertEqual(importlib.reload(cheats).BASE, 0x7100000000)
|
||||
|
||||
def test_the_mods_code_is_in_the_lift_key_and_not_the_shaders_key(self):
|
||||
import make_game
|
||||
kit = self.tmp / 'kit'
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user