prime/include/Kyoto/CMemoryCardSys.hpp

70 lines
1.4 KiB
C++
Raw Normal View History

#ifndef _CMEMORYCARDSYS
#define _CMEMORYCARDSYS
#include "types.h"
2022-10-10 19:58:03 +00:00
// TODO: likely comes from dolphin sdk
2022-10-10 23:02:10 +00:00
enum ECardResult {
kCR_CRC_MISMATCH = -1003, /* Extension enum for Retro's CRC check */
kCR_FATAL_ERROR = -128,
kCR_ENCODING = -13,
kCR_NAMETOOLONG = -12,
kCR_INSSPACE = -9,
kCR_NOENT = -8,
kCR_EXIST = -7,
kCR_BROKEN = -6,
kCR_IOERROR = -5,
kCR_NOFILE = -4,
kCR_NOCARD = -3,
kCR_WRONGDEVICE = -2,
kCR_BUSY = -1,
kCR_READY = 0
};
2022-10-10 22:53:28 +00:00
struct FileHandle {
u8 x0_pad[0x10];
};
struct ProbeResults {
ECardResult x0_error;
2022-10-11 09:41:19 +00:00
int x4_cardSize; /* in megabits */
int x8_sectorSize; /* in bytes */
2022-10-10 22:53:28 +00:00
};
2022-10-10 19:58:03 +00:00
class CMemoryCardSys {
public:
2022-10-10 22:53:28 +00:00
enum EMemoryCardPort { kCS_SlotA, kCS_SlotB };
2022-10-10 19:58:03 +00:00
struct CardFileHandle {
2022-10-10 22:53:28 +00:00
EMemoryCardPort slot;
2022-10-10 19:58:03 +00:00
FileHandle handle;
2022-10-10 22:53:28 +00:00
CardFileHandle(EMemoryCardPort slot) : slot(slot) {}
2022-10-10 19:58:03 +00:00
int getFileNo() const;
};
2022-10-10 22:53:28 +00:00
class CCardFileInfo {
uchar pad[0x114];
public:
~CCardFileInfo();
2022-10-11 04:00:52 +00:00
ECardResult PumpCardTransfer();
ECardResult CloseFile();
2022-10-10 22:53:28 +00:00
};
2022-10-10 19:58:03 +00:00
CMemoryCardSys();
~CMemoryCardSys();
2022-10-10 22:53:28 +00:00
static ECardResult GetResultCode(int);
static ProbeResults IsMemoryCardInserted(EMemoryCardPort);
2022-10-10 23:08:19 +00:00
static ECardResult GetSerialNo(EMemoryCardPort port, long long& serialOut);
2022-10-11 04:00:52 +00:00
static void UnmountCard(EMemoryCardPort);
static ECardResult Rename(EMemoryCardPort, const rstl::string&, const rstl::string&);
2022-10-10 22:53:28 +00:00
void Initialize();
private:
// TODO
};
#endif // _CMEMORYCARDSYS