Skip to Content
The Alchemy Project

src/scene/file_screen.c

The File Screen overlay, the first screen after the title. More…

Structures

NameDescription
structFILE_SCREEN_LOADED_SCENE_STATEThe loaded file's scene state as Continue reads it: the play time it holds must match the file's own, or the data is corrupted.
structSAVE_LINK_GREETINGA console's link payload as the cable transfer reads it from SerialPeerPayloads.
structPASSWORD_STATSA party member's base stats, which the password clamps and packs.
structPASSWORD_MEMBERA party member as the password reads them: their level, base stats, inventory and Djinn, a view of UNIT at its offsets.

Macros

NameDescription
#defineFILE_SCREEN_PASSWORD_BUFFER_SIZE WHEN(LARGER_PASSWORD_BUFFER, 320, 260)The password buffer: a Gold password is 260 symbols (scFileScreenEncodePassword) in every edition, which the Japanese buffer holds exactly.
#defineFILE_SCREEN_LINK_SEND_BYTES 4100What a cable transfer sends of the chosen Clear Data file, loaded into BupBuffer: the first 4096 bytes of its save image, rounded up to whole 20-byte link blocks (205 of them).
#defineFILE_SCREEN_LINK_WINDOW_X 4
#defineFILE_SCREEN_LINK_WINDOW_WIDTH 22
#defineFILE_SCREEN_LINK_LANGUAGE_TAG BY_LANGUAGE('C', 'U', 'E', 'S', 'F', 'I')The first letter of the greeting a cable transfer waits for, before V, T and S (scInit).
#defineFILE_SCREEN_SENDING_WINDOW_X 4
#defineFILE_SCREEN_SENDING_WINDOW_WIDTH 22
#defineFILE_SCREEN_PASSWORD_HEADING_X 8
#defineFILE_SCREEN_PASSWORD_HEADING_WIDTH 13
#defineFILE_SCREEN_PASSWORD_RETURN_X JAPANESE_OR(0, 80)The x of a one-page password's help line, "B: Return", in pixels.
#defineFILE_SCREEN_PASSWORD_HELP_X 0
#defineFILE_SCREEN_PASSWORD_HELP_WIDTH 30
#definePASSWORD_SYMBOLS_PER_PAGE 50five rows of ten
#definePASSWORD_SYMBOLS_PER_ROW 10a page's row
#definePASSWORD_SYMBOL_MASK 0x3fsix bits: 64 symbols
#definePASSWORD_GOLD_BYTES 175The bytes each password level packs, its checksum's two included, as The Lost Age's password screen decodes them.
#definePASSWORD_SILVER_BYTES 41
#definePASSWORD_BRONZE_BYTES 11
#definePASSWORD_CRC_BYTES 2The checksum's two bytes at the end of each level's (scFileScreenCalculatePasswordCrc16).
#definePASSWORD_CRC_SEED 0xffff
#definePASSWORD_CRC_POLYNOMIAL 0x1021
#definePASSWORD_CRC_TOP_BIT 0x8000of its 16 bits
#definePASSWORD_FLAGS_BYTE 7Where a password's parts start among its bytes: the four levels and the Djinn from the first, the story flags, then Silver's and Bronze's Psynergy items, which Gold has not; the stats rows after those, two party members to a row; and Gold's alone, the party's items, 15 a member in nine bits each, their quantities, five bits for each of the 23 items that stack (FileScreenPasswordStackItems), and the coins, high byte first.
#definePASSWORD_KEY_ITEMS_BYTE 8
#definePASSWORD_STATS_ROW_BYTES 15
#definePASSWORD_ITEMS_BYTE 39
#definePASSWORD_QUANTITIES_BYTE 107
#definePASSWORD_COINS_BYTE 165
#definePASSWORD_STACK_ITEMS 23
#definePASSWORD_MEMBERS 4The party members a password packs (FileScreenPasswordMembers), its story flags (FileScreenPasswordFlags) and Psynergy items (FileScreenPasswordKeyItems).
#definePASSWORD_FLAGS 6
#definePASSWORD_KEY_ITEMS 8
#definePASSWORD_HP_SHIFT 21A party member's base stats in the password, two words of fields: HP (11 bits), PP (11) and Attack (10); then Defense (10), Agility (10) and Luck (8) over four bits of 0.
#definePASSWORD_PP_SHIFT 10
#definePASSWORD_DEFENSE_SHIFT 22
#definePASSWORD_AGILITY_SHIFT 12
#definePASSWORD_LUCK_SHIFT 4
#defineSYMBOL_TA 15
#defineSYMBOL_WO 45
#defineSYMBOL_GA 46
#defineSYMBOL_DA 56
#defineSYMBOL_BA 59
#defineSYMBOL_DIGITS 24
#defineSYMBOL_SMALL_LETTERS 32
#defineSYMBOL_SIGNS 56
#defineLINK_SEND_TICKS 600000Sending by cable gives up after this long, almost three hours, and with a communication error once the other console goes unheard this long.
#defineLINK_SILENT_TICKS 10
#defineEXTRA_CODE_HELDUB: the second code's held flag, a word, is read and written as its low halfword.
#defineTILE_GRID_COLUMNS 16The grid of the window tilemap the two unused functions below fill: 16 by 8 entries; the second's tiles start at TILE_GRID_FIRST_TILE.
#defineTILE_GRID_ROWS 8
#defineTILE_GRID_FIRST_TILE 32

Functions

NameDescription
Sint32scInit (void)Runs the File Screen.
static Sint32scFileScreenPackPasswordData (Sint32 unused, Sint32 level, Uint8 *out)Packs the four heroes' data for a password of the given level (enum PASSWORD_LEVEL), its checksum's bytes still to come; any other level clears PASSWORD_BRONZE_BYTES.
static Sint32scFileScreenEncodePassword (Uint8 *data, Sint32 size, Uint8 *out)Encodes size bytes of data as password symbols in out and returns how many there are: every byte but the last XORed with the last, six bits a symbol, a checksum symbol after every nine, and each symbol plus its place.
static Uint16scFileScreenCalculatePasswordCrc16 (Uint32 byteCount, Uint8 *data)The password's checksum: over byteCount bytes of data, shifted a bit at a time from PASSWORD_CRC_SEED, PASSWORD_CRC_POLYNOMIAL subtracted when the top bit falls out, and the result complemented.
Uint8 *scGetEntrances (void)The File Screen overlay's scene tables, for the scene loader.
Sint32scGetExitRegions (void)The File Screen has no exit regions.
Uint8 *scGetExits (void)Both scenes share one exit table.
Uint8 *scGetActorPlacements (void)Some villagers only turn back after talking once the flood is over or their family has gone home.
Uint8 *scGetCues (void)The first water beast's cave changes its cues once the first drain has lowered its water: the beast is gone and its two puddles can be frozen.
static voidscFileScreenLoadBackground (void)Loads the Golden Sun logo onto BG2 as scTitleLoadBackground (title.c) does, and stops the leader's motion.
static voidscFileScreenFadeInBlend (void)The event that fades BG0 and the sprites in over the logo, a step of the blend every second tick.
static voidscFileScreenCheckButtonCodes (void)The event that follows the two hidden codes each tick while the File Screen runs: each held key that matches the next key of a code advances it, a wrong key starts it again, and finishing a code unlocks it with a chime.
static voidscFileScreenGetPasswordCharacter (Sint32 symbol, Uint8 *text)The character a password symbol stands for, in the font's codes, with the voiced mark after it where it has one.
static Sint32scFileScreenIsRetreatBlocked (void)Nonzero (-1) when the save was made where Retreat is blocked, unless in a town or on the world map: such a save cannot restart at the Sanctum, by L and Start held as it loads or as a corrupted save is recovered.
static voidscFileScreenFillTileGridByWindowWidth (WINDOW *window, const void *compressedTiles)Unused: unpacks the tiles into a scratch buffer, then fills a grid of the window tilemap, in VRAM and in its shadow, from the window's corner: each entry's tile the row times the window's width plus the column.
static voidscFileScreenFillTileGridByGridWidth (const WINDOW *window)Unused: fills a grid of the window tilemap with the tiles from TILE_GRID_FIRST_TILE on, TILE_GRID_COLUMNS to a row.

Variables

NameDescription
extern Uint32FileScreenExits []
extern ACTOR_PLACEFileScreenActorPlacements []
extern CUEFileScreenCues []
extern Sint16FileScreenBlendTickTicks since scFileScreenFadeInBlend began; the blend level is half of it.
extern Sint16FileScreenCodeUnlockedSet once FileScreenButtonCode has been entered; nothing here clears it.
extern Sint16FileScreenExtraCodeUnlockedSet once FileScreenExtraButtonCode has been entered.
extern Sint16FileScreenCodeProgressThe index in FileScreenButtonCode of the key to press next.
extern Sint16FileScreenExtraCodeProgressThe index in FileScreenExtraButtonCode of the key to press next.
extern Sint16FileScreenCodeHeldSet while the first code's last correct key is still held.
extern Sint32FileScreenExtraCodeHeldThe same for the second code: a word, of which only the low halfword is used.
extern Uint16FileScreenPasswordStackItems []The items whose quantity a Gold password keeps for each party member.
extern Uint32FileScreenPasswordMembers [PASSWORD_MEMBERS]The party members the password packs: Isaac, Garet, Ivan and Mia.
extern Uint16FileScreenPasswordFlags [PASSWORD_FLAGS]The six story flags of the password's PASSWORD_FLAGS_BYTE, bits 0 to 5.
extern Uint16FileScreenPasswordKeyItems [PASSWORD_KEY_ITEMS]The eight Psynergy items, ITEM_ORB_OF_FORCE to ITEM_CATCH_BEADS, which Silver and Bronze record in PASSWORD_KEY_ITEMS_BYTE.
const Uint16FileScreenButtonCode []The first hidden code, entered on the File Screen and ended by 0.
const Uint16FileScreenExtraButtonCode []The second, longer code.

