Finishing touches to CMemoryCardDriver

This commit is contained in:
Jack Andersen 2016-12-23 19:23:50 -10:00
parent a7d2e62846
commit 5e2f2e3af8
7 changed files with 581 additions and 567 deletions

View File

@ -242,28 +242,28 @@ void CMemoryCardSys::CCardFileInfo::WriteIconData(CMemoryOutStream& out) const
CMemoryCardSys::ECardResult CMemoryCardSys::CCardFileInfo::PumpCardTransfer() CMemoryCardSys::ECardResult CMemoryCardSys::CCardFileInfo::PumpCardTransfer()
{ {
if (x0_status == EStatus::Standby) if (x0_status == EStatus::Standby)
return ECardResult::CARD_RESULT_READY; return ECardResult::READY;
else if (x0_status == EStatus::Transferring) else if (x0_status == EStatus::Transferring)
{ {
ECardResult result = CMemoryCardSys::GetResultCode(GetCardPort()); ECardResult result = CMemoryCardSys::GetResultCode(GetCardPort());
if (result != ECardResult::CARD_RESULT_BUSY) if (result != ECardResult::BUSY)
x104_cardBuffer.clear(); x104_cardBuffer.clear();
if (result != ECardResult::CARD_RESULT_READY) if (result != ECardResult::READY)
return result; return result;
x0_status = EStatus::Done; x0_status = EStatus::Done;
CARDStat stat = {}; CARDStat stat = {};
result = GetStatus(stat); result = GetStatus(stat);
if (result != ECardResult::CARD_RESULT_READY) if (result != ECardResult::READY)
return result; return result;
result = CMemoryCardSys::SetStatus(GetCardPort(), GetFileNo(), stat); result = CMemoryCardSys::SetStatus(GetCardPort(), GetFileNo(), stat);
if (result != ECardResult::CARD_RESULT_READY) if (result != ECardResult::READY)
return result; return result;
return ECardResult::CARD_RESULT_BUSY; return ECardResult::BUSY;
} }
else else
{ {
ECardResult result = CMemoryCardSys::GetResultCode(GetCardPort()); ECardResult result = CMemoryCardSys::GetResultCode(GetCardPort());
if (result == ECardResult::CARD_RESULT_READY) if (result == ECardResult::READY)
x0_status = EStatus::Standby; x0_status = EStatus::Standby;
return result; return result;
} }
@ -272,7 +272,7 @@ CMemoryCardSys::ECardResult CMemoryCardSys::CCardFileInfo::PumpCardTransfer()
CMemoryCardSys::ECardResult CMemoryCardSys::CCardFileInfo::GetStatus(CARDStat& stat) const CMemoryCardSys::ECardResult CMemoryCardSys::CCardFileInfo::GetStatus(CARDStat& stat) const
{ {
ECardResult result = CMemoryCardSys::GetStatus(GetCardPort(), GetFileNo(), stat); ECardResult result = CMemoryCardSys::GetStatus(GetCardPort(), GetFileNo(), stat);
if (result != ECardResult::CARD_RESULT_READY) if (result != ECardResult::READY)
return result; return result;
stat.SetCommentAddr(4); stat.SetCommentAddr(4);
@ -303,12 +303,12 @@ CMemoryCardSys::ECardResult CMemoryCardSys::CCardFileInfo::GetStatus(CARDStat& s
stat.SetIconSpeed(0, idx); stat.SetIconSpeed(0, idx);
} }
return ECardResult::CARD_RESULT_READY; return ECardResult::READY;
} }
CMemoryCardSys::ECardResult CMemoryCardSys::CCardFileInfo::CreateFile() CMemoryCardSys::ECardResult CMemoryCardSys::CCardFileInfo::CreateFile()
{ {
return ECardResult::CARD_RESULT_READY; return ECardResult::READY;
} }
CMemoryCardSys::ECardResult CMemoryCardSys::CCardFileInfo::Write() CMemoryCardSys::ECardResult CMemoryCardSys::CCardFileInfo::Write()
@ -316,7 +316,7 @@ CMemoryCardSys::ECardResult CMemoryCardSys::CCardFileInfo::Write()
BuildCardBuffer(); BuildCardBuffer();
//DCStoreRange(info.x104_cardBuffer.data(), info.x104_cardBuffer.size()); //DCStoreRange(info.x104_cardBuffer.data(), info.x104_cardBuffer.size());
//CARDWriteAsync(&info.x4_info, info.x104_cardBuffer.data(), info.x104_cardBuffer.size(), 0, 0); //CARDWriteAsync(&info.x4_info, info.x104_cardBuffer.data(), info.x104_cardBuffer.size(), 0, 0);
return ECardResult::CARD_RESULT_READY; return ECardResult::READY;
} }
CMemoryCardSys::ECardResult CMemoryCardSys::CCardFileInfo::Close() CMemoryCardSys::ECardResult CMemoryCardSys::CCardFileInfo::Close()
@ -324,7 +324,7 @@ CMemoryCardSys::ECardResult CMemoryCardSys::CCardFileInfo::Close()
EMemoryCardPort port = GetCardPort(); EMemoryCardPort port = GetCardPort();
//CARDClose(port); //CARDClose(port);
x4_info.chan = port; x4_info.chan = port;
return ECardResult::CARD_RESULT_READY; return ECardResult::READY;
} }
CMemoryCardSys::CardProbeResults CMemoryCardSys::CardProbe(EMemoryCardPort port) CMemoryCardSys::CardProbeResults CMemoryCardSys::CardProbe(EMemoryCardPort port)
@ -334,57 +334,57 @@ CMemoryCardSys::CardProbeResults CMemoryCardSys::CardProbe(EMemoryCardPort port)
CMemoryCardSys::ECardResult CMemoryCardSys::MountCard(EMemoryCardPort port) CMemoryCardSys::ECardResult CMemoryCardSys::MountCard(EMemoryCardPort port)
{ {
return ECardResult::CARD_RESULT_READY; return ECardResult::READY;
} }
CMemoryCardSys::ECardResult CMemoryCardSys::CheckCard(EMemoryCardPort port) CMemoryCardSys::ECardResult CMemoryCardSys::CheckCard(EMemoryCardPort port)
{ {
return ECardResult::CARD_RESULT_READY; return ECardResult::READY;
} }
CMemoryCardSys::ECardResult CMemoryCardSys::GetNumFreeBytes(EMemoryCardPort port, s32& freeBytes, s32& freeFiles) CMemoryCardSys::ECardResult CMemoryCardSys::GetNumFreeBytes(EMemoryCardPort port, s32& freeBytes, s32& freeFiles)
{ {
return ECardResult::CARD_RESULT_READY; return ECardResult::READY;
} }
CMemoryCardSys::ECardResult CMemoryCardSys::GetSerialNo(EMemoryCardPort port, u64& serialOut) CMemoryCardSys::ECardResult CMemoryCardSys::GetSerialNo(EMemoryCardPort port, u64& serialOut)
{ {
return ECardResult::CARD_RESULT_READY; return ECardResult::READY;
} }
CMemoryCardSys::ECardResult CMemoryCardSys::GetResultCode(EMemoryCardPort port) CMemoryCardSys::ECardResult CMemoryCardSys::GetResultCode(EMemoryCardPort port)
{ {
return ECardResult::CARD_RESULT_READY; return ECardResult::READY;
} }
CMemoryCardSys::ECardResult CMemoryCardSys::GetStatus(EMemoryCardPort port, int fileNo, CARDStat& statOut) CMemoryCardSys::ECardResult CMemoryCardSys::GetStatus(EMemoryCardPort port, int fileNo, CARDStat& statOut)
{ {
return ECardResult::CARD_RESULT_READY; return ECardResult::READY;
} }
CMemoryCardSys::ECardResult CMemoryCardSys::SetStatus(EMemoryCardPort port, int fileNo, const CARDStat& stat) CMemoryCardSys::ECardResult CMemoryCardSys::SetStatus(EMemoryCardPort port, int fileNo, const CARDStat& stat)
{ {
return ECardResult::CARD_RESULT_READY; return ECardResult::READY;
} }
CMemoryCardSys::ECardResult CMemoryCardSys::DeleteFile(EMemoryCardPort port, const char* name) CMemoryCardSys::ECardResult CMemoryCardSys::DeleteFile(EMemoryCardPort port, const char* name)
{ {
return ECardResult::CARD_RESULT_READY; return ECardResult::READY;
} }
CMemoryCardSys::ECardResult CMemoryCardSys::FastDeleteFile(EMemoryCardPort port, int fileNo) CMemoryCardSys::ECardResult CMemoryCardSys::FastDeleteFile(EMemoryCardPort port, int fileNo)
{ {
return ECardResult::CARD_RESULT_READY; return ECardResult::READY;
} }
CMemoryCardSys::ECardResult CMemoryCardSys::Rename(EMemoryCardPort port, const char* oldName, const char* newName) CMemoryCardSys::ECardResult CMemoryCardSys::Rename(EMemoryCardPort port, const char* oldName, const char* newName)
{ {
return ECardResult::CARD_RESULT_READY; return ECardResult::READY;
} }
CMemoryCardSys::ECardResult CMemoryCardSys::FormatCard(EMemoryCardPort port) CMemoryCardSys::ECardResult CMemoryCardSys::FormatCard(EMemoryCardPort port)
{ {
return ECardResult::CARD_RESULT_READY; return ECardResult::READY;
} }
} }

View File

@ -8,6 +8,8 @@
#include "GuiSys/CStringTable.hpp" #include "GuiSys/CStringTable.hpp"
#include <vector> #include <vector>
#undef NOFILE
// longest file name string excluding terminating zero // longest file name string excluding terminating zero
#define CARD_FILENAME_MAX 32 #define CARD_FILENAME_MAX 32
@ -76,16 +78,16 @@ public:
enum class ECardResult enum class ECardResult
{ {
CARD_RESULT_CRC_MISMATCH = -1003, CRC_MISMATCH = -1003,
CARD_RESULT_FATAL_ERROR = -128, FATAL_ERROR = -128,
CARD_RESULT_ENCODING = -13, ENCODING = -13,
CARD_RESULT_BROKEN = -6, BROKEN = -6,
CARD_RESULT_IOERROR = -5, IOERROR = -5,
CARD_RESULT_NOFILE = -4, NOFILE = -4,
CARD_RESULT_NOCARD = -3, NOCARD = -3,
CARD_RESULT_WRONGDEVICE = -2, WRONGDEVICE = -2,
CARD_RESULT_BUSY = -1, BUSY = -1,
CARD_RESULT_READY = 0 READY = 0
}; };
struct CardProbeResults struct CardProbeResults

File diff suppressed because it is too large Load Diff

