From 7de5192d593b68bd57fd28a8c4b5607fcb831933 Mon Sep 17 00:00:00 2001 From: Ash Ketchum Date: Wed, 15 Jul 2026 10:25:37 +0200 Subject: 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). --- engine/slop_menu.asm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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: -- cgit v1.3.1-sl0p