diff --git a/asm/MetroidPrime/CMemoryCardDriver.s b/asm/MetroidPrime/CMemoryCardDriver.s index de24e12d..9fc867d4 100644 --- a/asm/MetroidPrime/CMemoryCardDriver.s +++ b/asm/MetroidPrime/CMemoryCardDriver.s @@ -483,7 +483,7 @@ ExportPersistentOptions__17CMemoryCardDriverFv: /* 8024C808 00249768 4B F8 91 61 */ bl __ct__14CSystemOptionsFR12CInputStream /* 8024C80C 0024976C 80 6D A0 80 */ lwz r3, gpGameState@sda21(r13) /* 8024C810 00249770 38 81 00 B8 */ addi r4, r1, 0xb8 -/* 8024C814 00249774 4B F8 74 F5 */ bl ExportPersistentOptions__10CGameStateFRC14CSystemOptions +/* 8024C814 00249774 4B F8 74 F5 */ bl ExportPersistentOptions__10CGameStateFR14CSystemOptions /* 8024C818 00249778 7F E4 FB 78 */ mr r4, r31 /* 8024C81C 0024977C 38 61 00 2C */ addi r3, r1, 0x2c /* 8024C820 00249780 38 A0 00 AE */ li r5, 0xae diff --git a/asm/MetroidPrime/Player/CGameState.s b/asm/MetroidPrime/Player/CGameState.s index 49a7d8ac..cbebff77 100644 --- a/asm/MetroidPrime/Player/CGameState.s +++ b/asm/MetroidPrime/Player/CGameState.s @@ -415,8 +415,8 @@ lbl_801D3CE0: /* 801D3D00 001D0C60 38 21 00 30 */ addi r1, r1, 0x30 /* 801D3D04 001D0C64 4E 80 00 20 */ blr -.global ExportPersistentOptions__10CGameStateFRC14CSystemOptions -ExportPersistentOptions__10CGameStateFRC14CSystemOptions: +.global ExportPersistentOptions__10CGameStateFR14CSystemOptions +ExportPersistentOptions__10CGameStateFR14CSystemOptions: /* 801D3D08 001D0C68 94 21 FF F0 */ stwu r1, -0x10(r1) /* 801D3D0C 001D0C6C 7C 08 02 A6 */ mflr r0 /* 801D3D10 001D0C70 90 01 00 14 */ stw r0, 0x14(r1) diff --git a/include/Kyoto/Streams/CMemoryStreamOut.hpp b/include/Kyoto/Streams/CMemoryStreamOut.hpp index e2c58877..0919ce03 100644 --- a/include/Kyoto/Streams/CMemoryStreamOut.hpp +++ b/include/Kyoto/Streams/CMemoryStreamOut.hpp @@ -12,6 +12,12 @@ public: CMemoryStreamOut(void* buffer, size_t len, EOwnerShip ownerShip = kOS_NotOwned, int blockLen = 4096); virtual ~CMemoryStreamOut(); + +private: + u8* x7c_ptr; + u32 x80_len; + u32 x84_position; + bool x88_owned; }; #endif // _CMEMORYSTREAMOUT diff --git a/include/MetroidPrime/Player/CGameState.hpp b/include/MetroidPrime/Player/CGameState.hpp index 5df018a3..c74a752c 100644 --- a/include/MetroidPrime/Player/CGameState.hpp +++ b/include/MetroidPrime/Player/CGameState.hpp @@ -53,7 +53,7 @@ public: float x1c_scanPercent; bool x20_hardMode; }; - static GameFileStateInfo LoadGameFileState(const uchar* data); + static GameFileStateInfo LoadGameFileState(const void* data); private: rstl::reserved_vector< bool, 128 > x0_; diff --git a/src/MetroidPrime/CMemoryCardDriver.cpp b/src/MetroidPrime/CMemoryCardDriver.cpp index 127a1f2c..3835bb96 100644 --- a/src/MetroidPrime/CMemoryCardDriver.cpp +++ b/src/MetroidPrime/CMemoryCardDriver.cpp @@ -784,7 +784,13 @@ void SGameFileSlot::DoPut(CMemoryStreamOut& w) const { w.Put(x0_saveBuffer.data(), x0_saveBuffer.capacity()); } -void SGameFileSlot::InitializeFromGameState() {} +void SGameFileSlot::InitializeFromGameState() { + { + CMemoryStreamOut w(x0_saveBuffer.data(), x0_saveBuffer.capacity()); + gpGameState->PutTo(w); + } + x944_fileInfo = CGameState::LoadGameFileState(x0_saveBuffer.data()); +} void SGameFileSlot::LoadGameState(int) {}