11#define OVL_NAME(name) STGMCARD_##name
14#if VERSION_US || VERSION_JP
15#define FILE_GMCARD_SPRITES 0x28F
16#define FILE_GMCARD_SHEET 0x28E
18#define FILE_GMCARD_SPRITES 0x29E
19#define FILE_GMCARD_SHEET 0x29D
92#define MEMCARD_FILE_MAGIC 0x33574D44
98#define MEMCARD_SAVE_VERSION 3
99#elif VERSION_EU || VERSION_JP
100#define MEMCARD_SAVE_VERSION 4
102#define SAVE_CHECKED 4
106#define MEMCARD_LOAD_FRAMES 1239
107#define MEMCARD_SAVE_FRAMES 1266
108#elif VERSION_EU || VERSION_JP
109#define MEMCARD_LOAD_FRAMES 1240
110#define MEMCARD_SAVE_FRAMES 1267
120#define GAME_SAVE (*(GameSave *)&GAME)
137#define MEMCARD_SYSTEM (*(MemCardSystem *)&MEMCARD)
#define TASK_HEADER(Type)
#define GAME_SAVE_SIZE
The saved part of the game state, GAME up to mode: a save's data section (stgmcard....
void STGMCARD_slideInSlots(MemCardMenu *menu)
Slides the slot picker's three slots in from the right.
MemCardWindowSpec STGMCARD_detailWindows[]
the details' text windows: their text, type and place
MemCardPanel * STGMCARD_createPanel(s32 x, s32 y, s32 w, s32 h)
Creates a gradient panel (task) at x, y, w by h, empty until started.
void STGMCARD_hideInfo(MemCardInfo *info)
Hides the details window's text and starts fading it out (info->hide)
void STGMCARD_showInfo(MemCardInfo *info)
info.c
MemCardScreenFuncs STGMCARD_funcs
STGMCARD's data (data/stgmcard.c)
void STGMCARD_startFader(ScreenFade *task, s32 fadeIn, s32 duration)
void STGMCARD_refreshInfo(MemCardInfo *info)
Fills the details window with the selected save, or hides it.
ScreenFade * STGMCARD_createFader(void)
void STGMCARD_updateSaves(MemCardSaves *saves, MemCardSavesWindows *win)
The save list's task: creates its windows, then runs it.
void STGMCARD_setPanelBottomColor(MemCardPanel *panel, u8 r, u8 g, u8 b)
Sets the color of the panel's gradient at its bottom (panel->setBottomColor)
MemCardInfo * STGMCARD_createInfo(MemCardSaves *saves)
Creates the details window (task) of the save list.
void STGMCARD_updatePanel(MemCardPanel *panel)
The panel's task: opens it by scaling it horizontally, then draws it as a gradient with a sprite.
void STGMCARD_startSlotPick(MemCardMenu *menu, s32 slot)
Selects slot, slides the slot picker's cursor into place and moves it to the slot; then the player pi...
void STGMCARD_freeBuffers(void)
Frees the buffers of a save and of the card's info section, when leaving the screen.
void STGMCARD_setPanelPos(MemCardPanel *panel, s32 x, s32 y)
Moves the panel (panel->setPos)
MemCardSaves * STGMCARD_createSaves(MemCardScreen *screen)
Creates the save list (task) of the main task.
void STGMCARD_closeMenuForError(MemCardSaves *saves, MemCardSavesWindows *win)
Hides the message and panel and closes the slot picker, then shows the error in saves->result.
void STGMCARD_setPanelTopColor(MemCardPanel *panel, u8 r, u8 g, u8 b)
Sets the color of the panel's gradient at its top (panel->setTopColor)
void STGMCARD_resetMenu(MemCardMenu *menu)
Puts the slot picker back out of view, idle, with slot 0 selected.
void STGMCARD_slideOutSlots(MemCardMenu *menu)
Slides the slot picker's three slots out to the right.
SaveIcon STGMCARD_saveIcon
void STGMCARD_hideSaves(MemCardSaves *saves)
Hides the save list's windows and ends it (TASK_DONE), which makes the main task fade out and leave t...
MemCardMenu * STGMCARD_createMenu(MemCardSaves *saves)
Creates the slot picker (task) of the save list.
void STGMCARD_runSaves(MemCardSaves *saves, MemCardSavesWindows *win)
The save list's states (saves->substate): picks the port, reads the card's info section,...
void STGMCARD_resetPanel(MemCardPanel *panel)
panel.c
void STGMCARD_startPanel(MemCardPanel *panel, s32 substate, s32 duration)
Starts the panel (panel->start): substate 1 opens it to 95% over duration frames while a card operati...
void STGMCARD_slideOutHeader(MemCardMenu *menu)
Slides the slot picker's header up out of view, then resets the picker.
s32 STGMCARD_updateLerp(MenuLerp *lerp)
void STGMCARD_showError(MemCardSaves *saves, MemCardSavesWindows *win)
Shows the error of the last card operation (saves->result, made an index of STGMCARD_errorTexts),...
void STGMCARD_startFade(PanelAnim *fade, s32 fadeIn)
void STGMCARD_updateInfo(MemCardInfo *info)
The details window's task: creates its text windows, fades it in and out, and draws the selected save...
void STGMCARD_updateMenu(MemCardMenu *menu, TextWindow **windows)
The save picker's task: slides in and out, moves between the first three saves with left and right,...
MemCardModeEntry STGMCARD_prevModes[]
void STGMCARD_updateFader(ScreenFade *task)
void STGMCARD_loadFiles(void)
Loads the screen's images, gives the memory card's save file its title and icon, allocates the buffer...
s32 STGMCARD_places[]
the place a save shows (a string of TEXT_SHOP_NAMES), by the low byte of the game mode: the save poin...
void STGMCARD_drawSaves(MemCardSaves *saves)
Draws the save list's sprites: the blinking cross button while a message waits for it,...
void STGMCARD_showPort(MemCardSaves *saves, MemCardSavesWindows *win, s32 show)
saves.c
void STGMCARD_moveSlotCursor(MemCardMenu *menu)
Slides the slot picker's cursor from the previous slot to the selected one.
void STGMCARD_refreshSaves(MemCardSaves *saves)
Fills the details window with the selected save again (saves->refresh)
void STGMCARD_drawFader(ScreenFade *task)
s32 STGMCARD_updateFade(PanelAnim *fade)
s32 STGMCARD_errorTexts[]
the texts of the errors, by result
void STGMCARD_updateScene(MemCardScene *task, MemCardScreen **child)
scene.c
void STGMCARD_slideInHeader(MemCardMenu *menu)
menu.c
void STGMCARD_updateScreen(MemCardScreen *screen, MemCardScreenTasks *tasks)
screen.c
void STGMCARD_startLerp(MenuLerp *lerp, s32 from, s32 to, s32 frames)
s32 STGMCARD_filesLoading(void)
Whether the screen's strings are still loading.
s32 STGMCARD_partnerIcons[]
the sprite of a save's first partner, by partner (from 3), and its x, by save
MemCardScreen * STGMCARD_createScreen(void)
Creates the screen's main task, with what it needs from the mode it was opened from and the one it wa...
s32 STGMCARD_partnerAnims[][7]
the partners' sprites while they wait, by partner (from 3): -1 ends a loop
Memory card save header (first CARD_SECTOR_SIZE bytes of a save)
A menu cursor: a text window showing one of the CURSOR_FRAMES glyphs.
The saved part of the game state, to copy it whole.
The game state (GAME): the first 0x26BC bytes are what newGame clears (the save data),...
The memory card's info section: the three slots' saves, as the list shows them (STGMCARD_funcs....
u8 version
MEMCARD_SAVE_VERSION.
u8 checksum
of the rest, from magic
u8 last
the slot last saved to
The memory card functions (MEMCARD_FUNCS); like MemCard's operations, the card ones return 0 while th...
The window with the selected save's details (STGMCARD_updateInfo)
s32 frames[3]
of the three partners' animations
void(* hide)(struct MemCardInfo *info)
void(* refresh)(struct MemCardInfo *info)
s32 drawing
the partners and frame are drawn
void(* show)(struct MemCardInfo *info)
A mode (or stage) the screen can be opened from, and the area a save made from it shows (STGMCARD_pre...
u8 area
a string of TEXT_AREA_NAMES
u8 stage
a string of TEXT_STAGE_NAMES; nothing reads it
A gradient panel that opens by scaling (STGMCARD_updatePanel)
void(* setPos)(struct MemCardPanel *panel, s32 x, s32 y)
void(* setBottomColor)(struct MemCardPanel *panel, u8 r, u8 g, u8 b)
void(* start)(struct MemCardPanel *panel, s32 substate, s32 duration)
void(* reset)(struct MemCardPanel *panel)
s32 pad[2]
never read or written
void(* setTopColor)(struct MemCardPanel *panel, u8 r, u8 g, u8 b)
A save of the memory card, as the list shows it.
u8 name[0x18]
empty for a free slot
s32 partners[3]
3 and up: a partner, whose animation the details show
The children of the save list.
struct MemCardInfo * info
TextWindow * title
save or load
struct MemCardMenu * menu
struct MemCardPanel * panel
The saves of a memory card (STGMCARD_updateSaves)
s32 choice
of a yes/no question, 0 for yes; 0x2804 in the European version, as all below
u8 pad[0x26C4]
never read or written
void(* hide)(struct MemCardSaves *saves)
s32 choosing
the cursor's two choices are shown
s32 result
of the last card operation, then the error (STGMCARD_errorTexts)
s32 prompting
a message waits for the cross button
MemCardFile file
the card's
void(* refresh)(struct MemCardSaves *saves)
MenuLerp slide[2]
the list's x and y offsets
s32 origin[3]
x and y of the list's windows
s32 backToPick
the message returns to the slot picker
The root task of the overlay (STGMCARD_start)
s32 pad[2]
never read or written: createTask allocates 0x58 bytes
The overlay's buffers and helpers (STGMCARD_funcs)
void(* startLerp)(MenuLerp *lerp, s32 from, s32 to, s32 frames)
SaveData * dataBuf
the saved part of the game state
s32(* filesLoading)(void)
s32(* updateFade)(PanelAnim *fade)
s32 prevSlot
where the cursor moves from
void(* freeBuffers)(void)
void(* startFade)(PanelAnim *fade, s32 fadeIn)
s32 lastSlot
the card's last saved one
s32(* updateLerp)(MenuLerp *lerp)
The children of the main task.
struct MemCardSaves * saves
The main task of the screen (STGMCARD_createScreen)
s32 bgScroll
the background's offset, 0 to 95
s32 place
a string of TEXT_SHOP_NAMES (STGMCARD_places)
s32 bgTick
it moves every other frame
s32 area
a string of TEXT_AREA_NAMES, from the previous mode
s32 loading
opened from the title screen: the game mode's argument is not negative (saving: negative)
s32 pad[2]
never read or written
MEMCARD followed by MEMCARD_FUNCS, as STGMCARD_runSaves reaches the functions: through MEMCARD's addr...
A text window of the details (STGMCARD_detailWindows)
s32 text
a string of text file 0x79
s32 isNumber
shows 0, right-aligned, for an empty slot
Memory card access (MEMCARD), one step per call: every operation returns 0 while it runs,...
Opens or closes a menu panel: level goes 0 -> ONE in duration frames (or back at twice the speed),...
GameState's play time, which a memory card save copies whole.
A frame of the save's icon, a sector of the save file: 16x16 pixels of 4 bits, the left one of each b...
The save's icon for the memory card's directory.
SaveIconFrame * frames[3]
Fades the whole screen to black and back with a subtractive rectangle.
A text window (createTextWindow): up to six text buffers (0 is shown, 1-5 are "work" buffers that con...
A save's data section (STGMCARD_funcs.dataBuf): copied whole to and from GAME, read by its fields,...