Fix/ghost hack crash usamune - #59
Open
hugou74130 wants to merge 5 commits into
Open
Conversation
…ed dummy variable logic
…ou74130/STROOP into fix/ghost-hack-crash-usamune
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.
Fixes #4
Problem
The ghost hack's extended-RAM region lived at
0x80400000, which collides with ROM hacks that use expansion-pak memory. On Usamune 1.93 U, enabling the ghost hack caused stack-overflow crashes in Mupen as soon as Mario performed certain animations (backflip, long jump, sideflip, triple jump, dive...).Changes
0x80400000to0x80600000, for both US and JP:GhostHackUS.hckandGhostHackJP.hck, plus thearea_update_objectshook (jal 0x80608000)ghost_loop.asm,ghost_hack_US.asm/ghost_hack_JP.asm,additional hacks.txt) so they match the shipped payloadsGHOST_REGION_BASEinGhostTab.cswith named offsets (NUM_GHOSTS_ADDR,FIRST_GHOST_POINTER_ADDR,DISABLE_REQUEST_ADDR,GHOST_CODE_ADDR) replacing the scattered hex literals;ColoredHats.csderives from it. The asm side mirrors this with a singleGhostBaseHisymbol (the oldExtendedRAMStartHialias is removed) whose comment lists every place that must stay in sync.0x80400000/0x80500000(the freed former ghost region), since the previous defaults (0x80600000/0x80700000) would now overlap the relocated ghost region.Testing
Tested in the emulator with the ghost hack enabled and ghosts rendering: US vanilla, JP vanilla, Usamune 1.93 U and one other ROM hack — no crashes, including the animations that previously crashed Usamune.
The JP payload was additionally byte-verified against the US one: after relocation the two only differ at the version-specific addresses (gMarioObject, global timer,
set_mario_animation/alloc_display_listtargets), matching theequtables in the asm sources.