mirror of https://github.com/PrimeDecomp/prime.git
Almost match CMemoryCardDriver::InitializeFileInfo
Former-commit-id: c41d43ebcb
This commit is contained in:
parent
3249380a37
commit
9a4d5ae6bc
|
@ -65,9 +65,11 @@ public:
|
||||||
ECardResult WriteFile();
|
ECardResult WriteFile();
|
||||||
ECardResult CloseFile();
|
ECardResult CloseFile();
|
||||||
|
|
||||||
|
rstl::vector<u8>& SaveBuffer() { return xf4_saveBuffer; }
|
||||||
|
|
||||||
inline CMemoryStreamOut BeginMemoryOut(uint sz) {
|
inline CMemoryStreamOut BeginMemoryOut(uint sz) {
|
||||||
xf4_saveBuffer.resize(sz, '\x00');
|
xf4_saveBuffer.resize(sz, '\x00');
|
||||||
return CMemoryStreamOut(xf4_saveBuffer.data(), sz, CMemoryStreamOut::kOS_NotOwned, sz);
|
return CMemoryStreamOut(xf4_saveBuffer.data(), sz);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
CHECK_SIZEOF(CCardFileInfo, 0x114)
|
CHECK_SIZEOF(CCardFileInfo, 0x114)
|
||||||
|
|
|
@ -661,7 +661,12 @@ void CMemoryCardDriver::InitializeFileInfo() {
|
||||||
fileInfo.SetComment(rstl::string_l(nameConstant) + nameBuffer);
|
fileInfo.SetComment(rstl::string_l(nameConstant) + nameBuffer);
|
||||||
fileInfo.LockBannerToken(x4_saveBanner, *gpSimplePool);
|
fileInfo.LockBannerToken(x4_saveBanner, *gpSimplePool);
|
||||||
fileInfo.LockIconToken(x8_saveIcon0, 2, *gpSimplePool);
|
fileInfo.LockIconToken(x8_saveIcon0, 2, *gpSimplePool);
|
||||||
CMemoryStreamOut w = fileInfo.BeginMemoryOut(3004);
|
|
||||||
|
// CMemoryStreamOut w(fileInfo.BeginMemoryOut(3004));
|
||||||
|
|
||||||
|
rstl::vector< u8 >& saveBuffer = fileInfo.SaveBuffer();
|
||||||
|
saveBuffer.resize(3004, '\x00');
|
||||||
|
CMemoryStreamOut w(saveBuffer.data(), 3004);
|
||||||
|
|
||||||
SSaveHeader header(0);
|
SSaveHeader header(0);
|
||||||
for (int i = 0; i < xe4_fileSlots.capacity(); ++i) {
|
for (int i = 0; i < xe4_fileSlots.capacity(); ++i) {
|
||||||
|
@ -669,12 +674,13 @@ void CMemoryCardDriver::InitializeFileInfo() {
|
||||||
}
|
}
|
||||||
header.DoPut(w);
|
header.DoPut(w);
|
||||||
|
|
||||||
w.Put(x30_systemData.data(), x30_systemData.size());
|
w.Put(x30_systemData.data(), x30_systemData.capacity());
|
||||||
|
|
||||||
for (int i = 0; i < xe4_fileSlots.size(); ++i) {
|
for (rstl::reserved_vector< rstl::auto_ptr< SGameFileSlot >, 3 >::iterator it =
|
||||||
rstl::auto_ptr< SGameFileSlot >& fileSlot = xe4_fileSlots[i];
|
xe4_fileSlots.begin();
|
||||||
if (!fileSlot.null()) {
|
it != xe4_fileSlots.end(); ++it) {
|
||||||
fileSlot->DoPut(w);
|
if (!it->null()) {
|
||||||
|
(*it)->DoPut(w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -806,10 +812,11 @@ const CGameState::GameFileStateInfo* CMemoryCardDriver::GetGameFileStateInfo(int
|
||||||
};
|
};
|
||||||
|
|
||||||
bool CMemoryCardDriver::GetCardFreeBytes() {
|
bool CMemoryCardDriver::GetCardFreeBytes() {
|
||||||
if (CMemoryCardSys::GetNumFreeBytes(x0_cardPort, x18_cardFreeBytes, x1c_cardFreeFiles) != kCR_READY) {
|
if (CMemoryCardSys::GetNumFreeBytes(x0_cardPort, x18_cardFreeBytes, x1c_cardFreeFiles) !=
|
||||||
|
kCR_READY) {
|
||||||
NoCardFound();
|
NoCardFound();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue