mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 08:24:16 +00:00
100% match of many functions in the LegoGameState::Save codepath (#86)
* Only include decomps * One more function * Add offset to endOfVariables * Remove leftover header * Use undefined where applicable * Fixes, refactorings * Fixes * Fix calling convention * Added offset comment --------- Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
48
LEGO1/legounksavedatawriter.cpp
Normal file
48
LEGO1/legounksavedatawriter.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
|
||||
#include "legounksavedatawriter.h"
|
||||
#include "legogamestate.h"
|
||||
#include "legostream.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoSaveDataEntry3, 0x108);
|
||||
|
||||
// GLOBAL OFFSET: LEGO1 0x10104f20
|
||||
LegoSaveDataEntry3 g_saveData3[66];
|
||||
|
||||
// OFFSET: LEGO1 0x10083310
|
||||
MxResult LegoUnkSaveDataWriter::WriteSaveData3(LegoStream *p_stream)
|
||||
{
|
||||
MxResult result = FAILURE;
|
||||
|
||||
// This should probably be a for loop but I can't figure out how to
|
||||
// make it match as a for loop.
|
||||
LegoSaveDataEntry3 *entry = g_saveData3;
|
||||
const LegoSaveDataEntry3 *end = &g_saveData3[66];
|
||||
|
||||
while (TRUE) {
|
||||
if (p_stream->Write(&entry->m_savePart1, 4) != SUCCESS)
|
||||
break;
|
||||
if (p_stream->Write(&entry->m_savePart2, 4) != SUCCESS)
|
||||
break;
|
||||
if (p_stream->Write(&entry->m_savePart3, 1) != SUCCESS)
|
||||
break;
|
||||
if (p_stream->Write(&entry->m_currentFrame, 1) != SUCCESS)
|
||||
break;
|
||||
if (p_stream->Write(&entry->m_savePart5, 1) != SUCCESS)
|
||||
break;
|
||||
if (p_stream->Write(&entry->m_savePart6, 1) != SUCCESS)
|
||||
break;
|
||||
if (p_stream->Write(&entry->m_savePart7, 1) != SUCCESS)
|
||||
break;
|
||||
if (p_stream->Write(&entry->m_savePart8, 1) != SUCCESS)
|
||||
break;
|
||||
if (p_stream->Write(&entry->m_savePart9, 1) != SUCCESS)
|
||||
break;
|
||||
if (p_stream->Write(&entry->m_savePart10, 1) != SUCCESS)
|
||||
break;
|
||||
if (++entry >= end) {
|
||||
result = SUCCESS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
Reference in New Issue
Block a user