#ifndef __URDE_CMEMORYCARDSYS_HPP__ #define __URDE_CMEMORYCARDSYS_HPP__ #include "CToken.hpp" #include "World/CWorld.hpp" #include "CGameHintInfo.hpp" #include "CSaveWorld.hpp" #include namespace urde { class CDummyWorld; class CStringTable; class CSaveWorldMemory { friend class CMemoryCardSys; ResId x0_strgId = -1; ResId x4_savwId = -1; u32 x8_areaCount; std::vector xc_areaIds; std::vector x1c_defaultLayerStates; TLockedToken x2c_worldName; /* used to be optional */ TLockedToken x3c_saveWorld; /* used to be optional */ public: ResId GetSaveWorldAssetId() const { return x4_savwId; } u32 GetAreaCount() const { return x8_areaCount; } const TLockedToken& GetWorldName() const { return x2c_worldName; } const TLockedToken& GetSaveWorld() const { return x3c_saveWorld; } }; class CSaveWorldIntermediate { friend class CMemoryCardSys; ResId x0_mlvlId; ResId x4_strgId; ResId x8_savwId; std::vector xc_areaIds; std::vector x1c_defaultLayerStates; std::unique_ptr x2c_dummyWorld; TLockedToken x34_saveWorld; /* Used to be auto_ptr */ public: CSaveWorldIntermediate(ResId mlvl, ResId savw); bool InitializePump(); }; class CMemoryCardSys { TLockedToken x0_hints; std::vector> xc_memoryWorlds; /* MLVL as key */ std::experimental::optional> x1c_worldInter; /* used to be auto_ptr of vector */ std::unordered_map x20_scanStates; public: const std::vector& GetHints() const { return x0_hints->GetHints(); } const std::vector>& GetMemoryWorlds() const { return xc_memoryWorlds; } CMemoryCardSys(); bool InitializePump(); enum class EMemoryCardPort { SlotA, SlotB }; enum class ECardResult { CARD_RESULT_FATAL_ERROR = -128, CARD_RESULT_ENCODING = -13, CARD_RESULT_BROKEN = -6, CARD_RESULT_IOERROR = -5, CARD_RESULT_NOCARD = -3, CARD_RESULT_WRONGDEVICE = -2, CARD_RESULT_BUSY = -1, CARD_RESULT_READY = 0 }; struct CardProbeResults { ECardResult x0_error; u32 x4_cardSize; // in megabits u32 x8_sectorSize; // in bytes }; static CardProbeResults CardProbe(EMemoryCardPort port); static ECardResult MountCard(EMemoryCardPort port); static ECardResult CheckCard(EMemoryCardPort port); static ECardResult GetNumFreeBytes(EMemoryCardPort port, s32& freeBytes, s32& freeFiles); static ECardResult GetSerialNo(EMemoryCardPort port, u64& serialOut); }; } #endif // __URDE_CMEMORYCARDSYS_HPP__