View File

@ -15,58 +15,58 @@ class CMemoryCardDriver
public: public:
enum class EState enum class EState
{ {
Initial, Initial = 0,
Ready = 1, Ready = 1,
NoCard = 2, NoCard = 2,
RuntimeBackup = 3, DriverClosed = 3,
CardFormatted = 4, CardFormatted = 4,
CardNeedsMount = 5, CardProbeDone = 5,
CardMountDone = 6, CardMountDone = 6,
SelectCardFile = 7, CardCheckDone = 7,
WillWrite = 8, FileCreateDone = 8,
Nine = 9, FileCreateTransactionalDone = 9,
Ten = 10, FileWriteTransactionalDone = 10,
Eleven = 11, FileDeleteAltTransactionalDone = 11,
Twelve = 12, CardProbeFailed = 12,
Thirteen = 13, CardMountFailed = 13,
Fourteen = 14, CardCheckFailed = 14,
Fifteen = 15, FileDeleteBadFailed = 15,
Sixteen = 16, FileDeleteAltFailed = 16,
Seventeen = 17, FileBad = 17,
Eighteen = 18, FileCreateFailed = 18,
Nineteen = 19, FileWriteFailed = 19,
Twenty = 20, FileCreateTransactionalFailed = 20,
TwentyOne = 21, FileWriteTransactionalFailed = 21,
TwentyTwo = 22, FileDeleteAltTransactionalFailed = 22,
TwentyThree = 23, FileRenameBtoAFailed = 23,
CardFormatBroken = 24, CardFormatFailed = 24,
TwentyFive = 25, CardProbe = 25,
CardMount = 26, CardMount = 26,
TwentySeven = 27, CardCheck = 27,
TwentyEight = 28, FileDeleteBad = 28,
TwentyNine = 29, FileRead = 29,
Thirty = 30, FileDeleteAlt = 30,
ThirtyOne = 31, FileCreate = 31,
ThirtyTwo = 32, FileWrite = 32,
FileBuild = 33, FileCreateTransactional = 33,
FileWrite = 34, FileWriteTransactional = 34,
ThirtyFive = 35, FileDeleteAltTransactional = 35,
FileRename = 36, FileRenameBtoA = 36,
CardFormat = 37 CardFormat = 37
}; };
enum class EError enum class EError
{ {
Zero, OK,
One, CardBroken,
Two, CardWrongCharacterSet,
Three, CardIOError,
Four, CardWrongDevice,
Five, CardFull,
Six, CardStillFull, /* After attempting alt-delete (if needed) */
Seven, CardNon8KSectors,
Eight, FileMissing,
Nine FileCorrupted
}; };
private: private:
@ -121,20 +121,27 @@ private:
} }
}; };
enum class EFileState
{
Unknown,
NoFile,
File,
BadFile
};
CMemoryCardSys::EMemoryCardPort x0_cardPort; CMemoryCardSys::EMemoryCardPort x0_cardPort;
ResId x4_saveBanner; ResId x4_saveBanner;
ResId x8_saveIcon0; ResId x8_saveIcon0;
ResId xc_saveIcon1; ResId xc_saveIcon1;
EState x10_state = EState::Initial; EState x10_state = EState::Initial;
EError x14_error = EError::Zero; EError x14_error = EError::OK;
s32 x18_cardFreeBytes = 0; s32 x18_cardFreeBytes = 0;
s32 x1c_cardFreeFiles = 0; s32 x1c_cardFreeFiles = 0;
u32 x20_fileTime = 0; u32 x20_fileTime = 0;
u32 x24_ = 0;
u64 x28_cardSerial = 0; u64 x28_cardSerial = 0;
u8 x30_systemData[174] = {}; u8 x30_systemData[174] = {};
std::unique_ptr<SGameFileSlot> xe4_fileSlots[3]; std::unique_ptr<SGameFileSlot> xe4_fileSlots[3];
std::vector<std::pair<u32, SFileInfo>> x100_mcFileInfos; std::vector<std::pair<EFileState, SFileInfo>> x100_mcFileInfos;
u32 x194_fileIdx = -1; u32 x194_fileIdx = -1;
std::unique_ptr<CMemoryCardSys::CCardFileInfo> x198_fileInfo; std::unique_ptr<CMemoryCardSys::CCardFileInfo> x198_fileInfo;
bool x19c_ = false; bool x19c_ = false;
@ -143,44 +150,44 @@ private:
public: public:
CMemoryCardDriver(CMemoryCardSys::EMemoryCardPort cardPort, ResId saveBanner, CMemoryCardDriver(CMemoryCardSys::EMemoryCardPort cardPort, ResId saveBanner,
ResId saveIcon0, ResId saveIcon1, bool importPersistent); ResId saveIcon0, ResId saveIcon1, bool importPersistent);
void FinishedLoading();
void FinishedLoading2();
void NoCardFound();
void MountCard();
void CheckCard();
void NoCardFound();
CGameState::GameFileStateInfo* GetGameFileStateInfo(int idx); CGameState::GameFileStateInfo* GetGameFileStateInfo(int idx);
static SSaveHeader LoadSaveHeader(CMemoryInStream& in); static SSaveHeader LoadSaveHeader(CMemoryInStream& in);
static std::unique_ptr<SGameFileSlot> LoadSaveFile(CMemoryInStream& in); static std::unique_ptr<SGameFileSlot> LoadSaveFile(CMemoryInStream& in);
void ReadFinished(); void ReadFinished();
void ImportPersistentOptions(); void ImportPersistentOptions();
void ExportPersistentOptions(); void ExportPersistentOptions();
void DeleteFile();
void CheckCardCapacity(); void CheckCardCapacity();
void IndexFiles();
void Case26(CMemoryCardSys::ECardResult result); void StartCardProbe(); // 25
void Case27(CMemoryCardSys::ECardResult result); void StartMountCard(); // 26
void Case28(CMemoryCardSys::ECardResult result); void StartCardCheck(); // 27
void Case29(CMemoryCardSys::ECardResult result); void StartFileDeleteBad(); // 28
void Case30(CMemoryCardSys::ECardResult result); void StartFileRead(); // 29
void Case31(CMemoryCardSys::ECardResult result); void StartFileDeleteAlt(); // 30
void Case32(CMemoryCardSys::ECardResult result); void StartFileCreate(); // 31
void Case33(CMemoryCardSys::ECardResult result); void StartFileWrite(); // 32
void Case34(CMemoryCardSys::ECardResult result); void StartFileCreateTransactional(); // 33
void Case35(CMemoryCardSys::ECardResult result); void StartFileWriteTransactional(); // 34
void Case36(CMemoryCardSys::ECardResult result); void StartFileDeleteAltTransactional(); // 35
void Case37(CMemoryCardSys::ECardResult result); void StartFileRenameBtoA(); // 36
void StartCardFormat(); // 37
void GoTo17(); void UpdateCardProbe(); // 25
void GoTo28(); void UpdateMountCard(CMemoryCardSys::ECardResult result); // 26
void GoTo29(); void UpdateCardCheck(CMemoryCardSys::ECardResult result); // 27
void GoTo31(); void UpdateFileDeleteBad(CMemoryCardSys::ECardResult result); // 28
void GoTo32(); void UpdateFileRead(CMemoryCardSys::ECardResult result); // 29
void GoTo33(); void UpdateFileDeleteAlt(CMemoryCardSys::ECardResult result); // 30
void GoTo34(); void UpdateFileCreate(CMemoryCardSys::ECardResult result); // 31
void GoTo35(); void UpdateFileWrite(CMemoryCardSys::ECardResult result); // 32
void GoTo36(); void UpdateFileCreateTransactional(CMemoryCardSys::ECardResult result); // 33
void GoTo37(); void UpdateFileWriteTransactional(CMemoryCardSys::ECardResult result); // 34
void UpdateFileDeleteAltTransactional(CMemoryCardSys::ECardResult result); // 35
void UpdateFileRenameBtoA(CMemoryCardSys::ECardResult result); // 36
void UpdateCardFormat(CMemoryCardSys::ECardResult result); // 37
void ClearFileInfo() { x198_fileInfo.reset(); } void ClearFileInfo() { x198_fileInfo.reset(); }
void InitializeFileInfo(); void InitializeFileInfo();
@ -189,18 +196,18 @@ public:
void HandleCardError(CMemoryCardSys::ECardResult result, EState state); void HandleCardError(CMemoryCardSys::ECardResult result, EState state);
void Update(); void Update();
static bool InCardInsertedRange(EState v) static bool IsCardBusy(EState v)
{ {
return v >= EState::CardMount && v <= EState::CardFormat; return v >= EState::CardMount && v <= EState::CardFormat;
} }
static bool InRange2(EState v) static bool IsOperationDestructive(EState v)
{ {
if (v < EState::TwentyFive) if (v < EState::CardProbe)
return false; return false;
if (v == EState::TwentySeven) if (v == EState::CardCheck)
return false; return false;
if (v == EState::TwentyNine) if (v == EState::FileRead)
return false; return false;
return true; return true;
} }

View File

@ -18,9 +18,9 @@ void CSaveUI::ResetCardDriver()
{ {
x92_ = false; x92_ = false;
x6c_cardDriver.reset(); x6c_cardDriver.reset();
bool flag = (x0_instIdx == 0 && !x90_needsDriverReset); bool importState = (x0_instIdx == 0 && !x90_needsDriverReset);
x6c_cardDriver = ConstructCardDriver(flag); x6c_cardDriver = ConstructCardDriver(importState);
x6c_cardDriver->FinishedLoading(); x6c_cardDriver->StartCardProbe();
x10_uiType = UIType::Zero; x10_uiType = UIType::Zero;
FinishedLoading(); FinishedLoading();
} }
@ -33,7 +33,7 @@ CIOWin::EMessageReturn CSaveUI::Update(float dt)
x50_loadedFrame->Update(dt); x50_loadedFrame->Update(dt);
x6c_cardDriver->Update(); x6c_cardDriver->Update();
if (x6c_cardDriver->x10_state == EState::RuntimeBackup) if (x6c_cardDriver->x10_state == EState::DriverClosed)
{ {
if (x90_needsDriverReset) if (x90_needsDriverReset)
{ {
@ -43,7 +43,7 @@ CIOWin::EMessageReturn CSaveUI::Update(float dt)
else else
x80_iowRet = CIOWin::EMessageReturn::Exit; x80_iowRet = CIOWin::EMessageReturn::Exit;
} }
else if (x6c_cardDriver->x10_state == EState::SelectCardFile && x10_uiType != UIType::Fourteen) else if (x6c_cardDriver->x10_state == EState::CardCheckDone && x10_uiType != UIType::Fourteen)
{ {
if (x6c_cardDriver->x28_cardSerial && x8_serial) if (x6c_cardDriver->x28_cardSerial && x8_serial)
{ {
@ -55,14 +55,14 @@ CIOWin::EMessageReturn CSaveUI::Update(float dt)
else else
{ {
x8_serial = x6c_cardDriver->x28_cardSerial; x8_serial = x6c_cardDriver->x28_cardSerial;
x6c_cardDriver->GoTo17(); x6c_cardDriver->IndexFiles();
} }
} }
} }
else if (x6c_cardDriver->x10_state == EState::Ready) else if (x6c_cardDriver->x10_state == EState::Ready)
{ {
if (x90_needsDriverReset) if (x90_needsDriverReset)
x6c_cardDriver->GoTo33(); x6c_cardDriver->StartFileCreateTransactional();
} }
if (x80_iowRet != CIOWin::EMessageReturn::Normal) if (x80_iowRet != CIOWin::EMessageReturn::Normal)
@ -76,18 +76,18 @@ CIOWin::EMessageReturn CSaveUI::Update(float dt)
if (x6c_cardDriver->x10_state == EState::NoCard) if (x6c_cardDriver->x10_state == EState::NoCard)
{ {
auto res = CMemoryCardSys::CardProbe(CMemoryCardSys::EMemoryCardPort::SlotA); auto res = CMemoryCardSys::CardProbe(CMemoryCardSys::EMemoryCardPort::SlotA);
if (res.x0_error == CMemoryCardSys::ECardResult::CARD_RESULT_READY || if (res.x0_error == CMemoryCardSys::ECardResult::READY ||
res.x0_error == CMemoryCardSys::ECardResult::CARD_RESULT_WRONGDEVICE) res.x0_error == CMemoryCardSys::ECardResult::WRONGDEVICE)
ResetCardDriver(); ResetCardDriver();
} }
else if (x6c_cardDriver->x10_state == EState::CardFormatted) else if (x6c_cardDriver->x10_state == EState::CardFormatted)
{ {
ResetCardDriver(); ResetCardDriver();
} }
else if (x6c_cardDriver->x10_state == EState::Seventeen && else if (x6c_cardDriver->x10_state == EState::FileBad &&
x6c_cardDriver->x14_error == EError::Eight) x6c_cardDriver->x14_error == EError::FileMissing)
{ {
x6c_cardDriver->GoTo31(); x6c_cardDriver->StartFileCreate();
} }
return CIOWin::EMessageReturn::Normal; return CIOWin::EMessageReturn::Normal;
@ -125,7 +125,7 @@ bool CSaveUI::PumpLoad()
std::bind(&CSaveUI::DoSelectionChange, this, std::placeholders::_1)); std::bind(&CSaveUI::DoSelectionChange, this, std::placeholders::_1));
if (x0_instIdx == 1) if (x0_instIdx == 1)
x6c_cardDriver->FinishedLoading(); x6c_cardDriver->StartCardProbe();
x10_uiType = SelectUIType(); x10_uiType = SelectUIType();
FinishedLoading(); FinishedLoading();
@ -146,43 +146,43 @@ CSaveUI::UIType CSaveUI::SelectUIType() const
default: break; default: break;
} }
if (CMemoryCardDriver::InCardInsertedRange(x6c_cardDriver->x10_state)) if (CMemoryCardDriver::IsCardBusy(x6c_cardDriver->x10_state))
{ {
if (!CMemoryCardDriver::InRange2(x6c_cardDriver->x10_state)) if (!CMemoryCardDriver::IsOperationDestructive(x6c_cardDriver->x10_state))
return UIType::Two; return UIType::Two;
return UIType::One; return UIType::One;
} }
if (x6c_cardDriver->x10_state == EState::Ready) if (x6c_cardDriver->x10_state == EState::Ready)
{ {
if (x6c_cardDriver->x14_error == CMemoryCardDriver::EError::Six) if (x6c_cardDriver->x14_error == CMemoryCardDriver::EError::CardStillFull)
return UIType::Twelve; return UIType::Twelve;
return UIType::Sixteen; return UIType::Sixteen;
} }
if (x6c_cardDriver->x14_error == CMemoryCardDriver::EError::One) if (x6c_cardDriver->x14_error == CMemoryCardDriver::EError::CardBroken)
return UIType::Four; return UIType::Four;
if (x6c_cardDriver->x14_error == CMemoryCardDriver::EError::Two) if (x6c_cardDriver->x14_error == CMemoryCardDriver::EError::CardWrongCharacterSet)
return UIType::Five; return UIType::Five;
if (x6c_cardDriver->x14_error == CMemoryCardDriver::EError::Four) if (x6c_cardDriver->x14_error == CMemoryCardDriver::EError::CardWrongDevice)
return UIType::Seven; return UIType::Seven;
if (x6c_cardDriver->x14_error == CMemoryCardDriver::EError::Five) if (x6c_cardDriver->x14_error == CMemoryCardDriver::EError::CardFull)
{ {
if (x6c_cardDriver->x10_state == EState::Fourteen) if (x6c_cardDriver->x10_state == EState::CardCheckFailed)
return UIType::Eight; return UIType::Eight;
return UIType::Nine; return UIType::Nine;
} }
if (x6c_cardDriver->x14_error == CMemoryCardDriver::EError::Seven) if (x6c_cardDriver->x14_error == CMemoryCardDriver::EError::CardNon8KSectors)
return UIType::Ten; return UIType::Ten;
if (x6c_cardDriver->x14_error == CMemoryCardDriver::EError::Nine) if (x6c_cardDriver->x14_error == CMemoryCardDriver::EError::FileCorrupted)
return UIType::Eleven; return UIType::Eleven;
if (x6c_cardDriver->x14_error == CMemoryCardDriver::EError::Three) if (x6c_cardDriver->x14_error == CMemoryCardDriver::EError::CardIOError)
return UIType::Six; return UIType::Six;
return UIType::Zero; return UIType::Zero;
@ -254,12 +254,12 @@ CSaveUI::CSaveUI(u32 instIdx, u64 serial)
} }
} }
std::unique_ptr<CMemoryCardDriver> CSaveUI::ConstructCardDriver(bool flag) std::unique_ptr<CMemoryCardDriver> CSaveUI::ConstructCardDriver(bool importState)
{ {
return std::make_unique<CMemoryCardDriver>(CMemoryCardSys::EMemoryCardPort::SlotA, return std::make_unique<CMemoryCardDriver>(CMemoryCardSys::EMemoryCardPort::SlotA,
g_ResFactory->GetResourceIdByName("TXTR_SaveBanner")->id, g_ResFactory->GetResourceIdByName("TXTR_SaveBanner")->id,
g_ResFactory->GetResourceIdByName("TXTR_SaveIcon0")->id, g_ResFactory->GetResourceIdByName("TXTR_SaveIcon0")->id,
g_ResFactory->GetResourceIdByName("TXTR_SaveIcon1")->id, flag); g_ResFactory->GetResourceIdByName("TXTR_SaveIcon1")->id, importState);
} }
} }

