mirror of https://github.com/PrimeDecomp/prime.git
Use a struct instead of pair for x198_fileInfo
This commit is contained in:
parent
cfcf615e23
commit
1d323af190
|
@ -1076,8 +1076,8 @@ lbl_8034E1C8:
|
|||
/* 8034E284 0034B1E4 38 21 00 10 */ addi r1, r1, 0x10
|
||||
/* 8034E288 0034B1E8 4E 80 00 20 */ blr
|
||||
|
||||
.global __ct__19SMemoryCardFileInfoFiRCQ24rstl6string
|
||||
__ct__19SMemoryCardFileInfoFiRCQ24rstl6string:
|
||||
.global "__ct__19SMemoryCardFileInfoFiRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>"
|
||||
"__ct__19SMemoryCardFileInfoFiRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>":
|
||||
/* 8034E28C 0034B1EC 94 21 FF F0 */ stwu r1, -0x10(r1)
|
||||
/* 8034E290 0034B1F0 7C 08 02 A6 */ mflr r0
|
||||
/* 8034E294 0034B1F4 90 01 00 14 */ stw r0, 0x14(r1)
|
||||
|
|
|
@ -3023,14 +3023,14 @@ sub_8024ea40:
|
|||
/* 8024EA44 0024B9A4 7C 08 02 A6 */ mflr r0
|
||||
/* 8024EA48 0024B9A8 38 80 FF FF */ li r4, -1
|
||||
/* 8024EA4C 0024B9AC 90 01 00 14 */ stw r0, 0x14(r1)
|
||||
/* 8024EA50 0024B9B0 48 00 00 15 */ bl "__dt__Q24rstl29pair<i,19SMemoryCardSlotInfo>Fv"
|
||||
/* 8024EA50 0024B9B0 48 00 00 15 */ bl "__dt__Q217CMemoryCardDriver9SFileInfoFv"
|
||||
/* 8024EA54 0024B9B4 80 01 00 14 */ lwz r0, 0x14(r1)
|
||||
/* 8024EA58 0024B9B8 7C 08 03 A6 */ mtlr r0
|
||||
/* 8024EA5C 0024B9BC 38 21 00 10 */ addi r1, r1, 0x10
|
||||
/* 8024EA60 0024B9C0 4E 80 00 20 */ blr
|
||||
|
||||
.global "__dt__Q24rstl29pair<i,19SMemoryCardSlotInfo>Fv"
|
||||
"__dt__Q24rstl29pair<i,19SMemoryCardSlotInfo>Fv":
|
||||
.global "__dt__Q217CMemoryCardDriver9SFileInfoFv"
|
||||
"__dt__Q217CMemoryCardDriver9SFileInfoFv":
|
||||
/* 8024EA64 0024B9C4 94 21 FF F0 */ stwu r1, -0x10(r1)
|
||||
/* 8024EA68 0024B9C8 7C 08 02 A6 */ mflr r0
|
||||
/* 8024EA6C 0024B9CC 90 01 00 14 */ stw r0, 0x14(r1)
|
||||
|
@ -3297,13 +3297,13 @@ lbl_8024EDB0:
|
|||
/* 8024EDE8 0024BD48 38 61 00 7C */ addi r3, r1, 0x7c
|
||||
/* 8024EDEC 0024BD4C 38 A1 00 20 */ addi r5, r1, 0x20
|
||||
/* 8024EDF0 0024BD50 90 01 00 78 */ stw r0, 0x78(r1)
|
||||
/* 8024EDF4 0024BD54 48 0F F4 99 */ bl __ct__19SMemoryCardFileInfoFiRCQ24rstl6string
|
||||
/* 8024EDF4 0024BD54 48 0F F4 99 */ bl "__ct__19SMemoryCardFileInfoFiRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>"
|
||||
/* 8024EDF8 0024BD58 38 7E 01 00 */ addi r3, r30, 0x100
|
||||
/* 8024EDFC 0024BD5C 38 81 00 78 */ addi r4, r1, 0x78
|
||||
/* 8024EE00 0024BD60 48 00 00 7D */ bl "push_back__Q24rstl89reserved_vector<Q24rstl61pair<Q217CMemoryCardDriver10EFileState,19SMemoryCardFileInfo>,2>FRCQ24rstl61pair<Q217CMemoryCardDriver10EFileState,19SMemoryCardFileInfo>"
|
||||
/* 8024EE00 0024BD60 48 00 00 7D */ bl "push_back__Q24rstl50reserved_vector<Q217CMemoryCardDriver9SFileInfo,2>FRCQ217CMemoryCardDriver9SFileInfo"
|
||||
/* 8024EE04 0024BD64 38 61 00 78 */ addi r3, r1, 0x78
|
||||
/* 8024EE08 0024BD68 38 80 FF FF */ li r4, -1
|
||||
/* 8024EE0C 0024BD6C 4B FF FC 59 */ bl "__dt__Q24rstl29pair<i,19SMemoryCardSlotInfo>Fv"
|
||||
/* 8024EE0C 0024BD6C 4B FF FC 59 */ bl "__dt__Q217CMemoryCardDriver9SFileInfoFv"
|
||||
/* 8024EE10 0024BD70 38 61 00 20 */ addi r3, r1, 0x20
|
||||
/* 8024EE14 0024BD74 48 0E EC CD */ bl "internal_dereference__Q24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>Fv"
|
||||
/* 8024EE18 0024BD78 38 82 B8 B0 */ addi r4, r2, skSaveFileNames@sda21
|
||||
|
@ -3315,13 +3315,13 @@ lbl_8024EDB0:
|
|||
/* 8024EE30 0024BD90 38 61 00 34 */ addi r3, r1, 0x34
|
||||
/* 8024EE34 0024BD94 38 A1 00 10 */ addi r5, r1, 0x10
|
||||
/* 8024EE38 0024BD98 90 01 00 30 */ stw r0, 0x30(r1)
|
||||
/* 8024EE3C 0024BD9C 48 0F F4 51 */ bl __ct__19SMemoryCardFileInfoFiRCQ24rstl6string
|
||||
/* 8024EE3C 0024BD9C 48 0F F4 51 */ bl "__ct__19SMemoryCardFileInfoFiRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>"
|
||||
/* 8024EE40 0024BDA0 38 7E 01 00 */ addi r3, r30, 0x100
|
||||
/* 8024EE44 0024BDA4 38 81 00 30 */ addi r4, r1, 0x30
|
||||
/* 8024EE48 0024BDA8 48 00 00 35 */ bl "push_back__Q24rstl89reserved_vector<Q24rstl61pair<Q217CMemoryCardDriver10EFileState,19SMemoryCardFileInfo>,2>FRCQ24rstl61pair<Q217CMemoryCardDriver10EFileState,19SMemoryCardFileInfo>"
|
||||
/* 8024EE48 0024BDA8 48 00 00 35 */ bl "push_back__Q24rstl50reserved_vector<Q217CMemoryCardDriver9SFileInfo,2>FRCQ217CMemoryCardDriver9SFileInfo"
|
||||
/* 8024EE4C 0024BDAC 38 61 00 30 */ addi r3, r1, 0x30
|
||||
/* 8024EE50 0024BDB0 38 80 FF FF */ li r4, -1
|
||||
/* 8024EE54 0024BDB4 4B FF FC 11 */ bl "__dt__Q24rstl29pair<i,19SMemoryCardSlotInfo>Fv"
|
||||
/* 8024EE54 0024BDB4 4B FF FC 11 */ bl "__dt__Q217CMemoryCardDriver9SFileInfoFv"
|
||||
/* 8024EE58 0024BDB8 38 61 00 10 */ addi r3, r1, 0x10
|
||||
/* 8024EE5C 0024BDBC 48 0E EC 85 */ bl "internal_dereference__Q24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>Fv"
|
||||
/* 8024EE60 0024BDC0 80 01 00 D4 */ lwz r0, 0xd4(r1)
|
||||
|
@ -3332,8 +3332,8 @@ lbl_8024EDB0:
|
|||
/* 8024EE74 0024BDD4 38 21 00 D0 */ addi r1, r1, 0xd0
|
||||
/* 8024EE78 0024BDD8 4E 80 00 20 */ blr
|
||||
|
||||
.global "push_back__Q24rstl89reserved_vector<Q24rstl61pair<Q217CMemoryCardDriver10EFileState,19SMemoryCardFileInfo>,2>FRCQ24rstl61pair<Q217CMemoryCardDriver10EFileState,19SMemoryCardFileInfo>"
|
||||
"push_back__Q24rstl89reserved_vector<Q24rstl61pair<Q217CMemoryCardDriver10EFileState,19SMemoryCardFileInfo>,2>FRCQ24rstl61pair<Q217CMemoryCardDriver10EFileState,19SMemoryCardFileInfo>":
|
||||
.global "push_back__Q24rstl50reserved_vector<Q217CMemoryCardDriver9SFileInfo,2>FRCQ217CMemoryCardDriver9SFileInfo"
|
||||
"push_back__Q24rstl50reserved_vector<Q217CMemoryCardDriver9SFileInfo,2>FRCQ217CMemoryCardDriver9SFileInfo":
|
||||
/* 8024EE7C 0024BDDC 94 21 FF F0 */ stwu r1, -0x10(r1)
|
||||
/* 8024EE80 0024BDE0 7C 08 02 A6 */ mflr r0
|
||||
/* 8024EE84 0024BDE4 90 01 00 14 */ stw r0, 0x14(r1)
|
||||
|
|
|
@ -17,8 +17,8 @@ struct SMemoryCardFileInfo {
|
|||
CMemoryCardSys::CardFileHandle x0_fileInfo;
|
||||
|
||||
rstl::string x14_name;
|
||||
rstl::vector< u8 > x24_saveFileData;
|
||||
rstl::vector< u8 > x34_saveData;
|
||||
rstl::vector< uchar > x24_saveFileData;
|
||||
rstl::vector< char > x34_saveData;
|
||||
|
||||
SMemoryCardFileInfo(int cardPort, const rstl::string& name);
|
||||
SMemoryCardFileInfo(const SMemoryCardFileInfo& other)
|
||||
|
@ -26,6 +26,7 @@ struct SMemoryCardFileInfo {
|
|||
, x14_name(other.x14_name)
|
||||
, x24_saveFileData(other.x24_saveFileData)
|
||||
, x34_saveData(other.x34_saveData) {}
|
||||
~SMemoryCardFileInfo() {}
|
||||
|
||||
ECardResult Open();
|
||||
ECardResult Close();
|
||||
|
@ -117,6 +118,17 @@ public:
|
|||
};
|
||||
enum EFileState { kFS_Unknown, kFS_NoFile, kFS_File, kFS_BadFile };
|
||||
|
||||
struct SFileInfo {
|
||||
EFileState first;
|
||||
SMemoryCardFileInfo second;
|
||||
|
||||
SFileInfo(EFileState state, int cardPort, const rstl::string& name)
|
||||
: first(state)
|
||||
, second(cardPort, name)
|
||||
{}
|
||||
~SFileInfo();
|
||||
};
|
||||
|
||||
private:
|
||||
CMemoryCardSys::EMemoryCardPort x0_cardPort;
|
||||
CAssetId x4_saveBanner;
|
||||
|
@ -130,7 +142,7 @@ private:
|
|||
long long x28_cardSerial;
|
||||
rstl::reserved_vector< u8, 174 > x30_systemData;
|
||||
rstl::reserved_vector< rstl::auto_ptr< SGameFileSlot >, 3 > xe4_fileSlots;
|
||||
rstl::reserved_vector< rstl::pair< EFileState, SMemoryCardFileInfo >, 2 > x100_mcFileInfos;
|
||||
rstl::reserved_vector< SFileInfo, 2 > x100_mcFileInfos;
|
||||
int x194_fileIdx;
|
||||
rstl::single_ptr< CMemoryCardSys::CCardFileInfo > x198_fileInfo;
|
||||
bool x19c_;
|
||||
|
|
|
@ -43,15 +43,17 @@ CMemoryCardDriver::CMemoryCardDriver(CMemoryCardSys::EMemoryCardPort cardPort, C
|
|||
, x19d_importPersistent(importPersistent) {
|
||||
lbl_805A9118 = true;
|
||||
|
||||
x100_mcFileInfos.push_back(rstl::pair< EFileState, SMemoryCardFileInfo >(
|
||||
kFS_Unknown, SMemoryCardFileInfo(x0_cardPort, rstl::string_l(skSaveFileNames[0]))));
|
||||
x100_mcFileInfos.push_back(
|
||||
SFileInfo(kFS_Unknown, x0_cardPort, rstl::string_l(skSaveFileNames[0])));
|
||||
|
||||
x100_mcFileInfos.push_back(rstl::pair< EFileState, SMemoryCardFileInfo >(
|
||||
kFS_Unknown, SMemoryCardFileInfo(x0_cardPort, rstl::string_l(skSaveFileNames[1]))));
|
||||
x100_mcFileInfos.push_back(
|
||||
SFileInfo(kFS_Unknown, x0_cardPort, rstl::string_l(skSaveFileNames[1])));
|
||||
}
|
||||
|
||||
void CMemoryCardDriver::ClearFileInfo() { x198_fileInfo = nullptr; }
|
||||
|
||||
CMemoryCardDriver::SFileInfo::~SFileInfo() {}
|
||||
|
||||
CMemoryCardDriver::~CMemoryCardDriver() {
|
||||
CMemoryCardSys::UnmountCard(x0_cardPort);
|
||||
lbl_805A9118 = false;
|
||||
|
@ -451,7 +453,7 @@ void CMemoryCardDriver::NoCardFound() {
|
|||
void CMemoryCardDriver::IndexFiles() {
|
||||
x14_error = kE_OK;
|
||||
for (int i = 0; i < x100_mcFileInfos.capacity(); ++i) {
|
||||
rstl::pair< EFileState, SMemoryCardFileInfo >& info = x100_mcFileInfos[i];
|
||||
SFileInfo& info = x100_mcFileInfos[i];
|
||||
if (info.first == kFS_Unknown) {
|
||||
ECardResult result = info.second.Open();
|
||||
if (result == kCR_NOFILE) {
|
||||
|
@ -527,7 +529,7 @@ void CMemoryCardDriver::StartFileDeleteBad() {
|
|||
x10_state = kS_FileDeleteBad;
|
||||
|
||||
for (int idx = 0; idx < x100_mcFileInfos.capacity(); ++idx) {
|
||||
rstl::pair< EFileState, SMemoryCardFileInfo >& info = x100_mcFileInfos[idx];
|
||||
SFileInfo& info = x100_mcFileInfos[idx];
|
||||
if (info.first == kFS_BadFile) {
|
||||
x194_fileIdx = idx;
|
||||
ECardResult result = CMemoryCardSys::FastDeleteFile(x0_cardPort, info.second.GetFileNo());
|
||||
|
@ -580,7 +582,8 @@ void CMemoryCardDriver::StartFileCreate() {
|
|||
}
|
||||
|
||||
x194_fileIdx = 0;
|
||||
x198_fileInfo = new CMemoryCardSys::CCardFileInfo(x0_cardPort, rstl::string_l(skSaveFileNames[x194_fileIdx]));
|
||||
x198_fileInfo =
|
||||
new CMemoryCardSys::CCardFileInfo(x0_cardPort, rstl::string_l(skSaveFileNames[x194_fileIdx]));
|
||||
InitializeFileInfo();
|
||||
ECardResult result = x198_fileInfo->CreateFile();
|
||||
if (result != kCR_READY)
|
||||
|
@ -613,7 +616,8 @@ void CMemoryCardDriver::StartFileCreateTransactional() {
|
|||
}
|
||||
|
||||
x194_fileIdx = altFileIdx;
|
||||
x198_fileInfo = new CMemoryCardSys::CCardFileInfo(x0_cardPort, rstl::string_l(skSaveFileNames[x194_fileIdx]));
|
||||
x198_fileInfo =
|
||||
new CMemoryCardSys::CCardFileInfo(x0_cardPort, rstl::string_l(skSaveFileNames[x194_fileIdx]));
|
||||
InitializeFileInfo();
|
||||
ECardResult result = x198_fileInfo->CreateFile();
|
||||
if (result != kCR_READY)
|
||||
|
|
Loading…
Reference in New Issue