mirror of https://github.com/PrimeDecomp/prime.git
Almost match CMemoryCardDriver::ReadFinished
This commit is contained in:
parent
b0ce4e26f1
commit
da2b4706db
|
@ -306,8 +306,8 @@ SetStatus__14CMemoryCardSysFiiPC8CARDStat:
|
|||
/* 8034D828 0034A788 38 21 00 10 */ addi r1, r1, 0x10
|
||||
/* 8034D82C 0034A78C 4E 80 00 20 */ blr
|
||||
|
||||
.global GetStatus__14CMemoryCardSysFQ214CMemoryCardSys15EMemoryCardPortiR8CardStat
|
||||
GetStatus__14CMemoryCardSysFQ214CMemoryCardSys15EMemoryCardPortiR8CardStat:
|
||||
.global GetStatus__14CMemoryCardSysF15EMemoryCardPortiR8CardStat
|
||||
GetStatus__14CMemoryCardSysF15EMemoryCardPortiR8CardStat:
|
||||
/* 8034D830 0034A790 94 21 FF 80 */ stwu r1, -0x80(r1)
|
||||
/* 8034D834 0034A794 7C 08 02 A6 */ mflr r0
|
||||
/* 8034D838 0034A798 90 01 00 84 */ stw r0, 0x84(r1)
|
||||
|
@ -385,7 +385,7 @@ StartRead__19SMemoryCardFileInfoFv:
|
|||
/* 8034D928 0034A888 48 00 11 85 */ bl GetFileCardPort__19SMemoryCardFileInfoFv
|
||||
/* 8034D92C 0034A88C 7F E4 FB 78 */ mr r4, r31
|
||||
/* 8034D930 0034A890 38 A1 00 28 */ addi r5, r1, 0x28
|
||||
/* 8034D934 0034A894 4B FF FE FD */ bl GetStatus__14CMemoryCardSysFQ214CMemoryCardSys15EMemoryCardPortiR8CardStat
|
||||
/* 8034D934 0034A894 4B FF FE FD */ bl GetStatus__14CMemoryCardSysF15EMemoryCardPortiR8CardStat
|
||||
/* 8034D938 0034A898 2C 03 00 00 */ cmpwi r3, 0
|
||||
/* 8034D93C 0034A89C 41 82 00 08 */ beq lbl_8034D944
|
||||
/* 8034D940 0034A8A0 48 00 00 90 */ b lbl_8034D9D0
|
||||
|
@ -522,7 +522,7 @@ GetStatus__13CCardFileInfoFP8CARDStat:
|
|||
/* 8034DB04 0034AA64 48 00 0F 99 */ bl GetCardPort__13CCardFileInfoFv
|
||||
/* 8034DB08 0034AA68 7F E4 FB 78 */ mr r4, r31
|
||||
/* 8034DB0C 0034AA6C 7F A5 EB 78 */ mr r5, r29
|
||||
/* 8034DB10 0034AA70 4B FF FD 21 */ bl GetStatus__14CMemoryCardSysFQ214CMemoryCardSys15EMemoryCardPortiR8CardStat
|
||||
/* 8034DB10 0034AA70 4B FF FD 21 */ bl GetStatus__14CMemoryCardSysF15EMemoryCardPortiR8CardStat
|
||||
/* 8034DB14 0034AA74 2C 03 00 00 */ cmpwi r3, 0
|
||||
/* 8034DB18 0034AA78 41 82 00 08 */ beq lbl_8034DB20
|
||||
/* 8034DB1C 0034AA7C 48 00 00 D8 */ b lbl_8034DBF4
|
||||
|
@ -1627,7 +1627,7 @@ GetSaveDataOffset__19SMemoryCardFileInfoFRPv:
|
|||
/* 8034E99C 0034B8FC 48 00 01 11 */ bl GetFileCardPort__19SMemoryCardFileInfoFv
|
||||
/* 8034E9A0 0034B900 7F C4 F3 78 */ mr r4, r30
|
||||
/* 8034E9A4 0034B904 38 A1 00 08 */ addi r5, r1, 8
|
||||
/* 8034E9A8 0034B908 4B FF EE 89 */ bl GetStatus__14CMemoryCardSysFQ214CMemoryCardSys15EMemoryCardPortiR8CardStat
|
||||
/* 8034E9A8 0034B908 4B FF EE 89 */ bl GetStatus__14CMemoryCardSysF15EMemoryCardPortiR8CardStat
|
||||
/* 8034E9AC 0034B90C 2C 03 00 00 */ cmpwi r3, 0
|
||||
/* 8034E9B0 0034B910 41 82 00 10 */ beq lbl_8034E9C0
|
||||
/* 8034E9B4 0034B914 38 00 FF FF */ li r0, -1
|
||||
|
|
|
@ -203,8 +203,8 @@ DoPut__13SGameFileSlotCFR16CMemoryStreamOut:
|
|||
/* 8024C454 002493B4 38 21 00 10 */ addi r1, r1, 0x10
|
||||
/* 8024C458 002493B8 4E 80 00 20 */ blr
|
||||
|
||||
.global LoadFile
|
||||
LoadFile:
|
||||
.global __ct__13SGameFileSlotFR15CMemoryInStream
|
||||
__ct__13SGameFileSlotFR15CMemoryInStream:
|
||||
/* 8024C45C 002493BC 94 21 FF C0 */ stwu r1, -0x40(r1)
|
||||
/* 8024C460 002493C0 7C 08 02 A6 */ mflr r0
|
||||
/* 8024C464 002493C4 90 01 00 44 */ stw r0, 0x44(r1)
|
||||
|
@ -431,8 +431,8 @@ lbl_8024C710:
|
|||
/* 8024C760 002496C0 38 21 00 20 */ addi r1, r1, 0x20
|
||||
/* 8024C764 002496C4 4E 80 00 20 */ blr
|
||||
|
||||
.global LoadSaveHeader
|
||||
LoadSaveHeader:
|
||||
.global __ct__11SSaveHeaderFR15CMemoryInStream
|
||||
__ct__11SSaveHeaderFR15CMemoryInStream:
|
||||
/* 8024C768 002496C8 94 21 FF E0 */ stwu r1, -0x20(r1)
|
||||
/* 8024C76C 002496CC 7C 08 02 A6 */ mflr r0
|
||||
/* 8024C770 002496D0 90 01 00 24 */ stw r0, 0x24(r1)
|
||||
|
@ -948,7 +948,7 @@ ReadFinished__17CMemoryCardDriverFv:
|
|||
/* 8024CE68 00249DC8 7C 64 1B 78 */ mr r4, r3
|
||||
/* 8024CE6C 00249DCC 80 7C 00 00 */ lwz r3, 0(r28)
|
||||
/* 8024CE70 00249DD0 38 A1 00 44 */ addi r5, r1, 0x44
|
||||
/* 8024CE74 00249DD4 48 10 09 BD */ bl GetStatus__14CMemoryCardSysFQ214CMemoryCardSys15EMemoryCardPortiR8CardStat
|
||||
/* 8024CE74 00249DD4 48 10 09 BD */ bl GetStatus__14CMemoryCardSysF15EMemoryCardPortiR8CardStat
|
||||
/* 8024CE78 00249DD8 2C 03 00 00 */ cmpwi r3, 0
|
||||
/* 8024CE7C 00249DDC 41 82 00 10 */ beq lbl_8024CE8C
|
||||
/* 8024CE80 00249DE0 7F 83 E3 78 */ mr r3, r28
|
||||
|
@ -964,7 +964,7 @@ lbl_8024CE8C:
|
|||
/* 8024CEA4 00249E04 48 0F 23 29 */ bl __ct__15CMemoryInStreamFPCvUl
|
||||
/* 8024CEA8 00249E08 38 61 00 18 */ addi r3, r1, 0x18
|
||||
/* 8024CEAC 00249E0C 38 81 00 20 */ addi r4, r1, 0x20
|
||||
/* 8024CEB0 00249E10 4B FF F8 B9 */ bl LoadSaveHeader
|
||||
/* 8024CEB0 00249E10 4B FF F8 B9 */ bl __ct__11SSaveHeaderFR15CMemoryInStream
|
||||
/* 8024CEB4 00249E14 38 61 00 20 */ addi r3, r1, 0x20
|
||||
/* 8024CEB8 00249E18 38 9C 00 34 */ addi r4, r28, 0x34
|
||||
/* 8024CEBC 00249E1C 38 A0 00 AE */ li r5, 0xae
|
||||
|
@ -985,7 +985,7 @@ lbl_8024CED0:
|
|||
/* 8024CEF4 00249E54 7C 64 1B 79 */ or. r4, r3, r3
|
||||
/* 8024CEF8 00249E58 41 82 00 10 */ beq lbl_8024CF08
|
||||
/* 8024CEFC 00249E5C 38 81 00 20 */ addi r4, r1, 0x20
|
||||
/* 8024CF00 00249E60 4B FF F5 5D */ bl LoadFile
|
||||
/* 8024CF00 00249E60 4B FF F5 5D */ bl __ct__13SGameFileSlotFR15CMemoryInStream
|
||||
/* 8024CF04 00249E64 7C 64 1B 78 */ mr r4, r3
|
||||
lbl_8024CF08:
|
||||
/* 8024CF08 00249E68 7C 64 00 D0 */ neg r3, r4
|
||||
|
@ -1884,7 +1884,7 @@ lbl_8024DB30:
|
|||
/* 8024DB50 0024AAB0 7C 64 1B 78 */ mr r4, r3
|
||||
/* 8024DB54 0024AAB4 80 7F 00 00 */ lwz r3, 0(r31)
|
||||
/* 8024DB58 0024AAB8 38 A1 00 74 */ addi r5, r1, 0x74
|
||||
/* 8024DB5C 0024AABC 48 0F FC D5 */ bl GetStatus__14CMemoryCardSysFQ214CMemoryCardSys15EMemoryCardPortiR8CardStat
|
||||
/* 8024DB5C 0024AABC 48 0F FC D5 */ bl GetStatus__14CMemoryCardSysF15EMemoryCardPortiR8CardStat
|
||||
/* 8024DB60 0024AAC0 2C 03 00 00 */ cmpwi r3, 0
|
||||
/* 8024DB64 0024AAC4 40 82 00 2C */ bne lbl_8024DB90
|
||||
/* 8024DB68 0024AAC8 38 61 00 74 */ addi r3, r1, 0x74
|
||||
|
@ -1934,7 +1934,7 @@ lbl_8024DBC4:
|
|||
/* 8024DC04 0024AB64 7C 64 1B 78 */ mr r4, r3
|
||||
/* 8024DC08 0024AB68 80 7F 00 00 */ lwz r3, 0(r31)
|
||||
/* 8024DC0C 0024AB6C 38 A1 00 08 */ addi r5, r1, 8
|
||||
/* 8024DC10 0024AB70 48 0F FC 21 */ bl GetStatus__14CMemoryCardSysFQ214CMemoryCardSys15EMemoryCardPortiR8CardStat
|
||||
/* 8024DC10 0024AB70 48 0F FC 21 */ bl GetStatus__14CMemoryCardSysF15EMemoryCardPortiR8CardStat
|
||||
/* 8024DC14 0024AB74 2C 03 00 00 */ cmpwi r3, 0
|
||||
/* 8024DC18 0024AB78 40 82 00 6C */ bne lbl_8024DC84
|
||||
/* 8024DC1C 0024AB7C 38 61 00 08 */ addi r3, r1, 8
|
||||
|
@ -1945,7 +1945,7 @@ lbl_8024DBC4:
|
|||
/* 8024DC30 0024AB90 7C 64 1B 78 */ mr r4, r3
|
||||
/* 8024DC34 0024AB94 80 7F 00 00 */ lwz r3, 0(r31)
|
||||
/* 8024DC38 0024AB98 38 A1 00 08 */ addi r5, r1, 8
|
||||
/* 8024DC3C 0024AB9C 48 0F FB F5 */ bl GetStatus__14CMemoryCardSysFQ214CMemoryCardSys15EMemoryCardPortiR8CardStat
|
||||
/* 8024DC3C 0024AB9C 48 0F FB F5 */ bl GetStatus__14CMemoryCardSysF15EMemoryCardPortiR8CardStat
|
||||
/* 8024DC40 0024ABA0 2C 03 00 00 */ cmpwi r3, 0
|
||||
/* 8024DC44 0024ABA4 40 82 00 34 */ bne lbl_8024DC78
|
||||
/* 8024DC48 0024ABA8 38 61 00 08 */ addi r3, r1, 8
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
void Get(void* dest, unsigned long len);
|
||||
|
||||
template < typename T >
|
||||
inline T Get(const TType< T >& type = TType<T>()) {
|
||||
inline T Get(const TType< T >& type = TType< T >()) {
|
||||
return cinput_stream_helper(type, *this);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include "rstl/single_ptr.hpp"
|
||||
#include "rstl/vector.hpp"
|
||||
|
||||
class CMemoryInStream;
|
||||
|
||||
struct SMemoryCardFileInfo {
|
||||
CMemoryCardSys::CardFileHandle x0_fileInfo;
|
||||
|
||||
|
@ -42,24 +44,23 @@ struct SSaveHeader {
|
|||
SSaveHeader();
|
||||
// : x0_version(0) {}
|
||||
|
||||
void DoPut(CMemoryStreamOut& out) const; /* {
|
||||
out.WriteLong(x0_version);
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
out.Put(x4_savePresent[i]);
|
||||
}
|
||||
}*/
|
||||
explicit SSaveHeader(CMemoryInStream& in);
|
||||
|
||||
void DoPut(CMemoryStreamOut& out) const;
|
||||
};
|
||||
|
||||
struct SGameFileSlot {
|
||||
u8 x0_saveBuffer[940];
|
||||
rstl::reserved_vector<u8, 940> x0_saveBuffer;
|
||||
CGameState::GameFileStateInfo x944_fileInfo;
|
||||
|
||||
SGameFileSlot();
|
||||
// explicit SGameFileSlot(CMemoryInStream& in);
|
||||
explicit SGameFileSlot(CMemoryInStream& in);
|
||||
|
||||
void InitializeFromGameState();
|
||||
void LoadGameState(u32 idx);
|
||||
void DoPut(CMemoryStreamOut& w) const; // { w.Put(x0_saveBuffer, 940); }
|
||||
void LoadGameState(int idx);
|
||||
void DoPut(CMemoryStreamOut& w) const;
|
||||
};
|
||||
CHECK_SIZEOF(SGameFileSlot, 0x3d8)
|
||||
|
||||
enum EState {
|
||||
kS_Initial = 0,
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include "MetroidPrime/CMain.hpp"
|
||||
|
||||
#include "Kyoto/Streams/CMemoryInStream.hpp"
|
||||
|
||||
#include "dolphin/os.h"
|
||||
#include "stdio.h"
|
||||
|
||||
|
@ -676,7 +678,33 @@ void CMemoryCardDriver::InitializeFileInfo() {
|
|||
}
|
||||
}
|
||||
|
||||
void CMemoryCardDriver::ReadFinished() {}
|
||||
void CMemoryCardDriver::ReadFinished() {
|
||||
SMemoryCardFileInfo& fileInfo = x100_mcFileInfos[x194_fileIdx].second;
|
||||
CardStat stat;
|
||||
if (CMemoryCardSys::GetStatus(fileInfo.x0_fileInfo.slot, fileInfo.GetFileNo(), stat) !=
|
||||
kCR_READY) {
|
||||
NoCardFound();
|
||||
return;
|
||||
}
|
||||
|
||||
x20_fileTime = stat.GetTime();
|
||||
|
||||
CMemoryInStream r(fileInfo.x34_saveData.data(), 3004);
|
||||
SSaveHeader header(r);
|
||||
r.Get(x30_systemData.data(), x30_systemData.capacity());
|
||||
|
||||
for (int i = 0; i < xe4_fileSlots.capacity(); ++i) {
|
||||
if (header.x4_savePresent[i]) {
|
||||
xe4_fileSlots[i] = new SGameFileSlot(r);
|
||||
} else {
|
||||
xe4_fileSlots[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (x19d_importPersistent) {
|
||||
ImportPersistentOptions();
|
||||
}
|
||||
}
|
||||
|
||||
void CMemoryCardDriver::EraseFileSlot(int) {}
|
||||
|
||||
|
@ -688,6 +716,32 @@ void CMemoryCardDriver::ImportPersistentOptions() {}
|
|||
|
||||
void CMemoryCardDriver::ExportPersistentOptions() {}
|
||||
|
||||
// SSaveHeader::SSaveHeader(int)
|
||||
|
||||
SSaveHeader::SSaveHeader(CMemoryInStream& in) {
|
||||
x0_version = in.ReadLong();
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
x4_savePresent[i] = in.ReadBool();
|
||||
}
|
||||
}
|
||||
|
||||
void SSaveHeader::DoPut(CMemoryStreamOut& out) const {
|
||||
out.WriteLong(x0_version);
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
out.Put(x4_savePresent[i]);
|
||||
}
|
||||
}
|
||||
|
||||
SGameFileSlot::SGameFileSlot() {}
|
||||
|
||||
SGameFileSlot::SGameFileSlot(CMemoryInStream& in) {}
|
||||
|
||||
void SGameFileSlot::DoPut(CMemoryStreamOut& w) const { w.Put(x0_saveBuffer.data(), x0_saveBuffer.capacity()); }
|
||||
|
||||
void SGameFileSlot::InitializeFromGameState() {}
|
||||
|
||||
void SGameFileSlot::LoadGameState(int) {}
|
||||
|
||||
const CGameState::GameFileStateInfo* CMemoryCardDriver::GetGameFileStateInfo(int) {
|
||||
return nullptr;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue