Cleaner SGameFileSlot save blob initializer

This commit is contained in:
Jack Andersen 2016-12-20 12:09:02 -10:00
parent 9639ac75cc
commit c92223301c
2 changed files with 8 additions and 4 deletions

View File

@ -103,6 +103,12 @@ CMemoryCardDriver::SGameFileSlot::SGameFileSlot()
InitializeFromGameState(); InitializeFromGameState();
} }
CMemoryCardDriver::SGameFileSlot::SGameFileSlot(CMemoryInStream& in)
{
in.readBytesToBuf(x0_saveBuffer, 940);
x944_fileInfo = CGameState::LoadGameFileState(x0_saveBuffer);
}
void CMemoryCardDriver::SGameFileSlot::InitializeFromGameState() void CMemoryCardDriver::SGameFileSlot::InitializeFromGameState()
{ {
CBitStreamWriter w(x0_saveBuffer, 940); CBitStreamWriter w(x0_saveBuffer, 940);
@ -202,10 +208,7 @@ CMemoryCardDriver::SSaveHeader CMemoryCardDriver::LoadSaveHeader(CMemoryInStream
std::unique_ptr<CMemoryCardDriver::SGameFileSlot> CMemoryCardDriver::LoadSaveFile(CMemoryInStream& in) std::unique_ptr<CMemoryCardDriver::SGameFileSlot> CMemoryCardDriver::LoadSaveFile(CMemoryInStream& in)
{ {
auto ret = std::make_unique<CMemoryCardDriver::SGameFileSlot>(); return std::make_unique<CMemoryCardDriver::SGameFileSlot>(in);
in.readBytesToBuf(ret->x0_saveBuffer, 940);
ret->x944_fileInfo = CGameState::LoadGameFileState(ret->x0_saveBuffer);
return ret;
} }
void CMemoryCardDriver::ReadFinished() void CMemoryCardDriver::ReadFinished()

View File

@ -91,6 +91,7 @@ private:
u8 x0_saveBuffer[940] = {}; u8 x0_saveBuffer[940] = {};
CGameState::GameFileStateInfo x944_fileInfo; CGameState::GameFileStateInfo x944_fileInfo;
SGameFileSlot(); SGameFileSlot();
SGameFileSlot(CMemoryInStream& in);
void InitializeFromGameState(); void InitializeFromGameState();
}; };