Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document SaveLoad #38

Merged
merged 1 commit into from
Sep 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
211 changes: 122 additions & 89 deletions src/saveload.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,131 +2,164 @@
#define SAVELOAD_H

/** @defgroup saveload Save and Load
* @brief Functions to use the save and load screen.
* @{
*/

Functions to use the save and load screen
@{
*/

/**Save and Load cancel*/
/** @def OSL_SAVELOAD_CANCEL
* @brief Indicates that the save/load operation was canceled.
*/
#define OSL_SAVELOAD_CANCEL 1
/**Save and Load OK*/

/** @def OSL_SAVELOAD_OK
* @brief Indicates that the save/load operation was successful.
*/
#define OSL_SAVELOAD_OK 0

/**Save dialog*/
/** @def OSL_DIALOG_SAVE
* @brief Indicates a save dialog type.
*/
#define OSL_DIALOG_SAVE 1
/**Load dialog*/

/** @def OSL_DIALOG_LOAD
* @brief Indicates a load dialog type.
*/
#define OSL_DIALOG_LOAD 2
/**Delete dialog*/

/** @def OSL_DIALOG_DELETE
* @brief Indicates a delete dialog type.
*/
#define OSL_DIALOG_DELETE 3
/**Struct containing data to save/load
\param gameTitle[0x80]
Title of the game
\param gameID[13]
Game ID of the game
\param saveName[20]
Save name
\param savedataTitle[0x80]
ParamSfo SaveData Title
\param detail[0x400]
ParamSfo SaveData Detail
\param (*nameList)[20]
List of names for saves data
\param *pic1
Pic1 data
\param size_pic1
Pic1 size
\param *icon0
Icon0 data
\param size_icon0
Icon0 size
\param dialogType
Type of load or save Dialog, example 0 for multi list, 1 single data, 2 automatic
\param *data
Pointer to data to be saved/loaded
\param dataSize
Size of data to be saved/loaded
*/
struct oslSaveLoad{

/** @struct oslSaveLoad
* @brief Structure containing data to save/load.
* @details This structure holds all the necessary data to perform save, load, or delete operations.
*
* @param gameTitle
* Title of the game.
* @param gameID
* Game ID of the game.
* @param saveName
* Name of the save.
* @param savedataTitle
* ParamSfo SaveData Title.
* @param detail
* ParamSfo SaveData Detail.
* @param nameList
* List of names for save data.
* @param pic1
* Pic1 data.
* @param size_pic1
* Size of pic1.
* @param icon0
* Icon0 data.
* @param size_icon0
* Size of icon0.
* @param dialogType
* Type of save/load dialog. Example: 0 for multi-list, 1 for single data, 2 for automatic.
* @param data
* Pointer to data to be saved/loaded.
* @param dataSize
* Size of the data to be saved/loaded.
*/
struct oslSaveLoad {
char gameTitle[0x80];
char gameID[13];
char saveName[20];
char savedataTitle[0x80];
char detail[0x400];
char savedataTitle[0x80];
char detail[0x400];
char (*nameList)[20];
unsigned char *pic1;
unsigned int size_pic1;
unsigned char *icon0;
unsigned int size_icon0;
int dialogType;
int dialogType;
void *data;
int dataSize;
};

/**Initializes the save dialog
\param *saveData
Pointer to a oslSaveLoad structure containing data to be saved
*/
/**
* @brief Initializes the save dialog.
* @param saveData Pointer to a oslSaveLoad structure containing data to be saved.
*/
void oslInitSaveDialog(struct oslSaveLoad *saveData);

/**Initializes the multilist save dialog
\param *saveData
Pointer to a oslSaveLoad structure containing data to be saved
*/
/**
* @brief Initializes the multi-list save dialog.
* @param saveData Pointer to a oslSaveLoad structure containing data to be saved.
*/
void oslInitMultiSaveDialog(struct oslSaveLoad *saveData);

/**Initializes the single save dialog
\param *saveData
Pointer to a oslSaveLoad structure containing data to be saved
*/
/**
* @brief Initializes the single save dialog.
* @param saveData Pointer to a oslSaveLoad structure containing data to be saved.
*/
void oslInitSingleSaveDialog(struct oslSaveLoad *saveData);

/**Initializes the automatic save dialog
\param *saveData
Pointer to a oslSaveLoad structure containing data to be saved
*/
/**
* @brief Initializes the automatic save dialog.
* @param saveData Pointer to a oslSaveLoad structure containing data to be saved.
*/
void oslInitAutoSaveDialog(struct oslSaveLoad *saveData);
/**Initializes the load dialog
\param *loadData
Pointer to a oslSaveLoad structure where data will be loaded
*/

/**
* @brief Initializes the load dialog.
* @param loadData Pointer to a oslSaveLoad structure where data will be loaded.
*/
void oslInitLoadDialog(struct oslSaveLoad *loadData);
/**Initializes the multilist load dialog
\param *loadData
Pointer to a oslSaveLoad structure where data will be loaded
*/

/**
* @brief Initializes the multi-list load dialog.
* @param loadData Pointer to a oslSaveLoad structure where data will be loaded.
*/
void oslInitMultiLoadDialog(struct oslSaveLoad *loadData);
/**Initializes the single load dialog
\param *loadData
Pointer to a oslSaveLoad structure where data will be loaded
*/

/**
* @brief Initializes the single load dialog.
* @param loadData Pointer to a oslSaveLoad structure where data will be loaded.
*/
void oslInitSingleLoadDialog(struct oslSaveLoad *loadData);

/**Initializes the automatic load dialog
\param *loadData
Pointer to a oslSaveLoad structure where data will be loaded
*/
/**
* @brief Initializes the automatic load dialog.
* @param loadData Pointer to a oslSaveLoad structure where data will be loaded.
*/
void oslInitAutoLoadDialog(struct oslSaveLoad *loadData);

/**
* @brief Initializes the delete dialog.
* @param deleteData Pointer to a oslSaveLoad structure where data will be deleted.
*/
void oslInitDeleteDialog(struct oslSaveLoad *deleteData);
/**Draws the save/load dialog
*/
void oslDrawSaveLoad();

/**Returns the current dialog status
*/
int oslGetLoadSaveStatus();
/**
* @brief Draws the save/load dialog.
*/
void oslDrawSaveLoad(void);

/**Returns the current dialog type
*/
int oslGetSaveLoadType();
/**
* @brief Returns the current dialog status.
* @return The status of the current save/load dialog.
*/
int oslGetLoadSaveStatus(void);

/**Gets the dialog's result
*/
int oslSaveLoadGetResult();
/**
* @brief Returns the current dialog type.
* @return The type of the current save/load dialog.
*/
int oslGetSaveLoadType(void);

/**Ends the current dialog
*/
void oslEndSaveLoadDialog();
/**
* @brief Gets the dialog's result.
* @return The result of the save/load operation.
*/
int oslSaveLoadGetResult(void);

/**
* @brief Ends the current dialog.
*/
void oslEndSaveLoadDialog(void);

/** @} */ // end of saveload
#endif

#endif // SAVELOAD_H