Description

The File Screen overlay, the first screen after the title.

It holds the Golden Sun logo, the start menu (New Game, Continue, Copy and Erase), the door to the Battle Arena and the sending of a cleared game's data to The Lost Age, by link cable or as a password. Two secret button codes on the screen (scFileScreenCheckButtonCodes) name more of the party.

Macros in detail

FILE_SCREEN_PASSWORD_BUFFER_SIZE

#define FILE_SCREEN_PASSWORD_BUFFER_SIZE WHEN(LARGER_PASSWORD_BUFFER, 320, 260)

The password buffer: a Gold password is 260 symbols (scFileScreenEncodePassword) in every edition, which the Japanese buffer holds exactly.

Open question (no evidence in reach): why the other editions reserve 320; nothing in this game writes or reads past 260, so the bytes show only the space.

Referenced by scInit().

Definition at line 39 of file file_screen.c.

#define FILE_SCREEN_LINK_SEND_BYTES 4100

What a cable transfer sends of the chosen Clear Data file, loaded into BupBuffer: the first 4096 bytes of its save image, rounded up to whole 20-byte link blocks (205 of them). The Lost Age (scClearReceiveByLink) reads from it the flags, the main routine's state and the eight units, which end at byte 3936.

Referenced by scInit().

Definition at line 46 of file file_screen.c.

#define FILE_SCREEN_LINK_WINDOW_X 4

#define FILE_SCREEN_LINK_WINDOW_X 6

Referenced by scInit().

Definition at lines 51 and 54 of file file_screen.c.

#define FILE_SCREEN_LINK_WINDOW_WIDTH 22

#define FILE_SCREEN_LINK_WINDOW_WIDTH 18

Referenced by scInit().

Definition at lines 52 and 55 of file file_screen.c.

#define FILE_SCREEN_LINK_LANGUAGE_TAG BY_LANGUAGE('C', 'U', 'E', 'S', 'F', 'I')

The first letter of the greeting a cable transfer waits for, before V, T and S (scInit).

Referenced by scInit().

Definition at line 60 of file file_screen.c.

FILE_SCREEN_SENDING_WINDOW_X

#define FILE_SCREEN_SENDING_WINDOW_X 4

#define FILE_SCREEN_SENDING_WINDOW_X 5

Referenced by scInit().

Definition at lines 65 and 68 of file file_screen.c.

FILE_SCREEN_SENDING_WINDOW_WIDTH

#define FILE_SCREEN_SENDING_WINDOW_WIDTH 22

#define FILE_SCREEN_SENDING_WINDOW_WIDTH 20

Referenced by scInit().

Definition at lines 66 and 69 of file file_screen.c.

FILE_SCREEN_PASSWORD_HEADING_X

#define FILE_SCREEN_PASSWORD_HEADING_X 8

#define FILE_SCREEN_PASSWORD_HEADING_X 10

Referenced by scInit().

Definition at lines 75 and 78 of file file_screen.c.

FILE_SCREEN_PASSWORD_HEADING_WIDTH

#define FILE_SCREEN_PASSWORD_HEADING_WIDTH 13

#define FILE_SCREEN_PASSWORD_HEADING_WIDTH 10

Referenced by scInit().

Definition at lines 76 and 79 of file file_screen.c.

FILE_SCREEN_PASSWORD_RETURN_X

#define FILE_SCREEN_PASSWORD_RETURN_X JAPANESE_OR(0, 80)

The x of a one-page password's help line, "B: Return", in pixels.

Referenced by scInit().

Definition at line 83 of file file_screen.c.

FILE_SCREEN_PASSWORD_HELP_X

#define FILE_SCREEN_PASSWORD_HELP_X 0

#define FILE_SCREEN_PASSWORD_HELP_X 3

#define FILE_SCREEN_PASSWORD_HELP_X 1

Referenced by scInit().

Definition at lines 89, 92 and 95 of file file_screen.c.

FILE_SCREEN_PASSWORD_HELP_WIDTH

#define FILE_SCREEN_PASSWORD_HELP_WIDTH 30

#define FILE_SCREEN_PASSWORD_HELP_WIDTH 24

#define FILE_SCREEN_PASSWORD_HELP_WIDTH 28

Referenced by scInit().

Definition at lines 90, 93 and 96 of file file_screen.c.

PASSWORD_SYMBOLS_PER_PAGE

#define PASSWORD_SYMBOLS_PER_PAGE 50

