134 if (prev != saves->
port) {
171 if (status == 1 || status - 1 == 3) {
334 saves->
result = status - 1;
412 saves->
result = status - 1;
435 if (prev != saves->
choice) {
469 saves->
result = result - 1;
501 for (i = 0; i < 3; i++) {
520 saves->
result = status - 1;
536 saves->
result = status - 1;
628 if (blocks + 4 >= 16) {
675 if (prev != saves->
choice) {
699 }
else if (saves->
choice == 0) {
1029 switch (saves->
state) {
GfxState GFX
GFX: the graphics state and its methods.
GameState GAME
The save data, the game mode and the methods.
#define TASK_INIT
Tasks: every game object is a task, a heap block that starts with this header and is updated once per...
Cursor * createCursor(s16 layerId, s32 depth, s16 x, s16 y)
A menu cursor on a layer at (x, y)
#define TEXT_MEMORY_CARD
MEMCRD.
#define FILE_MENU_SPRITES
Files the engine loads by number.
FileCache FILE_CACHE
The file cache.
char * strcpy(char *dst, const char *src)
#define STAT_LEVEL
Indices of a partner's stats (PartnerStats.stats, computeStats, setStat)
#define SCREEN_LAYER
The layer over the whole screen that most modes create first and draw their menus on (FIELDSTG and ST...
Heap HEAP
The functions that return what a call left in v0 (allocMemHigh, findTask) and the ones that take othe...
#define CARD_SECTOR_SIZE
The bytes the card reads or writes at once: one sector.
#define CARD_ERR_NO_FILE
McErrFileNotExist: "File cannot be found".
#define CARD_ERR_FULL
McErrBlockFull: "There are not enough blocks".
#define CARD_ERR_UNFORMATTED
#define SAVE_MAX_ICONS
The icon frames a save may have.
MemCardInfo * STGMCARD_createInfo(MemCardSaves *saves)
Creates the details window (task) of the save list.
STGMCARD.PRO: the memory card screen (MODE_CONTINUE).
#define MEMCARD_LOAD_FRAMES
The durations of the panels shown while loading and saving.
#define FILE_GMCARD_SHEET
#define MEMCARD_SAVE_FRAMES
#define GAME_SAVE
GAME's saved part, which a load overwrites and a save copies: GameState (game_state....
#define MEMCARD_SAVE_VERSION
A save's data section is GAME's first GAME_SAVE_SIZE bytes (SaveData).
#define MEMCARD_FILE_MAGIC
#define PAD_PRESSED(button)
One button of pad 1: newly pressed, auto-repeated while held, or held.
#define PAD_REPEATED(button)
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.
static void STGMCARD_cancelOverwrite(MemCardSaves *saves, MemCardSavesWindows *win)
Without cross on the question to save over the slot: triangle goes back to the pick,...
static void STGMCARD_endFormat(MemCardSaves *saves, MemCardSavesWindows *win)
Once the panel is done, asks to create the save file (error 5)
static void STGMCARD_closeSlots(MemCardSaves *saves, MemCardSavesWindows *win)
Slides the slots and header out, then goes on to saves->step.
static void STGMCARD_writeNewInfo(MemCardSaves *saves, MemCardSavesWindows *win)
Writes the new save file's info section, then ends the panel (125)
static void STGMCARD_waitLoadedMessage(MemCardSaves *saves, MemCardSavesWindows *win)
Waits for cross on the loaded message, then waits for the card (400) and leaves the screen (600)
void STGMCARD_updateSaves(MemCardSaves *saves, MemCardSavesWindows *win)
The save list's task: creates its windows, then runs it.
static void STGMCARD_answerError(MemCardSaves *saves, MemCardSavesWindows *win)
Waits for the answer to the error: yes formats the card (110) or creates the save file (120),...
static void STGMCARD_formatCard(MemCardSaves *saves, MemCardSavesWindows *win)
Formats the card, then ends the panel (111)
static void STGMCARD_endCardCheck(MemCardSaves *saves, MemCardSavesWindows *win)
Once the panel is done, goes on to read the info section (20) or shows the card's error.
static void STGMCARD_writeInfo(MemCardSaves *saves, MemCardSavesWindows *win)
Writes the info section with the slot's new summary.
static void STGMCARD_pickPort(MemCardSaves *saves, MemCardSavesWindows *win)
Moves the port cursor: cross starts checking the card in that port, triangle leaves the screen.
static void STGMCARD_writeSave(MemCardSaves *saves, MemCardSavesWindows *win)
Saves the game to the selected slot's section, then ends the panel (500)
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.
static void STGMCARD_endWaitCard(MemCardSaves *saves, MemCardSavesWindows *win)
Shows the error of a card that failed its check, then goes on to saves->step.
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...
static void STGMCARD_askError(MemCardSaves *saves, MemCardSavesWindows *win)
Shows the error STGMCARD_errorTexts[result] with the port: when saving, an unformatted card (4) asks ...
static void STGMCARD_startSave(MemCardSaves *saves, MemCardSavesWindows *win)
Shows the saving message and starts the panel.
static void STGMCARD_confirmMessage(MemCardSaves *saves, MemCardSavesWindows *win)
Waits for cross on the message (saved, or an empty slot to load): goes back to the pick,...
void STGMCARD_runSaves(MemCardSaves *saves, MemCardSavesWindows *win)
The save list's states (saves->substate): picks the port, reads the card's info section,...
static void STGMCARD_acceptCard(MemCardSaves *saves, MemCardSavesWindows *win)
Waits for the card in the port to answer: a ready card (1 or 4) has its files listed (11),...
static void STGMCARD_closeSlotsToLeave(MemCardSaves *saves, MemCardSavesWindows *win)
Slides the slots and header out before leaving the screen (601)
static void STGMCARD_createFile(MemCardSaves *saves, MemCardSavesWindows *win)
Creates the save file on the card.
static void STGMCARD_showSlots(MemCardSaves *saves, MemCardSavesWindows *win)
Slides the picker's header and slots in, then starts the pick at the last slot used.
static void STGMCARD_endCreate(MemCardSaves *saves, MemCardSavesWindows *win)
Once the panel is done, opens the slot picker (30) or shows the error.
static void STGMCARD_listCard(MemCardSaves *saves, MemCardSavesWindows *win)
Lists the card's files, then ends the check (12)
void STGMCARD_showError(MemCardSaves *saves, MemCardSavesWindows *win)
Shows the error of the last card operation (saves->result, made an index of STGMCARD_errorTexts),...
static void STGMCARD_openSaves(MemCardSaves *saves, MemCardSavesWindows *win)
Starts the save list: titles it for saving or loading and creates the details window.
static void STGMCARD_startLoad(MemCardSaves *saves, MemCardSavesWindows *win)
Loads from the selected slot: an empty one only tells so and goes back to the pick (501),...
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)
Shows the line with the memory card's port number, or hides it.
void STGMCARD_refreshSaves(MemCardSaves *saves)
Fills the details window with the selected save again (saves->refresh)
static void STGMCARD_promptSlot(MemCardSaves *saves, MemCardSavesWindows *win)
Once the picker waits, asks for the slot to save to or load from and shows its details.
static void STGMCARD_checkInfo(MemCardSaves *saves, MemCardSavesWindows *win)
Once the panel is done, checks the info section read: one without the magic starts empty,...
static void STGMCARD_loadSave(MemCardSaves *saves, MemCardSavesWindows *win)
Reads the selected slot's save into the game: a wrong checksum, or another save version while loading...
static void STGMCARD_fillSave(MemCardSaves *saves)
Copies the game to the save buffer with its checksum, fills the slot's summary (name,...
static void STGMCARD_answerOverwrite(MemCardSaves *saves, MemCardSavesWindows *win)
Yes to saving over the slot saves the game there (50), no goes back to the pick.
static void STGMCARD_openSlots(MemCardSaves *saves, MemCardSavesWindows *win)
Hides the messages and shows the slot picker and the details window.
static void STGMCARD_pickSlot(MemCardSaves *saves, MemCardSavesWindows *win)
Waits for the slot: cross saves to it (asking first over a used one) or loads it, triangle closes the...
static void STGMCARD_slideInTitle(MemCardSaves *saves, MemCardSavesWindows *win)
Slides the title in, then asks which memory card port to use.
static void STGMCARD_hideChoices(MemCardSavesWindows *win)
Hides the two choices and their cursor.
static void STGMCARD_readInfo(MemCardSaves *saves, MemCardSavesWindows *win)
Reads the save file's info section (the slots' summaries)
static void STGMCARD_showDone(MemCardSaves *saves, MemCardSavesWindows *win)
Once the panel is done, tells that the game was saved (501) or loaded (502)
static void STGMCARD_startInfoRead(MemCardSaves *saves, MemCardSavesWindows *win)
Once the panel is done, shows the reading message and restarts the panel.
static void STGMCARD_moveChoiceCursor(MemCardSaves *saves, MemCardSavesWindows *win)
Moves the cursor between the two choices (saves->choice)
static void STGMCARD_writeHeader(MemCardSaves *saves, MemCardSavesWindows *win)
Writes the new save file's header; a wrong icon count is error 3.
static void STGMCARD_writeIcons(MemCardSaves *saves, MemCardSavesWindows *win)
Writes the new save file's icon frames, one per call, then makes its empty info section.
SoundState SOUND
rsin and rcos (libgte) read rsin_tbl[a - 0x800] and the like: their addresses before the table fall i...
#define SOUND_MENU_CONFIRM
SYSTEM07.
#define SOUND_SELECT
Sounds the overlays share, with SOUNDTST's names.
#define SOUND_MENU_CANCEL
SYSTEM01.
#define SOUND_CURSOR
SYSTEM02: a cursor moves.
void initSpriteDrawer(SpriteDrawer *obj)
Clears a sprite drawer to neutral (no scale, gray tint, follows the scroll), gives it its methods and...
MemCardScreenFuncs STGMCARD_funcs
STGMCARD's data (data/stgmcard.c)
s32 STGMCARD_errorTexts[]
the texts of the errors, by result
void(* setPos)()
(cursor, x, y)
void(* setVisible)()
(cursor, visible)
void *(* getEntry)(u32 fileAndIndex)
s32(* getPartyMember)(u32 index)
The saved part of the game state, to copy it whole.
u8 checksum
a save's, of its bytes from 0x4 (STGMCARD_runSaves)
char name[0x18]
the player's
Partner partners[PARTNER_COUNT]
u8 version
a save's MEMCARD_SAVE_VERSION (stgmcard.h)
void(* zero)(void *ptr, s32 size)
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
void(* hide)(struct MemCardInfo *info)
void(* refresh)(struct MemCardInfo *info)
s32 drawing
the partners and frame are drawn
void(* show)(struct MemCardInfo *info)
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)
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
void(* hide)(struct MemCardSaves *saves)
void(* nextState)(struct MemCardSaves *task)
s32 choosing
the cursor's two choices are shown
void(* nextSubstate)(struct MemCardSaves *task)
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
void(* setStep)(struct MemCardSaves *task, s32 step)
void(* setState)(struct MemCardSaves *task, s32 state)
s32 backToPick
the message returns to the slot picker
void(* startLerp)(MenuLerp *lerp, s32 from, s32 to, s32 frames)
SaveData * dataBuf
the saved part of the game state
s32 lastSlot
the card's last saved one
s32(* updateLerp)(MenuLerp *lerp)
The main task of the screen (STGMCARD_createScreen)
s32 place
a string of TEXT_SHOP_NAMES (STGMCARD_places)
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 iconIndex
the icon a save is writing (STGMCARD_runSaves)
long fileCount
long: MemCardGetDirentry writes it
void * icons[3]
each frame's image (setSaveHeader)
s32 unlocked
partner id + 3, 0 while locked
short(* playSound)(s32 id)
returns the voice of a key-on
Draws sprites from a sprite sheet (such as file 0x277, the menu graphics): a sheet has a table of fra...
void(* setLayerId)()
(id, depth)
void(* setClutRow)()
(row)
void(* draw)()
(sheet, frame, x, y)
void(* setTexture)()
(x, y)
void(* setLines)()
no prototype: callers would truncate u8 args
void(* setPos)(struct TextWindow *obj, s16 x, s16 y)
void(* setVisible)(struct TextWindow *obj, u8 arg)
void * createTask(void(*update)(), s32 size, s32 childrenSize)
createTaskWithId for a task nothing needs to find
TextWindow * createTextWindow(s16 layerId, s16 style, s16 x, s16 y)
A text window on a layer, in a font style, at (x, y)