mirror of https://github.com/PrimeDecomp/prime.git
parent
e9d1f43c65
commit
2680a196e3
|
@ -883,8 +883,8 @@ DeleteFile__14CMemoryCardSysFiPCc:
|
|||
/* 8034DFD0 0034AF30 38 21 00 10 */ addi r1, r1, 0x10
|
||||
/* 8034DFD4 0034AF34 4E 80 00 20 */ blr
|
||||
|
||||
.global "CreateFile__14CMemoryCardSysFQ214CMemoryCardSys15EMemoryCardPortRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>UiRQ214CMemoryCardSys13CCardFileInfo"
|
||||
"CreateFile__14CMemoryCardSysFQ214CMemoryCardSys15EMemoryCardPortRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>UiRQ214CMemoryCardSys13CCardFileInfo":
|
||||
.global CreateFile__13CCardFileInfoFv
|
||||
CreateFile__13CCardFileInfoFv:
|
||||
/* 8034DFD8 0034AF38 94 21 FF F0 */ stwu r1, -0x10(r1)
|
||||
/* 8034DFDC 0034AF3C 7C 08 02 A6 */ mflr r0
|
||||
/* 8034DFE0 0034AF40 90 01 00 14 */ stw r0, 0x14(r1)
|
||||
|
@ -1036,8 +1036,8 @@ lbl_8034E1C8:
|
|||
/* 8034E1F0 0034B150 38 21 00 30 */ addi r1, r1, 0x30
|
||||
/* 8034E1F4 0034B154 4E 80 00 20 */ blr
|
||||
|
||||
.global __ct__13CCardFileInfoFRCQ24rstl6string
|
||||
__ct__13CCardFileInfoFRCQ24rstl6string:
|
||||
.global "__ct__13CCardFileInfoF15EMemoryCardPortRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>"
|
||||
"__ct__13CCardFileInfoF15EMemoryCardPortRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>":
|
||||
/* 8034E1F8 0034B158 94 21 FF F0 */ stwu r1, -0x10(r1)
|
||||
/* 8034E1FC 0034B15C 7C 08 02 A6 */ mflr r0
|
||||
/* 8034E200 0034B160 90 01 00 14 */ stw r0, 0x14(r1)
|
||||
|
|
|
@ -1470,7 +1470,7 @@ lbl_8024D568:
|
|||
/* 8024D5B8 0024A518 7F C3 F3 78 */ mr r3, r30
|
||||
/* 8024D5BC 0024A51C 38 A1 00 08 */ addi r5, r1, 8
|
||||
/* 8024D5C0 0024A520 3B A0 00 01 */ li r29, 1
|
||||
/* 8024D5C4 0024A524 48 10 0C 35 */ bl __ct__13CCardFileInfoFRCQ24rstl6string
|
||||
/* 8024D5C4 0024A524 48 10 0C 35 */ bl "__ct__13CCardFileInfoF15EMemoryCardPortRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>"
|
||||
/* 8024D5C8 0024A528 7C 7E 1B 78 */ mr r30, r3
|
||||
lbl_8024D5CC:
|
||||
/* 8024D5CC 0024A52C 7F C4 F3 78 */ mr r4, r30
|
||||
|
@ -1484,7 +1484,7 @@ lbl_8024D5E8:
|
|||
/* 8024D5E8 0024A548 7F E3 FB 78 */ mr r3, r31
|
||||
/* 8024D5EC 0024A54C 4B FF FB C5 */ bl InitializeFileInfo__17CMemoryCardDriverFv
|
||||
/* 8024D5F0 0024A550 80 7F 01 98 */ lwz r3, 0x198(r31)
|
||||
/* 8024D5F4 0024A554 48 10 09 E5 */ bl "CreateFile__14CMemoryCardSysFQ214CMemoryCardSys15EMemoryCardPortRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>UiRQ214CMemoryCardSys13CCardFileInfo"
|
||||
/* 8024D5F4 0024A554 48 10 09 E5 */ bl CreateFile__13CCardFileInfoFv
|
||||
/* 8024D5F8 0024A558 7C 64 1B 79 */ or. r4, r3, r3
|
||||
/* 8024D5FC 0024A55C 41 82 00 0C */ beq lbl_8024D608
|
||||
/* 8024D600 0024A560 7F E3 FB 78 */ mr r3, r31
|
||||
|
@ -1704,7 +1704,7 @@ lbl_8024D898:
|
|||
/* 8024D8DC 0024A83C 7F C3 F3 78 */ mr r3, r30
|
||||
/* 8024D8E0 0024A840 38 A1 00 08 */ addi r5, r1, 8
|
||||
/* 8024D8E4 0024A844 3B A0 00 01 */ li r29, 1
|
||||
/* 8024D8E8 0024A848 48 10 09 11 */ bl __ct__13CCardFileInfoFRCQ24rstl6string
|
||||
/* 8024D8E8 0024A848 48 10 09 11 */ bl "__ct__13CCardFileInfoF15EMemoryCardPortRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>"
|
||||
/* 8024D8EC 0024A84C 7C 7E 1B 78 */ mr r30, r3
|
||||
lbl_8024D8F0:
|
||||
/* 8024D8F0 0024A850 7F C4 F3 78 */ mr r4, r30
|
||||
|
@ -1718,7 +1718,7 @@ lbl_8024D90C:
|
|||
/* 8024D90C 0024A86C 7F E3 FB 78 */ mr r3, r31
|
||||
/* 8024D910 0024A870 4B FF F8 A1 */ bl InitializeFileInfo__17CMemoryCardDriverFv
|
||||
/* 8024D914 0024A874 80 7F 01 98 */ lwz r3, 0x198(r31)
|
||||
/* 8024D918 0024A878 48 10 06 C1 */ bl "CreateFile__14CMemoryCardSysFQ214CMemoryCardSys15EMemoryCardPortRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>UiRQ214CMemoryCardSys13CCardFileInfo"
|
||||
/* 8024D918 0024A878 48 10 06 C1 */ bl CreateFile__13CCardFileInfoFv
|
||||
/* 8024D91C 0024A87C 7C 64 1B 79 */ or. r4, r3, r3
|
||||
/* 8024D920 0024A880 41 82 00 0C */ beq lbl_8024D92C
|
||||
/* 8024D924 0024A884 7F E3 FB 78 */ mr r3, r31
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
#ifndef _CMEMORYCARDSYS
|
||||
#define _CMEMORYCARDSYS
|
||||
|
||||
#include "types.h"
|
||||
#include "string.h"
|
||||
#include "types.h"
|
||||
|
||||
#include "rstl/string.hpp"
|
||||
|
||||
// TODO: likely comes from dolphin sdk
|
||||
enum ECardResult {
|
||||
enum ECardResult {
|
||||
kCR_CRC_MISMATCH = -1003, /* Extension enum for Retro's CRC check */
|
||||
kCR_FATAL_ERROR = -128,
|
||||
kCR_ENCODING = -13,
|
||||
|
@ -21,6 +23,8 @@ enum ECardResult {
|
|||
kCR_BUSY = -1,
|
||||
kCR_READY = 0
|
||||
};
|
||||
enum EMemoryCardPort { kCS_SlotA, kCS_SlotB };
|
||||
|
||||
struct FileHandle {
|
||||
u8 x0_pad[0x10];
|
||||
};
|
||||
|
@ -34,19 +38,26 @@ struct ProbeResults {
|
|||
struct CardStat {
|
||||
u8 x0_pad[0x6c];
|
||||
|
||||
CardStat()
|
||||
{
|
||||
memset(this, 0, sizeof(CardStat));
|
||||
}
|
||||
CardStat() { memset(this, 0, sizeof(CardStat)); }
|
||||
|
||||
int GetTime() const;
|
||||
int GetCommentAddr() const;
|
||||
};
|
||||
|
||||
class CCardFileInfo {
|
||||
uchar pad[0x114];
|
||||
|
||||
public:
|
||||
CCardFileInfo(EMemoryCardPort port, const rstl::string& name);
|
||||
~CCardFileInfo();
|
||||
|
||||
ECardResult PumpCardTransfer();
|
||||
ECardResult CreateFile();
|
||||
ECardResult CloseFile();
|
||||
};
|
||||
|
||||
class CMemoryCardSys {
|
||||
public:
|
||||
enum EMemoryCardPort { kCS_SlotA, kCS_SlotB };
|
||||
|
||||
struct CardFileHandle {
|
||||
EMemoryCardPort slot;
|
||||
FileHandle handle;
|
||||
|
@ -54,16 +65,6 @@ public:
|
|||
int GetFileNo() const;
|
||||
};
|
||||
|
||||
class CCardFileInfo {
|
||||
uchar pad[0x114];
|
||||
|
||||
public:
|
||||
~CCardFileInfo();
|
||||
|
||||
ECardResult PumpCardTransfer();
|
||||
ECardResult CloseFile();
|
||||
};
|
||||
|
||||
CMemoryCardSys();
|
||||
~CMemoryCardSys();
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ struct SMemoryCardFileInfo {
|
|||
|
||||
ECardResult Open();
|
||||
ECardResult Close();
|
||||
CMemoryCardSys::EMemoryCardPort GetFileCardPort() const { return x0_fileInfo.slot; }
|
||||
EMemoryCardPort GetFileCardPort() const { return x0_fileInfo.slot; }
|
||||
int GetFileNo() const; // { return x0_fileInfo.GetFileNo(); }
|
||||
ECardResult StartRead();
|
||||
ECardResult TryFileRead();
|
||||
|
@ -104,7 +104,7 @@ private:
|
|||
// void DoPut(CMemoryStreamOut& w) const { w.Put(x0_saveBuffer.data(), x0_saveBuffer.size()); }
|
||||
};
|
||||
|
||||
CMemoryCardSys::EMemoryCardPort x0_cardPort;
|
||||
EMemoryCardPort x0_cardPort;
|
||||
CAssetId x4_saveBanner;
|
||||
CAssetId x8_saveIcon0;
|
||||
CAssetId xc_saveIcon1;
|
||||
|
@ -118,14 +118,14 @@ private:
|
|||
rstl::reserved_vector< rstl::auto_ptr< SGameFileSlot >, 3 > xe4_fileSlots;
|
||||
rstl::reserved_vector< rstl::pair< EFileState, SMemoryCardFileInfo >, 2 > x100_mcFileInfos;
|
||||
int x194_fileIdx;
|
||||
rstl::single_ptr< CMemoryCardSys::CCardFileInfo > x198_fileInfo;
|
||||
rstl::single_ptr< CCardFileInfo > x198_fileInfo;
|
||||
bool x19c_;
|
||||
bool x19d_importPersistent;
|
||||
|
||||
public:
|
||||
static bool IsCardBusy(EState);
|
||||
static bool IsCardWriting(EState);
|
||||
CMemoryCardDriver(CMemoryCardSys::EMemoryCardPort cardPort, CAssetId saveBanner,
|
||||
CMemoryCardDriver(EMemoryCardPort cardPort, CAssetId saveBanner,
|
||||
CAssetId saveIcon0, CAssetId saveIcon1, bool importPersistent);
|
||||
void ClearFileInfo();
|
||||
~CMemoryCardDriver();
|
||||
|
|
|
@ -17,7 +17,7 @@ bool CMemoryCardDriver::IsCardWriting(EState v) {
|
|||
return true;
|
||||
}
|
||||
|
||||
CMemoryCardDriver::CMemoryCardDriver(CMemoryCardSys::EMemoryCardPort cardPort, CAssetId saveBanner,
|
||||
CMemoryCardDriver::CMemoryCardDriver(EMemoryCardPort cardPort, CAssetId saveBanner,
|
||||
CAssetId saveIcon0, CAssetId saveIcon1, bool importPersistent)
|
||||
: x0_cardPort(cardPort)
|
||||
, x4_saveBanner(saveBanner)
|
||||
|
@ -563,7 +563,22 @@ void CMemoryCardDriver::StartFileRead() {
|
|||
UpdateFileRead(result);
|
||||
}
|
||||
|
||||
void CMemoryCardDriver::StartFileCreate() {}
|
||||
void CMemoryCardDriver::StartFileCreate() {
|
||||
x14_error = kE_OK;
|
||||
x10_state = kS_FileCreate;
|
||||
if (x18_cardFreeBytes < 0x4000 || x1c_cardFreeFiles < 2) {
|
||||
x10_state = kS_FileCreateFailed;
|
||||
x14_error = kE_CardFull;
|
||||
return;
|
||||
}
|
||||
|
||||
x194_fileIdx = 0;
|
||||
x198_fileInfo = new CCardFileInfo(x0_cardPort, rstl::string_l(skSaveFileNames[x194_fileIdx]));
|
||||
InitializeFileInfo();
|
||||
ECardResult result = x198_fileInfo->CreateFile();
|
||||
if (result != kCR_READY)
|
||||
UpdateFileCreate(result);
|
||||
}
|
||||
|
||||
void CMemoryCardDriver::StartFileWrite() {}
|
||||
|
||||
|
|
Loading…
Reference in New Issue