five rows of ten

Referenced by scInit().

Definition at line 99 of file file_screen.c.

PASSWORD_SYMBOLS_PER_ROW

#define PASSWORD_SYMBOLS_PER_ROW 10

a page's row

Referenced by scFileScreenEncodePassword() and scInit().

Definition at line 100 of file file_screen.c.

PASSWORD_SYMBOL_MASK

#define PASSWORD_SYMBOL_MASK 0x3f

six bits: 64 symbols

Referenced by scFileScreenEncodePassword() and scInit().

Definition at line 101 of file file_screen.c.

PASSWORD_GOLD_BYTES

#define PASSWORD_GOLD_BYTES 175

The bytes each password level packs, its checksum's two included, as The Lost Age's password screen decodes them.

Referenced by scFileScreenPackPasswordData().

Definition at line 105 of file file_screen.c.

PASSWORD_SILVER_BYTES

#define PASSWORD_SILVER_BYTES 41

Referenced by scFileScreenPackPasswordData().

Definition at line 106 of file file_screen.c.

PASSWORD_BRONZE_BYTES

#define PASSWORD_BRONZE_BYTES 11

Referenced by scFileScreenPackPasswordData().

Definition at line 107 of file file_screen.c.

PASSWORD_CRC_BYTES

#define PASSWORD_CRC_BYTES 2

The checksum's two bytes at the end of each level's (scFileScreenCalculatePasswordCrc16).

Referenced by scFileScreenPackPasswordData() and scInit().

Definition at line 110 of file file_screen.c.

PASSWORD_CRC_SEED

#define PASSWORD_CRC_SEED 0xffff

Referenced by scFileScreenCalculatePasswordCrc16().

Definition at line 111 of file file_screen.c.

PASSWORD_CRC_POLYNOMIAL

#define PASSWORD_CRC_POLYNOMIAL 0x1021

Referenced by scFileScreenCalculatePasswordCrc16().

Definition at line 112 of file file_screen.c.

PASSWORD_CRC_TOP_BIT

#define PASSWORD_CRC_TOP_BIT 0x8000

of its 16 bits

Referenced by scFileScreenCalculatePasswordCrc16().

Definition at line 113 of file file_screen.c.

PASSWORD_FLAGS_BYTE

#define PASSWORD_FLAGS_BYTE 7

Where a password's parts start among its bytes: the four levels and the Djinn from the first, the story flags, then Silver's and Bronze's Psynergy items, which Gold has not; the stats rows after those, two party members to a row; and Gold's alone, the party's items, 15 a member in nine bits each, their quantities, five bits for each of the 23 items that stack (FileScreenPasswordStackItems), and the coins, high byte first.

Referenced by scFileScreenPackPasswordData().

Definition at line 121 of file file_screen.c.

PASSWORD_KEY_ITEMS_BYTE

#define PASSWORD_KEY_ITEMS_BYTE 8

Referenced by scFileScreenPackPasswordData().

Definition at line 122 of file file_screen.c.

PASSWORD_STATS_ROW_BYTES

#define PASSWORD_STATS_ROW_BYTES 15

Referenced by scFileScreenPackPasswordData().

Definition at line 123 of file file_screen.c.

PASSWORD_ITEMS_BYTE

#define PASSWORD_ITEMS_BYTE 39

Referenced by scFileScreenPackPasswordData().

Definition at line 124 of file file_screen.c.

PASSWORD_QUANTITIES_BYTE

#define PASSWORD_QUANTITIES_BYTE 107

Referenced by scFileScreenPackPasswordData().

Definition at line 125 of file file_screen.c.

PASSWORD_COINS_BYTE

#define PASSWORD_COINS_BYTE 165

Referenced by scFileScreenPackPasswordData().

Definition at line 126 of file file_screen.c.

PASSWORD_STACK_ITEMS

#define PASSWORD_STACK_ITEMS 23

Referenced by FileScreenPasswordStackItems and scFileScreenPackPasswordData().

Definition at line 127 of file file_screen.c.

PASSWORD_MEMBERS

#define PASSWORD_MEMBERS 4

The party members a password packs (FileScreenPasswordMembers), its story flags (FileScreenPasswordFlags) and Psynergy items (FileScreenPasswordKeyItems).

Referenced by FileScreenPasswordMembers and scFileScreenPackPasswordData().

Definition at line 131 of file file_screen.c.

PASSWORD_FLAGS

#define PASSWORD_FLAGS 6

Referenced by FileScreenPasswordFlags and scFileScreenPackPasswordData().

Definition at line 132 of file file_screen.c.

PASSWORD_KEY_ITEMS

#define PASSWORD_KEY_ITEMS 8

Referenced by FileScreenPasswordKeyItems and scFileScreenPackPasswordData().

Definition at line 133 of file file_screen.c.

PASSWORD_HP_SHIFT