View File

@ -87,7 +87,7 @@ private:
void ResetCardDriver(); void ResetCardDriver();
public: public:
static std::unique_ptr<CMemoryCardDriver> ConstructCardDriver(bool flag); static std::unique_ptr<CMemoryCardDriver> ConstructCardDriver(bool importState);
CIOWin::EMessageReturn Update(float dt); CIOWin::EMessageReturn Update(float dt);
bool PumpLoad(); bool PumpLoad();
UIType SelectUIType() const; UIType SelectUIType() const;

View File

@ -214,7 +214,7 @@ private:
bool x160_28_ : 1; bool x160_28_ : 1;
bool x160_29_ : 1; bool x160_29_ : 1;
bool x160_30_ : 1; bool x160_30_ : 1;
bool x160_31_cardInserted : 1; bool x160_31_cardBusy : 1;
bool x161_24_ : 1; bool x161_24_ : 1;
}; };
u16 _dummy = 0; u16 _dummy = 0;
@ -251,7 +251,7 @@ public:
void ShutdownSubsystems() {} void ShutdownSubsystems() {}
EGameplayResult GetGameplayResult() const {return xe4_gameplayResult;} EGameplayResult GetGameplayResult() const {return xe4_gameplayResult;}
void SetGameplayResult(EGameplayResult wl) {xe4_gameplayResult = wl;} void SetGameplayResult(EGameplayResult wl) {xe4_gameplayResult = wl;}
void SetCardInserted(bool v) {x160_31_cardInserted = v;} void SetCardBusy(bool v) {x160_31_cardBusy = v;}
EFlowState GetFlowState() const { return x12c_flowState; } EFlowState GetFlowState() const { return x12c_flowState; }
}; };