Save file update (incomplete)

This commit is contained in:
2026-05-10 11:20:09 -05:00
parent d7f515575a
commit a8fd55cb38
42 changed files with 2678 additions and 1 deletions
+68
View File
@@ -0,0 +1,68 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "error/error.h"
#include "save/savefile.h"
#include <gccore.h>
#define SAVE_DOLPHIN_FILE_NAME_MAX 32
#define SAVE_DOLPHIN_SECTOR_SIZE 8192
#ifndef SAVE_DOLPHIN_GAME_CODE
#define SAVE_DOLPHIN_GAME_CODE "DUSK"
#endif
#ifndef SAVE_DOLPHIN_CHANNEL
#define SAVE_DOLPHIN_CHANNEL CARD_SLOTA
#endif
typedef struct {
card_file cardFile;
uint8_t cardBuffer[CARD_WORKAREA] __attribute__((aligned(32)));
bool_t mounted;
} savedolphin_t;
/**
* Initializes the save system on GameCube (memory card slot A by default).
*
* @return An error code if initialization fails.
*/
errorret_t saveInitDolphin(void);
/**
* Disposes of the save system on GameCube.
*
* @return An error code if disposal fails.
*/
errorret_t saveDisposeDolphin(void);
/**
* Loads a save file from the memory card for the given slot.
*
* @param slot The save slot index.
* @param file Output save file data.
* @return An error code if the load fails.
*/
errorret_t saveLoadDolphin(const uint8_t slot, savefile_t *file);
/**
* Writes a save file to the memory card for the given slot.
*
* @param slot The save slot index.
* @param file Save file data to write.
* @return An error code if the write fails.
*/
errorret_t saveWriteDolphin(const uint8_t slot, const savefile_t *file);
/**
* Deletes the save file for the given slot from the memory card.
*
* @param slot The save slot index.
* @return An error code if the delete fails.
*/
errorret_t saveDeleteDolphin(const uint8_t slot);