#define PASSWORD_HP_SHIFT 21

A party member's base stats in the password, two words of fields: HP (11 bits), PP (11) and Attack (10); then Defense (10), Agility (10) and Luck (8) over four bits of 0.

Referenced by scFileScreenPackPasswordData().

Definition at line 142 of file file_screen.c.

PASSWORD_PP_SHIFT

#define PASSWORD_PP_SHIFT 10

Referenced by scFileScreenPackPasswordData().

Definition at line 143 of file file_screen.c.

PASSWORD_DEFENSE_SHIFT

#define PASSWORD_DEFENSE_SHIFT 22

Referenced by scFileScreenPackPasswordData().

Definition at line 144 of file file_screen.c.

PASSWORD_AGILITY_SHIFT

#define PASSWORD_AGILITY_SHIFT 12

Referenced by scFileScreenPackPasswordData().

Definition at line 145 of file file_screen.c.

PASSWORD_LUCK_SHIFT

#define PASSWORD_LUCK_SHIFT 4

Referenced by scFileScreenPackPasswordData().

Definition at line 146 of file file_screen.c.

SYMBOL_TA

#define SYMBOL_TA 15

Definition at line 154 of file file_screen.c.

SYMBOL_WO

#define SYMBOL_WO 45

Definition at line 155 of file file_screen.c.

SYMBOL_GA

#define SYMBOL_GA 46

Definition at line 156 of file file_screen.c.

SYMBOL_DA

#define SYMBOL_DA 56

Definition at line 157 of file file_screen.c.

SYMBOL_BA

#define SYMBOL_BA 59

Definition at line 158 of file file_screen.c.

SYMBOL_DIGITS

#define SYMBOL_DIGITS 24

Referenced by scFileScreenGetPasswordCharacter().

Definition at line 160 of file file_screen.c.

SYMBOL_SMALL_LETTERS

#define SYMBOL_SMALL_LETTERS 32

Referenced by scFileScreenGetPasswordCharacter().

Definition at line 161 of file file_screen.c.

SYMBOL_SIGNS

#define SYMBOL_SIGNS 56

Referenced by scFileScreenGetPasswordCharacter().

Definition at line 162 of file file_screen.c.

#define LINK_SEND_TICKS 600000

Sending by cable gives up after this long, almost three hours, and with a communication error once the other console goes unheard this long.

Referenced by scInit().

Definition at line 167 of file file_screen.c.

#define LINK_SILENT_TICKS 10

Referenced by scInit().

Definition at line 168 of file file_screen.c.

EXTRA_CODE_HELD

#define EXTRA_CODE_HELD

UB: the second code's held flag, a word, is read and written as its low halfword.

Referenced by scFileScreenCheckButtonCodes().

Definition at line 172 of file file_screen.c.

TILE_GRID_COLUMNS

#define TILE_GRID_COLUMNS 16

The grid of the window tilemap the two unused functions below fill: 16 by 8 entries; the second's tiles start at TILE_GRID_FIRST_TILE.

Referenced by scFileScreenFillTileGridByGridWidth() and scFileScreenFillTileGridByWindowWidth().

Definition at line 1086 of file file_screen.c.

TILE_GRID_ROWS

#define TILE_GRID_ROWS 8

Referenced by scFileScreenFillTileGridByGridWidth() and scFileScreenFillTileGridByWindowWidth().

Definition at line 1087 of file file_screen.c.

TILE_GRID_FIRST_TILE

#define TILE_GRID_FIRST_TILE 32

Referenced by scFileScreenFillTileGridByGridWidth().

Definition at line 1088 of file file_screen.c.

Functions in detail

scInit

Sint32 scInit(void)

Runs the File Screen. Come from the credits, it offers to save the cleared game and goes on to the world map; otherwise it shows the start menu and carries out the choice: a new game in Isaac's bedroom, a file continued, copied or erased, the Battle Arena, or a cleared game's data sent.

References BupBuffer, DebugMode, fdScriptFinishScreenTransition(), fdScriptGetFlag(), fdScriptSetDestination(), fdScriptSetFlag(), fdScriptStartScreenTransition(), fdScriptWait(), fdScriptWaitTransitionTicks(), fdYesNoAsk(), FileScreenCodeUnlocked, FileScreenExtraCodeUnlocked, glyph, gmBuildStampGetTime(), gmFlagClear(), gmFlagSet(), gmInventorySnapshotRestore(), gmMainRoutineStateInitDefaults(), gmPartyAddMember(), gmPartyRemoveMember(), gmPartyStartChildhood(), IdleSleepEnabled, LinkStatusWork, MainRoutineStateWork, mnFieldMessageShow(), mnFieldMessageShowCentered(), mnFileListSelectAction(), mnGraphicsExpandVRAMTilesByColorTable(), mnIconMenuChooseSendOption(), mnMessageCloseFinishedWindows(), mnNameEntryEditMemberName(), mnPageArrowsDraw(), mnSaveChooseAndLoadFile(), mnSaveCopyFile(), mnSaveEraseSelectedFile(), mnSaveScanFileSummaries(), mnSaveToChosenFile(), mnTextDrawMessage(), mnTextDrawMessageAsTiles(), mnTextDrawString(), mnWindowClose(), mnWindowColorApply(), mnWindowCreate(), mnWindowDrawDividerLine(), mnWindowSetTilemapEntry(), mnWindowSpritePrepareForRedraw(), mnYesNoMenuRun(), PerData, PerPush, SceneLocalState and 21 more.

