This folder holds The Broken Seal's field menu, the screens it opens (Psynergy, Djinn, Item and Status), the member chooser and item picker that events open, and three scene overlays that are mostly menus: the title screen, the file select screen and the Battle Arena's lobby.
See also: Windows, whose windows and messages every screen is made of, and Shops, which share the menu's work block.
| File | What it holds |
|---|---|
| menu.c | the guide to the menu object: it includes menu_internal.h, then the parts in menu/ in ROM order |
| menu_internal.h | the includes, macros and types more than one part uses; it places no bytes |
| menudata.c, menustr.s | the menu object's tables (cursor bob, sort orders, highlight widths) and its short strings ("Lv", "HP", "/") |
| title.c, title.h | the title overlay; title.h names the Golden Sun logo the title and file select screens share |
| clear.c, keyboard.s | the file select overlay: new game, continue, copy, delete, the Battle Arena door and the data transfer, by link or as a password |
| lobby.c | the Battle Arena overlay: the link and monster battles, their records and the attendant |
| entry/, import/ | each overlay's entry veneers and the main-image functions it calls |
Each part's first lines say what it holds: head -4 menu/*.c lists them. A part includes menu_internal.h, so it resolves when opened on its own, but it is compiled only through menu.c. The ROM shows the menu object as one; the parts are ours, cut where one screen ends and the next begins. Link order is in games/tbs/objects.tsv, from menu/menu (the main image) and from menu/entry/title, menu/entry/clear and menu/entry/lobby (overlays 36f, 370 and 3cb).
The unit headers are in games/tbs/include/unit/menu/: unit/menu/menu.h for the menu object, and unit/menu/title.h, clear.h and lobby.h for the overlays. The menu work's views (struct InventoryMenuState and its kin) are in the shared headers under games/tbs/include, such as inventory_menu.h.
| Prefix | What it acts on |
|---|---|
| Menu_, UiMenu_ | pieces several screens share; field task suspension; the hand cursor in the top window |
| PsynergyMenu_ | the Psynergy screen, and the party figures and entry grid it set up first |
| ItemMenu_, InventoryMenu_, EquipmentMenu_ | the item screen, its messages and sorting, the equip markers |
| CharacterMenu_, CharacterSelector_, StatusMenu_ | the Status screen and the member chooser |
| DjinnMenu_, Djinn_, OwnerAction_ | the Djinn screen, its lists and its preview loop |
| FourObjectMotion_ | the row of four figures the Status and Djinn screens show |
| Item_, Ability_, BattleEffect_ | using an item or Psynergy from the menu |
| Title_, Clear_, SaveMenu_, LinkLobby_, SceneData_ | the three overlays and their scene entry functions |
| UiWindow_, UiText_, UiIcon_, UiWork_, UiPalette_, Palette_, Resource_, Render_, Scheduler_ | things the engine names elsewhere: windows, text, icons, palettes, VRAM slots and callbacks |
Many names are shared with The Lost Age's twins (games/tla/src/menu), with the far-call tables and with the window folder, so a rename crosses folders. Several prefixes are older than the parts and do not match the screen a function belongs to (PsynergyMenu_InitializeEntryObjects sets up the party figures every screen uses).
The spellings some sites keep to match, and the comment markers, are in Matching.
Every screen of the field menu works in the same heap block, HEAP_SLOT_MENU (0xa70 bytes), and each reads it through its own struct: InventoryMenuState for the item screen and the pieces the screens share, PsynergyMenuState, CharacterMenuState, DjinnMenuWork and FourObjectMotionState. Only one screen's loop runs at a time, so the block is the screen's while it runs. As with the field objects' five views, the views stay separate structs because each is what its screen's code matches with. The shops take the same slot for struct ShopRuntime, so a shop and the field menu are never open together.
Screens nest: the field menu runs a screen, the screen runs its own command loop with WaitFrames, and a command may run another loop inside that. Pressing Start must close all of them. Menu_CancelSoundReset schedules Menu_CancelSoundTick, a task that watches for Start while any screen runs; when Start is pressed it plays the cancel sound, sets FLAG_MENU_START_PRESSED and removes itself. The screens' loops test that flag and return as if cancelled, so the nested loops unwind one by one to the field without any of them knowing how deep it was. It is a game flag, not a variable, so code in other banks can test it with the flag calls they already import. XXX: that last reason is an inference.
The field menu's four icons reach the menu object through the far-call table system/far_call/MENU.S, in window/window/selection.c's order:
| Icon | Function | Part |
|---|---|---|
| 1 Psynergy | PsynergyMenu_Run | menu/psynergy.c |
| 2 Djinn | DjinnMenu_Run | menu/djinn.c |
| 3 Item | ItemMenu_Run | menu/item.c |
| 4 Status | StatusMenu_Run | menu/status.c |
These names are older than the parts and do not say which screen they open; they cross folders, so they wait for a rename of their own. Menu_OpenCharacterSelector (menu/status.c) is the member chooser the Colosso scenes open.
Screen and prefix names follow what each screen shows in the English release; the menu's two flags are named from what sets and tests them; the sort orders from the item types they list.
Still unknown:
Source: src/menu