Updating the save mechanism by creating an intermediary SaveData struct (#472)
* 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>
This commit is contained in:
+37
-4
@@ -2,6 +2,27 @@
|
||||
* @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
|
||||
@@ -11,15 +32,27 @@
|
||||
#include <tonc.h>
|
||||
|
||||
/**
|
||||
* @brief Save game data to SRAM.
|
||||
* @brief Save current run data to SRAM.
|
||||
*/
|
||||
void save_game();
|
||||
void save_game(void);
|
||||
|
||||
/**
|
||||
* @brief Load game data from SRAM.
|
||||
* @brief Load previous run data from SRAM.
|
||||
*
|
||||
* @sa save_game
|
||||
*/
|
||||
void load_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
|
||||
|
||||
Reference in New Issue
Block a user