Definition at lines 22 and 462 of file file_screen.c.

scFileScreenPackPasswordData

static Sint32 scFileScreenPackPasswordData(Sint32 unused, Sint32 level, Uint8 *out)

Packs the four heroes' data for a password of the given level (enum PASSWORD_LEVEL), its checksum's bytes still to come; any other level clears PASSWORD_BRONZE_BYTES. It clamps each party member's base stats and level in place first, and returns the byte count.

References FileScreenPasswordFlags, FileScreenPasswordKeyItems, FileScreenPasswordMembers, FileScreenPasswordStackItems, gmFlagGet(), gmItemGetDefinition(), gmUnitGet(), MainRoutineStateWork and Sint32.

Referenced by scInit().

Definition at lines 177 and 1200 of file file_screen.c.

scFileScreenEncodePassword

static Sint32 scFileScreenEncodePassword(Uint8 *data, Sint32 size, Uint8 *out)

Encodes size bytes of data as password symbols in out and returns how many there are: every byte but the last XORed with the last, six bits a symbol, a checksum symbol after every nine, and each symbol plus its place.

References Sint32.

Referenced by scInit().

Definition at lines 179 and 1455 of file file_screen.c.

scFileScreenCalculatePasswordCrc16

static Uint16 scFileScreenCalculatePasswordCrc16(Uint32 byteCount, Uint8 *data)

The password's checksum: over byteCount bytes of data, shifted a bit at a time from PASSWORD_CRC_SEED, PASSWORD_CRC_POLYNOMIAL subtracted when the top bit falls out, and the result complemented. The Lost Age's password screen checks it against a decoded password's last PASSWORD_CRC_BYTES.

Referenced by scInit().

Definition at lines 180 and 1511 of file file_screen.c.

scGetEntrances

Uint8 *scGetEntrances(void)

The File Screen overlay's scene tables, for the scene loader.

References ScreenEntrances.

Definition at line 183 of file file_screen.c.

scGetExitRegions

Sint32 scGetExitRegions(void)

The File Screen has no exit regions.

References Sint32.

Definition at line 189 of file file_screen.c.

scGetExits

Uint8 *scGetExits(void)

References FileScreenExits.

Definition at line 194 of file file_screen.c.

scGetActorPlacements

Uint8 *scGetActorPlacements(void)

References FileScreenActorPlacements.

Definition at line 199 of file file_screen.c.

scGetCues

Uint8 *scGetCues(void)

References FileScreenCues.

Definition at line 204 of file file_screen.c.

scFileScreenLoadBackground

static void scFileScreenLoadBackground(void)

Loads the Golden Sun logo onto BG2 as scTitleLoadBackground (title.c) does, and stops the leader's motion.

References BgScrollWork, fdActorGet(), MainRoutineStateWork, scFieldDecompressTaggedLZ(), Sint32, syDMAXCopy(), syResourceGetTableEntry() and syScreenFadeToBlack().

Referenced by scInit().

Definition at line 211 of file file_screen.c.

scFileScreenFadeInBlend

static void scFileScreenFadeInBlend(void)

The event that fades BG0 and the sprites in over the logo, a step of the blend every second tick.

References FileScreenBlendTick and syCloseEvent().

Referenced by scInit().

Definition at line 263 of file file_screen.c.

scFileScreenCheckButtonCodes

static void scFileScreenCheckButtonCodes(void)

The event that follows the two hidden codes each tick while the File Screen runs: each held key that matches the next key of a code advances it, a wrong key starts it again, and finishing a code unlocks it with a chime.

References FileScreenButtonCode, FileScreenCodeHeld, FileScreenCodeProgress, FileScreenCodeUnlocked, FileScreenExtraButtonCode, FileScreenExtraCodeProgress, FileScreenExtraCodeUnlocked, PerData and sySoundPlay().

Referenced by scInit().

Definition at line 300 of file file_screen.c.

scFileScreenGetPasswordCharacter

static void scFileScreenGetPasswordCharacter(Sint32 symbol, Uint8 *text)

The character a password symbol stands for, in the font's codes, with the voiced mark after it where it has one.

References Sint32.

Referenced by scInit().

Definition at line 357 of file file_screen.c.

