Add CMemoryCardDriver::BuildExistingFileSlot

Former-commit-id: 8487d3751b
This commit is contained in:
Henrique Gemignani Passos Lima 2022-10-11 19:28:27 +03:00
parent b079ad7432
commit 5198e478f2
5 changed files with 19 additions and 5 deletions

View File

@ -664,7 +664,7 @@ lbl_8024CA74:
/* 8024CA88 002499E8 48 0F 28 B5 */ bl __ct__16CMemoryStreamOutFPvUlQ216CMemoryStreamOut10EOwnerShipi /* 8024CA88 002499E8 48 0F 28 B5 */ bl __ct__16CMemoryStreamOutFPvUlQ216CMemoryStreamOut10EOwnerShipi
/* 8024CA8C 002499EC 80 6D A0 80 */ lwz r3, gpGameState@sda21(r13) /* 8024CA8C 002499EC 80 6D A0 80 */ lwz r3, gpGameState@sda21(r13)
/* 8024CA90 002499F0 38 81 00 10 */ addi r4, r1, 0x10 /* 8024CA90 002499F0 38 81 00 10 */ addi r4, r1, 0x10
/* 8024CA94 002499F4 4B F8 75 89 */ bl sub_801d401c /* 8024CA94 002499F4 4B F8 75 89 */ bl WriteSystemOptions__10CGameStateFR13COutputStream
/* 8024CA98 002499F8 38 61 00 10 */ addi r3, r1, 0x10 /* 8024CA98 002499F8 38 61 00 10 */ addi r3, r1, 0x10
/* 8024CA9C 002499FC 38 80 FF FF */ li r4, -1 /* 8024CA9C 002499FC 38 80 FF FF */ li r4, -1
/* 8024CAA0 00249A00 48 0F 28 21 */ bl __dt__16CMemoryStreamOutFv /* 8024CAA0 00249A00 48 0F 28 21 */ bl __dt__16CMemoryStreamOutFv

View File

@ -646,8 +646,8 @@ lbl_801D3FC0:
/* 801D4014 001D0F74 38 21 00 10 */ addi r1, r1, 0x10 /* 801D4014 001D0F74 38 21 00 10 */ addi r1, r1, 0x10
/* 801D4018 001D0F78 4E 80 00 20 */ blr /* 801D4018 001D0F78 4E 80 00 20 */ blr
.global sub_801d401c .global WriteSystemOptions__10CGameStateFR13COutputStream
sub_801d401c: WriteSystemOptions__10CGameStateFR13COutputStream:
/* 801D401C 001D0F7C 94 21 FF F0 */ stwu r1, -0x10(r1) /* 801D401C 001D0F7C 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 801D4020 001D0F80 7C 08 02 A6 */ mflr r0 /* 801D4020 001D0F80 7C 08 02 A6 */ mflr r0
/* 801D4024 001D0F84 38 63 00 A8 */ addi r3, r3, 0xa8 /* 801D4024 001D0F84 38 63 00 A8 */ addi r3, r3, 0xa8

View File

@ -10,7 +10,7 @@ public:
kOS_NotOwned, kOS_NotOwned,
}; };
CMemoryStreamOut(uchar* buffer, size_t len, EOwnerShip ownerShip = kOS_NotOwned, int blockLen = 4096); CMemoryStreamOut(void* buffer, size_t len, EOwnerShip ownerShip = kOS_NotOwned, int blockLen = 4096);
virtual ~CMemoryStreamOut(); virtual ~CMemoryStreamOut();
}; };

View File

@ -15,12 +15,15 @@
#include "rstl/reserved_vector.hpp" #include "rstl/reserved_vector.hpp"
#include "rstl/vector.hpp" #include "rstl/vector.hpp"
class CMemoryStreamOut;
class CGameState { class CGameState {
public: public:
CGameState(); CGameState();
CGameState(CInputStream& in, int saveIdx); CGameState(CInputStream& in, int saveIdx);
void ReadSystemOptions(CInputStream& in); void ReadSystemOptions(CInputStream& in);
void PutTo(CMemoryStreamOut& out);
void WriteSystemOptions(COutputStream& out);
rstl::rc_ptr< CPlayerState >& PlayerState(); rstl::rc_ptr< CPlayerState >& PlayerState();
CAssetId CurrentWorldAssetId(); CAssetId CurrentWorldAssetId();

View File

@ -728,7 +728,18 @@ void CMemoryCardDriver::BuildNewFileSlot(int saveIdx) {
gpGameState->SystemOptions().SetHasFusion(fusionBackup); gpGameState->SystemOptions().SetHasFusion(fusionBackup);
} }
void CMemoryCardDriver::BuildExistingFileSlot(int) {} void CMemoryCardDriver::BuildExistingFileSlot(int saveIdx) {
gpGameState->SetFileIdx(saveIdx);
rstl::auto_ptr< SGameFileSlot >& slot = xe4_fileSlots[saveIdx];
if (slot.null())
slot = new SGameFileSlot();
else
slot->InitializeFromGameState();
CMemoryStreamOut w(x30_systemData.data(), x30_systemData.capacity());
gpGameState->WriteSystemOptions(w);
}
void CMemoryCardDriver::ImportPersistentOptions() {} void CMemoryCardDriver::ImportPersistentOptions() {}