diff --git a/asm/MetroidPrime/CMemoryCardDriver.s b/asm/MetroidPrime/CMemoryCardDriver.s index 79c8e80a..d6f269f4 100644 --- a/asm/MetroidPrime/CMemoryCardDriver.s +++ b/asm/MetroidPrime/CMemoryCardDriver.s @@ -480,7 +480,7 @@ ExportPersistentOptions__17CMemoryCardDriverFv: /* 8024C7FC 0024975C 48 0F 29 D1 */ bl __ct__15CMemoryInStreamFPCvUl /* 8024C800 00249760 38 61 00 B8 */ addi r3, r1, 0xb8 /* 8024C804 00249764 38 81 00 08 */ addi r4, r1, 8 -/* 8024C808 00249768 4B F8 91 61 */ bl __ct__14CSystemOptionsFRC12CInputStream +/* 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 @@ -523,7 +523,7 @@ ImportPersistentOptions__17CMemoryCardDriverFv: /* 8024C89C 002497FC 48 0F 29 31 */ bl __ct__15CMemoryInStreamFPCvUl /* 8024C8A0 00249800 38 61 00 2C */ addi r3, r1, 0x2c /* 8024C8A4 00249804 38 81 00 08 */ addi r4, r1, 8 -/* 8024C8A8 00249808 4B F8 90 C1 */ bl __ct__14CSystemOptionsFRC12CInputStream +/* 8024C8A8 00249808 4B F8 90 C1 */ bl __ct__14CSystemOptionsFR12CInputStream /* 8024C8AC 0024980C 80 6D A0 80 */ lwz r3, gpGameState@sda21(r13) /* 8024C8B0 00249810 38 81 00 2C */ addi r4, r1, 0x2c /* 8024C8B4 00249814 4B F8 76 19 */ bl ImportPersistentOptions__10CGameStateFRC14CSystemOptions diff --git a/asm/MetroidPrime/Player/CGameState.s b/asm/MetroidPrime/Player/CGameState.s index db90b11a..49a7d8ac 100644 --- a/asm/MetroidPrime/Player/CGameState.s +++ b/asm/MetroidPrime/Player/CGameState.s @@ -666,7 +666,7 @@ ReadSystemOptions__10CGameStateFR12CInputStream: /* 801D404C 001D0FAC 93 E1 00 EC */ stw r31, 0xec(r1) /* 801D4050 001D0FB0 7C 7F 1B 78 */ mr r31, r3 /* 801D4054 001D0FB4 38 61 00 08 */ addi r3, r1, 8 -/* 801D4058 001D0FB8 48 00 19 11 */ bl __ct__14CSystemOptionsFRC12CInputStream +/* 801D4058 001D0FB8 48 00 19 11 */ bl __ct__14CSystemOptionsFR12CInputStream /* 801D405C 001D0FBC 38 7F 00 A8 */ addi r3, r31, 0xa8 /* 801D4060 001D0FC0 38 81 00 08 */ addi r4, r1, 8 /* 801D4064 001D0FC4 4B E2 F9 69 */ bl __as__14CSystemOptionsFRC14CSystemOptions @@ -2501,8 +2501,8 @@ lbl_801D5954: /* 801D5960 001D28C0 38 21 00 A0 */ addi r1, r1, 0xa0 /* 801D5964 001D28C4 4E 80 00 20 */ blr -.global __ct__14CSystemOptionsFRC12CInputStream -__ct__14CSystemOptionsFRC12CInputStream: +.global __ct__14CSystemOptionsFR12CInputStream +__ct__14CSystemOptionsFR12CInputStream: /* 801D5968 001D28C8 94 21 FF 60 */ stwu r1, -0xa0(r1) /* 801D596C 001D28CC 7C 08 02 A6 */ mflr r0 /* 801D5970 001D28D0 90 01 00 A4 */ stw r0, 0xa4(r1) diff --git a/include/MetroidPrime/Player/CGameState.hpp b/include/MetroidPrime/Player/CGameState.hpp index 34e2669b..5df018a3 100644 --- a/include/MetroidPrime/Player/CGameState.hpp +++ b/include/MetroidPrime/Player/CGameState.hpp @@ -29,6 +29,9 @@ public: CAssetId CurrentWorldAssetId(); void WriteBackupBuf(); + void ImportPersistentOptions(const CSystemOptions&); + void ExportPersistentOptions(CSystemOptions&); + CSystemOptions& SystemOptions() { return xa8_systemOptions; } CGameOptions& GameOptions() { return x17c_gameOptions; } CHintOptions& HintOptions() { return x1f8_hintOptions; } diff --git a/include/MetroidPrime/Player/CSystemOptions.hpp b/include/MetroidPrime/Player/CSystemOptions.hpp index 61451831..245d221d 100644 --- a/include/MetroidPrime/Player/CSystemOptions.hpp +++ b/include/MetroidPrime/Player/CSystemOptions.hpp @@ -12,6 +12,8 @@ class CSystemOptions { public: CSystemOptions(); + explicit CSystemOptions(CInputStream&); + ~CSystemOptions(); void SetHasFusion(bool v); bool GetHasFusion() const { return xd0_28_fusionSuitActive; } diff --git a/src/MetroidPrime/CMemoryCardDriver.cpp b/src/MetroidPrime/CMemoryCardDriver.cpp index 4a4c4f71..cc36d44e 100644 --- a/src/MetroidPrime/CMemoryCardDriver.cpp +++ b/src/MetroidPrime/CMemoryCardDriver.cpp @@ -741,7 +741,11 @@ void CMemoryCardDriver::BuildExistingFileSlot(int saveIdx) { gpGameState->WriteSystemOptions(w); } -void CMemoryCardDriver::ImportPersistentOptions() {} +void CMemoryCardDriver::ImportPersistentOptions() { + CMemoryInStream r(x30_systemData.data(), x30_systemData.capacity()); + CSystemOptions opts(r); + gpGameState->ImportPersistentOptions(opts); +} void CMemoryCardDriver::ExportPersistentOptions() {}