scFileScreenIsRetreatBlocked

static Sint32 scFileScreenIsRetreatBlocked(void)

Nonzero (-1) when the save was made where Retreat is blocked, unless in a town or on the world map: such a save cannot restart at the Sanctum, by L and Start held as it loads or as a corrupted save is recovered.

References gmFlagGet(), MainRoutineStateWork and Sint32.

Referenced by scInit().

Definition at line 419 of file file_screen.c.

scFileScreenFillTileGridByWindowWidth

static void scFileScreenFillTileGridByWindowWidth(WINDOW *window, const void *compressedTiles)

Unused: unpacks the tiles into a scratch buffer, then fills a grid of the window tilemap, in VRAM and in its shadow, from the window's corner: each entry's tile the row times the window's width plus the column.

References scFieldDecompressTaggedLZ(), Sint32, syHeapAllocateEWRAM() and syHeapRelease().

Definition at line 1093 of file file_screen.c.

scFileScreenFillTileGridByGridWidth

static void scFileScreenFillTileGridByGridWidth(const WINDOW *window)

Unused: fills a grid of the window tilemap with the tiles from TILE_GRID_FIRST_TILE on, TILE_GRID_COLUMNS to a row.

References Sint32, syHeapAllocateEWRAM() and syHeapRelease().

Definition at line 1127 of file file_screen.c.

Variables in detail

FileScreenExits

extern Uint32 FileScreenExits[]

Uint32 FileScreenExits[]

Referenced by scGetExits().

Definition at lines 23 and 1538 of file file_screen.c.

FileScreenActorPlacements

extern ACTOR_PLACE FileScreenActorPlacements[]

ACTOR_PLACE FileScreenActorPlacements[]

Referenced by scGetActorPlacements().

Definition at lines 24 and 1542 of file file_screen.c.

FileScreenCues

extern CUE FileScreenCues[]

CUE FileScreenCues[]

Referenced by scGetCues().

Definition at lines 25 and 1546 of file file_screen.c.

FileScreenBlendTick

extern Sint16 FileScreenBlendTick

Sint16 FileScreenBlendTick

Ticks since scFileScreenFadeInBlend began; the blend level is half of it.

Referenced by scFileScreenFadeInBlend().

Definition at lines 26 and 1551 of file file_screen.c.

FileScreenCodeUnlocked

extern Sint16 FileScreenCodeUnlocked

Sint16 FileScreenCodeUnlocked

Set once FileScreenButtonCode has been entered; nothing here clears it.

Referenced by scFileScreenCheckButtonCodes() and scInit().

Definition at lines 27 and 1554 of file file_screen.c.

FileScreenExtraCodeUnlocked

extern Sint16 FileScreenExtraCodeUnlocked

Sint16 FileScreenExtraCodeUnlocked

Set once FileScreenExtraButtonCode has been entered.

Referenced by scFileScreenCheckButtonCodes() and scInit().

Definition at lines 28 and 1557 of file file_screen.c.

FileScreenCodeProgress

extern Sint16 FileScreenCodeProgress

Sint16 FileScreenCodeProgress

The index in FileScreenButtonCode of the key to press next.

Referenced by scFileScreenCheckButtonCodes().

Definition at lines 29 and 1560 of file file_screen.c.

FileScreenExtraCodeProgress

extern Sint16 FileScreenExtraCodeProgress

Sint16 FileScreenExtraCodeProgress

The index in FileScreenExtraButtonCode of the key to press next.

Referenced by scFileScreenCheckButtonCodes().

Definition at lines 30 and 1563 of file file_screen.c.

FileScreenCodeHeld

extern Sint16 FileScreenCodeHeld

Sint16 FileScreenCodeHeld

Set while the first code's last correct key is still held.

Referenced by scFileScreenCheckButtonCodes().

Definition at lines 31 and 1566 of file file_screen.c.

FileScreenExtraCodeHeld

extern Sint32 FileScreenExtraCodeHeld

Sint32 FileScreenExtraCodeHeld

The same for the second code: a word, of which only the low halfword is used.

References Sint32.

Definition at lines 32 and 1569 of file file_screen.c.

FileScreenPasswordStackItems

extern Uint16 FileScreenPasswordStackItems[]

Uint16 FileScreenPasswordStackItems[PASSWORD_STACK_ITEMS]

The items whose quantity a Gold password keeps for each party member.

Referenced by scFileScreenPackPasswordData().

Definition at lines 33 and 1594 of file file_screen.c.

FileScreenPasswordMembers

extern Uint32 FileScreenPasswordMembers[PASSWORD_MEMBERS]

Uint32 FileScreenPasswordMembers[PASSWORD_MEMBERS]

The party members the password packs: Isaac, Garet, Ivan and Mia.

Referenced by scFileScreenPackPasswordData().

Definition at lines 135 and 1573 of file file_screen.c.

FileScreenPasswordFlags

extern Uint16 FileScreenPasswordFlags[PASSWORD_FLAGS]

Uint16 FileScreenPasswordFlags[PASSWORD_FLAGS]

The six story flags of the password's PASSWORD_FLAGS_BYTE, bits 0 to 5.

Referenced by scFileScreenPackPasswordData().

Definition at lines 136 and 1578 of file file_screen.c.

FileScreenPasswordKeyItems

extern Uint16 FileScreenPasswordKeyItems[PASSWORD_KEY_ITEMS]

Uint16 FileScreenPasswordKeyItems[PASSWORD_KEY_ITEMS]

The eight Psynergy items, ITEM_ORB_OF_FORCE to ITEM_CATCH_BEADS, which Silver and Bronze record in PASSWORD_KEY_ITEMS_BYTE.

Referenced by scFileScreenPackPasswordData().

Definition at lines 137 and 1586 of file file_screen.c.

FileScreenButtonCode

const Uint16 FileScreenButtonCode[]

The first hidden code, entered on the File Screen and ended by 0.

It is Select three times. With it a new game names Garet, Ivan and Mia as well as Isaac (scInit).

Referenced by scFileScreenCheckButtonCodes().

Definition at line 284 of file file_screen.c.

FileScreenExtraButtonCode

const Uint16 FileScreenExtraButtonCode[]

The second, longer code.

With it a new game also names Felix, Jenna and Sheba.

Referenced by scFileScreenCheckButtonCodes().

Definition at line 291 of file file_screen.c.

On this page

StructuresMacrosFunctionsVariablesDescriptionMacros in detailFILE_SCREEN_PASSWORD_BUFFER_SIZEFILE_SCREEN_LINK_SEND_BYTESFILE_SCREEN_LINK_WINDOW_XFILE_SCREEN_LINK_WINDOW_WIDTHFILE_SCREEN_LINK_LANGUAGE_TAGFILE_SCREEN_SENDING_WINDOW_XFILE_SCREEN_SENDING_WINDOW_WIDTHFILE_SCREEN_PASSWORD_HEADING_XFILE_SCREEN_PASSWORD_HEADING_WIDTHFILE_SCREEN_PASSWORD_RETURN_XFILE_SCREEN_PASSWORD_HELP_XFILE_SCREEN_PASSWORD_HELP_WIDTHPASSWORD_SYMBOLS_PER_PAGEPASSWORD_SYMBOLS_PER_ROWPASSWORD_SYMBOL_MASKPASSWORD_GOLD_BYTESPASSWORD_SILVER_BYTESPASSWORD_BRONZE_BYTESPASSWORD_CRC_BYTESPASSWORD_CRC_SEEDPASSWORD_CRC_POLYNOMIALPASSWORD_CRC_TOP_BITPASSWORD_FLAGS_BYTEPASSWORD_KEY_ITEMS_BYTEPASSWORD_STATS_ROW_BYTESPASSWORD_ITEMS_BYTEPASSWORD_QUANTITIES_BYTEPASSWORD_COINS_BYTEPASSWORD_STACK_ITEMSPASSWORD_MEMBERSPASSWORD_FLAGSPASSWORD_KEY_ITEMSPASSWORD_HP_SHIFTPASSWORD_PP_SHIFTPASSWORD_DEFENSE_SHIFTPASSWORD_AGILITY_SHIFTPASSWORD_LUCK_SHIFTSYMBOL_TASYMBOL_WOSYMBOL_GASYMBOL_DASYMBOL_BASYMBOL_DIGITSSYMBOL_SMALL_LETTERSSYMBOL_SIGNSLINK_SEND_TICKSLINK_SILENT_TICKSEXTRA_CODE_HELDTILE_GRID_COLUMNSTILE_GRID_ROWSTILE_GRID_FIRST_TILEFunctions in detailscInitscFileScreenPackPasswordDatascFileScreenEncodePasswordscFileScreenCalculatePasswordCrc16scGetEntrancesscGetExitRegionsscGetExitsscGetActorPlacementsscGetCuesscFileScreenLoadBackgroundscFileScreenFadeInBlendscFileScreenCheckButtonCodesscFileScreenGetPasswordCharacterscFileScreenIsRetreatBlockedscFileScreenFillTileGridByWindowWidthscFileScreenFillTileGridByGridWidthVariables in detailFileScreenExitsFileScreenActorPlacementsFileScreenCuesFileScreenBlendTickFileScreenCodeUnlockedFileScreenExtraCodeUnlockedFileScreenCodeProgressFileScreenExtraCodeProgressFileScreenCodeHeldFileScreenExtraCodeHeldFileScreenPasswordStackItemsFileScreenPasswordMembersFileScreenPasswordFlagsFileScreenPasswordKeyItemsFileScreenButtonCodeFileScreenExtraButtonCode