GBAlatro
A Demake of Balatro for the GBA
Loading...
Searching...
No Matches
save.h File Reference

Utils functions to save/load data structures from/to the SRAM. More...

#include "game_variables.h"
#include <tonc.h>

Go to the source code of this file.

Functions

bool is_game_data_valid (void)
 Checks whether the SaveGame section is present and valid.
 
void save_game (void)
 Save current run data to SRAM.
 
void load_game (void)
 Load previous run data from SRAM.
 
void save_options (void)
 Save options values to SRAM.
 
void load_options (void)
 Load options values from SRAM.
 

Detailed Description

Utils functions to save/load data structures from/to the SRAM.

Here is an overwiew of the contents of a valid save file.

┌─────────────┐ <-- SaveHeader
│ Header │
├─────────────┤ <-- SaveOptions
│ Options │
├─────────────┤ <-- SaveGame
│ Engine vars │
│ Jokers │
└─────────────┘
SaveGame will contain the data about the current run to be saved to SRAM. GameVariables was used for ...
Definition save.c:160
SaveHeader for validation checks to be packed and written to SRAM for validation. Defined in this dis...
Definition save.c:53
SaveOptions will only contain options data set in the Options Menu.
Definition save.c:87

SaveHeader indicates save validity by its presence. SaveOptions contains options values set in the corresponding menu and apply to the game itself. SaveGame contains values tied to a run with round, ante, money, owned Jokers etc...

See also
SaveHeader, SaveOptions, SaveGame

I strongly recommend using xxd -l 512 -e -g 4 <gbalatro.sav> to view the contents of the save

Definition in file save.h.

Function Documentation

◆ is_game_data_valid()

bool is_game_data_valid ( void  )

Checks whether the SaveGame section is present and valid.

Returns
true if it is, false if not.

Definition at line 335 of file save.c.

◆ load_game()

void load_game ( void  )

Load previous run data from SRAM.

See also
save_game

Definition at line 378 of file save.c.

◆ load_options()

void load_options ( void  )

Load options values from SRAM.

See also
save_options

Definition at line 316 of file save.c.

◆ save_game()

void save_game ( void  )

Save current run data to SRAM.

Definition at line 341 of file save.c.

◆ save_options()

void save_options ( void  )

Save options values to SRAM.

Definition at line 302 of file save.c.