aboutsummaryrefslogtreecommitdiffstats
path: root/engine
diff options
context:
space:
mode:
authorAsh Ketchum <no-reply@sl0p.foo>2026-07-15 10:25:37 +0200
committerAsh Ketchum <no-reply@sl0p.foo>2026-07-15 10:25:37 +0200
commit7de5192d593b68bd57fd28a8c4b5607fcb831933 (patch)
tree120f03497a24057e66fa0ef4362a037401eeb33c /engine
parentdocs: SL0P.md - overview of all SL0P EDITION features + cheat menu (diff)
downloadpokeyellow-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).
Diffstat (limited to 'engine')
-rw-r--r--engine/slop_menu.asm7
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: