Improve CMemoryCardDriver::InitializeFileInfo

Former-commit-id: fdd31b8283
This commit is contained in:
Henrique Gemignani Passos Lima 2022-10-11 20:32:10 +03:00
parent eb781ef4ea
commit 3249380a37
4 changed files with 11 additions and 9 deletions

View File

@ -970,8 +970,8 @@ lbl_8034E0F0:
/* 8034E100 0034B060 38 21 00 30 */ addi r1, r1, 0x30 /* 8034E100 0034B060 38 21 00 30 */ addi r1, r1, 0x30
/* 8034E104 0034B064 4E 80 00 20 */ blr /* 8034E104 0034B064 4E 80 00 20 */ blr
.global LockBannerToken__13CCardFileInfoFiR11CSimplePool .global LockBannerToken__13CCardFileInfoFUiR11CSimplePool
LockBannerToken__13CCardFileInfoFiR11CSimplePool: LockBannerToken__13CCardFileInfoFUiR11CSimplePool:
/* 8034E108 0034B068 94 21 FF D0 */ stwu r1, -0x30(r1) /* 8034E108 0034B068 94 21 FF D0 */ stwu r1, -0x30(r1)
/* 8034E10C 0034B06C 7C 08 02 A6 */ mflr r0 /* 8034E10C 0034B06C 7C 08 02 A6 */ mflr r0
/* 8034E110 0034B070 90 01 00 34 */ stw r0, 0x34(r1) /* 8034E110 0034B070 90 01 00 34 */ stw r0, 0x34(r1)

View File

@ -1258,7 +1258,7 @@ InitializeFileInfo__17CMemoryCardDriverFv:
/* 8024D2B8 0024A218 80 9E 00 04 */ lwz r4, 4(r30) /* 8024D2B8 0024A218 80 9E 00 04 */ lwz r4, 4(r30)
/* 8024D2BC 0024A21C 7F E3 FB 78 */ mr r3, r31 /* 8024D2BC 0024A21C 7F E3 FB 78 */ mr r3, r31
/* 8024D2C0 0024A220 80 AD A0 64 */ lwz r5, gpSimplePool@sda21(r13) /* 8024D2C0 0024A220 80 AD A0 64 */ lwz r5, gpSimplePool@sda21(r13)
/* 8024D2C4 0024A224 48 10 0E 45 */ bl LockBannerToken__13CCardFileInfoFiR11CSimplePool /* 8024D2C4 0024A224 48 10 0E 45 */ bl LockBannerToken__13CCardFileInfoFUiR11CSimplePool
/* 8024D2C8 0024A228 80 9E 00 08 */ lwz r4, 8(r30) /* 8024D2C8 0024A228 80 9E 00 08 */ lwz r4, 8(r30)
/* 8024D2CC 0024A22C 7F E3 FB 78 */ mr r3, r31 /* 8024D2CC 0024A22C 7F E3 FB 78 */ mr r3, r31
/* 8024D2D0 0024A230 80 CD A0 64 */ lwz r6, gpSimplePool@sda21(r13) /* 8024D2D0 0024A230 80 CD A0 64 */ lwz r6, gpSimplePool@sda21(r13)

View File

@ -95,6 +95,7 @@ public:
basic_string& operator=(const basic_string&); basic_string& operator=(const basic_string&);
basic_string operator+(const basic_string&); basic_string operator+(const basic_string&);
basic_string operator+(const _CharTp*);
const char* data() const { return x0_ptr; } const char* data() const { return x0_ptr; }
}; };

View File

@ -645,8 +645,11 @@ void CMemoryCardDriver::StartCardFormat() {
} }
void CMemoryCardDriver::InitializeFileInfo() { void CMemoryCardDriver::InitializeFileInfo() {
CCardFileInfo& fileInfo = *x198_fileInfo;
ExportPersistentOptions(); ExportPersistentOptions();
const char nameConstant[33] = "Metroid Prime ";
OSCalendarTime time; OSCalendarTime time;
OSTicksToCalendarTime(OSGetTime(), &time); OSTicksToCalendarTime(OSGetTime(), &time);
@ -655,12 +658,10 @@ void CMemoryCardDriver::InitializeFileInfo() {
sprintf(nameBuffer, "%02d.%02d.%02d %02d:%02d", time.x10_mon + 1, time.xc_mday, sprintf(nameBuffer, "%02d.%02d.%02d %02d:%02d", time.x10_mon + 1, time.xc_mday,
time.x14_year % 100, time.x8_hour, time.x4_min); time.x14_year % 100, time.x8_hour, time.x4_min);
x198_fileInfo->SetComment(rstl::string_l("Metroid Prime ") + nameBuffer); fileInfo.SetComment(rstl::string_l(nameConstant) + nameBuffer);
fileInfo.LockBannerToken(x4_saveBanner, *gpSimplePool);
x198_fileInfo->LockBannerToken(x4_saveBanner, *gpSimplePool); fileInfo.LockIconToken(x8_saveIcon0, 2, *gpSimplePool);
x198_fileInfo->LockIconToken(x8_saveIcon0, 2, *gpSimplePool); CMemoryStreamOut w = fileInfo.BeginMemoryOut(3004);
CMemoryStreamOut w = x198_fileInfo->BeginMemoryOut(3004);
SSaveHeader header(0); SSaveHeader header(0);
for (int i = 0; i < xe4_fileSlots.capacity(); ++i) { for (int i = 0; i < xe4_fileSlots.capacity(); ++i) {