mirror of
https://github.com/izzy2lost/WeeU.git
synced 2026-07-06 00:19:59 -07:00
coreinit: Refactor FS functions to be more accurate (#842)
This commit is contained in:
@@ -4,48 +4,83 @@ enum class FS_RESULT : sint32 // aka FSStatus
|
||||
{
|
||||
SUCCESS = 0,
|
||||
END_ITERATION = -2, // used by FSGetMountSource / FSGetMountSourceNext to indicate when last element was reached
|
||||
FATAL_ERROR = -0x400,
|
||||
|
||||
MAX_HANDLES = -3,
|
||||
ALREADY_EXISTS = -5,
|
||||
NOT_FOUND = -6,
|
||||
NOT_FILE = -7,
|
||||
NOT_DIR = -8,
|
||||
PERMISSION_ERROR = -10,
|
||||
|
||||
INVALID_CLIENT_HANDLE = -0x30000 - 37,
|
||||
|
||||
FATAL_ERROR = -0x400,
|
||||
ERR_PLACEHOLDER = -9999, // used when exact error code has yet to be determined
|
||||
};
|
||||
|
||||
enum class FSA_RESULT : sint32 // aka FSError/FSAStatus
|
||||
{
|
||||
SUCCESS = 0,
|
||||
INVALID_CLIENT_HANDLE = -0x30000 - 37,
|
||||
INVALID_HANDLE_UKN38 = -0x30000 - 38,
|
||||
END_DIR = -0x30000 - 0x04,
|
||||
END_FILE = -0x30000 - 0x05,
|
||||
MAX_FILES = -0x30000 - 0x13,
|
||||
MAX_DIRS = -0x30000 - 0x14,
|
||||
ALREADY_EXISTS = -0x30000 - 0x16,
|
||||
NOT_FOUND = -0x30000 - 0x17,
|
||||
PERMISSION_ERROR = -0x30000 - 0x1A,
|
||||
INVALID_PARAM = -0x30000 - 0x21,
|
||||
INVALID_PATH = -0x30000 - 0x22,
|
||||
INVALID_BUFFER = -0x30000 - 0x23,
|
||||
INVALID_ALIGNMENT = -0x30000 - 0x24,
|
||||
INVALID_CLIENT_HANDLE = -0x30000 - 0x25,
|
||||
INVALID_FILE_HANDLE = -0x30000 - 0x26,
|
||||
INVALID_DIR_HANDLE = -0x30000 - 0x27,
|
||||
NOT_FILE = -0x30000 - 0x28,
|
||||
NOT_DIR = -0x30000 - 0x29,
|
||||
FATAL_ERROR = -0x30000 - 0x400,
|
||||
};
|
||||
// todo - error handling in the IOSU part is pretty hacky right now and we use FS_RESULT in most places which we shouldn't be doing. Rework it
|
||||
|
||||
enum class FSA_CMD_OPERATION_TYPE : uint32
|
||||
{
|
||||
CHANGEDIR = 0x5,
|
||||
GETCWD = 0x6,
|
||||
MAKEDIR = 0x7,
|
||||
REMOVE = 0x8,
|
||||
RENAME = 0x9,
|
||||
OPENDIR = 0xA,
|
||||
READDIR = 0xB,
|
||||
CLOSEDIR = 0xD,
|
||||
OPENFILE = 0xE,
|
||||
READ = 0xF,
|
||||
WRITE = 0x10,
|
||||
GETPOS = 0x11,
|
||||
SETPOS = 0x12,
|
||||
ISEOF = 0x13,
|
||||
GETSTATFILE = 0x14,
|
||||
CLOSEFILE = 0x15,
|
||||
QUERYINFO = 0x18,
|
||||
APPENDFILE = 0x19,
|
||||
TRUNCATEFILE = 0x1A,
|
||||
FLUSHQUOTA = 0x1E,
|
||||
};
|
||||
|
||||
using FSResHandle = sint32;
|
||||
using FSFileHandle2 = FSResHandle;
|
||||
using FSDirHandle2 = FSResHandle;
|
||||
#define FS_INVALID_HANDLE_VALUE -1
|
||||
#define FS_INVALID_HANDLE_VALUE -1
|
||||
|
||||
#define FSA_FILENAME_SIZE_MAX 128
|
||||
#define FSA_PATH_SIZE_MAX (512 + FSA_FILENAME_SIZE_MAX)
|
||||
#define FSA_CMD_PATH_MAX_LENGTH FSA_PATH_SIZE_MAX
|
||||
#define FSA_MAX_CLIENTS 32
|
||||
#define FSA_FILENAME_SIZE_MAX 128
|
||||
#define FSA_PATH_SIZE_MAX (512 + FSA_FILENAME_SIZE_MAX)
|
||||
#define FSA_CMD_PATH_MAX_LENGTH FSA_PATH_SIZE_MAX
|
||||
#define FSA_MAX_CLIENTS 32
|
||||
|
||||
typedef sint32 FSStatus; // DEPR - replaced by FS_RESULT
|
||||
typedef uint32 FS_ERROR_MASK; // replace with enum bitmask
|
||||
typedef uint32 FSFileSize;
|
||||
typedef uint64 FSLargeSize;
|
||||
typedef uint64 FSTime;
|
||||
typedef sint32 FSStatus; // DEPR - replaced by FS_RESULT
|
||||
typedef uint32 FS_ERROR_MASK; // replace with enum bitmask
|
||||
typedef uint32 FSFileSize;
|
||||
typedef uint64 FSLargeSize;
|
||||
typedef uint64 FSTime;
|
||||
|
||||
enum class FSFlag : uint32
|
||||
{
|
||||
NONE = 0,
|
||||
IS_DIR = 0x80000000,
|
||||
NONE = 0,
|
||||
IS_DIR = 0x80000000,
|
||||
};
|
||||
DEFINE_ENUM_FLAG_OPERATORS(FSFlag);
|
||||
|
||||
@@ -53,25 +88,25 @@ DEFINE_ENUM_FLAG_OPERATORS(FSFlag);
|
||||
|
||||
struct FSStat_t
|
||||
{
|
||||
/* +0x000 */ betype<FSFlag> flag;
|
||||
/* +0x004 */ uint32be permissions;
|
||||
/* +0x008 */ uint32be ownerId;
|
||||
/* +0x00C */ uint32be groupId;
|
||||
/* +0x010 */ betype<FSFileSize> size;
|
||||
/* +0x014 */ betype<FSFileSize> allocatedSize;
|
||||
/* +0x018 */ betype<FSLargeSize> quotaSize;
|
||||
/* +0x020 */ uint32be entryId;
|
||||
/* +0x024 */ betype<FSTime> createdTime;
|
||||
/* +0x02C */ betype<FSTime> modifiedTime;
|
||||
/* +0x034 */ uint8 attributes[0x30];
|
||||
/* +0x000 */ betype<FSFlag> flag;
|
||||
/* +0x004 */ uint32be permissions;
|
||||
/* +0x008 */ uint32be ownerId;
|
||||
/* +0x00C */ uint32be groupId;
|
||||
/* +0x010 */ betype<FSFileSize> size;
|
||||
/* +0x014 */ betype<FSFileSize> allocatedSize;
|
||||
/* +0x018 */ betype<FSLargeSize> quotaSize;
|
||||
/* +0x020 */ uint32be entryId;
|
||||
/* +0x024 */ betype<FSTime> createdTime;
|
||||
/* +0x02C */ betype<FSTime> modifiedTime;
|
||||
/* +0x034 */ uint8 attributes[0x30];
|
||||
};
|
||||
|
||||
static_assert(sizeof(FSStat_t) == 0x64);
|
||||
|
||||
struct FSDirEntry_t
|
||||
{
|
||||
/* +0x00 */ FSStat_t stat;
|
||||
/* +0x64 */ char name[FSA_FILENAME_SIZE_MAX];
|
||||
/* +0x00 */ FSStat_t stat;
|
||||
/* +0x64 */ char name[FSA_FILENAME_SIZE_MAX];
|
||||
};
|
||||
|
||||
static_assert(sizeof(FSDirEntry_t) == 0xE4);
|
||||
@@ -79,5 +114,5 @@ static_assert(sizeof(FSDirEntry_t) == 0xE4);
|
||||
#pragma pack()
|
||||
|
||||
// query types for QueryInfo
|
||||
#define FSA_QUERY_TYPE_FREESPACE 0
|
||||
#define FSA_QUERY_TYPE_STAT 5
|
||||
#define FSA_QUERY_TYPE_FREESPACE 0
|
||||
#define FSA_QUERY_TYPE_STAT 5
|
||||
|
||||
+293
-262
File diff suppressed because it is too large
Load Diff
+139
-104
@@ -1,162 +1,197 @@
|
||||
#pragma once
|
||||
#include <IOSU/iosu_ipc_common.h>
|
||||
#include "fsa_types.h"
|
||||
|
||||
namespace iosu
|
||||
{
|
||||
namespace fsa
|
||||
{
|
||||
struct FSAIpcCommand
|
||||
|
||||
struct FSARequest
|
||||
{
|
||||
uint32be ukn0;
|
||||
union
|
||||
{
|
||||
uint8 ukn04[0x51C];
|
||||
struct
|
||||
{
|
||||
uint32 ukn0000;
|
||||
uint32 destBufferMPTR; // used as fileHandle for FSSetFilePosAsync
|
||||
uint32 ukn0008; // used as filePos for FSSetFilePosAsync
|
||||
uint32 ukn000C;
|
||||
uint32 transferFilePos; // used as filePos for read/write operation
|
||||
uint32 fileHandle;
|
||||
uint32 cmdFlag;
|
||||
uint32 ukn001C;
|
||||
uint8 ukn0020[0x10];
|
||||
uint8 ukn0030[0x10];
|
||||
uint8 ukn0040[0x10];
|
||||
uint8 ukn0050[0x10];
|
||||
uint8 ukn0060[0x10];
|
||||
uint8 ukn0070[0x10];
|
||||
uint8 ukn0080[0x10];
|
||||
uint8 ukn0090[0x10];
|
||||
uint8 ukn00A0[0x10];
|
||||
uint8 ukn00B0[0x10];
|
||||
uint8 ukn00C0[0x10];
|
||||
uint8 ukn00D0[0x10];
|
||||
uint8 ukn00E0[0x10];
|
||||
uint8 ukn00F0[0x10];
|
||||
uint8 ukn0100[0x100];
|
||||
uint8 ukn0200[0x100];
|
||||
uint8 ukn0300[0x100];
|
||||
uint8 ukn0400[0x100];
|
||||
uint8 ukn0500[0x100];
|
||||
uint8 ukn0600[0x100];
|
||||
}cmdDefault;
|
||||
MEMPTR<void> dest;
|
||||
uint32be size;
|
||||
uint32be count;
|
||||
uint32be filePos;
|
||||
uint32be fileHandle;
|
||||
uint32be flag;
|
||||
} cmdReadFile;
|
||||
struct
|
||||
{
|
||||
MEMPTR<void> dest;
|
||||
uint32be size;
|
||||
uint32be count;
|
||||
uint32be filePos;
|
||||
uint32be fileHandle;
|
||||
uint32be flag;
|
||||
} cmdWriteFile;
|
||||
struct
|
||||
{
|
||||
uint32 ukn0000;
|
||||
uint8 path[FSA_CMD_PATH_MAX_LENGTH];
|
||||
uint8 mode[12]; // +0x284 note: code seems to access this value like it has a size of 0x10 but the actual struct element is only 12 bytes? Maybe a typo (10 instead of 0x10 in the struct def)
|
||||
uint32 createMode; // +0x290
|
||||
uint32 openFlags; // +0x294
|
||||
uint32 preallocSize; // +0x298
|
||||
uint8 ukn[0x2E8]; // +0x29C
|
||||
// output
|
||||
uint32be fileHandleOutput; // +0x584 used to return file handle on success
|
||||
}cmdOpenFile;
|
||||
uint8 mode[12]; // +0x284 note: code seems to access this value like it has a size of 0x10 but the actual struct element is only 12 bytes? Maybe a typo (10 instead of 0x10 in the struct def)
|
||||
uint32be createMode; // +0x290
|
||||
uint32be openFlags; // +0x294
|
||||
uint32be preallocSize; // +0x298
|
||||
} cmdOpenFile;
|
||||
struct
|
||||
{
|
||||
uint32 ukn0000; // +0x000
|
||||
uint32be fileHandle; // +0x004
|
||||
}cmdCloseFile;
|
||||
uint32be fileHandle;
|
||||
} cmdCloseFile;
|
||||
struct
|
||||
{
|
||||
uint32 ukn0000;
|
||||
uint8 path[FSA_CMD_PATH_MAX_LENGTH];
|
||||
uint32 ukn0284;
|
||||
uint8 ukn0288[0x80 - 8];
|
||||
uint8 ukn0300[0x100];
|
||||
uint8 ukn0400[0x100];
|
||||
uint32 ukn0500;
|
||||
}cmdRemove;
|
||||
} cmdRemove;
|
||||
struct
|
||||
{
|
||||
uint32 ukn0000;
|
||||
uint8 path[FSA_CMD_PATH_MAX_LENGTH];
|
||||
uint8 ukn0284[12]; // +0x284
|
||||
uint32 ukn0290; // +0x290
|
||||
uint32 ukn0294; // +0x294
|
||||
uint32 ukn0298; // +0x298
|
||||
uint8 ukn[0x2E8]; // +0x29C
|
||||
// output
|
||||
uint32be dirHandleOutput; // +0x584 used to return dir handle on success
|
||||
}cmdOpenDir;
|
||||
} cmdOpenDir;
|
||||
struct
|
||||
{
|
||||
uint32 ukn0000;
|
||||
betype<uint32> dirHandle;
|
||||
}cmdReadDir;
|
||||
} cmdReadDir;
|
||||
struct
|
||||
{
|
||||
uint32 ukn0000;
|
||||
betype<uint32> dirHandle;
|
||||
}cmdCloseDir;
|
||||
} cmdCloseDir;
|
||||
struct
|
||||
{
|
||||
uint32 ukn0000;
|
||||
uint8 path[FSA_CMD_PATH_MAX_LENGTH];
|
||||
uint32 uknParam;
|
||||
uint8 ukn0288[0x80 - 8];
|
||||
uint8 ukn0300[0x100];
|
||||
uint8 ukn0400[0x100];
|
||||
uint32 ukn0500;
|
||||
}cmdMakeDir;
|
||||
uint32be uknParam;
|
||||
} cmdMakeDir;
|
||||
struct
|
||||
{
|
||||
uint32 ukn0000;
|
||||
uint8 path[FSA_CMD_PATH_MAX_LENGTH];
|
||||
uint8 ukn0284[0x80 - 4];
|
||||
uint8 ukn0300[0x100];
|
||||
uint8 ukn0400[0x100];
|
||||
uint32 ukn0500;
|
||||
}cmdChangeDir;
|
||||
} cmdChangeDir;
|
||||
struct
|
||||
{
|
||||
uint32 ukn0000;
|
||||
uint8 query[FSA_CMD_PATH_MAX_LENGTH];
|
||||
uint32 queryType;
|
||||
uint8 ukn0288[0x80 - 8];
|
||||
uint8 ukn0300[0x100];
|
||||
uint8 ukn0400[0x100];
|
||||
uint32 ukn0500;
|
||||
}cmdQueryInfo;
|
||||
uint32be queryType;
|
||||
} cmdQueryInfo;
|
||||
struct
|
||||
{
|
||||
uint32 ukn0000;
|
||||
uint8 srcPath[FSA_CMD_PATH_MAX_LENGTH];
|
||||
uint8 dstPath[FSA_CMD_PATH_MAX_LENGTH];
|
||||
}cmdRename;
|
||||
} cmdRename;
|
||||
struct
|
||||
{
|
||||
uint32 ukn0000;
|
||||
uint32 size;
|
||||
uint32 count;
|
||||
uint32 fileHandle;
|
||||
uint32 uknParam;
|
||||
}cmdAppendFile;
|
||||
uint32be size;
|
||||
uint32be count;
|
||||
uint32be fileHandle;
|
||||
uint32be uknParam;
|
||||
} cmdAppendFile;
|
||||
struct
|
||||
{
|
||||
uint32 ukn0000;
|
||||
betype<uint32> fileHandle;
|
||||
uint32be ukn0008;
|
||||
}cmdTruncateFile;
|
||||
uint32be fileHandle;
|
||||
} cmdTruncateFile;
|
||||
struct
|
||||
{
|
||||
uint32 ukn0000;
|
||||
betype<uint32> fileHandle;
|
||||
}cmdGetStatFile;
|
||||
uint32be fileHandle;
|
||||
} cmdGetStatFile;
|
||||
struct
|
||||
{
|
||||
uint32 ukn0000;
|
||||
uint8 path[FSA_CMD_PATH_MAX_LENGTH];
|
||||
}cmdFlushQuota;
|
||||
} cmdFlushQuota;
|
||||
struct
|
||||
{
|
||||
uint32be fileHandle;
|
||||
uint32be filePos;
|
||||
} cmdSetPosFile;
|
||||
struct
|
||||
{
|
||||
uint32be fileHandle;
|
||||
} cmdGetPosFile;
|
||||
struct
|
||||
{
|
||||
uint32be fileHandle;
|
||||
} cmdIsEof;
|
||||
};
|
||||
uint8 ukn0700[0x100];
|
||||
uint8 ukn0800[0x10];
|
||||
uint8 ukn0810[0x10];
|
||||
};
|
||||
static_assert(sizeof(FSARequest) == 0x520);
|
||||
|
||||
static_assert(sizeof(FSAIpcCommand) == 0x820); // exact size of this is not known
|
||||
struct FSAResponse
|
||||
{
|
||||
uint32be ukn0;
|
||||
union
|
||||
{
|
||||
uint8 ukn04[0x28F];
|
||||
struct
|
||||
{
|
||||
uint32be fileHandleOutput; // +0x584 used to return file handle on success
|
||||
} cmdOpenFile;
|
||||
struct
|
||||
{
|
||||
uint32be dirHandleOutput; // +0x584 used to return dir handle on success
|
||||
} cmdOpenDir;
|
||||
struct
|
||||
{
|
||||
uint32be filePos;
|
||||
} cmdGetPosFile;
|
||||
struct
|
||||
{
|
||||
FSStat_t statOut;
|
||||
} cmdStatFile;
|
||||
struct
|
||||
{
|
||||
FSDirEntry_t dirEntry;
|
||||
} cmdReadDir;
|
||||
struct
|
||||
{
|
||||
char path[FSA_CMD_PATH_MAX_LENGTH];
|
||||
} cmdGetCWD;
|
||||
struct
|
||||
{
|
||||
union
|
||||
{
|
||||
uint8 ukn04[0x64];
|
||||
struct
|
||||
{
|
||||
uint64be freespace;
|
||||
} queryFreeSpace;
|
||||
struct
|
||||
{
|
||||
FSStat_t stat;
|
||||
} queryStat;
|
||||
};
|
||||
} cmdQueryInfo;
|
||||
};
|
||||
};
|
||||
// static_assert(sizeof(FSAResponse) == 0x293);
|
||||
|
||||
struct FSAShimBuffer
|
||||
{
|
||||
FSARequest request;
|
||||
uint8 ukn0520[0x60];
|
||||
FSAResponse response;
|
||||
uint8 ukn0813[0x6D];
|
||||
IPCIoctlVector ioctlvVec[3];
|
||||
uint8 ukn08A4[0x5C];
|
||||
/* +0x0900 */ uint32be operationType;
|
||||
betype<IOSDevHandle> fsaDevHandle;
|
||||
/* +0x0908 */ uint16be ipcReqType; // 0 -> IoctlAsync, 1 -> IoctlvAsync
|
||||
uint8 ioctlvVecIn;
|
||||
uint8 ioctlvVecOut;
|
||||
uint32 ukn090C;
|
||||
uint32 ukn0910;
|
||||
uint32 ukn0914;
|
||||
uint32 ukn0918;
|
||||
uint32 ukn091C;
|
||||
uint32 ukn0920;
|
||||
uint32 ukn0924;
|
||||
uint32 ukn0928;
|
||||
uint32 ukn092C;
|
||||
uint32 ukn0930;
|
||||
uint32 ukn0934;
|
||||
};
|
||||
// static_assert(sizeof(FSAShimBuffer) == 0x938); // exact size of this is not known
|
||||
|
||||
void Initialize();
|
||||
void Shutdown();
|
||||
}
|
||||
}
|
||||
} // namespace fsa
|
||||
} // namespace iosu
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,25 +8,25 @@
|
||||
typedef struct
|
||||
{
|
||||
uint32be fileHandle;
|
||||
}FSFileHandleDepr_t;
|
||||
} FSFileHandleDepr_t;
|
||||
|
||||
typedef MEMPTR<betype<FSDirHandle2>> FSDirHandlePtr;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MEMPTR<void> userCallback;
|
||||
MEMPTR<void> userContext;
|
||||
MEMPTR<coreinit::OSMessageQueue> ioMsgQueue;
|
||||
}FSAsyncParamsNew_t;
|
||||
MEMPTR<void> userCallback;
|
||||
MEMPTR<void> userContext;
|
||||
MEMPTR<coreinit::OSMessageQueue> ioMsgQueue;
|
||||
} FSAsyncParamsNew_t;
|
||||
|
||||
static_assert(sizeof(FSAsyncParamsNew_t) == 0xC);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MPTR userCallback; // 0x96C
|
||||
MPTR userContext;
|
||||
MPTR ioMsgQueue;
|
||||
}FSAsyncParams_t; // legacy struct. Replace with FSAsyncParamsNew_t
|
||||
MPTR userCallback; // 0x96C
|
||||
MPTR userContext;
|
||||
MPTR ioMsgQueue;
|
||||
} FSAsyncParams_t; // legacy struct. Replace with FSAsyncParamsNew_t
|
||||
|
||||
namespace coreinit
|
||||
{
|
||||
@@ -48,8 +48,8 @@ namespace coreinit
|
||||
};
|
||||
DEFINE_ENUM_FLAG_OPERATORS(FSCmdQueue::QUEUE_FLAG);
|
||||
|
||||
#define FS_CLIENT_BUFFER_SIZE (5888)
|
||||
#define FS_CMD_BLOCK_SIZE (2688)
|
||||
#define FS_CLIENT_BUFFER_SIZE (5888)
|
||||
#define FS_CMD_BLOCK_SIZE (2688)
|
||||
|
||||
struct FSClient_t
|
||||
{
|
||||
@@ -64,7 +64,7 @@ namespace coreinit
|
||||
struct
|
||||
{
|
||||
uint32 mount_it;
|
||||
}data;
|
||||
} data;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace coreinit
|
||||
uint32 ukn1608;
|
||||
uint32 ukn160C;
|
||||
uint32 ukn1610;
|
||||
MEMPTR<FSClientBody_t> fsClientBodyNext; // next FSClientBody_t* in list of registered clients (list is circular, the last element points to the first element)
|
||||
MEMPTR<FSClientBody_t> fsClientBodyNext; // next FSClientBody_t* in list of registered clients (list is circular, the last element points to the first element)
|
||||
uint32 ukn1618;
|
||||
/* +0x161C */ MEMPTR<FSClient_t> selfClient; // pointer to FSClient struct which holds this FSClientBody
|
||||
uint32 ukn1620;
|
||||
@@ -127,81 +127,89 @@ namespace coreinit
|
||||
/* +0x00 */ FSAsyncParamsNew_t fsAsyncParamsNew;
|
||||
|
||||
// fs message storage
|
||||
struct FSMessage
|
||||
struct FSMessage
|
||||
{
|
||||
/* +0x0C / 0x0978 */ MEMPTR<FSAsyncResult> fsAsyncResult;
|
||||
/* +0x10 */ MPTR fsClientMPTR2; // 0x097C
|
||||
/* +0x14 */ MPTR fsCmdBlockMPTR; // 0x0980
|
||||
/* +0x18 */ MPTR commandType; // 0x0984
|
||||
/* +0x0C / 0x0978 */ MEMPTR<FSAsyncResult> fsAsyncResult;
|
||||
/* +0x10 */ MPTR fsClientMPTR2; // 0x097C
|
||||
/* +0x14 */ MPTR fsCmdBlockMPTR; // 0x0980
|
||||
/* +0x18 */ MPTR commandType; // 0x0984
|
||||
};
|
||||
|
||||
union
|
||||
{
|
||||
OSMessage osMsg;
|
||||
FSMessage fsMsg;
|
||||
}msgUnion;
|
||||
} msgUnion;
|
||||
|
||||
/* +0x1C */ MEMPTR<FSClient_t> fsClient; // 0x0988
|
||||
/* +0x1C */ MEMPTR<FSClient_t> fsClient; // 0x0988
|
||||
/* +0x20 */ MEMPTR<FSCmdBlock_t> fsCmdBlock; // 0x98C
|
||||
/* +0x24 */ uint32be fsStatusNew; // 0x990
|
||||
/* +0x24 */ uint32be fsStatusNew; // 0x990
|
||||
};
|
||||
|
||||
static_assert(sizeof(FSAsyncResult) == 0x28);
|
||||
|
||||
struct FSCmdBlockReturnValues_t
|
||||
{
|
||||
union
|
||||
{
|
||||
uint8 ukn0[0x14];
|
||||
struct
|
||||
{
|
||||
MEMPTR<uint32be> handlePtr;
|
||||
} cmdOpenFile;
|
||||
struct
|
||||
{
|
||||
MEMPTR<uint32be> filePosPtr;
|
||||
} cmdGetPosFile;
|
||||
struct
|
||||
{
|
||||
uint32be transferSize;
|
||||
uint32be uknVal094C;
|
||||
uint32be transferElemSize;
|
||||
uint32be uknVal0954;
|
||||
} cmdReadFile;
|
||||
struct
|
||||
{
|
||||
uint32be transferSize;
|
||||
uint32be uknVal094C;
|
||||
uint32be transferElemSize;
|
||||
uint32be uknVal0954;
|
||||
} cmdWriteFile;
|
||||
struct
|
||||
{
|
||||
MEMPTR<uint32be> handlePtr;
|
||||
} cmdOpenDir;
|
||||
struct
|
||||
{
|
||||
MEMPTR<FSDirEntry_t> dirEntryPtr;
|
||||
} cmdReadDir;
|
||||
struct
|
||||
{
|
||||
MEMPTR<char> pathPtr;
|
||||
uint32be transferSize;
|
||||
} cmdGetCwd;
|
||||
struct
|
||||
{
|
||||
MEMPTR<void> queryResultPtr;
|
||||
} cmdQueryInfo;
|
||||
struct
|
||||
{
|
||||
MEMPTR<void> resultPtr;
|
||||
} cmdStatFile;
|
||||
};
|
||||
};
|
||||
|
||||
static_assert(sizeof(FSCmdBlockReturnValues_t) == 0x14);
|
||||
|
||||
struct FSCmdBlockBody_t
|
||||
{
|
||||
iosu::fsa::FSAIpcCommand ipcData;
|
||||
uint8 ukn0820[0x10];
|
||||
uint8 ukn0830[0x10];
|
||||
uint8 ukn0840[0x10];
|
||||
uint8 ukn0850[0x10];
|
||||
uint8 ukn0860[0x10];
|
||||
uint8 ukn0870[0x10];
|
||||
MPTR fsCmdBlockBodyMPTR;
|
||||
uint32 ukn0884;
|
||||
uint32 ukn0888;
|
||||
uint32 destBuffer88CMPTR;
|
||||
uint32 ukn0890;
|
||||
uint32 ukn0894;
|
||||
uint32 ukn0898;
|
||||
uint32 ukn089C;
|
||||
uint32 ukn08A0;
|
||||
uint32 ukn08A4;
|
||||
uint32 ukn08A8;
|
||||
uint32 ukn08AC;
|
||||
uint8 ukn08B0[0x10];
|
||||
uint8 ukn08C0[0x10];
|
||||
uint8 ukn08D0[0x10];
|
||||
uint8 ukn08E0[0x10];
|
||||
uint8 ukn08F0[0x10];
|
||||
/* +0x0900 */ uint32be operationType;
|
||||
betype<IOSDevHandle> fsaDevHandle;
|
||||
/* +0x0908 */ uint16be ipcReqType; // 0 -> IoctlAsync, 1 -> IoctlvAsync
|
||||
uint8 ukn090A;
|
||||
uint8 ukn090B;
|
||||
uint32 ukn090C;
|
||||
uint32 ukn0910;
|
||||
uint32 ukn0914;
|
||||
uint32 ukn0918;
|
||||
uint32 ukn091C;
|
||||
uint32 ukn0920;
|
||||
uint32 ukn0924;
|
||||
uint32 ukn0928;
|
||||
uint32 ukn092C;
|
||||
uint32 ukn0930;
|
||||
uint32 ukn0934;
|
||||
iosu::fsa::FSAShimBuffer fsaShimBuffer;
|
||||
/* +0x0938 */ MEMPTR<FSClientBody_t> fsClientBody;
|
||||
/* +0x093C */ uint32 statusCode; // not a status code but rather the state? Uses weird values for some reason
|
||||
/* +0x093C */ uint32 statusCode; // not a status code but rather the state? Uses weird values for some reason
|
||||
/* +0x0940 */ uint32be cancelState; // bitmask. Bit 0 -> If set command has been canceled
|
||||
// return values
|
||||
/* +0x0944 */ uint32 returnValueMPTR; // returnedFilePos (used to store pointer to variable that holds return value?), also used by QUERYINFO to store pointer for result. Also used for GetCwd() to hold the pointer for the returned dir path. Also used by OPENFILE to hold returned fileHandle
|
||||
/* +0x0948 */ uint32 transferSize; // number of bytes to transfer
|
||||
// transfer control?
|
||||
uint32 uknVal094C;
|
||||
uint32 transferElemSize; // number of bytes of a single transferred element (count of elements can be calculated via count = transferSize/transferElemSize)
|
||||
uint32 uknVal0954; // this is set to max(0x10, transferSize) for reads and to min(0x40000, transferSize) for writes?
|
||||
FSCmdBlockReturnValues_t returnValues;
|
||||
// link for cmd queue
|
||||
MPTR nextMPTR; // points towards FSCmdQueue->first
|
||||
MPTR nextMPTR; // points towards FSCmdQueue->first
|
||||
MPTR previousMPTR; // points towards FSCmdQueue->last
|
||||
|
||||
/* +0x960 */ betype<FSA_RESULT> lastFSAStatus;
|
||||
@@ -226,34 +234,12 @@ namespace coreinit
|
||||
static_assert(sizeof(FSAsyncParams_t) == 0xC);
|
||||
static_assert(sizeof(FSCmdBlock_t) == 0xA80);
|
||||
|
||||
#define FSA_CMD_FLAG_SET_POS (1<<0)
|
||||
#define FSA_CMD_FLAG_SET_POS (1 << 0)
|
||||
|
||||
#define FSA_CMD_OPERATION_TYPE_CHANGEDIR (0x5)
|
||||
#define FSA_CMD_OPERATION_TYPE_GETCWD (0x6)
|
||||
#define FSA_CMD_OPERATION_TYPE_MAKEDIR (0x7)
|
||||
#define FSA_CMD_OPERATION_TYPE_REMOVE (0x8)
|
||||
#define FSA_CMD_OPERATION_TYPE_RENAME (0x9)
|
||||
#define FSA_CMD_OPERATION_TYPE_OPENDIR (0xA)
|
||||
#define FSA_CMD_OPERATION_TYPE_READDIR (0xB)
|
||||
#define FSA_CMD_OPERATION_TYPE_CLOSEDIR (0xD)
|
||||
#define FSA_CMD_OPERATION_TYPE_OPENFILE (0xE)
|
||||
#define FSA_CMD_OPERATION_TYPE_READ (0xF)
|
||||
#define FSA_CMD_OPERATION_TYPE_WRITE (0x10)
|
||||
#define FSA_CMD_OPERATION_TYPE_GETPOS (0x11)
|
||||
#define FSA_CMD_OPERATION_TYPE_SETPOS (0x12)
|
||||
#define FSA_CMD_OPERATION_TYPE_ISEOF (0x13)
|
||||
#define FSA_CMD_OPERATION_TYPE_GETSTATFILE (0x14)
|
||||
#define FSA_CMD_OPERATION_TYPE_CLOSEFILE (0x15)
|
||||
#define FSA_CMD_OPERATION_TYPE_QUERYINFO (0x18)
|
||||
#define FSA_CMD_OPERATION_TYPE_APPENDFILE (0x19)
|
||||
#define FSA_CMD_OPERATION_TYPE_TRUNCATEFILE (0x1A)
|
||||
#define FSA_CMD_OPERATION_TYPE_FLUSHQUOTA (0x1E)
|
||||
|
||||
|
||||
#define FSA_CMD_STATUS_CODE_D900A21 0xD900A21 // cmd block is initialized
|
||||
#define FSA_CMD_STATUS_CODE_D900A22 0xD900A22 // cmd block is queued
|
||||
#define FSA_CMD_STATUS_CODE_D900A24 0xD900A24 // cmd block was processed and is available again
|
||||
#define FSA_CMD_STATUS_CODE_D900A26 0xD900A26 // cmd block result is being processed
|
||||
#define FSA_CMD_STATUS_CODE_D900A21 0xD900A21 // cmd block is initialized
|
||||
#define FSA_CMD_STATUS_CODE_D900A22 0xD900A22 // cmd block is queued
|
||||
#define FSA_CMD_STATUS_CODE_D900A24 0xD900A24 // cmd block was processed and is available again
|
||||
#define FSA_CMD_STATUS_CODE_D900A26 0xD900A26 // cmd block result is being processed
|
||||
|
||||
enum FS_VOLSTATE : sint32
|
||||
{
|
||||
@@ -272,12 +258,12 @@ namespace coreinit
|
||||
|
||||
sint32 FSOpenFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, char* mode, FSFileHandleDepr_t* fileHandle, uint32 errHandling, FSAsyncParamsNew_t* asyncParams);
|
||||
sint32 FSOpenFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, char* mode, FSFileHandleDepr_t* fileHandle, uint32 errHandling);
|
||||
|
||||
|
||||
sint32 FSReadFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* dst, uint32 size, uint32 count, uint32 fileHandle, uint32 flag, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams);
|
||||
sint32 FSReadFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* dst, uint32 size, uint32 count, uint32 fileHandle, uint32 flag, uint32 errorMask);
|
||||
sint32 FSReadFileWithPosAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* dst, uint32 size, uint32 count, uint32 filePos, uint32 fileHandle, uint32 flag, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams);
|
||||
sint32 FSReadFileWithPos(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* dst, uint32 size, uint32 count, uint32 filePos, uint32 fileHandle, uint32 flag, uint32 errorMask);
|
||||
|
||||
|
||||
sint32 FSWriteFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* src, uint32 size, uint32 count, uint32 fileHandle, uint32 flag, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams);
|
||||
sint32 FSWriteFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* src, uint32 size, uint32 count, uint32 fileHandle, uint32 flag, uint32 errorMask);
|
||||
sint32 FSWriteFileWithPosAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* src, uint32 size, uint32 count, uint32 filePos, uint32 fileHandle, uint32 flag, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams);
|
||||
@@ -321,5 +307,4 @@ namespace coreinit
|
||||
FS_VOLSTATE FSGetVolumeState(FSClient_t* fsClient);
|
||||
|
||||
void InitializeFS();
|
||||
};
|
||||
|
||||
}; // namespace coreinit
|
||||
|
||||
Reference in New Issue
Block a user