Repository navigation
Conversation
…(code caves)
Discord, 19/11 ("exefs patches not applying according to log"): Always-On Rupee Counter, Faster Dash and HUD of Time were
left out, "in the gap between two segments". The game's .text ends at 0x3c461d0 and its .rodata starts at 0x3c47000: the
console maps the code a page at a time, so the rest of that page is there and executable, and those mods put their own code
in it, as emulators let them. Such a write is applied now: the patched copy's .text is made that much longer (zeros up to
the patch, the game's and the copy's alike, so only the patch's bytes count as changed) and its size in the header with it,
so the translation takes the cave's code with the rest (nso.py code_range). A write past the page, or anywhere else
outside the segments, is still left out whole; one that starts in the page and runs past it says so.
Tests: test_exefs_mods.py CodeCave (the cave applied, the .text 0x1d40 -> 0x1e08 in the copy, its SHA-256 made again, a
write across the page end left out); the 27 tests pass. Not yet tried on a game build with those mods.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Merged into 0.7.9.3 (https://github.com/pixl27/ProjectReLink/releases/tag/v0.7.9.3), through the hotfix branch rather than this pull request, with your authorship kept in the commit ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Discord #issues, 19/11 ("exefs patches not applying according to log", "exefs mods dont seem to work"): Always-On Rupee Counter, Faster Dash and HUD of Time were left out, "in the gap between two segments".
Why: the game's
.textends at0x3c461d0and its.rodatastarts at0x3c47000. The console maps the code a page at a time, so the rest of that page exists and is executable; these mods put their own code there (a code cave), which emulators accept.nx2/exefs_mods.pytreated it as a gap and left the whole patch out.Change (
nx2/exefs_mods.py):[.text end, min(page end, .rodata start))is applied: the patched copy's.textgrows to cover it (zeros up to the patch, in the game's and the copy's bytes alike, so only the patch's bytes count as changed), and its size in the NSO header (0x18 + 0x10*i) is written with it. The lift then translates the cave's code with the rest (nso.pycode_range).Tests:
nx2/test_exefs_mods.pyCodeCave: the cave applied, the copy's.text0x1d40 → 0x1e08 with its SHA-256 made again, the description counting only the patch's bytes, a write across the page end left out. 27 tests pass (1 skipped).Not verified: no game build with these mods yet (needs the mods and a full lift + compile).
🤖 Generated with Claude Code