a79c4c92e2
* Make save changes their own branch * Make SaveData tags char[] instead of u32[] * Make Game and Options data saving independent * removed unused functions * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * mark save sections as valid only after they are actually written to SRAM * fix comparison between different integer types * Implement some suggestions from @ricfehr3 * Add extensive documentation on the structure of the savefile * fix doxygen doc generation * fix it again --------- Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
59 lines
1.3 KiB
C
59 lines
1.3 KiB
C
/**
|
|
* @file save.h
|
|
*
|
|
* @brief 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 │
|
|
* └─────────────┘
|
|
* ```
|
|
*
|
|
* 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...
|
|
*
|
|
* @sa SaveHeader, SaveOptions, SaveGame
|
|
*
|
|
* I strongly recommend using `xxd -l 512 -e -g 4 <gbalatro.sav>` to view the contents of the save
|
|
*/
|
|
#ifndef SAVE_H
|
|
#define SAVE_H
|
|
|
|
#include "game_variables.h"
|
|
|
|
#include <tonc.h>
|
|
|
|
/**
|
|
* @brief Save current run data to SRAM.
|
|
*/
|
|
void save_game(void);
|
|
|
|
/**
|
|
* @brief Load previous run data from SRAM.
|
|
*
|
|
* @sa save_game
|
|
*/
|
|
void load_game(void);
|
|
|
|
/**
|
|
* @brief Save options values to SRAM.
|
|
*/
|
|
void save_options(void);
|
|
|
|
/**
|
|
* @brief Load options values from SRAM.
|
|
*
|
|
* @sa save_options
|
|
*/
|
|
void load_options(void);
|
|
|
|
#endif // SAVE_H
|