diff options
| author | Ash Ketchum <no-reply@sl0p.foo> | 2026-07-15 10:25:37 +0200 |
|---|---|---|
| committer | Ash Ketchum <no-reply@sl0p.foo> | 2026-07-15 10:25:37 +0200 |
| commit | 7de5192d593b68bd57fd28a8c4b5607fcb831933 (patch) | |
| tree | 120f03497a24057e66fa0ef4362a037401eeb33c | |
| parent | docs: SL0P.md - overview of all SL0P EDITION features + cheat menu (diff) | |
| download | pokeyellow-7de5192d593b68bd57fd28a8c4b5607fcb831933.tar.gz pokeyellow-7de5192d593b68bd57fd28a8c4b5607fcb831933.tar.xz pokeyellow-7de5192d593b68bd57fd28a8c4b5607fcb831933.zip | |
fix(menu): push ROM bank before CloseTextDisplay (was corrupting collision)
The SL0P menu jumped straight to CloseTextDisplay on close, but that routine
ends with 'pop af' + bankswitch expecting the caller's bank to have been pushed
(DisplayTextID does this at open, which we bypass). The unbalanced pop ate a
stack word -> wrong bank -> corrupted overworld/collision state, leaving the
player unable to move after closing the menu. Now we push hLoadedROMBank first,
and dropped the bogus LoadScreenTilesFromBuffer2 (CloseTextDisplay's
LoadCurrentMapView rebuilds wTileMap/collision itself).
| -rw-r--r-- | engine/slop_menu.asm | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/engine/slop_menu.asm b/engine/slop_menu.asm index 8bbbf19f..7cb779a2 100644 --- a/engine/slop_menu.asm +++ b/engine/slop_menu.asm @@ -80,7 +80,12 @@ SlopMenu:: call SlopMenuRestoreFlags ld a, $01 ld [wUpdateSpritesEnabled], a - call LoadScreenTilesFromBuffer2 +; CloseTextDisplay rebuilds the overworld (LoadCurrentMapView restores the +; collision map) and ends with `pop af` + bankswitch expecting the caller's bank +; to have been pushed. We bypass DisplayTextID, so push it ourselves - otherwise +; the pop eats a stack word and corrupts the bank/collision state. + ldh a, [hLoadedROMBank] + push af jp CloseTextDisplay SlopMenuRestoreFlags: |
