Skip to content

Port: fix the dungeon minimap and lock-on disappearing after the item overflow screen - #139

Merged
Adubbz merged 1 commit into
TheMoonPeople:masterfrom
FredTheSlug:fix/trash-message-slots
Oct 22, 2026
Merged

Adubbz merged 1 commit into
TheMoonPeople:masterfrom
FredTheSlug:fix/trash-message-slots

Conversation

@FredTheSlug

@FredTheSlug FredTheSlug commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Fixes the minimap and enemy lock-on disappearing in dungeons after going through the item overflow screen. I ran into this while playing: my bag was full, I picked up an item, sorted it out on the overflow screen, and the minimap and lock-on were gone until the next floor. The status bar still showed up fine.

Before opening the chest (minimap in the top right):
image

The overflow screen. Closing this notice is what breaks it:
image

After closing the overflow screen on master:
image

Same spot with this change:
image

Before: when the item menu opens with stuff in the overflow slots it shows a notice about it. Closing that notice (CMenuItemInfo::KeyStep, ps2/src/menusys.cpp:11818) sets TrushMesCls[i] to NULL for i < 8, but TrushMesCls only has 4 entries. The PAL symbol map has it at 0x10 bytes too, so this is a retail bug. On PS2 the extra writes land at the start of MenuItemMainMemory instead. On PC the pointers are twice as big and different statics come after it. On Windows the first one is debag_param from dng_main.cpp. DngMainDraw skips the minimap, lock-on, monster names and damage numbers while that's 0, and nothing turns it back on until InitDungeonMain runs for the next floor.

After: a unit fixup makes the PC copy of TrushMesCls 8 entries so the loop stays in bounds. The extra 4 are never used. It's the same thing that was done for DownLoadMes in editmenu.cpp. The PS2 source isn't touched.

Tests:

  • Added test_trash_message_reset_stays_inside_its_slots to scripts/port/test_header_fixups.py. It fails without the fixup.
  • Full ctest on Windows passes except Sound.SecondLoadReplacesTheBanks, which failed once with -j8 and passes when run on its own.
  • Reproduced it headless on master a58bfcc, using --give to fill the bag so the first chest on Underground Channel floor 1 goes to overflow. After closing the overflow screen the minimap is gone on master and still there with this change.
  • Added the fixup to the list in docs/PC.md.

… overflow screen

CMenuItemInfo::KeyStep clears TrushMesCls[i] for i < 8 when the item
menu's overflow notice closes, but the table has 4 entries (0x10 bytes in
the PAL symbol map). On the PS2 the extra writes landed in the start of
MenuItemMainMemory. On the host the 4 pointers past the end are the next
statics, starting with dng_main.cpp's debag_param, so after the overflow
screen the dungeon stopped drawing the mini map, the lock-on and the
damage numbers until the next floor. The unit copy now declares eight
slots, which stay null, like DownLoadMes.
@Adubbz
Adubbz merged commit fcbf66f into TheMoonPeople:master Oct 22, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants