mirror of
https://github.com/J-D-K/JKSV.git
synced 2026-07-20 01:01:27 -05:00
52 lines
2.1 KiB
C++
52 lines
2.1 KiB
C++
#pragma once
|
|
#include "data/TitleInfo.hpp"
|
|
#include <cstdint>
|
|
#include <switch.h>
|
|
|
|
namespace fs
|
|
{
|
|
/// @brief This is the magic value written to the beginning.
|
|
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.
|
|
uint32_t m_magic;
|
|
/// @brief Application ID.
|
|
uint64_t m_applicationID;
|
|
/// @brief Save data type.
|
|
uint8_t m_saveType;
|
|
/// @brief Save data rank.
|
|
uint8_t m_saveRank;
|
|
/// @brief Save data space id.
|
|
uint8_t m_saveSpaceID;
|
|
/// @brief Base save data size.
|
|
int64_t m_saveDataSize;
|
|
/// @brief Maximum save size "allowed".
|
|
int64_t m_saveDataSizeMax;
|
|
/// @brief Base journaling size.
|
|
int64_t m_journalSize;
|
|
/// @brief Maximum journaling size.
|
|
int64_t m_journalSizeMax;
|
|
/// @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.
|
|
/// @param titleInfo TitleInfo instance to use to create the meta.
|
|
/// @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
|