Add SGameFileSlot/SSaveHeader constructors

Former-commit-id: fb0c6815ac
This commit is contained in:
Henrique Gemignani Passos Lima 2022-10-11 20:04:52 +03:00
parent 950d8e9d31
commit b1da312932
2 changed files with 8 additions and 7 deletions

View File

@ -41,9 +41,7 @@ struct SSaveHeader {
uint x0_version;
bool x4_savePresent[3];
SSaveHeader();
// : x0_version(0) {}
explicit SSaveHeader(int);
explicit SSaveHeader(CMemoryInStream& in);
void DoPut(CMemoryStreamOut& out) const;

View File

@ -662,7 +662,7 @@ void CMemoryCardDriver::InitializeFileInfo() {
CMemoryStreamOut w = x198_fileInfo->BeginMemoryOut(3004);
SSaveHeader header;
SSaveHeader header(0);
for (int i = 0; i < xe4_fileSlots.capacity(); ++i) {
header.x4_savePresent[i] = !xe4_fileSlots[i].null();
}
@ -757,7 +757,7 @@ void CMemoryCardDriver::ExportPersistentOptions() {
opts.PutTo(w);
}
// SSaveHeader::SSaveHeader(int)
SSaveHeader::SSaveHeader(int i) : x0_version(i) {}
SSaveHeader::SSaveHeader(CMemoryInStream& in) {
x0_version = in.ReadLong();
@ -773,9 +773,12 @@ void SSaveHeader::DoPut(CMemoryStreamOut& out) const {
}
}
SGameFileSlot::SGameFileSlot() {}
SGameFileSlot::SGameFileSlot() : x0_saveBuffer('\x00') { InitializeFromGameState(); }
SGameFileSlot::SGameFileSlot(CMemoryInStream& in) {}
SGameFileSlot::SGameFileSlot(CMemoryInStream& in) : x0_saveBuffer('\x00') {
in.Get(x0_saveBuffer.data(), x0_saveBuffer.capacity());
x944_fileInfo = gpGameState->LoadGameFileState(x0_saveBuffer.data());
}
void SGameFileSlot::DoPut(CMemoryStreamOut& w) const {
w.Put(x0_saveBuffer.data(), x0_saveBuffer.capacity());