src/save.c file

Classes

struct SaveFileStatus
struct SaveFileEEPROMAddresses

Functions

static auto HandleSaveInit(u32) -> SaveResult
static auto HandleSaveInProgress(u32) -> SaveResult
static auto HandleSaveDone(u32) -> SaveResult
auto GetSaveFileEEPROMAddresses(u32) -> const SaveFileEEPROMAddresses*
auto DataDoubleReadWithStatus(u32, void* data) -> u32
auto DataDoubleWriteWithStatus(u32, const void* data) -> u32
auto VerifyChecksum(SaveFileStatus* fileStatus, u16* data, u32 size) -> u32
auto CalculateChecksum(u16* data, u32) -> u16
auto WriteSaveFile(u32 index, SaveFile* saveFile) -> u32
void SetFileStatusInit(u32 index)
auto ReadSaveFileStatus(u32 address, SaveFileStatus* fileStatus) -> u32
auto ParseSaveFileStatus(const SaveFileStatus* fileStatus) -> u32
2 for valid existing file 1 for valid empty file 0 for bad file
auto WriteSaveFileStatus(u32 address, const SaveFileStatus* fileStatus) -> u32
auto DataRead(u32 address, void* data, u32 size) -> u32
read arbitrary data from EEPROM
auto DataWrite(u32 address, const void* data, u32 size) -> u32
write arbitrary data to EEPROM
auto DataCompare(u32 address, const void* data, u32 size) -> u32
compare arbitrary data with EEPROM
void sub_0807CD9C(void)
auto HandleSave(u32 idx) -> SaveResult
Attempt to save the game.
auto InitSaveData(void) -> u32
Initialize the save system.
auto WriteSaveHeader(SaveHeader* saveHeader) -> u32
Write save header.
auto sub_0807CF1C(u8* arg0) -> u32
auto ReadSaveFile(u32 index, SaveFile* saveFile) -> s32
Read save file.
auto ReadSaveHeader(SaveHeader* saveHeader) -> u32
Read save header.
auto sub_0807CF3C(u8* arg0) -> u32
void SetFileStatusDeleted(u32 index)
Mark a save file as deleted.
auto WriteSaveFileStatus(u32 address, const struct SaveFileStatus* fileStatus) -> bool32

Variables

const char gUnk_0811E470
const u8 padding
static SaveResult(*const sSaveHandlers
static const char sSignatureLong
static const SaveFileStatus sSaveDescInit
static const SaveFileStatus sSaveDescDeleted
const char sDummyData
const SaveFileEEPROMAddresses gSaveFileEEPROMAddresses

Function documentation

u32 ParseSaveFileStatus(const SaveFileStatus* fileStatus)

2 for valid existing file 1 for valid empty file 0 for bad file

Parameters
fileStatus

u32 DataRead(u32 address, void* data, u32 size)

read arbitrary data from EEPROM

Parameters
address EEPROM address
data buffer to read into
size size in bytes to read
Returns TRUE on success

u32 DataWrite(u32 address, const void* data, u32 size)

write arbitrary data to EEPROM

Parameters
address EEPROM address
data buffer to write from
size size in bytes to write
Returns TRUE on success

u32 DataCompare(u32 address, const void* data, u32 size)

compare arbitrary data with EEPROM

Parameters
address EEPROM address
data buffer to compare to
size size in bytes to compare
Returns TRUE on success

SaveResult HandleSave(u32 idx)

Attempt to save the game.

Parameters
idx The save slot.
Returns SaveResult result.

u32 InitSaveData(void)

Initialize the save system.

Returns Success

u32 WriteSaveHeader(SaveHeader* saveHeader)

Write save header.

Returns Success.

s32 ReadSaveFile(u32 index, SaveFile* saveFile)

Read save file.

Returns Success.

u32 ReadSaveHeader(SaveHeader* saveHeader)

Read save header.

Returns Success.

void SetFileStatusDeleted(u32 index)

Mark a save file as deleted.

Parameters
index The save file index.