mirror of https://github.com/PrimeDecomp/prime.git
Add CMemoryCardDriver
This commit is contained in:
parent
fbfdc6cd09
commit
e7e54730a3
|
@ -0,0 +1,109 @@
|
||||||
|
#ifndef _CMEMORYCARDDRIVER
|
||||||
|
#define _CMEMORYCARDDRIVER
|
||||||
|
|
||||||
|
#include "MetroidPrime/Player/CGameState.hpp"
|
||||||
|
|
||||||
|
class CMemoryCardDriver {
|
||||||
|
public:
|
||||||
|
enum EState {
|
||||||
|
kS_Initial = 0,
|
||||||
|
kS_Ready = 1,
|
||||||
|
kS_NoCard = 2,
|
||||||
|
kS_DriverClosed = 3,
|
||||||
|
kS_CardFormatted = 4,
|
||||||
|
kS_CardProbeDone = 5,
|
||||||
|
kS_CardMountDone = 6,
|
||||||
|
kS_CardCheckDone = 7,
|
||||||
|
kS_FileCreateDone = 8,
|
||||||
|
kS_FileCreateTransactionalDone = 9,
|
||||||
|
kS_FileWriteTransactionalDone = 10,
|
||||||
|
kS_FileDeleteAltTransactionalDone = 11,
|
||||||
|
kS_CardProbeFailed = 12,
|
||||||
|
kS_CardMountFailed = 13,
|
||||||
|
kS_CardCheckFailed = 14,
|
||||||
|
kS_FileDeleteBadFailed = 15,
|
||||||
|
kS_FileDeleteAltFailed = 16,
|
||||||
|
kS_FileBad = 17,
|
||||||
|
kS_FileCreateFailed = 18,
|
||||||
|
kS_FileWriteFailed = 19,
|
||||||
|
kS_FileCreateTransactionalFailed = 20,
|
||||||
|
kS_FileWriteTransactionalFailed = 21,
|
||||||
|
kS_FileDeleteAltTransactionalFailed = 22,
|
||||||
|
kS_FileRenameBtoAFailed = 23,
|
||||||
|
kS_CardFormatFailed = 24,
|
||||||
|
kS_CardProbe = 25,
|
||||||
|
kS_CardMount = 26,
|
||||||
|
kS_CardCheck = 27,
|
||||||
|
kS_FileDeleteBad = 28,
|
||||||
|
kS_FileRead = 29,
|
||||||
|
kS_FileDeleteAlt = 30,
|
||||||
|
kS_FileCreate = 31,
|
||||||
|
kS_FileWrite = 32,
|
||||||
|
kS_FileCreateTransactional = 33,
|
||||||
|
kS_FileWriteTransactional = 34,
|
||||||
|
kS_FileDeleteAltTransactional = 35,
|
||||||
|
kS_FileRenameBtoA = 36,
|
||||||
|
kS_CardFormat = 37
|
||||||
|
};
|
||||||
|
|
||||||
|
enum EError {
|
||||||
|
kE_OK,
|
||||||
|
kE_CardBroken,
|
||||||
|
kE_CardWrongCharacterSet,
|
||||||
|
kE_CardIOError,
|
||||||
|
kE_CardWrongDevice,
|
||||||
|
kE_CardFull,
|
||||||
|
kE_CardStillFull, /* After attempting alt-delete (if needed) */
|
||||||
|
kE_CardNon8KSectors,
|
||||||
|
kE_FileMissing,
|
||||||
|
kE_FileCorrupted
|
||||||
|
};
|
||||||
|
|
||||||
|
static bool IsCardBusy(EState);
|
||||||
|
static bool IsCardWriting(EState);
|
||||||
|
CMemoryCardDriver();
|
||||||
|
void ClearFileInfo();
|
||||||
|
~CMemoryCardDriver();
|
||||||
|
void Update();
|
||||||
|
void HandleCardError(int);
|
||||||
|
void UpdateMountCard(int);
|
||||||
|
void UpdateCardCheck();
|
||||||
|
void UpdateFileRead();
|
||||||
|
void UpdateFileDeleteAlt();
|
||||||
|
void UpdateFileDeleteBad();
|
||||||
|
void UpdateFileCreate();
|
||||||
|
void UpdateFileWrite();
|
||||||
|
void UpdateFileCreateTransactional();
|
||||||
|
void UpdateFileWriteTransactional();
|
||||||
|
void UpdateFileRenameBtoA();
|
||||||
|
void StartFileRenameBtoA();
|
||||||
|
void WriteBackupBuf();
|
||||||
|
void UpdateFileAltDeleteTransactional();
|
||||||
|
void UpdateCardFormat();
|
||||||
|
void StartCardProbe();
|
||||||
|
void UpdateCardProbe();
|
||||||
|
void StartMountCard();
|
||||||
|
void StartCardCheck();
|
||||||
|
void ClearError();
|
||||||
|
void CheckCardCapacity();
|
||||||
|
void NoCardFound();
|
||||||
|
void IndexFiles();
|
||||||
|
void StartFileDeleteBad();
|
||||||
|
void StartFileCreate();
|
||||||
|
void StartFileWrite();
|
||||||
|
void StartFileCreateTransactional();
|
||||||
|
void StartFileWriteTransactional();
|
||||||
|
void StartFileDeleteAltTransactional();
|
||||||
|
void StartCardFormat();
|
||||||
|
void InitializeFileInfo();
|
||||||
|
void ReadFinished();
|
||||||
|
void EraseFileSlot(int);
|
||||||
|
void BuildNewFileSlot(int);
|
||||||
|
void BuildExistingFileSlot(int);
|
||||||
|
void ImportPersistentOptions();
|
||||||
|
void ExportPersistentOptions();
|
||||||
|
const CGameState::GameFileStateInfo* GetGameFileStateInfo(int);
|
||||||
|
bool GetCardFreeBytes();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _CMEMORYCARDDRIVER
|
|
@ -7,6 +7,7 @@
|
||||||
#include "rstl/reserved_vector.hpp"
|
#include "rstl/reserved_vector.hpp"
|
||||||
#include "rstl/vector.hpp"
|
#include "rstl/vector.hpp"
|
||||||
|
|
||||||
|
#include "Kyoto/SObjectTag.hpp"
|
||||||
#include "Kyoto/Streams/CInputStream.hpp"
|
#include "Kyoto/Streams/CInputStream.hpp"
|
||||||
#include "MetroidPrime/TGameTypes.hpp"
|
#include "MetroidPrime/TGameTypes.hpp"
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,18 @@ public:
|
||||||
u64& CardSerial() { return x210_cardSerial; }
|
u64& CardSerial() { return x210_cardSerial; }
|
||||||
rstl::vector< uchar >& BackupBuf() { return x218_backupBuf; }
|
rstl::vector< uchar >& BackupBuf() { return x218_backupBuf; }
|
||||||
|
|
||||||
|
struct GameFileStateInfo {
|
||||||
|
double x0_playTime;
|
||||||
|
CAssetId x8_mlvlId;
|
||||||
|
float xc_health;
|
||||||
|
uint x10_energyTanks;
|
||||||
|
uint x14_timestamp;
|
||||||
|
uint x18_itemPercent;
|
||||||
|
float x1c_scanPercent;
|
||||||
|
bool x20_hardMode;
|
||||||
|
};
|
||||||
|
static GameFileStateInfo LoadGameFileState(const uchar* data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
rstl::reserved_vector< bool, 128 > x0_;
|
rstl::reserved_vector< bool, 128 > x0_;
|
||||||
CAssetId x84_mlvlId;
|
CAssetId x84_mlvlId;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
#include "rstl/vector.hpp"
|
#include "rstl/vector.hpp"
|
||||||
|
#include "rstl/string.hpp"
|
||||||
|
|
||||||
enum EHintState { kHS_Zero, kHS_Waiting, kHS_Displaying, kHS_Delayed };
|
enum EHintState { kHS_Zero, kHS_Waiting, kHS_Displaying, kHS_Delayed };
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
#include "MetroidPrime/CMemoryCardDriver.hpp"
|
||||||
|
|
||||||
|
bool CMemoryCardDriver::IsCardBusy(EState) { return false; }
|
||||||
|
|
||||||
|
bool CMemoryCardDriver::IsCardWriting(EState) { return false; }
|
||||||
|
|
||||||
|
CMemoryCardDriver::CMemoryCardDriver() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::ClearFileInfo() {}
|
||||||
|
|
||||||
|
CMemoryCardDriver::~CMemoryCardDriver() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::Update() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::HandleCardError(int) {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::UpdateMountCard(int) {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::UpdateCardCheck() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::UpdateFileRead() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::UpdateFileDeleteAlt() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::UpdateFileDeleteBad() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::UpdateFileCreate() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::UpdateFileWrite() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::UpdateFileCreateTransactional() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::UpdateFileWriteTransactional() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::UpdateFileRenameBtoA() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::StartFileRenameBtoA() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::WriteBackupBuf() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::UpdateFileAltDeleteTransactional() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::UpdateCardFormat() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::StartCardProbe() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::UpdateCardProbe() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::StartMountCard() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::StartCardCheck() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::ClearError() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::CheckCardCapacity() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::NoCardFound() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::IndexFiles() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::StartFileDeleteBad() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::StartFileCreate() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::StartFileWrite() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::StartFileCreateTransactional() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::StartFileWriteTransactional() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::StartFileDeleteAltTransactional() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::StartCardFormat() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::InitializeFileInfo() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::ReadFinished() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::EraseFileSlot(int) {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::BuildNewFileSlot(int) {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::BuildExistingFileSlot(int) {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::ImportPersistentOptions() {}
|
||||||
|
|
||||||
|
void CMemoryCardDriver::ExportPersistentOptions() {}
|
||||||
|
|
||||||
|
const CGameState::GameFileStateInfo* CMemoryCardDriver::GetGameFileStateInfo(int) {
|
||||||
|
return nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
bool CMemoryCardDriver::GetCardFreeBytes() { return false; }
|
Loading…
Reference in New Issue