Implement processing save data meta files.

This commit is contained in:
J-D-K
2025-06-12 20:46:55 -04:00
parent 8dd16c12bc
commit 71b4c1fbfa
10 changed files with 142 additions and 17 deletions

View File

@@ -6,12 +6,13 @@
namespace fs
{
/// @brief This is the magic value written to the beginning.
constexpr uint64_t SAVE_META_MAGIC = 0x56534B4A;
constexpr uint32_t SAVE_META_MAGIC = 0x56534B4A;
/// @brief This is the filename used for the save data meta info.
static constexpr std::string_view NAME_SAVE_META = ".jksv_save_meta.bin";
/// @brief This struct is for storing the data necessary to restore saves to a different console.
/// @note Some of this data isn't really needed. Just rather be safe than sorry.
typedef struct __attribute__((packed))
{
/// @brief Magic.
@@ -32,8 +33,8 @@ namespace fs
int64_t m_journalSize;
/// @brief Maximum journaling size.
int64_t m_journalSizeMax;
/// @brief Total size of the files in the backup. For ZIP, this is uncompressed.
uint64_t m_totalSaveSize;
/// @brief Total size of the container upon backup.
int64_t m_totalSaveSize;
} SaveMetaData;
/// @brief Didn't feel like a whole new file just for this. Fills an fs::SaveMetaData struct using the passed TitleInfo pointer.
@@ -41,4 +42,10 @@ namespace fs
/// @param info Reference to FsSaveDataInfo struct to use to fill out the meta struct.
/// @param meta Struct to fill.
void create_save_meta_data(data::TitleInfo *titleInfo, const FsSaveDataInfo *saveInfo, SaveMetaData &meta);
/// @brief Processes the save meta data and applies it to the passed saveInfo pointer.
/// @param saveInfo FsSaveDataInfo to apply the meta to.
/// @param meta Save meta data to apply.
bool process_save_meta_data(const FsSaveDataInfo *saveInfo, SaveMetaData &meta);
} // namespace fs