coreinit+nn_save: Cleanup some legacy code

This commit is contained in:
Exzap 2024-05-01 05:06:50 +02:00
parent e7c6862e19
commit 379950d185
12 changed files with 282 additions and 449 deletions

View File

@ -55,19 +55,18 @@ namespace coreinit
{ {
// return full size of foreground bucket area // return full size of foreground bucket area
if (offset) if (offset)
*offset = MEMPTR<void>{ (uint32)MEMORY_FGBUCKET_AREA_ADDR }; *offset = { (MPTR)MEMORY_FGBUCKET_AREA_ADDR };
if (size) if (size)
*size = MEMORY_FGBUCKET_AREA_SIZE; *size = MEMORY_FGBUCKET_AREA_SIZE;
// return true if in foreground // return true if in foreground
return true; return true;
} }
bool OSGetForegroundBucketFreeArea(MPTR* offset, MPTR* size) bool OSGetForegroundBucketFreeArea(MEMPTR<void>* offset, uint32be* size)
{ {
uint8* freeAreaAddr = GetFGMemByArea(FG_BUCKET_AREA_FREE).GetPtr(); uint8* freeAreaAddr = GetFGMemByArea(FG_BUCKET_AREA_FREE).GetPtr();
*offset = freeAreaAddr;
*offset = _swapEndianU32(memory_getVirtualOffsetFromPointer(freeAreaAddr)); *size = FG_BUCKET_AREA_FREE_SIZE;
*size = _swapEndianU32(FG_BUCKET_AREA_FREE_SIZE);
// return true if in foreground // return true if in foreground
return (fgAddr != nullptr); return (fgAddr != nullptr);
} }
@ -82,15 +81,6 @@ namespace coreinit
osLib_returnFromFunction(hCPU, r ? 1 : 0); osLib_returnFromFunction(hCPU, r ? 1 : 0);
} }
void coreinitExport_OSGetForegroundBucketFreeArea(PPCInterpreter_t* hCPU)
{
debug_printf("OSGetForegroundBucketFreeArea(0x%x,0x%x)\n", hCPU->gpr[3], hCPU->gpr[4]);
ppcDefineParamMPTR(areaOutput, 0);
ppcDefineParamMPTR(areaSize, 1);
bool r = OSGetForegroundBucketFreeArea((MPTR*)memory_getPointerFromVirtualOffsetAllowNull(areaOutput), (MPTR*)memory_getPointerFromVirtualOffsetAllowNull(areaSize));
osLib_returnFromFunction(hCPU, r ? 1 : 0);
}
void InitForegroundBucket() void InitForegroundBucket()
{ {
uint32be fgSize; uint32be fgSize;
@ -194,7 +184,7 @@ namespace coreinit
void InitializeFG() void InitializeFG()
{ {
osLib_addFunction("coreinit", "OSGetForegroundBucket", coreinitExport_OSGetForegroundBucket); osLib_addFunction("coreinit", "OSGetForegroundBucket", coreinitExport_OSGetForegroundBucket);
osLib_addFunction("coreinit", "OSGetForegroundBucketFreeArea", coreinitExport_OSGetForegroundBucketFreeArea); cafeExportRegister("coreinit", OSGetForegroundBucket, LogType::CoreinitMem);
osLib_addFunction("coreinit", "OSCopyFromClipboard", coreinitExport_OSCopyFromClipboard); osLib_addFunction("coreinit", "OSCopyFromClipboard", coreinitExport_OSCopyFromClipboard);
} }
} }

View File

@ -9,7 +9,7 @@ namespace coreinit
bool __OSResizeCopyData(sint32 length); bool __OSResizeCopyData(sint32 length);
bool OSGetForegroundBucket(MEMPTR<void>* offset, uint32be* size); bool OSGetForegroundBucket(MEMPTR<void>* offset, uint32be* size);
bool OSGetForegroundBucketFreeArea(MPTR* offset, MPTR* size); bool OSGetForegroundBucketFreeArea(MEMPTR<void>* offset, uint32be* size);
void InitForegroundBucket(); void InitForegroundBucket();

View File

@ -56,7 +56,7 @@ namespace coreinit
OSUnlockMutex(&s_fsGlobalMutex); OSUnlockMutex(&s_fsGlobalMutex);
} }
void _debugVerifyCommand(const char* stage, FSCmdBlockBody_t* fsCmdBlockBody); void _debugVerifyCommand(const char* stage, FSCmdBlockBody* fsCmdBlockBody);
bool sFSInitialized = true; // this should be false but it seems like some games rely on FSInit being called before main()? Twilight Princess for example reads files before it calls FSInit bool sFSInitialized = true; // this should be false but it seems like some games rely on FSInit being called before main()? Twilight Princess for example reads files before it calls FSInit
bool sFSShutdown = false; bool sFSShutdown = false;
@ -194,12 +194,12 @@ namespace coreinit
} }
// return the aligned FSClientBody struct inside a FSClient struct // return the aligned FSClientBody struct inside a FSClient struct
FSCmdBlockBody_t* __FSGetCmdBlockBody(FSCmdBlock_t* fsCmdBlock) FSCmdBlockBody* __FSGetCmdBlockBody(FSCmdBlock_t* fsCmdBlock)
{ {
// align pointer to 64 bytes // align pointer to 64 bytes
if (fsCmdBlock == nullptr) if (fsCmdBlock == nullptr)
return nullptr; return nullptr;
FSCmdBlockBody_t* fsCmdBlockBody = (FSCmdBlockBody_t*)(((uintptr_t)fsCmdBlock + 0x3F) & ~0x3F); FSCmdBlockBody* fsCmdBlockBody = (FSCmdBlockBody*)(((uintptr_t)fsCmdBlock + 0x3F) & ~0x3F);
fsCmdBlockBody->selfCmdBlock = fsCmdBlock; fsCmdBlockBody->selfCmdBlock = fsCmdBlock;
return fsCmdBlockBody; return fsCmdBlockBody;
} }
@ -261,8 +261,8 @@ namespace coreinit
fsCmdQueueBE->numCommandsInFlight = 0; fsCmdQueueBE->numCommandsInFlight = 0;
fsCmdQueueBE->numMaxCommandsInFlight = numMaxCommandsInFlight; fsCmdQueueBE->numMaxCommandsInFlight = numMaxCommandsInFlight;
coreinit::OSFastMutex_Init(&fsCmdQueueBE->fastMutex, nullptr); coreinit::OSFastMutex_Init(&fsCmdQueueBE->fastMutex, nullptr);
fsCmdQueueBE->firstMPTR = _swapEndianU32(0); fsCmdQueueBE->first = nullptr;
fsCmdQueueBE->lastMPTR = _swapEndianU32(0); fsCmdQueueBE->last = nullptr;
} }
void FSInit() void FSInit()
@ -382,74 +382,71 @@ namespace coreinit
Semaphore g_semaphoreQueuedCmds; Semaphore g_semaphoreQueuedCmds;
void __FSQueueCmdByPriority(FSCmdQueue* fsCmdQueueBE, FSCmdBlockBody_t* fsCmdBlockBody, bool stopAtEqualPriority) void __FSQueueCmdByPriority(FSCmdQueue* fsCmdQueueBE, FSCmdBlockBody* fsCmdBlockBody, bool stopAtEqualPriority)
{ {
MPTR fsCmdBlockBodyMPTR = memory_getVirtualOffsetFromPointer(fsCmdBlockBody); if (!fsCmdQueueBE->first)
if (_swapEndianU32(fsCmdQueueBE->firstMPTR) == MPTR_NULL)
{ {
// queue is currently empty // queue is currently empty
cemu_assert(fsCmdQueueBE->lastMPTR == MPTR_NULL); cemu_assert(!fsCmdQueueBE->last);
fsCmdQueueBE->firstMPTR = _swapEndianU32(fsCmdBlockBodyMPTR); fsCmdQueueBE->first = fsCmdBlockBody;
fsCmdQueueBE->lastMPTR = _swapEndianU32(fsCmdBlockBodyMPTR); fsCmdQueueBE->last = fsCmdBlockBody;
fsCmdBlockBody->nextMPTR = _swapEndianU32(MPTR_NULL); fsCmdBlockBody->next = nullptr;
fsCmdBlockBody->previousMPTR = _swapEndianU32(MPTR_NULL); fsCmdBlockBody->previous = nullptr;
return; return;
} }
// iterate from last to first element as long as iterated priority is lower // iterate from last to first element as long as iterated priority is lower
FSCmdBlockBody_t* fsCmdBlockBodyItrPrev = NULL; FSCmdBlockBody* fsCmdBlockBodyItrPrev = nullptr;
FSCmdBlockBody_t* fsCmdBlockBodyItr = (FSCmdBlockBody_t*)memory_getPointerFromVirtualOffsetAllowNull(_swapEndianU32(fsCmdQueueBE->lastMPTR)); FSCmdBlockBody* fsCmdBlockBodyItr = fsCmdQueueBE->last;
while (true) while (true)
{ {
if (fsCmdBlockBodyItr == NULL) if (!fsCmdBlockBodyItr)
{ {
// insert at the head of the list // insert at the head of the list
fsCmdQueueBE->firstMPTR = _swapEndianU32(fsCmdBlockBodyMPTR); fsCmdQueueBE->first = fsCmdBlockBody;
fsCmdBlockBody->nextMPTR = _swapEndianU32(memory_getVirtualOffsetFromPointer(fsCmdBlockBodyItrPrev)); fsCmdBlockBody->next = fsCmdBlockBodyItrPrev;
fsCmdBlockBody->previousMPTR = _swapEndianU32(MPTR_NULL); fsCmdBlockBody->previous = nullptr;
fsCmdBlockBodyItrPrev->previousMPTR = _swapEndianU32(memory_getVirtualOffsetFromPointer(fsCmdBlockBody)); fsCmdBlockBodyItrPrev->previous = fsCmdBlockBody;
return; return;
} }
// compare priority // compare priority
if ((stopAtEqualPriority && fsCmdBlockBodyItr->priority >= fsCmdBlockBody->priority) || (stopAtEqualPriority == false && fsCmdBlockBodyItr->priority > fsCmdBlockBody->priority)) if ((stopAtEqualPriority && fsCmdBlockBodyItr->priority >= fsCmdBlockBody->priority) || (stopAtEqualPriority == false && fsCmdBlockBodyItr->priority > fsCmdBlockBody->priority))
{ {
// insert cmd here // insert cmd here
if (fsCmdBlockBodyItrPrev != NULL) if (fsCmdBlockBodyItrPrev)
{ {
fsCmdBlockBody->nextMPTR = _swapEndianU32(memory_getVirtualOffsetFromPointer(fsCmdBlockBodyItrPrev)); fsCmdBlockBody->next = fsCmdBlockBodyItrPrev;
} }
else else
{ {
fsCmdBlockBody->nextMPTR = _swapEndianU32(MPTR_NULL); fsCmdBlockBody->next = nullptr;
fsCmdQueueBE->lastMPTR = _swapEndianU32(fsCmdBlockBodyMPTR); fsCmdQueueBE->last = fsCmdBlockBody;
} }
fsCmdBlockBody->previousMPTR = _swapEndianU32(memory_getVirtualOffsetFromPointer(fsCmdBlockBodyItr)); fsCmdBlockBody->previous = fsCmdBlockBodyItr;
if (fsCmdBlockBodyItrPrev) if (fsCmdBlockBodyItrPrev)
fsCmdBlockBodyItrPrev->previousMPTR = _swapEndianU32(memory_getVirtualOffsetFromPointer(fsCmdBlockBody)); fsCmdBlockBodyItrPrev->previous = fsCmdBlockBody;
fsCmdBlockBodyItr->nextMPTR = _swapEndianU32(memory_getVirtualOffsetFromPointer(fsCmdBlockBody)); fsCmdBlockBodyItr->next = fsCmdBlockBody;
return; return;
} }
// next // next
fsCmdBlockBodyItrPrev = fsCmdBlockBodyItr; fsCmdBlockBodyItrPrev = fsCmdBlockBodyItr;
fsCmdBlockBodyItr = (FSCmdBlockBody_t*)memory_getPointerFromVirtualOffsetAllowNull(_swapEndianU32(fsCmdBlockBodyItr->previousMPTR)); fsCmdBlockBodyItr = fsCmdBlockBodyItr->previous;
} }
} }
FSCmdBlockBody_t* __FSTakeCommandFromQueue(FSCmdQueue* cmdQueue) FSCmdBlockBody* __FSTakeCommandFromQueue(FSCmdQueue* cmdQueue)
{ {
FSCmdBlockBody_t* dequeuedCmd = nullptr; if (!cmdQueue->first)
if (_swapEndianU32(cmdQueue->firstMPTR) != MPTR_NULL) return nullptr;
// dequeue cmd
FSCmdBlockBody* dequeuedCmd = cmdQueue->first;
if (cmdQueue->first == cmdQueue->last)
cmdQueue->last = nullptr;
cmdQueue->first = dequeuedCmd->next;
dequeuedCmd->next = nullptr;
if (dequeuedCmd->next)
{ {
dequeuedCmd = (FSCmdBlockBody_t*)memory_getPointerFromVirtualOffset(_swapEndianU32(cmdQueue->firstMPTR)); FSCmdBlockBody* fsCmdBodyNext = dequeuedCmd->next;
// dequeue cmd fsCmdBodyNext->previous = nullptr;
if (cmdQueue->firstMPTR == cmdQueue->lastMPTR)
cmdQueue->lastMPTR = _swapEndianU32(MPTR_NULL);
cmdQueue->firstMPTR = dequeuedCmd->nextMPTR;
dequeuedCmd->nextMPTR = _swapEndianU32(MPTR_NULL);
if (_swapEndianU32(dequeuedCmd->nextMPTR) != MPTR_NULL)
{
FSCmdBlockBody_t* fsCmdBodyNext = (FSCmdBlockBody_t*)memory_getPointerFromVirtualOffset(_swapEndianU32(dequeuedCmd->nextMPTR));
fsCmdBodyNext->previousMPTR = _swapEndianU32(MPTR_NULL);
}
} }
return dequeuedCmd; return dequeuedCmd;
} }
@ -499,7 +496,7 @@ namespace coreinit
FSLockMutex(); FSLockMutex();
if (cmdQueue->numCommandsInFlight < cmdQueue->numMaxCommandsInFlight) if (cmdQueue->numCommandsInFlight < cmdQueue->numMaxCommandsInFlight)
{ {
FSCmdBlockBody_t* dequeuedCommand = __FSTakeCommandFromQueue(cmdQueue); FSCmdBlockBody* dequeuedCommand = __FSTakeCommandFromQueue(cmdQueue);
if (dequeuedCommand) if (dequeuedCommand)
{ {
cmdQueue->numCommandsInFlight += 1; cmdQueue->numCommandsInFlight += 1;
@ -512,7 +509,7 @@ namespace coreinit
FSUnlockMutex(); FSUnlockMutex();
} }
void __FSQueueDefaultFinishFunc(FSCmdBlockBody_t* fsCmdBlockBody, FS_RESULT result) void __FSQueueDefaultFinishFunc(FSCmdBlockBody* fsCmdBlockBody, FS_RESULT result)
{ {
switch ((FSA_CMD_OPERATION_TYPE)fsCmdBlockBody->fsaShimBuffer.operationType.value()) switch ((FSA_CMD_OPERATION_TYPE)fsCmdBlockBody->fsaShimBuffer.operationType.value())
{ {
@ -594,13 +591,13 @@ namespace coreinit
void export___FSQueueDefaultFinishFunc(PPCInterpreter_t* hCPU) void export___FSQueueDefaultFinishFunc(PPCInterpreter_t* hCPU)
{ {
ppcDefineParamPtr(cmd, FSCmdBlockBody_t, 0); ppcDefineParamPtr(cmd, FSCmdBlockBody, 0);
FS_RESULT result = (FS_RESULT)PPCInterpreter_getCallParamU32(hCPU, 1); FS_RESULT result = (FS_RESULT)PPCInterpreter_getCallParamU32(hCPU, 1);
__FSQueueDefaultFinishFunc(cmd, static_cast<FS_RESULT>(result)); __FSQueueDefaultFinishFunc(cmd, static_cast<FS_RESULT>(result));
osLib_returnFromFunction(hCPU, 0); osLib_returnFromFunction(hCPU, 0);
} }
void __FSQueueCmd(FSCmdQueue* cmdQueue, FSCmdBlockBody_t* fsCmdBlockBody, MPTR finishCmdFunc) void __FSQueueCmd(FSCmdQueue* cmdQueue, FSCmdBlockBody* fsCmdBlockBody, MPTR finishCmdFunc)
{ {
fsCmdBlockBody->cmdFinishFuncMPTR = finishCmdFunc; fsCmdBlockBody->cmdFinishFuncMPTR = finishCmdFunc;
FSLockMutex(); FSLockMutex();
@ -676,7 +673,7 @@ namespace coreinit
return FS_RESULT::FATAL_ERROR; return FS_RESULT::FATAL_ERROR;
} }
void __FSCmdSubmitResult(FSCmdBlockBody_t* fsCmdBlockBody, FS_RESULT result) void __FSCmdSubmitResult(FSCmdBlockBody* fsCmdBlockBody, FS_RESULT result)
{ {
_debugVerifyCommand("FSCmdSubmitResult", fsCmdBlockBody); _debugVerifyCommand("FSCmdSubmitResult", fsCmdBlockBody);
@ -720,7 +717,7 @@ namespace coreinit
void __FSAIoctlResponseCallback(PPCInterpreter_t* hCPU) void __FSAIoctlResponseCallback(PPCInterpreter_t* hCPU)
{ {
ppcDefineParamU32(iosResult, 0); ppcDefineParamU32(iosResult, 0);
ppcDefineParamPtr(cmd, FSCmdBlockBody_t, 1); ppcDefineParamPtr(cmd, FSCmdBlockBody, 1);
FSA_RESULT fsaStatus = _FSIosErrorToFSAStatus((IOS_ERROR)iosResult); FSA_RESULT fsaStatus = _FSIosErrorToFSAStatus((IOS_ERROR)iosResult);
@ -754,25 +751,25 @@ namespace coreinit
void FSInitCmdBlock(FSCmdBlock_t* fsCmdBlock) void FSInitCmdBlock(FSCmdBlock_t* fsCmdBlock)
{ {
memset(fsCmdBlock, 0x00, sizeof(FSCmdBlock_t)); memset(fsCmdBlock, 0x00, sizeof(FSCmdBlock_t));
FSCmdBlockBody_t* fsCmdBlockBody = __FSGetCmdBlockBody(fsCmdBlock); FSCmdBlockBody* fsCmdBlockBody = __FSGetCmdBlockBody(fsCmdBlock);
fsCmdBlockBody->statusCode = _swapEndianU32(FSA_CMD_STATUS_CODE_D900A21); fsCmdBlockBody->statusCode = _swapEndianU32(FSA_CMD_STATUS_CODE_D900A21);
fsCmdBlockBody->priority = 0x10; fsCmdBlockBody->priority = 0x10;
} }
void __FSAsyncToSyncInit(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSAsyncParamsNew_t* asyncParams) void __FSAsyncToSyncInit(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSAsyncParams* asyncParams)
{ {
if (fsClient == nullptr || fsCmdBlock == nullptr || asyncParams == nullptr) if (fsClient == nullptr || fsCmdBlock == nullptr || asyncParams == nullptr)
assert_dbg(); assert_dbg();
FSCmdBlockBody_t* fsCmdBlockBody = __FSGetCmdBlockBody(fsCmdBlock); FSCmdBlockBody* fsCmdBlockBody = __FSGetCmdBlockBody(fsCmdBlock);
coreinit::OSInitMessageQueue(&fsCmdBlockBody->syncTaskMsgQueue, fsCmdBlockBody->_syncTaskMsg, 1); coreinit::OSInitMessageQueue(&fsCmdBlockBody->syncTaskMsgQueue, fsCmdBlockBody->_syncTaskMsg, 1);
asyncParams->userCallback = nullptr; asyncParams->userCallback = nullptr;
asyncParams->userContext = nullptr; asyncParams->userContext = nullptr;
asyncParams->ioMsgQueue = &fsCmdBlockBody->syncTaskMsgQueue; asyncParams->ioMsgQueue = &fsCmdBlockBody->syncTaskMsgQueue;
} }
void __FSPrepareCmdAsyncResult(FSClientBody_t* fsClientBody, FSCmdBlockBody_t* fsCmdBlockBody, FSAsyncResult* fsCmdBlockAsyncResult, FSAsyncParamsNew_t* fsAsyncParams) void __FSPrepareCmdAsyncResult(FSClientBody_t* fsClientBody, FSCmdBlockBody* fsCmdBlockBody, FSAsyncResult* fsCmdBlockAsyncResult, FSAsyncParams* fsAsyncParams)
{ {
memcpy(&fsCmdBlockAsyncResult->fsAsyncParamsNew, fsAsyncParams, sizeof(FSAsyncParamsNew_t)); memcpy(&fsCmdBlockAsyncResult->fsAsyncParamsNew, fsAsyncParams, sizeof(FSAsyncParams));
fsCmdBlockAsyncResult->fsClient = fsClientBody->selfClient; fsCmdBlockAsyncResult->fsClient = fsClientBody->selfClient;
fsCmdBlockAsyncResult->fsCmdBlock = fsCmdBlockBody->selfCmdBlock; fsCmdBlockAsyncResult->fsCmdBlock = fsCmdBlockBody->selfCmdBlock;
@ -781,7 +778,7 @@ namespace coreinit
fsCmdBlockAsyncResult->msgUnion.fsMsg.commandType = _swapEndianU32(8); fsCmdBlockAsyncResult->msgUnion.fsMsg.commandType = _swapEndianU32(8);
} }
sint32 __FSPrepareCmd(FSClientBody_t* fsClientBody, FSCmdBlockBody_t* fsCmdBlockBody, uint32 errHandling, FSAsyncParamsNew_t* fsAsyncParams) sint32 __FSPrepareCmd(FSClientBody_t* fsClientBody, FSCmdBlockBody* fsCmdBlockBody, uint32 errHandling, FSAsyncParams* fsAsyncParams)
{ {
if (sFSInitialized == false || sFSShutdown == true) if (sFSInitialized == false || sFSShutdown == true)
return -0x400; return -0x400;
@ -813,18 +810,18 @@ namespace coreinit
#define _FSCmdIntro() \ #define _FSCmdIntro() \
FSClientBody_t* fsClientBody = __FSGetClientBody(fsClient); \ FSClientBody_t* fsClientBody = __FSGetClientBody(fsClient); \
FSCmdBlockBody_t* fsCmdBlockBody = __FSGetCmdBlockBody(fsCmdBlock); \ FSCmdBlockBody* fsCmdBlockBody = __FSGetCmdBlockBody(fsCmdBlock); \
sint32 fsError = __FSPrepareCmd(fsClientBody, fsCmdBlockBody, errorMask, fsAsyncParams); \ sint32 fsError = __FSPrepareCmd(fsClientBody, fsCmdBlockBody, errorMask, fsAsyncParams); \
if (fsError != 0) \ if (fsError != 0) \
return fsError; return fsError;
void _debugVerifyCommand(const char* stage, FSCmdBlockBody_t* fsCmdBlockBody) void _debugVerifyCommand(const char* stage, FSCmdBlockBody* fsCmdBlockBody)
{ {
if (fsCmdBlockBody->asyncResult.msgUnion.fsMsg.commandType != _swapEndianU32(8)) if (fsCmdBlockBody->asyncResult.msgUnion.fsMsg.commandType != _swapEndianU32(8))
{ {
cemuLog_log(LogType::Force, "Corrupted FS command detected in stage {}", stage); cemuLog_log(LogType::Force, "Corrupted FS command detected in stage {}", stage);
cemuLog_log(LogType::Force, "Printing CMD block: "); cemuLog_log(LogType::Force, "Printing CMD block: ");
for (uint32 i = 0; i < (sizeof(FSCmdBlockBody_t) + 31) / 32; i++) for (uint32 i = 0; i < (sizeof(FSCmdBlockBody) + 31) / 32; i++)
{ {
uint8* p = ((uint8*)fsCmdBlockBody) + i * 32; uint8* p = ((uint8*)fsCmdBlockBody) + i * 32;
cemuLog_log(LogType::Force, "{:04x}: {:02x} {:02x} {:02x} {:02x} - {:02x} {:02x} {:02x} {:02x} - {:02x} {:02x} {:02x} {:02x} - {:02x} {:02x} {:02x} {:02x} | {:02x} {:02x} {:02x} {:02x} - {:02x} {:02x} {:02x} {:02x} - {:02x} {:02x} {:02x} {:02x} - {:02x} {:02x} {:02x} {:02x}", cemuLog_log(LogType::Force, "{:04x}: {:02x} {:02x} {:02x} {:02x} - {:02x} {:02x} {:02x} {:02x} - {:02x} {:02x} {:02x} {:02x} - {:02x} {:02x} {:02x} {:02x} | {:02x} {:02x} {:02x} {:02x} - {:02x} {:02x} {:02x} {:02x} - {:02x} {:02x} {:02x} {:02x} - {:02x} {:02x} {:02x} {:02x}",
@ -845,7 +842,7 @@ namespace coreinit
// a positive result (or zero) means success. Most operations return zero in case of success. Read and write operations return the number of transferred units // a positive result (or zero) means success. Most operations return zero in case of success. Read and write operations return the number of transferred units
if (fsStatus >= 0) if (fsStatus >= 0)
{ {
FSCmdBlockBody_t* fsCmdBlockBody = __FSGetCmdBlockBody(fsCmdBlock); FSCmdBlockBody* fsCmdBlockBody = __FSGetCmdBlockBody(fsCmdBlock);
OSMessage msg; OSMessage msg;
OSReceiveMessage(&fsCmdBlockBody->syncTaskMsgQueue, &msg, OS_MESSAGE_BLOCK); OSReceiveMessage(&fsCmdBlockBody->syncTaskMsgQueue, &msg, OS_MESSAGE_BLOCK);
_debugVerifyCommand("handleAsyncResult", fsCmdBlockBody); _debugVerifyCommand("handleAsyncResult", fsCmdBlockBody);
@ -906,12 +903,12 @@ namespace coreinit
return FSA_RESULT::OK; return FSA_RESULT::OK;
} }
sint32 FSOpenFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, char* mode, FSFileHandleDepr_t* outFileHandle, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSOpenFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, char* mode, FSFileHandlePtr outFileHandle, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
_FSCmdIntro(); _FSCmdIntro();
if (outFileHandle == nullptr || path == nullptr || mode == nullptr) if (outFileHandle == nullptr || path == nullptr || mode == nullptr)
return -0x400; return -0x400;
fsCmdBlockBody->returnValues.cmdOpenFile.handlePtr = &outFileHandle->fileHandle; fsCmdBlockBody->returnValues.cmdOpenFile.handlePtr = outFileHandle;
fsError = (FSStatus)__FSPrepareCmd_OpenFile(&fsCmdBlockBody->fsaShimBuffer, fsClientBody->iosuFSAHandle, path, mode, 0x660, 0, 0); fsError = (FSStatus)__FSPrepareCmd_OpenFile(&fsCmdBlockBody->fsaShimBuffer, fsClientBody->iosuFSAHandle, path, mode, 0x660, 0, 0);
if (fsError != (FSStatus)FS_RESULT::SUCCESS) if (fsError != (FSStatus)FS_RESULT::SUCCESS)
return fsError; return fsError;
@ -919,15 +916,15 @@ namespace coreinit
return (FSStatus)FS_RESULT::SUCCESS; return (FSStatus)FS_RESULT::SUCCESS;
} }
sint32 FSOpenFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, char* mode, FSFileHandleDepr_t* fileHandle, uint32 errHandling) sint32 FSOpenFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, char* mode, FSFileHandlePtr outFileHandle, uint32 errHandling)
{ {
StackAllocator<FSAsyncParamsNew_t, 1> asyncParams; StackAllocator<FSAsyncParams, 1> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSOpenFileAsync(fsClient, fsCmdBlock, path, mode, fileHandle, errHandling, &asyncParams); sint32 fsAsyncRet = FSOpenFileAsync(fsClient, fsCmdBlock, path, mode, outFileHandle, errHandling, &asyncParams);
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errHandling); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errHandling);
} }
sint32 FSOpenFileExAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, char* mode, uint32 createMode, uint32 openFlag, uint32 preallocSize, FSFileHandleDepr_t* outFileHandle, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSOpenFileExAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, char* mode, uint32 createMode, uint32 openFlag, uint32 preallocSize, FSFileHandlePtr outFileHandle, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
if (openFlag != 0) if (openFlag != 0)
{ {
@ -938,7 +935,7 @@ namespace coreinit
_FSCmdIntro(); _FSCmdIntro();
if (outFileHandle == nullptr || path == nullptr || mode == nullptr) if (outFileHandle == nullptr || path == nullptr || mode == nullptr)
return -0x400; return -0x400;
fsCmdBlockBody->returnValues.cmdOpenFile.handlePtr = &outFileHandle->fileHandle; fsCmdBlockBody->returnValues.cmdOpenFile.handlePtr = outFileHandle;
FSA_RESULT prepareResult = __FSPrepareCmd_OpenFile(&fsCmdBlockBody->fsaShimBuffer, fsClientBody->iosuFSAHandle, path, mode, createMode, openFlag, preallocSize); FSA_RESULT prepareResult = __FSPrepareCmd_OpenFile(&fsCmdBlockBody->fsaShimBuffer, fsClientBody->iosuFSAHandle, path, mode, createMode, openFlag, preallocSize);
if (prepareResult != FSA_RESULT::OK) if (prepareResult != FSA_RESULT::OK)
@ -948,11 +945,11 @@ namespace coreinit
return (FSStatus)FS_RESULT::SUCCESS; return (FSStatus)FS_RESULT::SUCCESS;
} }
sint32 FSOpenFileEx(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, char* mode, uint32 createMode, uint32 openFlag, uint32 preallocSize, FSFileHandleDepr_t* fileHandle, uint32 errHandling) sint32 FSOpenFileEx(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, char* mode, uint32 createMode, uint32 openFlag, uint32 preallocSize, FSFileHandlePtr outFileHandle, uint32 errHandling)
{ {
StackAllocator<FSAsyncParamsNew_t, 1> asyncParams; StackAllocator<FSAsyncParams, 1> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSOpenFileExAsync(fsClient, fsCmdBlock, path, mode, createMode, openFlag, preallocSize, fileHandle, errHandling, &asyncParams); sint32 fsAsyncRet = FSOpenFileExAsync(fsClient, fsCmdBlock, path, mode, createMode, openFlag, preallocSize, outFileHandle, errHandling, &asyncParams);
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errHandling); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errHandling);
} }
@ -970,7 +967,7 @@ namespace coreinit
return FSA_RESULT::OK; return FSA_RESULT::OK;
} }
sint32 FSCloseFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSCloseFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
_FSCmdIntro(); _FSCmdIntro();
@ -984,7 +981,7 @@ namespace coreinit
sint32 FSCloseFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 errHandling) sint32 FSCloseFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 errHandling)
{ {
StackAllocator<FSAsyncParamsNew_t, 1> asyncParams; StackAllocator<FSAsyncParams, 1> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSCloseFileAsync(fsClient, fsCmdBlock, fileHandle, errHandling, &asyncParams); sint32 fsAsyncRet = FSCloseFileAsync(fsClient, fsCmdBlock, fileHandle, errHandling, &asyncParams);
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errHandling); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errHandling);
@ -1004,7 +1001,7 @@ namespace coreinit
return FSA_RESULT::OK; return FSA_RESULT::OK;
} }
sint32 FSFlushFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSFlushFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
_FSCmdIntro(); _FSCmdIntro();
@ -1018,7 +1015,7 @@ namespace coreinit
sint32 FSFlushFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 errHandling) sint32 FSFlushFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 errHandling)
{ {
StackAllocator<FSAsyncParamsNew_t, 1> asyncParams; StackAllocator<FSAsyncParams, 1> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSFlushFileAsync(fsClient, fsCmdBlock, fileHandle, errHandling, &asyncParams); sint32 fsAsyncRet = FSFlushFileAsync(fsClient, fsCmdBlock, fileHandle, errHandling, &asyncParams);
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errHandling); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errHandling);
@ -1060,7 +1057,7 @@ namespace coreinit
SysAllocator<uint8, 128, 64> _tempFSSpace; SysAllocator<uint8, 128, 64> _tempFSSpace;
sint32 __FSReadFileAsyncEx(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* dest, uint32 size, uint32 count, bool usePos, uint32 filePos, uint32 fileHandle, uint32 flag, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 __FSReadFileAsyncEx(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* dest, uint32 size, uint32 count, bool usePos, uint32 filePos, uint32 fileHandle, uint32 flag, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
_FSCmdIntro(); _FSCmdIntro();
if (size == 0 || count == 0 || dest == NULL) if (size == 0 || count == 0 || dest == NULL)
@ -1091,7 +1088,7 @@ namespace coreinit
return (FSStatus)FS_RESULT::SUCCESS; return (FSStatus)FS_RESULT::SUCCESS;
} }
sint32 FSReadFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* dst, uint32 size, uint32 count, uint32 fileHandle, uint32 flag, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSReadFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* dst, uint32 size, uint32 count, uint32 fileHandle, uint32 flag, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
cemu_assert_debug(flag == 0); // todo cemu_assert_debug(flag == 0); // todo
return __FSReadFileAsyncEx(fsClient, fsCmdBlock, dst, size, count, false, 0, fileHandle, flag, errorMask, fsAsyncParams); return __FSReadFileAsyncEx(fsClient, fsCmdBlock, dst, size, count, false, 0, fileHandle, flag, errorMask, fsAsyncParams);
@ -1099,13 +1096,13 @@ namespace coreinit
sint32 FSReadFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* dst, uint32 size, uint32 count, uint32 fileHandle, uint32 flag, uint32 errorMask) sint32 FSReadFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* dst, uint32 size, uint32 count, uint32 fileHandle, uint32 flag, uint32 errorMask)
{ {
StackAllocator<FSAsyncParamsNew_t, 1> asyncParams; StackAllocator<FSAsyncParams, 1> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSReadFileAsync(fsClient, fsCmdBlock, dst, size, count, fileHandle, flag, errorMask, asyncParams.GetPointer()); sint32 fsAsyncRet = FSReadFileAsync(fsClient, fsCmdBlock, dst, size, count, fileHandle, flag, errorMask, asyncParams.GetPointer());
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, 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 FSReadFileWithPosAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* dst, uint32 size, uint32 count, uint32 filePos, uint32 fileHandle, uint32 flag, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
cemu_assert_debug(flag == 0); // todo cemu_assert_debug(flag == 0); // todo
sint32 fsStatus = __FSReadFileAsyncEx(fsClient, fsCmdBlock, dst, size, count, true, filePos, fileHandle, flag, errorMask, fsAsyncParams); sint32 fsStatus = __FSReadFileAsyncEx(fsClient, fsCmdBlock, dst, size, count, true, filePos, fileHandle, flag, errorMask, fsAsyncParams);
@ -1114,7 +1111,7 @@ namespace coreinit
sint32 FSReadFileWithPos(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* dst, uint32 size, uint32 count, uint32 filePos, uint32 fileHandle, uint32 flag, uint32 errorMask) sint32 FSReadFileWithPos(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* dst, uint32 size, uint32 count, uint32 filePos, uint32 fileHandle, uint32 flag, uint32 errorMask)
{ {
StackAllocator<FSAsyncParamsNew_t, 1> asyncParams; StackAllocator<FSAsyncParams, 1> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSReadFileWithPosAsync(fsClient, fsCmdBlock, dst, size, count, filePos, fileHandle, flag, errorMask, asyncParams.GetPointer()); sint32 fsAsyncRet = FSReadFileWithPosAsync(fsClient, fsCmdBlock, dst, size, count, filePos, fileHandle, flag, errorMask, asyncParams.GetPointer());
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask);
@ -1154,7 +1151,7 @@ namespace coreinit
return FSA_RESULT::OK; return FSA_RESULT::OK;
} }
sint32 __FSWriteFileWithPosAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* dest, uint32 size, uint32 count, bool useFilePos, uint32 filePos, uint32 fileHandle, uint32 flag, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 __FSWriteFileWithPosAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* dest, uint32 size, uint32 count, bool useFilePos, uint32 filePos, uint32 fileHandle, uint32 flag, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
_FSCmdIntro(); _FSCmdIntro();
if (size == 0 || count == 0 || dest == nullptr) if (size == 0 || count == 0 || dest == nullptr)
@ -1185,27 +1182,27 @@ namespace coreinit
return (FSStatus)FS_RESULT::SUCCESS; return (FSStatus)FS_RESULT::SUCCESS;
} }
sint32 FSWriteFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* src, uint32 size, uint32 count, uint32 fileHandle, uint32 flag, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSWriteFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* src, uint32 size, uint32 count, uint32 fileHandle, uint32 flag, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
return __FSWriteFileWithPosAsync(fsClient, fsCmdBlock, src, size, count, false, 0, fileHandle, flag, errorMask, fsAsyncParams); return __FSWriteFileWithPosAsync(fsClient, fsCmdBlock, src, size, count, false, 0, fileHandle, flag, errorMask, fsAsyncParams);
} }
sint32 FSWriteFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* src, uint32 size, uint32 count, uint32 fileHandle, uint32 flag, uint32 errorMask) sint32 FSWriteFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* src, uint32 size, uint32 count, uint32 fileHandle, uint32 flag, uint32 errorMask)
{ {
StackAllocator<FSAsyncParamsNew_t, 1> asyncParams; StackAllocator<FSAsyncParams, 1> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSWriteFileAsync(fsClient, fsCmdBlock, src, size, count, fileHandle, flag, errorMask, asyncParams.GetPointer()); sint32 fsAsyncRet = FSWriteFileAsync(fsClient, fsCmdBlock, src, size, count, fileHandle, flag, errorMask, asyncParams.GetPointer());
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, 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) sint32 FSWriteFileWithPosAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* src, uint32 size, uint32 count, uint32 filePos, uint32 fileHandle, uint32 flag, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
return __FSWriteFileWithPosAsync(fsClient, fsCmdBlock, src, size, count, true, filePos, fileHandle, flag, errorMask, fsAsyncParams); return __FSWriteFileWithPosAsync(fsClient, fsCmdBlock, src, size, count, true, filePos, fileHandle, flag, errorMask, fsAsyncParams);
} }
sint32 FSWriteFileWithPos(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* src, uint32 size, uint32 count, uint32 filePos, uint32 fileHandle, uint32 flag, uint32 errorMask) sint32 FSWriteFileWithPos(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* src, uint32 size, uint32 count, uint32 filePos, uint32 fileHandle, uint32 flag, uint32 errorMask)
{ {
StackAllocator<FSAsyncParamsNew_t, 1> asyncParams; StackAllocator<FSAsyncParams, 1> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSWriteFileWithPosAsync(fsClient, fsCmdBlock, src, size, count, filePos, fileHandle, flag, errorMask, asyncParams.GetPointer()); sint32 fsAsyncRet = FSWriteFileWithPosAsync(fsClient, fsCmdBlock, src, size, count, filePos, fileHandle, flag, errorMask, asyncParams.GetPointer());
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask);
@ -1224,7 +1221,7 @@ namespace coreinit
return FSA_RESULT::OK; return FSA_RESULT::OK;
} }
sint32 FSSetPosFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 filePos, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSSetPosFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 filePos, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
_FSCmdIntro(); _FSCmdIntro();
FSA_RESULT prepareResult = __FSPrepareCmd_SetPosFile(&fsCmdBlockBody->fsaShimBuffer, fsClientBody->iosuFSAHandle, fileHandle, filePos); FSA_RESULT prepareResult = __FSPrepareCmd_SetPosFile(&fsCmdBlockBody->fsaShimBuffer, fsClientBody->iosuFSAHandle, fileHandle, filePos);
@ -1237,7 +1234,7 @@ namespace coreinit
sint32 FSSetPosFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 filePos, uint32 errorMask) sint32 FSSetPosFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 filePos, uint32 errorMask)
{ {
// used by games: Mario Kart 8 // used by games: Mario Kart 8
StackAllocator<FSAsyncParamsNew_t, 1> asyncParams; StackAllocator<FSAsyncParams, 1> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSSetPosFileAsync(fsClient, fsCmdBlock, fileHandle, filePos, errorMask, asyncParams.GetPointer()); sint32 fsAsyncRet = FSSetPosFileAsync(fsClient, fsCmdBlock, fileHandle, filePos, errorMask, asyncParams.GetPointer());
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask);
@ -1254,7 +1251,7 @@ namespace coreinit
return FSA_RESULT::OK; return FSA_RESULT::OK;
} }
sint32 FSGetPosFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32be* returnedFilePos, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSGetPosFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32be* returnedFilePos, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
// games using this: Darksiders Warmastered Edition // games using this: Darksiders Warmastered Edition
_FSCmdIntro(); _FSCmdIntro();
@ -1268,7 +1265,7 @@ namespace coreinit
sint32 FSGetPosFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32be* returnedFilePos, uint32 errorMask) sint32 FSGetPosFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32be* returnedFilePos, uint32 errorMask)
{ {
StackAllocator<FSAsyncParamsNew_t, 1> asyncParams; StackAllocator<FSAsyncParams, 1> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSGetPosFileAsync(fsClient, fsCmdBlock, fileHandle, returnedFilePos, errorMask, asyncParams.GetPointer()); sint32 fsAsyncRet = FSGetPosFileAsync(fsClient, fsCmdBlock, fileHandle, returnedFilePos, errorMask, asyncParams.GetPointer());
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask);
@ -1302,7 +1299,7 @@ namespace coreinit
return FSA_RESULT::OK; return FSA_RESULT::OK;
} }
sint32 FSOpenDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, FSDirHandlePtr dirHandleOut, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSOpenDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, FSDirHandlePtr dirHandleOut, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
_FSCmdIntro(); _FSCmdIntro();
cemu_assert(dirHandleOut && path); cemu_assert(dirHandleOut && path);
@ -1316,7 +1313,7 @@ namespace coreinit
sint32 FSOpenDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, FSDirHandlePtr dirHandleOut, uint32 errorMask) sint32 FSOpenDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, FSDirHandlePtr dirHandleOut, uint32 errorMask)
{ {
StackAllocator<FSAsyncParamsNew_t, 1> asyncParams; StackAllocator<FSAsyncParams, 1> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSOpenDirAsync(fsClient, fsCmdBlock, path, dirHandleOut, errorMask, &asyncParams); sint32 fsAsyncRet = FSOpenDirAsync(fsClient, fsCmdBlock, path, dirHandleOut, errorMask, &asyncParams);
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask);
@ -1333,7 +1330,7 @@ namespace coreinit
return FSA_RESULT::OK; return FSA_RESULT::OK;
} }
sint32 FSReadDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, FSDirEntry_t* dirEntryOut, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSReadDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, FSDirEntry_t* dirEntryOut, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
_FSCmdIntro(); _FSCmdIntro();
FSA_RESULT prepareResult = __FSPrepareCmd_ReadDir(&fsCmdBlockBody->fsaShimBuffer, fsClientBody->iosuFSAHandle, dirHandle); FSA_RESULT prepareResult = __FSPrepareCmd_ReadDir(&fsCmdBlockBody->fsaShimBuffer, fsClientBody->iosuFSAHandle, dirHandle);
@ -1344,9 +1341,9 @@ namespace coreinit
return (FSStatus)FS_RESULT::SUCCESS; return (FSStatus)FS_RESULT::SUCCESS;
} }
sint32 FSReadDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, FSDirEntry_t* dirEntryOut, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSReadDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, FSDirEntry_t* dirEntryOut, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
StackAllocator<FSAsyncParamsNew_t, 1> asyncParams; StackAllocator<FSAsyncParams, 1> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSReadDirAsync(fsClient, fsCmdBlock, dirHandle, dirEntryOut, errorMask, &asyncParams); sint32 fsAsyncRet = FSReadDirAsync(fsClient, fsCmdBlock, dirHandle, dirEntryOut, errorMask, &asyncParams);
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask);
@ -1363,7 +1360,7 @@ namespace coreinit
return FSA_RESULT::OK; return FSA_RESULT::OK;
} }
sint32 FSCloseDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSCloseDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
_FSCmdIntro(); _FSCmdIntro();
FSA_RESULT prepareResult = __FSPrepareCmd_CloseDir(&fsCmdBlockBody->fsaShimBuffer, fsClientBody->iosuFSAHandle, dirHandle); FSA_RESULT prepareResult = __FSPrepareCmd_CloseDir(&fsCmdBlockBody->fsaShimBuffer, fsClientBody->iosuFSAHandle, dirHandle);
@ -1376,7 +1373,7 @@ namespace coreinit
sint32 FSCloseDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, uint32 errorMask) sint32 FSCloseDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, uint32 errorMask)
{ {
StackAllocator<FSAsyncParamsNew_t, 1> asyncParams; StackAllocator<FSAsyncParams, 1> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSCloseDirAsync(fsClient, fsCmdBlock, dirHandle, errorMask, &asyncParams); sint32 fsAsyncRet = FSCloseDirAsync(fsClient, fsCmdBlock, dirHandle, errorMask, &asyncParams);
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask);
@ -1396,7 +1393,7 @@ namespace coreinit
return FSA_RESULT::OK; return FSA_RESULT::OK;
} }
sint32 FSRewindDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSRewindDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
_FSCmdIntro(); _FSCmdIntro();
FSA_RESULT prepareResult = __FSPrepareCmd_RewindDir(&fsCmdBlockBody->fsaShimBuffer, fsClientBody->iosuFSAHandle, dirHandle); FSA_RESULT prepareResult = __FSPrepareCmd_RewindDir(&fsCmdBlockBody->fsaShimBuffer, fsClientBody->iosuFSAHandle, dirHandle);
@ -1409,7 +1406,7 @@ namespace coreinit
sint32 FSRewindDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, uint32 errorMask) sint32 FSRewindDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, uint32 errorMask)
{ {
StackAllocator<FSAsyncParamsNew_t, 1> asyncParams; StackAllocator<FSAsyncParams, 1> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSRewindDirAsync(fsClient, fsCmdBlock, dirHandle, errorMask, &asyncParams); sint32 fsAsyncRet = FSRewindDirAsync(fsClient, fsCmdBlock, dirHandle, errorMask, &asyncParams);
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask);
@ -1431,7 +1428,7 @@ namespace coreinit
return FSA_RESULT::OK; return FSA_RESULT::OK;
} }
sint32 FSAppendFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 size, uint32 count, uint32 fileHandle, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSAppendFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 size, uint32 count, uint32 fileHandle, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
_FSCmdIntro(); _FSCmdIntro();
FSA_RESULT prepareResult = __FSPrepareCmd_AppendFile(&fsCmdBlockBody->fsaShimBuffer, fsClientBody->iosuFSAHandle, size, count, fileHandle, 0); FSA_RESULT prepareResult = __FSPrepareCmd_AppendFile(&fsCmdBlockBody->fsaShimBuffer, fsClientBody->iosuFSAHandle, size, count, fileHandle, 0);
@ -1444,7 +1441,7 @@ namespace coreinit
sint32 FSAppendFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 size, uint32 count, uint32 fileHandle, uint32 errorMask) sint32 FSAppendFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 size, uint32 count, uint32 fileHandle, uint32 errorMask)
{ {
StackAllocator<FSAsyncParamsNew_t> asyncParams; StackAllocator<FSAsyncParams> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSAppendFileAsync(fsClient, fsCmdBlock, size, count, fileHandle, errorMask, asyncParams.GetPointer()); sint32 fsAsyncRet = FSAppendFileAsync(fsClient, fsCmdBlock, size, count, fileHandle, errorMask, asyncParams.GetPointer());
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask);
@ -1463,7 +1460,7 @@ namespace coreinit
return FSA_RESULT::OK; return FSA_RESULT::OK;
} }
sint32 FSTruncateFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSFileHandle2 fileHandle, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSTruncateFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSFileHandle2 fileHandle, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
_FSCmdIntro(); _FSCmdIntro();
FSA_RESULT prepareResult = __FSPrepareCmd_TruncateFile(&fsCmdBlockBody->fsaShimBuffer, fsClientBody->iosuFSAHandle, fileHandle); FSA_RESULT prepareResult = __FSPrepareCmd_TruncateFile(&fsCmdBlockBody->fsaShimBuffer, fsClientBody->iosuFSAHandle, fileHandle);
@ -1476,7 +1473,7 @@ namespace coreinit
sint32 FSTruncateFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSFileHandle2 fileHandle, uint32 errorMask) sint32 FSTruncateFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSFileHandle2 fileHandle, uint32 errorMask)
{ {
StackAllocator<FSAsyncParamsNew_t> asyncParams; StackAllocator<FSAsyncParams> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSTruncateFileAsync(fsClient, fsCmdBlock, fileHandle, errorMask, asyncParams.GetPointer()); sint32 fsAsyncRet = FSTruncateFileAsync(fsClient, fsCmdBlock, fileHandle, errorMask, asyncParams.GetPointer());
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask);
@ -1521,7 +1518,7 @@ namespace coreinit
return FSA_RESULT::OK; return FSA_RESULT::OK;
} }
sint32 FSRenameAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* srcPath, char* dstPath, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSRenameAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* srcPath, char* dstPath, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
// used by titles: XCX (via SAVERenameAsync) // used by titles: XCX (via SAVERenameAsync)
_FSCmdIntro(); _FSCmdIntro();
@ -1540,7 +1537,7 @@ namespace coreinit
sint32 FSRename(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* srcPath, char* dstPath, uint32 errorMask) sint32 FSRename(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* srcPath, char* dstPath, uint32 errorMask)
{ {
StackAllocator<FSAsyncParamsNew_t> asyncParams; StackAllocator<FSAsyncParams> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSRenameAsync(fsClient, fsCmdBlock, srcPath, dstPath, errorMask, asyncParams.GetPointer()); sint32 fsAsyncRet = FSRenameAsync(fsClient, fsCmdBlock, srcPath, dstPath, errorMask, asyncParams.GetPointer());
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask);
@ -1572,7 +1569,7 @@ namespace coreinit
return FSA_RESULT::OK; return FSA_RESULT::OK;
} }
sint32 FSRemoveAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint8* filePath, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSRemoveAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint8* filePath, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
// used by titles: XCX (via SAVERemoveAsync) // used by titles: XCX (via SAVERemoveAsync)
_FSCmdIntro(); _FSCmdIntro();
@ -1591,7 +1588,7 @@ namespace coreinit
sint32 FSRemove(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint8* filePath, uint32 errorMask) sint32 FSRemove(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint8* filePath, uint32 errorMask)
{ {
StackAllocator<FSAsyncParamsNew_t> asyncParams; StackAllocator<FSAsyncParams> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSRemoveAsync(fsClient, fsCmdBlock, filePath, errorMask, &asyncParams); sint32 fsAsyncRet = FSRemoveAsync(fsClient, fsCmdBlock, filePath, errorMask, &asyncParams);
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask);
@ -1624,7 +1621,7 @@ namespace coreinit
return FSA_RESULT::OK; return FSA_RESULT::OK;
} }
sint32 FSMakeDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* dirPath, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSMakeDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* dirPath, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
// used by titles: XCX (via SAVEMakeDirAsync) // used by titles: XCX (via SAVEMakeDirAsync)
_FSCmdIntro(); _FSCmdIntro();
@ -1643,7 +1640,7 @@ namespace coreinit
sint32 FSMakeDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* path, uint32 errorMask) sint32 FSMakeDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* path, uint32 errorMask)
{ {
StackAllocator<FSAsyncParamsNew_t> asyncParams; StackAllocator<FSAsyncParams> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSMakeDirAsync(fsClient, fsCmdBlock, path, errorMask, &asyncParams); sint32 fsAsyncRet = FSMakeDirAsync(fsClient, fsCmdBlock, path, errorMask, &asyncParams);
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask);
@ -1674,7 +1671,7 @@ namespace coreinit
return FSA_RESULT::OK; return FSA_RESULT::OK;
} }
sint32 FSChangeDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSChangeDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
_FSCmdIntro(); _FSCmdIntro();
if (path == NULL) if (path == NULL)
@ -1692,7 +1689,7 @@ namespace coreinit
sint32 FSChangeDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, uint32 errorMask) sint32 FSChangeDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, uint32 errorMask)
{ {
StackAllocator<FSAsyncParamsNew_t> asyncParams; StackAllocator<FSAsyncParams> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSChangeDirAsync(fsClient, fsCmdBlock, path, errorMask, &asyncParams); sint32 fsAsyncRet = FSChangeDirAsync(fsClient, fsCmdBlock, path, errorMask, &asyncParams);
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask);
@ -1710,7 +1707,7 @@ namespace coreinit
return FSA_RESULT::OK; return FSA_RESULT::OK;
} }
sint32 FSGetCwdAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* dirPathOut, sint32 dirPathMaxLen, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSGetCwdAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* dirPathOut, sint32 dirPathMaxLen, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
// used by titles: Super Mario Maker // used by titles: Super Mario Maker
_FSCmdIntro(); _FSCmdIntro();
@ -1727,7 +1724,7 @@ namespace coreinit
sint32 FSGetCwd(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* dirPathOut, sint32 dirPathMaxLen, uint32 errorMask) sint32 FSGetCwd(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* dirPathOut, sint32 dirPathMaxLen, uint32 errorMask)
{ {
StackAllocator<FSAsyncParamsNew_t> asyncParams; StackAllocator<FSAsyncParams> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSGetCwdAsync(fsClient, fsCmdBlock, dirPathOut, dirPathMaxLen, errorMask, &asyncParams); sint32 fsAsyncRet = FSGetCwdAsync(fsClient, fsCmdBlock, dirPathOut, dirPathMaxLen, errorMask, &asyncParams);
auto r = __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask); auto r = __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask);
@ -1758,7 +1755,7 @@ namespace coreinit
return FSA_RESULT::OK; return FSA_RESULT::OK;
} }
sint32 FSFlushQuotaAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSFlushQuotaAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
_FSCmdIntro(); _FSCmdIntro();
@ -1772,7 +1769,7 @@ namespace coreinit
sint32 FSFlushQuota(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, uint32 errorMask) sint32 FSFlushQuota(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, uint32 errorMask)
{ {
StackAllocator<FSAsyncParamsNew_t> asyncParams; StackAllocator<FSAsyncParams> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSFlushQuotaAsync(fsClient, fsCmdBlock, path, errorMask, &asyncParams); sint32 fsAsyncRet = FSFlushQuotaAsync(fsClient, fsCmdBlock, path, errorMask, &asyncParams);
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask);
@ -1808,7 +1805,7 @@ namespace coreinit
return FSA_RESULT::OK; return FSA_RESULT::OK;
} }
sint32 __FSQueryInfoAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint8* queryString, uint32 queryType, void* queryResult, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 __FSQueryInfoAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint8* queryString, uint32 queryType, void* queryResult, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
_FSCmdIntro(); _FSCmdIntro();
cemu_assert(queryString && queryResult); // query string and result must not be null cemu_assert(queryString && queryResult); // query string and result must not be null
@ -1822,7 +1819,7 @@ namespace coreinit
return (FSStatus)FS_RESULT::SUCCESS; return (FSStatus)FS_RESULT::SUCCESS;
} }
sint32 FSGetStatAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* path, FSStat_t* statOut, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSGetStatAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* path, FSStat_t* statOut, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
sint32 fsStatus = __FSQueryInfoAsync(fsClient, fsCmdBlock, (uint8*)path, FSA_QUERY_TYPE_STAT, statOut, errorMask, fsAsyncParams); sint32 fsStatus = __FSQueryInfoAsync(fsClient, fsCmdBlock, (uint8*)path, FSA_QUERY_TYPE_STAT, statOut, errorMask, fsAsyncParams);
return fsStatus; return fsStatus;
@ -1830,7 +1827,7 @@ namespace coreinit
sint32 FSGetStat(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* path, FSStat_t* statOut, uint32 errorMask) sint32 FSGetStat(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* path, FSStat_t* statOut, uint32 errorMask)
{ {
StackAllocator<FSAsyncParamsNew_t, 1> asyncParams; StackAllocator<FSAsyncParams, 1> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSGetStatAsync(fsClient, fsCmdBlock, path, statOut, errorMask, &asyncParams); sint32 fsAsyncRet = FSGetStatAsync(fsClient, fsCmdBlock, path, statOut, errorMask, &asyncParams);
sint32 ret = __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask); sint32 ret = __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask);
@ -1851,7 +1848,7 @@ namespace coreinit
return FSA_RESULT::OK; return FSA_RESULT::OK;
} }
sint32 FSGetStatFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSFileHandle2 fileHandle, FSStat_t* statOut, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSGetStatFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSFileHandle2 fileHandle, FSStat_t* statOut, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
_FSCmdIntro(); _FSCmdIntro();
cemu_assert(statOut); // statOut must not be null cemu_assert(statOut); // statOut must not be null
@ -1867,13 +1864,13 @@ namespace coreinit
sint32 FSGetStatFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSFileHandle2 fileHandle, FSStat_t* statOut, uint32 errorMask) sint32 FSGetStatFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSFileHandle2 fileHandle, FSStat_t* statOut, uint32 errorMask)
{ {
StackAllocator<FSAsyncParamsNew_t, 1> asyncParams; StackAllocator<FSAsyncParams, 1> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSGetStatFileAsync(fsClient, fsCmdBlock, fileHandle, statOut, errorMask, &asyncParams); sint32 fsAsyncRet = FSGetStatFileAsync(fsClient, fsCmdBlock, fileHandle, statOut, errorMask, &asyncParams);
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask);
} }
sint32 FSGetFreeSpaceSizeAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* path, FSLargeSize* returnedFreeSize, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSGetFreeSpaceSizeAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* path, FSLargeSize* returnedFreeSize, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
// used by: Wii U system settings app, Art Academy, Unity (e.g. Snoopy's Grand Adventure), Super Smash Bros // used by: Wii U system settings app, Art Academy, Unity (e.g. Snoopy's Grand Adventure), Super Smash Bros
sint32 fsStatus = __FSQueryInfoAsync(fsClient, fsCmdBlock, (uint8*)path, FSA_QUERY_TYPE_FREESPACE, returnedFreeSize, errorMask, fsAsyncParams); sint32 fsStatus = __FSQueryInfoAsync(fsClient, fsCmdBlock, (uint8*)path, FSA_QUERY_TYPE_FREESPACE, returnedFreeSize, errorMask, fsAsyncParams);
@ -1882,7 +1879,7 @@ namespace coreinit
sint32 FSGetFreeSpaceSize(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* path, FSLargeSize* returnedFreeSize, uint32 errorMask) sint32 FSGetFreeSpaceSize(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* path, FSLargeSize* returnedFreeSize, uint32 errorMask)
{ {
StackAllocator<FSAsyncParamsNew_t, 1> asyncParams; StackAllocator<FSAsyncParams, 1> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSGetFreeSpaceSizeAsync(fsClient, fsCmdBlock, path, returnedFreeSize, errorMask, &asyncParams); sint32 fsAsyncRet = FSGetFreeSpaceSizeAsync(fsClient, fsCmdBlock, path, returnedFreeSize, errorMask, &asyncParams);
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask);
@ -1902,7 +1899,7 @@ namespace coreinit
return FSA_RESULT::OK; return FSA_RESULT::OK;
} }
sint32 FSIsEofAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams) sint32 FSIsEofAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 errorMask, FSAsyncParams* fsAsyncParams)
{ {
// used by Paper Monsters Recut // used by Paper Monsters Recut
_FSCmdIntro(); _FSCmdIntro();
@ -1917,7 +1914,7 @@ namespace coreinit
sint32 FSIsEof(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 errorMask) sint32 FSIsEof(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 errorMask)
{ {
StackAllocator<FSAsyncParamsNew_t, 1> asyncParams; StackAllocator<FSAsyncParams, 1> asyncParams;
__FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams); __FSAsyncToSyncInit(fsClient, fsCmdBlock, &asyncParams);
sint32 fsAsyncRet = FSIsEofAsync(fsClient, fsCmdBlock, fileHandle, errorMask, &asyncParams); sint32 fsAsyncRet = FSIsEofAsync(fsClient, fsCmdBlock, fileHandle, errorMask, &asyncParams);
return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask); return __FSProcessAsyncResult(fsClient, fsCmdBlock, fsAsyncRet, errorMask);
@ -1925,14 +1922,14 @@ namespace coreinit
void FSSetUserData(FSCmdBlock_t* fsCmdBlock, void* userData) void FSSetUserData(FSCmdBlock_t* fsCmdBlock, void* userData)
{ {
FSCmdBlockBody_t* fsCmdBlockBody = __FSGetCmdBlockBody(fsCmdBlock); FSCmdBlockBody* fsCmdBlockBody = __FSGetCmdBlockBody(fsCmdBlock);
if (fsCmdBlockBody) if (fsCmdBlockBody)
fsCmdBlockBody->userData = userData; fsCmdBlockBody->userData = userData;
} }
void* FSGetUserData(FSCmdBlock_t* fsCmdBlock) void* FSGetUserData(FSCmdBlock_t* fsCmdBlock)
{ {
FSCmdBlockBody_t* fsCmdBlockBody = __FSGetCmdBlockBody(fsCmdBlock); FSCmdBlockBody* fsCmdBlockBody = __FSGetCmdBlockBody(fsCmdBlock);
void* userData = nullptr; void* userData = nullptr;
if (fsCmdBlockBody) if (fsCmdBlockBody)
userData = fsCmdBlockBody->userData.GetPtr(); userData = fsCmdBlockBody->userData.GetPtr();
@ -1956,7 +1953,7 @@ namespace coreinit
FSClientBody_t* fsClientBody = __FSGetClientBody(fsClient); FSClientBody_t* fsClientBody = __FSGetClientBody(fsClient);
if (!fsClientBody) if (!fsClientBody)
return nullptr; return nullptr;
FSCmdBlockBody_t* cmdBlockBody = fsClientBody->currentCmdBlockBody; FSCmdBlockBody* cmdBlockBody = fsClientBody->currentCmdBlockBody;
if (!cmdBlockBody) if (!cmdBlockBody)
return nullptr; return nullptr;
return cmdBlockBody->selfCmdBlock; return cmdBlockBody->selfCmdBlock;

View File

@ -5,33 +5,23 @@
#include "Cafe/IOSU/fsa/iosu_fsa.h" #include "Cafe/IOSU/fsa/iosu_fsa.h"
#include "coreinit_MessageQueue.h" #include "coreinit_MessageQueue.h"
typedef struct typedef MEMPTR<betype<FSFileHandle2>> FSFileHandlePtr;
{
uint32be fileHandle;
} FSFileHandleDepr_t;
typedef MEMPTR<betype<FSDirHandle2>> FSDirHandlePtr; typedef MEMPTR<betype<FSDirHandle2>> FSDirHandlePtr;
typedef uint32 FSAClientHandle; typedef uint32 FSAClientHandle;
typedef struct struct FSAsyncParams
{ {
MEMPTR<void> userCallback; MEMPTR<void> userCallback;
MEMPTR<void> userContext; MEMPTR<void> userContext;
MEMPTR<coreinit::OSMessageQueue> ioMsgQueue; MEMPTR<coreinit::OSMessageQueue> ioMsgQueue;
} FSAsyncParamsNew_t; };
static_assert(sizeof(FSAsyncParams) == 0xC);
static_assert(sizeof(FSAsyncParamsNew_t) == 0xC);
typedef struct
{
MPTR userCallback; // 0x96C
MPTR userContext;
MPTR ioMsgQueue;
} FSAsyncParams_t; // legacy struct. Replace with FSAsyncParamsNew_t
namespace coreinit namespace coreinit
{ {
struct FSCmdBlockBody;
struct FSCmdQueue struct FSCmdQueue
{ {
enum class QUEUE_FLAG : uint32 enum class QUEUE_FLAG : uint32
@ -40,8 +30,8 @@ namespace coreinit
CANCEL_ALL = (1 << 4), CANCEL_ALL = (1 << 4),
}; };
/* +0x00 */ MPTR firstMPTR; /* +0x00 */ MEMPTR<FSCmdBlockBody> first;
/* +0x04 */ MPTR lastMPTR; /* +0x04 */ MEMPTR<FSCmdBlockBody> last;
/* +0x08 */ OSFastMutex fastMutex; /* +0x08 */ OSFastMutex fastMutex;
/* +0x34 */ MPTR dequeueHandlerFuncMPTR; /* +0x34 */ MPTR dequeueHandlerFuncMPTR;
/* +0x38 */ uint32be numCommandsInFlight; /* +0x38 */ uint32be numCommandsInFlight;
@ -108,7 +98,7 @@ namespace coreinit
uint8 ukn1460[0x10]; uint8 ukn1460[0x10];
uint8 ukn1470[0x10]; uint8 ukn1470[0x10];
FSCmdQueue fsCmdQueue; FSCmdQueue fsCmdQueue;
/* +0x14C4 */ MEMPTR<struct FSCmdBlockBody_t> currentCmdBlockBody; // set to currently active cmd /* +0x14C4 */ MEMPTR<struct FSCmdBlockBody> currentCmdBlockBody; // set to currently active cmd
uint32 ukn14C8; uint32 ukn14C8;
uint32 ukn14CC; uint32 ukn14CC;
uint8 ukn14D0[0x10]; uint8 ukn14D0[0x10];
@ -128,7 +118,7 @@ namespace coreinit
struct FSAsyncResult struct FSAsyncResult
{ {
/* +0x00 */ FSAsyncParamsNew_t fsAsyncParamsNew; /* +0x00 */ FSAsyncParams fsAsyncParamsNew;
// fs message storage // fs message storage
struct FSMessage struct FSMessage
@ -159,7 +149,7 @@ namespace coreinit
uint8 ukn0[0x14]; uint8 ukn0[0x14];
struct struct
{ {
MEMPTR<uint32be> handlePtr; MEMPTR<betype<FSResHandle>> handlePtr;
} cmdOpenFile; } cmdOpenFile;
struct struct
{ {
@ -205,7 +195,7 @@ namespace coreinit
static_assert(sizeof(FSCmdBlockReturnValues_t) == 0x14); static_assert(sizeof(FSCmdBlockReturnValues_t) == 0x14);
struct FSCmdBlockBody_t struct FSCmdBlockBody
{ {
iosu::fsa::FSAShimBuffer fsaShimBuffer; iosu::fsa::FSAShimBuffer fsaShimBuffer;
/* +0x0938 */ MEMPTR<FSClientBody_t> fsClientBody; /* +0x0938 */ MEMPTR<FSClientBody_t> fsClientBody;
@ -213,9 +203,8 @@ namespace coreinit
/* +0x0940 */ uint32be cancelState; // bitmask. Bit 0 -> If set command has been canceled /* +0x0940 */ uint32be cancelState; // bitmask. Bit 0 -> If set command has been canceled
FSCmdBlockReturnValues_t returnValues; FSCmdBlockReturnValues_t returnValues;
// link for cmd queue // link for cmd queue
MPTR nextMPTR; // points towards FSCmdQueue->first MEMPTR<FSCmdBlockBody> next;
MPTR previousMPTR; // points towards FSCmdQueue->last MEMPTR<FSCmdBlockBody> previous;
/* +0x960 */ betype<FSA_RESULT> lastFSAStatus; /* +0x960 */ betype<FSA_RESULT> lastFSAStatus;
uint32 ukn0964; uint32 ukn0964;
/* +0x0968 */ uint8 errHandling; // return error flag mask /* +0x0968 */ uint8 errHandling; // return error flag mask
@ -235,7 +224,6 @@ namespace coreinit
uint32 ukn9FC; uint32 ukn9FC;
}; };
static_assert(sizeof(FSAsyncParams_t) == 0xC);
static_assert(sizeof(FSCmdBlock_t) == 0xA80); static_assert(sizeof(FSCmdBlock_t) == 0xA80);
#define FSA_CMD_FLAG_SET_POS (1 << 0) #define FSA_CMD_FLAG_SET_POS (1 << 0)
@ -251,7 +239,7 @@ namespace coreinit
}; };
// internal interface // internal interface
sint32 __FSQueryInfoAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint8* queryString, uint32 queryType, void* queryResult, uint32 errHandling, FSAsyncParamsNew_t* fsAsyncParams); sint32 __FSQueryInfoAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint8* queryString, uint32 queryType, void* queryResult, uint32 errHandling, FSAsyncParams* fsAsyncParams);
// coreinit exports // coreinit exports
FS_RESULT FSAddClientEx(FSClient_t* fsClient, uint32 uknR4, uint32 errHandling); FS_RESULT FSAddClientEx(FSClient_t* fsClient, uint32 uknR4, uint32 errHandling);
@ -260,52 +248,52 @@ namespace coreinit
void FSInitCmdBlock(FSCmdBlock_t* fsCmdBlock); void FSInitCmdBlock(FSCmdBlock_t* fsCmdBlock);
sint32 FSOpenFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, char* mode, FSFileHandleDepr_t* fileHandle, uint32 errHandling, FSAsyncParamsNew_t* asyncParams); sint32 FSOpenFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, char* mode, FSFileHandlePtr outFileHandle, uint32 errHandling, FSAsyncParams* asyncParams);
sint32 FSOpenFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, char* mode, FSFileHandleDepr_t* fileHandle, uint32 errHandling); sint32 FSOpenFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, char* mode, FSFileHandlePtr outFileHandle, 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 FSReadFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* dst, uint32 size, uint32 count, uint32 fileHandle, uint32 flag, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSReadFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* dst, uint32 size, uint32 count, uint32 fileHandle, uint32 flag, uint32 errorMask); 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 FSReadFileWithPosAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* dst, uint32 size, uint32 count, uint32 filePos, uint32 fileHandle, uint32 flag, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSReadFileWithPos(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* dst, uint32 size, uint32 count, uint32 filePos, uint32 fileHandle, uint32 flag, uint32 errorMask); 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 FSWriteFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* src, uint32 size, uint32 count, uint32 fileHandle, uint32 flag, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSWriteFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* src, uint32 size, uint32 count, uint32 fileHandle, uint32 flag, uint32 errorMask); 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); sint32 FSWriteFileWithPosAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* src, uint32 size, uint32 count, uint32 filePos, uint32 fileHandle, uint32 flag, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSWriteFileWithPos(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* src, uint32 size, uint32 count, uint32 filePos, uint32 fileHandle, uint32 flag, uint32 errorMask); sint32 FSWriteFileWithPos(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* src, uint32 size, uint32 count, uint32 filePos, uint32 fileHandle, uint32 flag, uint32 errorMask);
sint32 FSSetPosFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 filePos, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams); sint32 FSSetPosFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 filePos, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSSetPosFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 filePos, uint32 errorMask); sint32 FSSetPosFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 filePos, uint32 errorMask);
sint32 FSGetPosFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32be* returnedFilePos, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams); sint32 FSGetPosFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32be* returnedFilePos, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSGetPosFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32be* returnedFilePos, uint32 errorMask); sint32 FSGetPosFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32be* returnedFilePos, uint32 errorMask);
sint32 FSAppendFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 size, uint32 count, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams); sint32 FSAppendFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 size, uint32 count, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSAppendFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 size, uint32 count, uint32 errorMask); sint32 FSAppendFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 size, uint32 count, uint32 errorMask);
sint32 FSIsEofAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams); sint32 FSIsEofAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSIsEof(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 errorMask); sint32 FSIsEof(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 errorMask);
sint32 FSRenameAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* srcPath, char* dstPath, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams); sint32 FSRenameAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* srcPath, char* dstPath, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSRename(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* srcPath, char* dstPath, uint32 errorMask); sint32 FSRename(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* srcPath, char* dstPath, uint32 errorMask);
sint32 FSRemoveAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint8* filePath, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams); sint32 FSRemoveAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint8* filePath, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSRemove(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint8* filePath, uint32 errorMask); sint32 FSRemove(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint8* filePath, uint32 errorMask);
sint32 FSMakeDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* dirPath, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams); sint32 FSMakeDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* dirPath, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSMakeDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* path, uint32 errorMask); sint32 FSMakeDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* path, uint32 errorMask);
sint32 FSChangeDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams); sint32 FSChangeDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSChangeDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, uint32 errorMask); sint32 FSChangeDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, uint32 errorMask);
sint32 FSGetCwdAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* dirPathOut, sint32 dirPathMaxLen, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams); sint32 FSGetCwdAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* dirPathOut, sint32 dirPathMaxLen, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSGetCwd(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* dirPathOut, sint32 dirPathMaxLen, uint32 errorMask); sint32 FSGetCwd(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* dirPathOut, sint32 dirPathMaxLen, uint32 errorMask);
sint32 FSGetFreeSpaceSizeAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* path, FSLargeSize* returnedFreeSize, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams); sint32 FSGetFreeSpaceSizeAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* path, FSLargeSize* returnedFreeSize, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSGetFreeSpaceSize(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* path, FSLargeSize* returnedFreeSize, uint32 errorMask); sint32 FSGetFreeSpaceSize(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* path, FSLargeSize* returnedFreeSize, uint32 errorMask);
sint32 FSOpenDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, FSDirHandlePtr dirHandleOut, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams); sint32 FSOpenDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, FSDirHandlePtr dirHandleOut, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSOpenDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, FSDirHandlePtr dirHandleOut, uint32 errorMask); sint32 FSOpenDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, FSDirHandlePtr dirHandleOut, uint32 errorMask);
sint32 FSReadDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, FSDirEntry_t* dirEntryOut, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams); sint32 FSReadDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, FSDirEntry_t* dirEntryOut, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSReadDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, FSDirEntry_t* dirEntryOut, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams); sint32 FSReadDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, FSDirEntry_t* dirEntryOut, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSCloseDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams); sint32 FSCloseDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSCloseDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, uint32 errorMask); sint32 FSCloseDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, uint32 errorMask);
sint32 FSFlushQuotaAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, uint32 errorMask, FSAsyncParamsNew_t* fsAsyncParams); sint32 FSFlushQuotaAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSFlushQuota(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, uint32 errorMask); sint32 FSFlushQuota(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, uint32 errorMask);
FS_VOLSTATE FSGetVolumeState(FSClient_t* fsClient); FS_VOLSTATE FSGetVolumeState(FSClient_t* fsClient);

View File

@ -128,7 +128,7 @@ namespace coreinit
{ {
MEMPTR<void> memBound; MEMPTR<void> memBound;
uint32be memBoundSize; uint32be memBoundSize;
OSGetMemBound(1, (MPTR*)memBound.GetBEPtr(), (uint32*)&memBoundSize); OSGetMemBound(1, &memBound, &memBoundSize);
MEMPTR<void> bucket; MEMPTR<void> bucket;
uint32be bucketSize; uint32be bucketSize;
@ -257,7 +257,7 @@ namespace coreinit
{ {
MEMPTR<void> memBound; MEMPTR<void> memBound;
uint32be memBoundSize; uint32be memBoundSize;
OSGetMemBound(1, (MPTR*)memBound.GetBEPtr(), (uint32*)&memBoundSize); OSGetMemBound(1, &memBound, &memBoundSize);
MEMPTR<void> bucket; MEMPTR<void> bucket;
uint32be bucketSize; uint32be bucketSize;
@ -593,16 +593,16 @@ namespace coreinit
{ {
MEMPTR<void> memBound; MEMPTR<void> memBound;
uint32be memBoundSize; uint32be memBoundSize;
OSGetMemBound(1, (MPTR*)memBound.GetBEPtr(), (uint32*)&memBoundSize); OSGetMemBound(1, &memBound, &memBoundSize);
mem1Heap = MEMCreateFrmHeapEx(memBound.GetPtr(), (uint32)memBoundSize, 0); mem1Heap = MEMCreateFrmHeapEx(memBound.GetPtr(), (uint32)memBoundSize, 0);
OSGetForegroundBucketFreeArea((MPTR*)memBound.GetBEPtr(), (MPTR*)&memBoundSize); OSGetForegroundBucketFreeArea(&memBound, &memBoundSize);
memFGHeap = MEMCreateFrmHeapEx(memBound.GetPtr(), (uint32)memBoundSize, 0); memFGHeap = MEMCreateFrmHeapEx(memBound.GetPtr(), (uint32)memBoundSize, 0);
} }
MEMPTR<void> memBound; MEMPTR<void> memBound;
uint32be memBoundSize; uint32be memBoundSize;
OSGetMemBound(2, (MPTR*)memBound.GetBEPtr(), (uint32*)&memBoundSize); OSGetMemBound(2, &memBound, &memBoundSize);
mem2Heap = MEMDefaultHeap_Init(memBound.GetPtr(), (uint32)memBoundSize); mem2Heap = MEMDefaultHeap_Init(memBound.GetPtr(), (uint32)memBoundSize);
// set DynLoad allocators // set DynLoad allocators

View File

@ -131,7 +131,7 @@ namespace coreinit
// no-op // no-op
} }
void OSGetMemBound(sint32 memType, MPTR* offsetOutput, uint32* sizeOutput) void OSGetMemBound(sint32 memType, MEMPTR<void>* offsetOutput, uint32be* sizeOutput)
{ {
MPTR memAddr = MPTR_NULL; MPTR memAddr = MPTR_NULL;
uint32 memSize = 0; uint32 memSize = 0;
@ -195,9 +195,9 @@ namespace coreinit
cemu_assert_debug(false); cemu_assert_debug(false);
} }
if (offsetOutput) if (offsetOutput)
*offsetOutput = _swapEndianU32(memAddr); *offsetOutput = memAddr;
if (sizeOutput) if (sizeOutput)
*sizeOutput = _swapEndianU32(memSize); *sizeOutput = memSize;
} }
void InitializeMemory() void InitializeMemory()

View File

@ -4,7 +4,7 @@ namespace coreinit
{ {
void InitializeMemory(); void InitializeMemory();
void OSGetMemBound(sint32 memType, MPTR* offsetOutput, uint32* sizeOutput); void OSGetMemBound(sint32 memType, MEMPTR<void>* offsetOutput, uint32be* sizeOutput);
void* OSBlockMove(MEMPTR<void> dst, MEMPTR<void> src, uint32 size, bool flushDC); void* OSBlockMove(MEMPTR<void> dst, MEMPTR<void> src, uint32 size, bool flushDC);
void* OSBlockSet(MEMPTR<void> dst, uint32 value, uint32 size); void* OSBlockSet(MEMPTR<void> dst, uint32 value, uint32 size);

View File

@ -1401,12 +1401,10 @@ void export_curl_easy_getinfo(PPCInterpreter_t* hCPU)
} }
case CURLINFO_CONTENT_TYPE: case CURLINFO_CONTENT_TYPE:
{ {
//cemuLog_logDebug(LogType::Force, "CURLINFO_CONTENT_TYPE not supported");
//*(uint32*)parameter.GetPtr() = MPTR_NULL;
char* contentType = nullptr; char* contentType = nullptr;
result = curl_easy_getinfo(curlObj, CURLINFO_REDIRECT_URL, &contentType); result = curl_easy_getinfo(curlObj, CURLINFO_REDIRECT_URL, &contentType);
_updateGuestString(curl.GetPtr(), curl->info_contentType, contentType); _updateGuestString(curl.GetPtr(), curl->info_contentType, contentType);
*(uint32*)parameter.GetPtr() = curl->info_contentType.GetMPTRBE(); *(MEMPTR<char>*)parameter.GetPtr() = curl->info_contentType;
break; break;
} }
case CURLINFO_REDIRECT_URL: case CURLINFO_REDIRECT_URL:
@ -1414,7 +1412,7 @@ void export_curl_easy_getinfo(PPCInterpreter_t* hCPU)
char* redirectUrl = nullptr; char* redirectUrl = nullptr;
result = curl_easy_getinfo(curlObj, CURLINFO_REDIRECT_URL, &redirectUrl); result = curl_easy_getinfo(curlObj, CURLINFO_REDIRECT_URL, &redirectUrl);
_updateGuestString(curl.GetPtr(), curl->info_redirectUrl, redirectUrl); _updateGuestString(curl.GetPtr(), curl->info_redirectUrl, redirectUrl);
*(uint32*)parameter.GetPtr() = curl->info_redirectUrl.GetMPTRBE(); *(MEMPTR<char>*)parameter.GetPtr() = curl->info_redirectUrl;
break; break;
} }
default: default:

View File

@ -320,7 +320,7 @@ namespace save
return SAVE_STATUS_OK; return SAVE_STATUS_OK;
} }
SAVEStatus SAVERemoveAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FS_ERROR_MASK errHandling, const FSAsyncParams_t* asyncParams) SAVEStatus SAVERemoveAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FS_ERROR_MASK errHandling, const FSAsyncParams* asyncParams)
{ {
SAVEStatus result = (FSStatus)(FS_RESULT::FATAL_ERROR); SAVEStatus result = (FSStatus)(FS_RESULT::FATAL_ERROR);
@ -331,7 +331,7 @@ namespace save
{ {
char fullPath[SAVE_MAX_PATH_SIZE]; char fullPath[SAVE_MAX_PATH_SIZE];
if (GetAbsoluteFullPath(persistentId, path, fullPath)) if (GetAbsoluteFullPath(persistentId, path, fullPath))
result = coreinit::FSRemoveAsync(client, block, (uint8*)fullPath, errHandling, (FSAsyncParamsNew_t*)asyncParams); result = coreinit::FSRemoveAsync(client, block, (uint8*)fullPath, errHandling, (FSAsyncParams*)asyncParams);
} }
else else
result = (FSStatus)FS_RESULT::NOT_FOUND; result = (FSStatus)FS_RESULT::NOT_FOUND;
@ -340,7 +340,7 @@ namespace save
return result; return result;
} }
SAVEStatus SAVEMakeDirAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FS_ERROR_MASK errHandling, const FSAsyncParams_t* asyncParams) SAVEStatus SAVEMakeDirAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FS_ERROR_MASK errHandling, const FSAsyncParams* asyncParams)
{ {
SAVEStatus result = (FSStatus)(FS_RESULT::FATAL_ERROR); SAVEStatus result = (FSStatus)(FS_RESULT::FATAL_ERROR);
@ -351,7 +351,7 @@ namespace save
{ {
char fullPath[SAVE_MAX_PATH_SIZE]; char fullPath[SAVE_MAX_PATH_SIZE];
if (GetAbsoluteFullPath(persistentId, path, fullPath)) if (GetAbsoluteFullPath(persistentId, path, fullPath))
result = coreinit::FSMakeDirAsync(client, block, fullPath, errHandling, (FSAsyncParamsNew_t*)asyncParams); result = coreinit::FSMakeDirAsync(client, block, fullPath, errHandling, (FSAsyncParams*)asyncParams);
} }
else else
result = (FSStatus)FS_RESULT::NOT_FOUND; result = (FSStatus)FS_RESULT::NOT_FOUND;
@ -361,7 +361,7 @@ namespace save
return result; return result;
} }
SAVEStatus SAVEOpenDirAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FSDirHandlePtr hDir, FS_ERROR_MASK errHandling, const FSAsyncParams_t* asyncParams) SAVEStatus SAVEOpenDirAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FSDirHandlePtr hDir, FS_ERROR_MASK errHandling, const FSAsyncParams* asyncParams)
{ {
SAVEStatus result = (FSStatus)(FS_RESULT::FATAL_ERROR); SAVEStatus result = (FSStatus)(FS_RESULT::FATAL_ERROR);
@ -372,7 +372,7 @@ namespace save
{ {
char fullPath[SAVE_MAX_PATH_SIZE]; char fullPath[SAVE_MAX_PATH_SIZE];
if (GetAbsoluteFullPath(persistentId, path, fullPath)) if (GetAbsoluteFullPath(persistentId, path, fullPath))
result = coreinit::FSOpenDirAsync(client, block, fullPath, hDir, errHandling, (FSAsyncParamsNew_t*)asyncParams); result = coreinit::FSOpenDirAsync(client, block, fullPath, hDir, errHandling, (FSAsyncParams*)asyncParams);
} }
else else
@ -383,7 +383,7 @@ namespace save
return result; return result;
} }
SAVEStatus SAVEOpenFileAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, const char* mode, FSFileHandleDepr_t* hFile, FS_ERROR_MASK errHandling, const FSAsyncParamsNew_t* asyncParams) SAVEStatus SAVEOpenFileAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, const char* mode, FSFileHandlePtr outFileHandle, FS_ERROR_MASK errHandling, const FSAsyncParams* asyncParams)
{ {
SAVEStatus result = (FSStatus)(FS_RESULT::FATAL_ERROR); SAVEStatus result = (FSStatus)(FS_RESULT::FATAL_ERROR);
@ -394,7 +394,7 @@ namespace save
{ {
char fullPath[SAVE_MAX_PATH_SIZE]; char fullPath[SAVE_MAX_PATH_SIZE];
if (GetAbsoluteFullPath(persistentId, path, fullPath)) if (GetAbsoluteFullPath(persistentId, path, fullPath))
result = coreinit::FSOpenFileAsync(client, block, fullPath, (char*)mode, hFile, errHandling, (FSAsyncParamsNew_t*)asyncParams); result = coreinit::FSOpenFileAsync(client, block, fullPath, (char*)mode, outFileHandle, errHandling, (FSAsyncParams*)asyncParams);
} }
else else
result = (FSStatus)FS_RESULT::NOT_FOUND; result = (FSStatus)FS_RESULT::NOT_FOUND;
@ -404,7 +404,7 @@ namespace save
return result; return result;
} }
SAVEStatus SAVEOpenFileOtherApplicationAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint64 titleId, uint8 accountSlot, const char* path, const char* mode, FSFileHandleDepr_t* hFile, FS_ERROR_MASK errHandling, const FSAsyncParamsNew_t* asyncParams) SAVEStatus SAVEOpenFileOtherApplicationAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint64 titleId, uint8 accountSlot, const char* path, const char* mode, FSFileHandlePtr outFileHandle, FS_ERROR_MASK errHandling, const FSAsyncParams* asyncParams)
{ {
if (strcmp(mode, "r") != 0) if (strcmp(mode, "r") != 0)
return (SAVEStatus)(FS_RESULT::PERMISSION_ERROR); return (SAVEStatus)(FS_RESULT::PERMISSION_ERROR);
@ -418,7 +418,7 @@ namespace save
{ {
char fullPath[SAVE_MAX_PATH_SIZE]; char fullPath[SAVE_MAX_PATH_SIZE];
if (GetAbsoluteFullPathOtherApplication(persistentId, titleId, path, fullPath)) if (GetAbsoluteFullPathOtherApplication(persistentId, titleId, path, fullPath))
result = coreinit::FSOpenFileAsync(client, block, fullPath, (char*)mode, hFile, errHandling, (FSAsyncParamsNew_t*)asyncParams); result = coreinit::FSOpenFileAsync(client, block, fullPath, (char*)mode, outFileHandle, errHandling, (FSAsyncParams*)asyncParams);
} }
else else
result = (FSStatus)FS_RESULT::NOT_FOUND; result = (FSStatus)FS_RESULT::NOT_FOUND;
@ -428,26 +428,10 @@ namespace save
return result; return result;
} }
void export_SAVEOpenFileOtherApplicationAsync(PPCInterpreter_t* hCPU) SAVEStatus SAVEOpenFileOtherApplication(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint64 titleId, uint8 accountSlot, const char* path, const char* mode, FSFileHandlePtr outFileHandle, FS_ERROR_MASK errHandling)
{
ppcDefineParamMEMPTR(fsClient, coreinit::FSClient_t, 0);
ppcDefineParamMEMPTR(fsCmdBlock, coreinit::FSCmdBlock_t, 1);
ppcDefineParamU64(titleId, 2);
ppcDefineParamU8(accountSlot, 4);
ppcDefineParamMEMPTR(path, const char, 5);
ppcDefineParamMEMPTR(mode, const char, 6);
ppcDefineParamMEMPTR(hFile, FSFileHandleDepr_t, 7);
ppcDefineParamU32(errHandling, 8);
ppcDefineParamMEMPTR(asyncParams, FSAsyncParamsNew_t, 9);
const SAVEStatus result = SAVEOpenFileOtherApplicationAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), titleId, accountSlot, path.GetPtr(), mode.GetPtr(), hFile.GetPtr(), errHandling, asyncParams.GetPtr());
osLib_returnFromFunction(hCPU, result);
}
SAVEStatus SAVEOpenFileOtherApplication(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint64 titleId, uint8 accountSlot, const char* path, const char* mode, FSFileHandleDepr_t* hFile, FS_ERROR_MASK errHandling)
{ {
MEMPTR<OSThread_t> currentThread{coreinit::OSGetCurrentThread()}; MEMPTR<OSThread_t> currentThread{coreinit::OSGetCurrentThread()};
FSAsyncParamsNew_t asyncParams; FSAsyncParams asyncParams;
asyncParams.ioMsgQueue = nullptr; asyncParams.ioMsgQueue = nullptr;
asyncParams.userCallback = PPCInterpreter_makeCallableExportDepr(AsyncCallback); asyncParams.userCallback = PPCInterpreter_makeCallableExportDepr(AsyncCallback);
@ -456,7 +440,7 @@ namespace save
param->returnStatus = (FSStatus)FS_RESULT::SUCCESS; param->returnStatus = (FSStatus)FS_RESULT::SUCCESS;
asyncParams.userContext = param.GetPointer(); asyncParams.userContext = param.GetPointer();
SAVEStatus status = SAVEOpenFileOtherApplicationAsync(client, block, titleId, accountSlot, path, mode, hFile, errHandling, &asyncParams); SAVEStatus status = SAVEOpenFileOtherApplicationAsync(client, block, titleId, accountSlot, path, mode, outFileHandle, errHandling, &asyncParams);
if (status == (FSStatus)FS_RESULT::SUCCESS) if (status == (FSStatus)FS_RESULT::SUCCESS)
{ {
coreinit_suspendThread(currentThread, 1000); coreinit_suspendThread(currentThread, 1000);
@ -467,113 +451,31 @@ namespace save
return status; return status;
} }
void export_SAVEOpenFileOtherApplication(PPCInterpreter_t* hCPU) SAVEStatus SAVEOpenFileOtherNormalApplicationAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint32 uniqueId, uint8 accountSlot, const char* path, const char* mode, FSFileHandlePtr outFileHandle, FS_ERROR_MASK errHandling, const FSAsyncParams* asyncParams)
{
ppcDefineParamMEMPTR(fsClient, coreinit::FSClient_t, 0);
ppcDefineParamMEMPTR(fsCmdBlock, coreinit::FSCmdBlock_t, 1);
ppcDefineParamU64(titleId, 2);
ppcDefineParamU8(accountSlot, 4);
ppcDefineParamMEMPTR(path, const char, 5);
ppcDefineParamMEMPTR(mode, const char, 6);
ppcDefineParamMEMPTR(hFile, FSFileHandleDepr_t, 7);
ppcDefineParamU32(errHandling, 8);
const SAVEStatus result = SAVEOpenFileOtherApplication(fsClient.GetPtr(), fsCmdBlock.GetPtr(), titleId, accountSlot, path.GetPtr(), mode.GetPtr(), hFile.GetPtr(), errHandling);
osLib_returnFromFunction(hCPU, result);
}
SAVEStatus SAVEOpenFileOtherNormalApplicationAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint32 uniqueId, uint8 accountSlot, const char* path, const char* mode, FSFileHandleDepr_t* hFile, FS_ERROR_MASK errHandling, const FSAsyncParamsNew_t* asyncParams)
{ {
uint64 titleId = SAVE_UNIQUE_TO_TITLE_ID(uniqueId); uint64 titleId = SAVE_UNIQUE_TO_TITLE_ID(uniqueId);
return SAVEOpenFileOtherApplicationAsync(client, block, titleId, accountSlot, path, mode, hFile, errHandling, asyncParams); return SAVEOpenFileOtherApplicationAsync(client, block, titleId, accountSlot, path, mode, outFileHandle, errHandling, asyncParams);
} }
void export_SAVEOpenFileOtherNormalApplicationAsync(PPCInterpreter_t* hCPU) SAVEStatus SAVEOpenFileOtherNormalApplication(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint32 uniqueId, uint8 accountSlot, const char* path, const char* mode, FSFileHandlePtr outFileHandle, FS_ERROR_MASK errHandling)
{ {
ppcDefineParamMEMPTR(fsClient, coreinit::FSClient_t, 0);
ppcDefineParamMEMPTR(fsCmdBlock, coreinit::FSCmdBlock_t, 1);
ppcDefineParamU32(uniqueId, 2);
ppcDefineParamU8(accountSlot, 3);
ppcDefineParamMEMPTR(path, const char, 4);
ppcDefineParamMEMPTR(mode, const char, 5);
ppcDefineParamMEMPTR(hFile, FSFileHandleDepr_t, 6);
ppcDefineParamU32(errHandling, 7);
ppcDefineParamMEMPTR(asyncParams, FSAsyncParamsNew_t, 8);
const SAVEStatus result = SAVEOpenFileOtherNormalApplicationAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), uniqueId, accountSlot, path.GetPtr(), mode.GetPtr(), hFile.GetPtr(), errHandling, asyncParams.GetPtr());
osLib_returnFromFunction(hCPU, result);
}
SAVEStatus SAVEOpenFileOtherNormalApplication(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint32 uniqueId, uint8 accountSlot, const char* path, const char* mode, FSFileHandleDepr_t* hFile, FS_ERROR_MASK errHandling)
{
//peterBreak();
uint64 titleId = SAVE_UNIQUE_TO_TITLE_ID(uniqueId); uint64 titleId = SAVE_UNIQUE_TO_TITLE_ID(uniqueId);
return SAVEOpenFileOtherApplication(client, block, titleId, accountSlot, path, mode, hFile, errHandling); return SAVEOpenFileOtherApplication(client, block, titleId, accountSlot, path, mode, outFileHandle, errHandling);
} }
void export_SAVEOpenFileOtherNormalApplication(PPCInterpreter_t* hCPU) SAVEStatus SAVEOpenFileOtherNormalApplicationVariationAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint32 uniqueId, uint8 variation, uint8 accountSlot, const char* path, const char* mode, FSFileHandlePtr outFileHandle, FS_ERROR_MASK errHandling, const FSAsyncParams* asyncParams)
{
ppcDefineParamMEMPTR(fsClient, coreinit::FSClient_t, 0);
ppcDefineParamMEMPTR(fsCmdBlock, coreinit::FSCmdBlock_t, 1);
ppcDefineParamU32(uniqueId, 2);
ppcDefineParamU8(accountSlot, 3);
ppcDefineParamMEMPTR(path, const char, 4);
ppcDefineParamMEMPTR(mode, const char, 5);
ppcDefineParamMEMPTR(hFile, FSFileHandleDepr_t, 6);
ppcDefineParamU32(errHandling, 7);
const SAVEStatus result = SAVEOpenFileOtherNormalApplication(fsClient.GetPtr(), fsCmdBlock.GetPtr(), uniqueId, accountSlot, path.GetPtr(), mode.GetPtr(), hFile.GetPtr(), errHandling);
osLib_returnFromFunction(hCPU, result);
}
SAVEStatus SAVEOpenFileOtherNormalApplicationVariationAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint32 uniqueId, uint8 variation, uint8 accountSlot, const char* path, const char* mode, FSFileHandleDepr_t* hFile, FS_ERROR_MASK errHandling, const FSAsyncParamsNew_t* asyncParams)
{
//peterBreak();
uint64 titleId = SAVE_UNIQUE_TO_TITLE_ID_VARIATION(uniqueId, variation);
return SAVEOpenFileOtherApplicationAsync(client, block, titleId, accountSlot, path, mode, hFile, errHandling, asyncParams);
}
void export_SAVEOpenFileOtherNormalApplicationVariationAsync(PPCInterpreter_t* hCPU)
{
ppcDefineParamMEMPTR(fsClient, coreinit::FSClient_t, 0);
ppcDefineParamMEMPTR(fsCmdBlock, coreinit::FSCmdBlock_t, 1);
ppcDefineParamU32(uniqueId, 2);
ppcDefineParamU8(variation, 3);
ppcDefineParamU8(accountSlot, 4);
ppcDefineParamMEMPTR(path, const char, 5);
ppcDefineParamMEMPTR(mode, const char, 6);
ppcDefineParamMEMPTR(hFile, FSFileHandleDepr_t, 7);
ppcDefineParamU32(errHandling, 8);
ppcDefineParamMEMPTR(asyncParams, FSAsyncParamsNew_t, 9);
const SAVEStatus result = SAVEOpenFileOtherNormalApplicationVariationAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), uniqueId, variation, accountSlot, path.GetPtr(), mode.GetPtr(), hFile.GetPtr(), errHandling, asyncParams.GetPtr());
osLib_returnFromFunction(hCPU, result);
}
SAVEStatus SAVEOpenFileOtherNormalApplicationVariation(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint32 uniqueId, uint8 variation, uint8 accountSlot, const char* path, const char* mode, FSFileHandleDepr_t* hFile, FS_ERROR_MASK errHandling)
{ {
uint64 titleId = SAVE_UNIQUE_TO_TITLE_ID_VARIATION(uniqueId, variation); uint64 titleId = SAVE_UNIQUE_TO_TITLE_ID_VARIATION(uniqueId, variation);
return SAVEOpenFileOtherApplication(client, block, titleId, accountSlot, path, mode, hFile, errHandling); return SAVEOpenFileOtherApplicationAsync(client, block, titleId, accountSlot, path, mode, outFileHandle, errHandling, asyncParams);
} }
void export_SAVEOpenFileOtherNormalApplicationVariation(PPCInterpreter_t* hCPU) SAVEStatus SAVEOpenFileOtherNormalApplicationVariation(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint32 uniqueId, uint8 variation, uint8 accountSlot, const char* path, const char* mode, FSFileHandlePtr outFileHandle, FS_ERROR_MASK errHandling)
{ {
ppcDefineParamMEMPTR(fsClient, coreinit::FSClient_t, 0); uint64 titleId = SAVE_UNIQUE_TO_TITLE_ID_VARIATION(uniqueId, variation);
ppcDefineParamMEMPTR(fsCmdBlock, coreinit::FSCmdBlock_t, 1); return SAVEOpenFileOtherApplication(client, block, titleId, accountSlot, path, mode, outFileHandle, errHandling);
ppcDefineParamU32(uniqueId, 2);
ppcDefineParamU8(variation, 3);
ppcDefineParamU8(accountSlot, 4);
ppcDefineParamMEMPTR(path, const char, 5);
ppcDefineParamMEMPTR(mode, const char, 6);
ppcDefineParamMEMPTR(hFile, FSFileHandleDepr_t, 7);
ppcDefineParamU32(errHandling, 8);
const SAVEStatus result = SAVEOpenFileOtherNormalApplicationVariation(fsClient.GetPtr(), fsCmdBlock.GetPtr(), uniqueId, variation, accountSlot, path.GetPtr(), mode.GetPtr(), hFile.GetPtr(), errHandling);
osLib_returnFromFunction(hCPU, result);
} }
SAVEStatus SAVEGetFreeSpaceSizeAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, FSLargeSize* freeSize, FS_ERROR_MASK errHandling, const FSAsyncParams_t* asyncParams) SAVEStatus SAVEGetFreeSpaceSizeAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, FSLargeSize* freeSize, FS_ERROR_MASK errHandling, const FSAsyncParams* asyncParams)
{ {
SAVEStatus result = (FSStatus)(FS_RESULT::FATAL_ERROR); SAVEStatus result = (FSStatus)(FS_RESULT::FATAL_ERROR);
@ -583,9 +485,8 @@ namespace save
if (GetPersistentIdEx(accountSlot, &persistentId)) if (GetPersistentIdEx(accountSlot, &persistentId))
{ {
char fullPath[SAVE_MAX_PATH_SIZE]; char fullPath[SAVE_MAX_PATH_SIZE];
// usually a pointer with '\0' instead of nullptr, but it's basically the same
if (GetAbsoluteFullPath(persistentId, nullptr, fullPath)) if (GetAbsoluteFullPath(persistentId, nullptr, fullPath))
result = coreinit::FSGetFreeSpaceSizeAsync(client, block, fullPath, freeSize, errHandling, (FSAsyncParamsNew_t*)asyncParams); result = coreinit::FSGetFreeSpaceSizeAsync(client, block, fullPath, freeSize, errHandling, (FSAsyncParams*)asyncParams);
} }
else else
result = (FSStatus)FS_RESULT::NOT_FOUND; result = (FSStatus)FS_RESULT::NOT_FOUND;
@ -595,7 +496,7 @@ namespace save
return result; return result;
} }
SAVEStatus SAVEGetStatAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FSStat_t* stat, FS_ERROR_MASK errHandling, const FSAsyncParams_t* asyncParams) SAVEStatus SAVEGetStatAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FSStat_t* stat, FS_ERROR_MASK errHandling, const FSAsyncParams* asyncParams)
{ {
SAVEStatus result = (FSStatus)(FS_RESULT::FATAL_ERROR); SAVEStatus result = (FSStatus)(FS_RESULT::FATAL_ERROR);
@ -606,7 +507,7 @@ namespace save
{ {
char fullPath[SAVE_MAX_PATH_SIZE]; char fullPath[SAVE_MAX_PATH_SIZE];
if (GetAbsoluteFullPath(persistentId, path, fullPath)) if (GetAbsoluteFullPath(persistentId, path, fullPath))
result = coreinit::__FSQueryInfoAsync(client, block, (uint8*)fullPath, FSA_QUERY_TYPE_STAT, stat, errHandling, (FSAsyncParamsNew_t*)asyncParams); // FSGetStatAsync(...) result = coreinit::__FSQueryInfoAsync(client, block, (uint8*)fullPath, FSA_QUERY_TYPE_STAT, stat, errHandling, (FSAsyncParams*)asyncParams); // FSGetStatAsync(...)
} }
else else
result = (FSStatus)FS_RESULT::NOT_FOUND; result = (FSStatus)FS_RESULT::NOT_FOUND;
@ -616,7 +517,7 @@ namespace save
return result; return result;
} }
SAVEStatus SAVEGetStatOtherApplicationAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint64 titleId, uint8 accountSlot, const char* path, FSStat_t* stat, FS_ERROR_MASK errHandling, const FSAsyncParams_t* asyncParams) SAVEStatus SAVEGetStatOtherApplicationAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint64 titleId, uint8 accountSlot, const char* path, FSStat_t* stat, FS_ERROR_MASK errHandling, const FSAsyncParams* asyncParams)
{ {
SAVEStatus result = (FSStatus)(FS_RESULT::FATAL_ERROR); SAVEStatus result = (FSStatus)(FS_RESULT::FATAL_ERROR);
@ -627,7 +528,7 @@ namespace save
{ {
char fullPath[SAVE_MAX_PATH_SIZE]; char fullPath[SAVE_MAX_PATH_SIZE];
if (GetAbsoluteFullPathOtherApplication(persistentId, titleId, path, fullPath) == (FSStatus)FS_RESULT::SUCCESS) if (GetAbsoluteFullPathOtherApplication(persistentId, titleId, path, fullPath) == (FSStatus)FS_RESULT::SUCCESS)
result = coreinit::__FSQueryInfoAsync(client, block, (uint8*)fullPath, FSA_QUERY_TYPE_STAT, stat, errHandling, (FSAsyncParamsNew_t*)asyncParams); // FSGetStatAsync(...) result = coreinit::__FSQueryInfoAsync(client, block, (uint8*)fullPath, FSA_QUERY_TYPE_STAT, stat, errHandling, (FSAsyncParams*)asyncParams); // FSGetStatAsync(...)
} }
else else
result = (FSStatus)FS_RESULT::NOT_FOUND; result = (FSStatus)FS_RESULT::NOT_FOUND;
@ -637,25 +538,25 @@ namespace save
return result; return result;
} }
SAVEStatus SAVEGetStatOtherNormalApplicationAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint32 uniqueId, uint8 accountSlot, const char* path, FSStat_t* stat, FS_ERROR_MASK errHandling, const FSAsyncParams_t* asyncParams) SAVEStatus SAVEGetStatOtherNormalApplicationAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint32 uniqueId, uint8 accountSlot, const char* path, FSStat_t* stat, FS_ERROR_MASK errHandling, const FSAsyncParams* asyncParams)
{ {
uint64 titleId = SAVE_UNIQUE_TO_TITLE_ID(uniqueId); uint64 titleId = SAVE_UNIQUE_TO_TITLE_ID(uniqueId);
return SAVEGetStatOtherApplicationAsync(client, block, titleId, accountSlot, path, stat, errHandling, asyncParams); return SAVEGetStatOtherApplicationAsync(client, block, titleId, accountSlot, path, stat, errHandling, asyncParams);
} }
SAVEStatus SAVEGetStatOtherDemoApplicationAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint32 uniqueId, uint8 accountSlot, const char* path, FSStat_t* stat, FS_ERROR_MASK errHandling, const FSAsyncParams_t* asyncParams) SAVEStatus SAVEGetStatOtherDemoApplicationAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint32 uniqueId, uint8 accountSlot, const char* path, FSStat_t* stat, FS_ERROR_MASK errHandling, const FSAsyncParams* asyncParams)
{ {
uint64 titleId = SAVE_UNIQUE_DEMO_TO_TITLE_ID(uniqueId); uint64 titleId = SAVE_UNIQUE_DEMO_TO_TITLE_ID(uniqueId);
return SAVEGetStatOtherApplicationAsync(client, block, titleId, accountSlot, path, stat, errHandling, asyncParams); return SAVEGetStatOtherApplicationAsync(client, block, titleId, accountSlot, path, stat, errHandling, asyncParams);
} }
SAVEStatus SAVEGetStatOtherNormalApplicationVariationAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint32 uniqueId, uint8 variation, uint8 accountSlot, const char* path, FSStat_t* stat, FS_ERROR_MASK errHandling, const FSAsyncParams_t* asyncParams) SAVEStatus SAVEGetStatOtherNormalApplicationVariationAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint32 uniqueId, uint8 variation, uint8 accountSlot, const char* path, FSStat_t* stat, FS_ERROR_MASK errHandling, const FSAsyncParams* asyncParams)
{ {
uint64 titleId = SAVE_UNIQUE_TO_TITLE_ID_VARIATION(uniqueId, variation); uint64 titleId = SAVE_UNIQUE_TO_TITLE_ID_VARIATION(uniqueId, variation);
return SAVEGetStatOtherApplicationAsync(client, block, titleId, accountSlot, path, stat, errHandling, asyncParams); return SAVEGetStatOtherApplicationAsync(client, block, titleId, accountSlot, path, stat, errHandling, asyncParams);
} }
SAVEStatus SAVEGetStatOtherDemoApplicationVariationAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint32 uniqueId, uint8 variation, uint8 accountSlot, const char* path, FSStat_t* stat, FS_ERROR_MASK errHandling, const FSAsyncParams_t* asyncParams) SAVEStatus SAVEGetStatOtherDemoApplicationVariationAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint32 uniqueId, uint8 variation, uint8 accountSlot, const char* path, FSStat_t* stat, FS_ERROR_MASK errHandling, const FSAsyncParams* asyncParams)
{ {
uint64 titleId = SAVE_UNIQUE_DEMO_TO_TITLE_ID_VARIATION(uniqueId, variation); uint64 titleId = SAVE_UNIQUE_DEMO_TO_TITLE_ID_VARIATION(uniqueId, variation);
return SAVEGetStatOtherApplicationAsync(client, block, titleId, accountSlot, path, stat, errHandling, asyncParams); return SAVEGetStatOtherApplicationAsync(client, block, titleId, accountSlot, path, stat, errHandling, asyncParams);
@ -682,14 +583,14 @@ namespace save
SAVEStatus SAVEGetFreeSpaceSize(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, FSLargeSize* freeSize, FS_ERROR_MASK errHandling) SAVEStatus SAVEGetFreeSpaceSize(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, FSLargeSize* freeSize, FS_ERROR_MASK errHandling)
{ {
MEMPTR<OSThread_t> currentThread{coreinit::OSGetCurrentThread()}; MEMPTR<OSThread_t> currentThread{coreinit::OSGetCurrentThread()};
FSAsyncParams_t asyncParams; FSAsyncParams asyncParams;
asyncParams.ioMsgQueue = MPTR_NULL; asyncParams.ioMsgQueue = nullptr;
asyncParams.userCallback = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(AsyncCallback)); asyncParams.userCallback = RPLLoader_MakePPCCallable(AsyncCallback);
StackAllocator<AsyncCallbackParam_t> param; StackAllocator<AsyncCallbackParam_t> param;
param->thread = currentThread; param->thread = currentThread;
param->returnStatus = (FSStatus)FS_RESULT::SUCCESS; param->returnStatus = (FSStatus)FS_RESULT::SUCCESS;
asyncParams.userContext = param.GetMPTRBE(); asyncParams.userContext = &param;
SAVEStatus status = SAVEGetFreeSpaceSizeAsync(client, block, accountSlot, freeSize, errHandling, &asyncParams); SAVEStatus status = SAVEGetFreeSpaceSizeAsync(client, block, accountSlot, freeSize, errHandling, &asyncParams);
if (status == (FSStatus)FS_RESULT::SUCCESS) if (status == (FSStatus)FS_RESULT::SUCCESS)
@ -722,7 +623,7 @@ namespace save
ppcDefineParamU8(accountSlot, 2); ppcDefineParamU8(accountSlot, 2);
ppcDefineParamMEMPTR(returnedFreeSize, FSLargeSize, 3); ppcDefineParamMEMPTR(returnedFreeSize, FSLargeSize, 3);
ppcDefineParamU32(errHandling, 4); ppcDefineParamU32(errHandling, 4);
ppcDefineParamMEMPTR(asyncParams, FSAsyncParams_t, 5); ppcDefineParamMEMPTR(asyncParams, FSAsyncParams, 5);
const SAVEStatus result = SAVEGetFreeSpaceSizeAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), accountSlot, returnedFreeSize.GetPtr(), errHandling, asyncParams.GetPtr()); const SAVEStatus result = SAVEGetFreeSpaceSizeAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), accountSlot, returnedFreeSize.GetPtr(), errHandling, asyncParams.GetPtr());
cemuLog_log(LogType::Save, "SAVEGetFreeSpaceSizeAsync(0x{:08x}, 0x{:08x}, {:x}, {:x}) -> {:x}", fsClient.GetMPTR(), fsCmdBlock.GetMPTR(), accountSlot, errHandling, result); cemuLog_log(LogType::Save, "SAVEGetFreeSpaceSizeAsync(0x{:08x}, 0x{:08x}, {:x}, {:x}) -> {:x}", fsClient.GetMPTR(), fsCmdBlock.GetMPTR(), accountSlot, errHandling, result);
@ -743,7 +644,7 @@ namespace save
ppcDefineParamU8(accountSlot, 2); ppcDefineParamU8(accountSlot, 2);
ppcDefineParamMEMPTR(path, const char, 3); ppcDefineParamMEMPTR(path, const char, 3);
ppcDefineParamU32(errHandling, 4); ppcDefineParamU32(errHandling, 4);
ppcDefineParamMEMPTR(asyncParams, FSAsyncParams_t, 5); ppcDefineParamMEMPTR(asyncParams, FSAsyncParams, 5);
const SAVEStatus result = SAVERemoveAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), accountSlot, path.GetPtr(), errHandling, asyncParams.GetPtr()); const SAVEStatus result = SAVERemoveAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), accountSlot, path.GetPtr(), errHandling, asyncParams.GetPtr());
osLib_returnFromFunction(hCPU, result); osLib_returnFromFunction(hCPU, result);
@ -752,14 +653,14 @@ namespace save
SAVEStatus SAVERemove(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FS_ERROR_MASK errHandling) SAVEStatus SAVERemove(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FS_ERROR_MASK errHandling)
{ {
MEMPTR<OSThread_t> currentThread{coreinit::OSGetCurrentThread()}; MEMPTR<OSThread_t> currentThread{coreinit::OSGetCurrentThread()};
FSAsyncParams_t asyncParams; FSAsyncParams asyncParams;
asyncParams.ioMsgQueue = MPTR_NULL; asyncParams.ioMsgQueue = nullptr;
asyncParams.userCallback = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(AsyncCallback)); asyncParams.userCallback = RPLLoader_MakePPCCallable(AsyncCallback);
StackAllocator<AsyncCallbackParam_t> param; StackAllocator<AsyncCallbackParam_t> param;
param->thread = currentThread; param->thread = currentThread;
param->returnStatus = (FSStatus)FS_RESULT::SUCCESS; param->returnStatus = (FSStatus)FS_RESULT::SUCCESS;
asyncParams.userContext = param.GetMPTRBE(); asyncParams.userContext = &param;
SAVEStatus status = SAVERemoveAsync(client, block, accountSlot, path, errHandling, &asyncParams); SAVEStatus status = SAVERemoveAsync(client, block, accountSlot, path, errHandling, &asyncParams);
if (status == (FSStatus)FS_RESULT::SUCCESS) if (status == (FSStatus)FS_RESULT::SUCCESS)
@ -784,7 +685,7 @@ namespace save
osLib_returnFromFunction(hCPU, result); osLib_returnFromFunction(hCPU, result);
} }
SAVEStatus SAVERenameAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* oldPath, const char* newPath, FS_ERROR_MASK errHandling, const FSAsyncParams_t* asyncParams) SAVEStatus SAVERenameAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* oldPath, const char* newPath, FS_ERROR_MASK errHandling, const FSAsyncParams* asyncParams)
{ {
SAVEStatus result = (FSStatus)(FS_RESULT::FATAL_ERROR); SAVEStatus result = (FSStatus)(FS_RESULT::FATAL_ERROR);
@ -798,7 +699,7 @@ namespace save
{ {
char fullNewPath[SAVE_MAX_PATH_SIZE]; char fullNewPath[SAVE_MAX_PATH_SIZE];
if (GetAbsoluteFullPath(persistentId, newPath, fullNewPath)) if (GetAbsoluteFullPath(persistentId, newPath, fullNewPath))
result = coreinit::FSRenameAsync(client, block, fullOldPath, fullNewPath, errHandling, (FSAsyncParamsNew_t*)asyncParams); result = coreinit::FSRenameAsync(client, block, fullOldPath, fullNewPath, errHandling, (FSAsyncParams*)asyncParams);
} }
} }
else else
@ -817,7 +718,7 @@ namespace save
ppcDefineParamMEMPTR(oldPath, const char, 3); ppcDefineParamMEMPTR(oldPath, const char, 3);
ppcDefineParamMEMPTR(newPath, const char, 4); ppcDefineParamMEMPTR(newPath, const char, 4);
ppcDefineParamU32(errHandling, 5); ppcDefineParamU32(errHandling, 5);
ppcDefineParamMEMPTR(asyncParams, FSAsyncParams_t, 6); ppcDefineParamMEMPTR(asyncParams, FSAsyncParams, 6);
const SAVEStatus result = SAVERenameAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), accountSlot, oldPath.GetPtr(), newPath.GetPtr(), errHandling, asyncParams.GetPtr()); const SAVEStatus result = SAVERenameAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), accountSlot, oldPath.GetPtr(), newPath.GetPtr(), errHandling, asyncParams.GetPtr());
cemuLog_log(LogType::Save, "SAVERenameAsync(0x{:08x}, 0x{:08x}, {:x}, {}, {}, {:x}) -> {:x}", fsClient.GetMPTR(), fsCmdBlock.GetMPTR(), accountSlot, oldPath.GetPtr(), newPath.GetPtr(), errHandling, result); cemuLog_log(LogType::Save, "SAVERenameAsync(0x{:08x}, 0x{:08x}, {:x}, {}, {}, {:x}) -> {:x}", fsClient.GetMPTR(), fsCmdBlock.GetMPTR(), accountSlot, oldPath.GetPtr(), newPath.GetPtr(), errHandling, result);
@ -855,7 +756,7 @@ namespace save
ppcDefineParamMEMPTR(path, const char, 3); ppcDefineParamMEMPTR(path, const char, 3);
ppcDefineParamMEMPTR(hDir, betype<FSDirHandle2>, 4); ppcDefineParamMEMPTR(hDir, betype<FSDirHandle2>, 4);
ppcDefineParamU32(errHandling, 5); ppcDefineParamU32(errHandling, 5);
ppcDefineParamMEMPTR(asyncParams, FSAsyncParams_t, 6); ppcDefineParamMEMPTR(asyncParams, FSAsyncParams, 6);
const SAVEStatus result = SAVEOpenDirAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), accountSlot, path.GetPtr(), hDir, errHandling, asyncParams.GetPtr()); const SAVEStatus result = SAVEOpenDirAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), accountSlot, path.GetPtr(), hDir, errHandling, asyncParams.GetPtr());
cemuLog_log(LogType::Save, "SAVEOpenDirAsync(0x{:08x}, 0x{:08x}, {:x}, {}, 0x{:08x} ({:x}), {:x}) -> {:x}", fsClient.GetMPTR(), fsCmdBlock.GetMPTR(), accountSlot, path.GetPtr(), hDir.GetMPTR(), cemuLog_log(LogType::Save, "SAVEOpenDirAsync(0x{:08x}, 0x{:08x}, {:x}, {}, 0x{:08x} ({:x}), {:x}) -> {:x}", fsClient.GetMPTR(), fsCmdBlock.GetMPTR(), accountSlot, path.GetPtr(), hDir.GetMPTR(),
@ -866,14 +767,14 @@ namespace save
SAVEStatus SAVEOpenDir(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FSDirHandlePtr hDir, FS_ERROR_MASK errHandling) SAVEStatus SAVEOpenDir(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FSDirHandlePtr hDir, FS_ERROR_MASK errHandling)
{ {
MEMPTR<OSThread_t> currentThread{coreinit::OSGetCurrentThread()}; MEMPTR<OSThread_t> currentThread{coreinit::OSGetCurrentThread()};
FSAsyncParams_t asyncParams; FSAsyncParams asyncParams;
asyncParams.ioMsgQueue = MPTR_NULL; asyncParams.ioMsgQueue = nullptr;
asyncParams.userCallback = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(AsyncCallback)); asyncParams.userCallback = RPLLoader_MakePPCCallable(AsyncCallback);
StackAllocator<AsyncCallbackParam_t> param; StackAllocator<AsyncCallbackParam_t> param;
param->thread = currentThread; param->thread = currentThread;
param->returnStatus = (FSStatus)FS_RESULT::SUCCESS; param->returnStatus = (FSStatus)FS_RESULT::SUCCESS;
asyncParams.userContext = param.GetMPTRBE(); asyncParams.userContext = &param;
SAVEStatus status = SAVEOpenDirAsync(client, block, accountSlot, path, hDir, errHandling, &asyncParams); SAVEStatus status = SAVEOpenDirAsync(client, block, accountSlot, path, hDir, errHandling, &asyncParams);
if (status == (FSStatus)FS_RESULT::SUCCESS) if (status == (FSStatus)FS_RESULT::SUCCESS)
@ -901,7 +802,7 @@ namespace save
osLib_returnFromFunction(hCPU, result); osLib_returnFromFunction(hCPU, result);
} }
SAVEStatus SAVEOpenDirOtherApplicationAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint64 titleId, uint8 accountSlot, const char* path, FSDirHandlePtr hDir, FS_ERROR_MASK errHandling, const FSAsyncParams_t* asyncParams) SAVEStatus SAVEOpenDirOtherApplicationAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint64 titleId, uint8 accountSlot, const char* path, FSDirHandlePtr hDir, FS_ERROR_MASK errHandling, const FSAsyncParams* asyncParams)
{ {
SAVEStatus result = (FSStatus)(FS_RESULT::FATAL_ERROR); SAVEStatus result = (FSStatus)(FS_RESULT::FATAL_ERROR);
@ -911,7 +812,7 @@ namespace save
{ {
char fullPath[SAVE_MAX_PATH_SIZE]; char fullPath[SAVE_MAX_PATH_SIZE];
if (GetAbsoluteFullPathOtherApplication(persistentId, titleId, path, fullPath)) if (GetAbsoluteFullPathOtherApplication(persistentId, titleId, path, fullPath))
result = coreinit::FSOpenDirAsync(client, block, fullPath, hDir, errHandling, (FSAsyncParamsNew_t*)asyncParams); result = coreinit::FSOpenDirAsync(client, block, fullPath, hDir, errHandling, (FSAsyncParams*)asyncParams);
} }
else else
result = (FSStatus)FS_RESULT::NOT_FOUND; result = (FSStatus)FS_RESULT::NOT_FOUND;
@ -929,7 +830,7 @@ namespace save
ppcDefineParamMEMPTR(path, const char, 4); ppcDefineParamMEMPTR(path, const char, 4);
ppcDefineParamMEMPTR(hDir, betype<FSDirHandle2>, 5); ppcDefineParamMEMPTR(hDir, betype<FSDirHandle2>, 5);
ppcDefineParamU32(errHandling, 6); ppcDefineParamU32(errHandling, 6);
ppcDefineParamMEMPTR(asyncParams, FSAsyncParams_t, 7); ppcDefineParamMEMPTR(asyncParams, FSAsyncParams, 7);
const SAVEStatus result = SAVEOpenDirOtherApplicationAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), titleId, accountSlot, path.GetPtr(), hDir, errHandling, asyncParams.GetPtr()); const SAVEStatus result = SAVEOpenDirOtherApplicationAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), titleId, accountSlot, path.GetPtr(), hDir, errHandling, asyncParams.GetPtr());
cemuLog_log(LogType::Save, "SAVEOpenDirOtherApplicationAsync(0x{:08x}, 0x{:08x}, {:x}, {:x}, {}, 0x{:08x} ({:x}), {:x}) -> {:x}", fsClient.GetMPTR(), fsCmdBlock.GetMPTR(), titleId, accountSlot, path.GetPtr(), hDir.GetMPTR(), cemuLog_log(LogType::Save, "SAVEOpenDirOtherApplicationAsync(0x{:08x}, 0x{:08x}, {:x}, {:x}, {}, 0x{:08x} ({:x}), {:x}) -> {:x}", fsClient.GetMPTR(), fsCmdBlock.GetMPTR(), titleId, accountSlot, path.GetPtr(), hDir.GetMPTR(),
@ -940,14 +841,14 @@ namespace save
SAVEStatus SAVEOpenDirOtherApplication(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint64 titleId, uint8 accountSlot, const char* path, FSDirHandlePtr hDir, FS_ERROR_MASK errHandling) SAVEStatus SAVEOpenDirOtherApplication(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint64 titleId, uint8 accountSlot, const char* path, FSDirHandlePtr hDir, FS_ERROR_MASK errHandling)
{ {
MEMPTR<OSThread_t> currentThread{coreinit::OSGetCurrentThread()}; MEMPTR<OSThread_t> currentThread{coreinit::OSGetCurrentThread()};
FSAsyncParams_t asyncParams; FSAsyncParams asyncParams;
asyncParams.ioMsgQueue = MPTR_NULL; asyncParams.ioMsgQueue = nullptr;
asyncParams.userCallback = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(AsyncCallback)); asyncParams.userCallback = RPLLoader_MakePPCCallable(AsyncCallback);
StackAllocator<AsyncCallbackParam_t> param; StackAllocator<AsyncCallbackParam_t> param;
param->thread = currentThread; param->thread = currentThread;
param->returnStatus = (FSStatus)FS_RESULT::SUCCESS; param->returnStatus = (FSStatus)FS_RESULT::SUCCESS;
asyncParams.userContext = param.GetMPTRBE(); asyncParams.userContext = &param;
SAVEStatus status = SAVEOpenDirOtherApplicationAsync(client, block, titleId, accountSlot, path, hDir, errHandling, &asyncParams); SAVEStatus status = SAVEOpenDirOtherApplicationAsync(client, block, titleId, accountSlot, path, hDir, errHandling, &asyncParams);
if (status == (FSStatus)FS_RESULT::SUCCESS) if (status == (FSStatus)FS_RESULT::SUCCESS)
@ -976,7 +877,7 @@ namespace save
osLib_returnFromFunction(hCPU, result); osLib_returnFromFunction(hCPU, result);
} }
SAVEStatus SAVEOpenDirOtherNormalApplicationAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint32 uniqueId, uint8 accountSlot, const char* path, FSDirHandlePtr hDir, FS_ERROR_MASK errHandling, const FSAsyncParams_t* asyncParams) SAVEStatus SAVEOpenDirOtherNormalApplicationAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint32 uniqueId, uint8 accountSlot, const char* path, FSDirHandlePtr hDir, FS_ERROR_MASK errHandling, const FSAsyncParams* asyncParams)
{ {
uint64 titleId = SAVE_UNIQUE_TO_TITLE_ID(uniqueId); uint64 titleId = SAVE_UNIQUE_TO_TITLE_ID(uniqueId);
return SAVEOpenDirOtherApplicationAsync(client, block, titleId, accountSlot, path, hDir, errHandling, asyncParams); return SAVEOpenDirOtherApplicationAsync(client, block, titleId, accountSlot, path, hDir, errHandling, asyncParams);
@ -991,7 +892,7 @@ namespace save
ppcDefineParamMEMPTR(path, const char, 4); ppcDefineParamMEMPTR(path, const char, 4);
ppcDefineParamMEMPTR(hDir, betype<FSDirHandle2>, 5); ppcDefineParamMEMPTR(hDir, betype<FSDirHandle2>, 5);
ppcDefineParamU32(errHandling, 6); ppcDefineParamU32(errHandling, 6);
ppcDefineParamMEMPTR(asyncParams, FSAsyncParams_t, 7); ppcDefineParamMEMPTR(asyncParams, FSAsyncParams, 7);
const SAVEStatus result = SAVEOpenDirOtherNormalApplicationAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), uniqueId, accountSlot, path.GetPtr(), hDir, errHandling, asyncParams.GetPtr()); const SAVEStatus result = SAVEOpenDirOtherNormalApplicationAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), uniqueId, accountSlot, path.GetPtr(), hDir, errHandling, asyncParams.GetPtr());
osLib_returnFromFunction(hCPU, result); osLib_returnFromFunction(hCPU, result);
@ -1017,7 +918,7 @@ namespace save
osLib_returnFromFunction(hCPU, result); osLib_returnFromFunction(hCPU, result);
} }
SAVEStatus SAVEOpenDirOtherNormalApplicationVariationAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint32 uniqueId, uint8 variation, uint8 accountSlot, const char* path, FSDirHandlePtr hDir, FS_ERROR_MASK errHandling, const FSAsyncParams_t* asyncParams) SAVEStatus SAVEOpenDirOtherNormalApplicationVariationAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint32 uniqueId, uint8 variation, uint8 accountSlot, const char* path, FSDirHandlePtr hDir, FS_ERROR_MASK errHandling, const FSAsyncParams* asyncParams)
{ {
uint64 titleId = SAVE_UNIQUE_TO_TITLE_ID_VARIATION(uniqueId, variation); uint64 titleId = SAVE_UNIQUE_TO_TITLE_ID_VARIATION(uniqueId, variation);
return SAVEOpenDirOtherApplicationAsync(client, block, titleId, accountSlot, path, hDir, errHandling, asyncParams); return SAVEOpenDirOtherApplicationAsync(client, block, titleId, accountSlot, path, hDir, errHandling, asyncParams);
@ -1033,7 +934,7 @@ namespace save
ppcDefineParamMEMPTR(path, const char, 5); ppcDefineParamMEMPTR(path, const char, 5);
ppcDefineParamMEMPTR(hDir, betype<FSDirHandle2>, 6); ppcDefineParamMEMPTR(hDir, betype<FSDirHandle2>, 6);
ppcDefineParamU32(errHandling, 7); ppcDefineParamU32(errHandling, 7);
ppcDefineParamMEMPTR(asyncParams, FSAsyncParams_t, 8); ppcDefineParamMEMPTR(asyncParams, FSAsyncParams, 8);
const SAVEStatus result = SAVEOpenDirOtherNormalApplicationVariationAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), uniqueId, variation, accountSlot, path.GetPtr(), hDir, errHandling, asyncParams.GetPtr()); const SAVEStatus result = SAVEOpenDirOtherNormalApplicationVariationAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), uniqueId, variation, accountSlot, path.GetPtr(), hDir, errHandling, asyncParams.GetPtr());
osLib_returnFromFunction(hCPU, result); osLib_returnFromFunction(hCPU, result);
@ -1067,7 +968,7 @@ namespace save
ppcDefineParamU8(accountSlot, 2); ppcDefineParamU8(accountSlot, 2);
ppcDefineParamMEMPTR(path, const char, 3); ppcDefineParamMEMPTR(path, const char, 3);
ppcDefineParamU32(errHandling, 4); ppcDefineParamU32(errHandling, 4);
ppcDefineParamMEMPTR(asyncParams, FSAsyncParams_t, 5); ppcDefineParamMEMPTR(asyncParams, FSAsyncParams, 5);
const SAVEStatus result = SAVEMakeDirAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), accountSlot, path.GetPtr(), errHandling, asyncParams.GetPtr()); const SAVEStatus result = SAVEMakeDirAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), accountSlot, path.GetPtr(), errHandling, asyncParams.GetPtr());
cemuLog_log(LogType::Save, "SAVEMakeDirAsync(0x{:08x}, 0x{:08x}, {:x}, {}, {:x}) -> {:x}", fsClient.GetMPTR(), fsCmdBlock.GetMPTR(), accountSlot, path.GetPtr(), errHandling, result); cemuLog_log(LogType::Save, "SAVEMakeDirAsync(0x{:08x}, 0x{:08x}, {:x}, {}, {:x}) -> {:x}", fsClient.GetMPTR(), fsCmdBlock.GetMPTR(), accountSlot, path.GetPtr(), errHandling, result);
@ -1077,14 +978,14 @@ namespace save
SAVEStatus SAVEMakeDir(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FS_ERROR_MASK errHandling) SAVEStatus SAVEMakeDir(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FS_ERROR_MASK errHandling)
{ {
MEMPTR<OSThread_t> currentThread{coreinit::OSGetCurrentThread()}; MEMPTR<OSThread_t> currentThread{coreinit::OSGetCurrentThread()};
FSAsyncParams_t asyncParams; FSAsyncParams asyncParams;
asyncParams.ioMsgQueue = MPTR_NULL; asyncParams.ioMsgQueue = nullptr;
asyncParams.userCallback = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(AsyncCallback)); asyncParams.userCallback = RPLLoader_MakePPCCallable(AsyncCallback);
StackAllocator<AsyncCallbackParam_t> param; StackAllocator<AsyncCallbackParam_t> param;
param->thread = currentThread; param->thread = currentThread;
param->returnStatus = (FSStatus)FS_RESULT::SUCCESS; param->returnStatus = (FSStatus)FS_RESULT::SUCCESS;
asyncParams.userContext = param.GetMPTRBE(); asyncParams.userContext = &param;
SAVEStatus status = SAVEMakeDirAsync(client, block, accountSlot, path, errHandling, &asyncParams); SAVEStatus status = SAVEMakeDirAsync(client, block, accountSlot, path, errHandling, &asyncParams);
if (status == (FSStatus)FS_RESULT::SUCCESS) if (status == (FSStatus)FS_RESULT::SUCCESS)
@ -1110,26 +1011,10 @@ namespace save
osLib_returnFromFunction(hCPU, result); osLib_returnFromFunction(hCPU, result);
} }
void export_SAVEOpenFileAsync(PPCInterpreter_t* hCPU) SAVEStatus SAVEOpenFile(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, const char* mode, FSFileHandlePtr outFileHandle, FS_ERROR_MASK errHandling)
{
ppcDefineParamMEMPTR(fsClient, coreinit::FSClient_t, 0);
ppcDefineParamMEMPTR(fsCmdBlock, coreinit::FSCmdBlock_t, 1);
ppcDefineParamU8(accountSlot, 2);
ppcDefineParamMEMPTR(path, const char, 3);
ppcDefineParamMEMPTR(mode, const char, 4);
ppcDefineParamMEMPTR(hFile, FSFileHandleDepr_t, 5);
ppcDefineParamU32(errHandling, 6);
ppcDefineParamMEMPTR(asyncParams, FSAsyncParamsNew_t, 7);
const SAVEStatus result = SAVEOpenFileAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), accountSlot, path.GetPtr(), mode.GetPtr(), hFile.GetPtr(), errHandling, asyncParams.GetPtr());
cemuLog_log(LogType::Save, "SAVEOpenFileAsync(0x{:08x}, 0x{:08x}, {:x}, {}, {}, 0x{:08x}, {:x}) -> {:x}", fsClient.GetMPTR(), fsCmdBlock.GetMPTR(), accountSlot, path.GetPtr(), mode.GetPtr(), hFile.GetMPTR(), errHandling, result);
osLib_returnFromFunction(hCPU, result);
}
SAVEStatus SAVEOpenFile(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, const char* mode, FSFileHandleDepr_t* hFile, FS_ERROR_MASK errHandling)
{ {
MEMPTR<OSThread_t> currentThread{coreinit::OSGetCurrentThread()}; MEMPTR<OSThread_t> currentThread{coreinit::OSGetCurrentThread()};
FSAsyncParamsNew_t asyncParams; FSAsyncParams asyncParams;
asyncParams.ioMsgQueue = nullptr; asyncParams.ioMsgQueue = nullptr;
asyncParams.userCallback = PPCInterpreter_makeCallableExportDepr(AsyncCallback); asyncParams.userCallback = PPCInterpreter_makeCallableExportDepr(AsyncCallback);
@ -1138,7 +1023,7 @@ namespace save
param->returnStatus = (FSStatus)FS_RESULT::SUCCESS; param->returnStatus = (FSStatus)FS_RESULT::SUCCESS;
asyncParams.userContext = param.GetPointer(); asyncParams.userContext = param.GetPointer();
SAVEStatus status = SAVEOpenFileAsync(client, block, accountSlot, path, mode, hFile, errHandling, &asyncParams); SAVEStatus status = SAVEOpenFileAsync(client, block, accountSlot, path, mode, outFileHandle, errHandling, &asyncParams);
if (status == (FSStatus)FS_RESULT::SUCCESS) if (status == (FSStatus)FS_RESULT::SUCCESS)
{ {
coreinit_suspendThread(currentThread, 1000); coreinit_suspendThread(currentThread, 1000);
@ -1149,21 +1034,6 @@ namespace save
return status; return status;
} }
void export_SAVEOpenFile(PPCInterpreter_t* hCPU)
{
ppcDefineParamMEMPTR(fsClient, coreinit::FSClient_t, 0);
ppcDefineParamMEMPTR(fsCmdBlock, coreinit::FSCmdBlock_t, 1);
ppcDefineParamU8(accountSlot, 2);
ppcDefineParamMEMPTR(path, const char, 3);
ppcDefineParamMEMPTR(mode, const char, 4);
ppcDefineParamMEMPTR(hFile, FSFileHandleDepr_t, 5);
ppcDefineParamU32(errHandling, 6);
const SAVEStatus result = SAVEOpenFile(fsClient.GetPtr(), fsCmdBlock.GetPtr(), accountSlot, path.GetPtr(), mode.GetPtr(), hFile.GetPtr(), errHandling);
cemuLog_log(LogType::Save, "SAVEOpenFile(0x{:08x}, 0x{:08x}, {:x}, {}, {}, 0x{:08x}, {:x}) -> {:x}", fsClient.GetMPTR(), fsCmdBlock.GetMPTR(), accountSlot, path.GetPtr(), mode.GetPtr(), hFile.GetMPTR(), errHandling, result);
osLib_returnFromFunction(hCPU, result);
}
void export_SAVEInitSaveDir(PPCInterpreter_t* hCPU) void export_SAVEInitSaveDir(PPCInterpreter_t* hCPU)
{ {
ppcDefineParamU8(accountSlot, 0); ppcDefineParamU8(accountSlot, 0);
@ -1180,7 +1050,7 @@ namespace save
ppcDefineParamMEMPTR(path, const char, 3); ppcDefineParamMEMPTR(path, const char, 3);
ppcDefineParamMEMPTR(stat, FSStat_t, 4); ppcDefineParamMEMPTR(stat, FSStat_t, 4);
ppcDefineParamU32(errHandling, 5); ppcDefineParamU32(errHandling, 5);
ppcDefineParamMEMPTR(asyncParams, FSAsyncParams_t, 6); ppcDefineParamMEMPTR(asyncParams, FSAsyncParams, 6);
const SAVEStatus result = SAVEGetStatAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), accountSlot, path.GetPtr(), stat.GetPtr(), errHandling, asyncParams.GetPtr()); const SAVEStatus result = SAVEGetStatAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), accountSlot, path.GetPtr(), stat.GetPtr(), errHandling, asyncParams.GetPtr());
cemuLog_log(LogType::Save, "SAVEGetStatAsync(0x{:08x}, 0x{:08x}, {:x}, {}, 0x{:08x}, {:x}) -> {:x}", fsClient.GetMPTR(), fsCmdBlock.GetMPTR(), accountSlot, path.GetPtr(), stat.GetMPTR(), errHandling, result); cemuLog_log(LogType::Save, "SAVEGetStatAsync(0x{:08x}, 0x{:08x}, {:x}, {}, 0x{:08x}, {:x}) -> {:x}", fsClient.GetMPTR(), fsCmdBlock.GetMPTR(), accountSlot, path.GetPtr(), stat.GetMPTR(), errHandling, result);
@ -1190,14 +1060,14 @@ namespace save
SAVEStatus SAVEGetStat(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FSStat_t* stat, FS_ERROR_MASK errHandling) SAVEStatus SAVEGetStat(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FSStat_t* stat, FS_ERROR_MASK errHandling)
{ {
MEMPTR<OSThread_t> currentThread{coreinit::OSGetCurrentThread()}; MEMPTR<OSThread_t> currentThread{coreinit::OSGetCurrentThread()};
FSAsyncParams_t asyncParams; FSAsyncParams asyncParams;
asyncParams.ioMsgQueue = MPTR_NULL; asyncParams.ioMsgQueue = nullptr;
asyncParams.userCallback = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(AsyncCallback)); asyncParams.userCallback = RPLLoader_MakePPCCallable(AsyncCallback);
StackAllocator<AsyncCallbackParam_t> param; StackAllocator<AsyncCallbackParam_t> param;
param->thread = currentThread; param->thread = currentThread;
param->returnStatus = (FSStatus)FS_RESULT::SUCCESS; param->returnStatus = (FSStatus)FS_RESULT::SUCCESS;
asyncParams.userContext = param.GetMPTRBE(); asyncParams.userContext = &param;
SAVEStatus status = SAVEGetStatAsync(client, block, accountSlot, path, stat, errHandling, &asyncParams); SAVEStatus status = SAVEGetStatAsync(client, block, accountSlot, path, stat, errHandling, &asyncParams);
if (status == (FSStatus)FS_RESULT::SUCCESS) if (status == (FSStatus)FS_RESULT::SUCCESS)
@ -1233,7 +1103,7 @@ namespace save
ppcDefineParamMEMPTR(path, const char, 5); ppcDefineParamMEMPTR(path, const char, 5);
ppcDefineParamMEMPTR(stat, FSStat_t, 6); ppcDefineParamMEMPTR(stat, FSStat_t, 6);
ppcDefineParamU32(errHandling, 7); ppcDefineParamU32(errHandling, 7);
ppcDefineParamMEMPTR(asyncParams, FSAsyncParams_t, 8); ppcDefineParamMEMPTR(asyncParams, FSAsyncParams, 8);
const SAVEStatus result = SAVEGetStatOtherApplicationAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), titleId, accountSlot, path.GetPtr(), stat.GetPtr(), errHandling, asyncParams.GetPtr()); const SAVEStatus result = SAVEGetStatOtherApplicationAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), titleId, accountSlot, path.GetPtr(), stat.GetPtr(), errHandling, asyncParams.GetPtr());
osLib_returnFromFunction(hCPU, result); osLib_returnFromFunction(hCPU, result);
@ -1242,14 +1112,14 @@ namespace save
SAVEStatus SAVEGetStatOtherApplication(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint64 titleId, uint8 accountSlot, const char* path, FSStat_t* stat, FS_ERROR_MASK errHandling) SAVEStatus SAVEGetStatOtherApplication(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint64 titleId, uint8 accountSlot, const char* path, FSStat_t* stat, FS_ERROR_MASK errHandling)
{ {
MEMPTR<OSThread_t> currentThread{coreinit::OSGetCurrentThread()}; MEMPTR<OSThread_t> currentThread{coreinit::OSGetCurrentThread()};
FSAsyncParams_t asyncParams; FSAsyncParams asyncParams;
asyncParams.ioMsgQueue = MPTR_NULL; asyncParams.ioMsgQueue = nullptr;
asyncParams.userCallback = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(AsyncCallback)); asyncParams.userCallback = RPLLoader_MakePPCCallable(AsyncCallback);
StackAllocator<AsyncCallbackParam_t> param; StackAllocator<AsyncCallbackParam_t> param;
param->thread = currentThread; param->thread = currentThread;
param->returnStatus = (FSStatus)FS_RESULT::SUCCESS; param->returnStatus = (FSStatus)FS_RESULT::SUCCESS;
asyncParams.userContext = param.GetMPTRBE(); asyncParams.userContext = &param;
SAVEStatus status = SAVEGetStatOtherApplicationAsync(client, block, titleId, accountSlot, path, stat, errHandling, &asyncParams); SAVEStatus status = SAVEGetStatOtherApplicationAsync(client, block, titleId, accountSlot, path, stat, errHandling, &asyncParams);
if (status == (FSStatus)FS_RESULT::SUCCESS) if (status == (FSStatus)FS_RESULT::SUCCESS)
@ -1286,7 +1156,7 @@ namespace save
ppcDefineParamMEMPTR(path, const char, 4); ppcDefineParamMEMPTR(path, const char, 4);
ppcDefineParamMEMPTR(stat, FSStat_t, 5); ppcDefineParamMEMPTR(stat, FSStat_t, 5);
ppcDefineParamU32(errHandling, 6); ppcDefineParamU32(errHandling, 6);
ppcDefineParamMEMPTR(asyncParams, FSAsyncParams_t, 8); ppcDefineParamMEMPTR(asyncParams, FSAsyncParams, 8);
const SAVEStatus result = SAVEGetStatOtherNormalApplicationAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), uniqueId, accountSlot, path.GetPtr(), stat.GetPtr(), errHandling, asyncParams.GetPtr()); const SAVEStatus result = SAVEGetStatOtherNormalApplicationAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), uniqueId, accountSlot, path.GetPtr(), stat.GetPtr(), errHandling, asyncParams.GetPtr());
osLib_returnFromFunction(hCPU, result); osLib_returnFromFunction(hCPU, result);
@ -1294,8 +1164,6 @@ namespace save
SAVEStatus SAVEGetStatOtherNormalApplication(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint32 uniqueId, uint8 accountSlot, const char* path, FSStat_t* stat, FS_ERROR_MASK errHandling) SAVEStatus SAVEGetStatOtherNormalApplication(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint32 uniqueId, uint8 accountSlot, const char* path, FSStat_t* stat, FS_ERROR_MASK errHandling)
{ {
//peterBreak();
uint64 titleId = SAVE_UNIQUE_TO_TITLE_ID(uniqueId); uint64 titleId = SAVE_UNIQUE_TO_TITLE_ID(uniqueId);
return SAVEGetStatOtherApplication(client, block, titleId, accountSlot, path, stat, errHandling); return SAVEGetStatOtherApplication(client, block, titleId, accountSlot, path, stat, errHandling);
} }
@ -1326,7 +1194,7 @@ namespace save
ppcDefineParamMEMPTR(path, const char, 5); ppcDefineParamMEMPTR(path, const char, 5);
ppcDefineParamMEMPTR(stat, FSStat_t, 6); ppcDefineParamMEMPTR(stat, FSStat_t, 6);
ppcDefineParamU32(errHandling, 7); ppcDefineParamU32(errHandling, 7);
ppcDefineParamMEMPTR(asyncParams, FSAsyncParams_t, 8); ppcDefineParamMEMPTR(asyncParams, FSAsyncParams, 8);
const SAVEStatus result = SAVEGetStatOtherNormalApplicationVariationAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), uniqueId, variation, accountSlot, path.GetPtr(), stat.GetPtr(), errHandling, asyncParams.GetPtr()); const SAVEStatus result = SAVEGetStatOtherNormalApplicationVariationAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), uniqueId, variation, accountSlot, path.GetPtr(), stat.GetPtr(), errHandling, asyncParams.GetPtr());
osLib_returnFromFunction(hCPU, result); osLib_returnFromFunction(hCPU, result);
@ -1397,7 +1265,7 @@ namespace save
osLib_returnFromFunction(hCPU, result); osLib_returnFromFunction(hCPU, result);
} }
SAVEStatus SAVEChangeDirAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FS_ERROR_MASK errHandling, const FSAsyncParams_t* asyncParams) SAVEStatus SAVEChangeDirAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FS_ERROR_MASK errHandling, const FSAsyncParams* asyncParams)
{ {
SAVEStatus result = (FSStatus)(FS_RESULT::FATAL_ERROR); SAVEStatus result = (FSStatus)(FS_RESULT::FATAL_ERROR);
@ -1407,7 +1275,7 @@ namespace save
{ {
char fullPath[SAVE_MAX_PATH_SIZE]; char fullPath[SAVE_MAX_PATH_SIZE];
if (GetAbsoluteFullPath(persistentId, path, fullPath)) if (GetAbsoluteFullPath(persistentId, path, fullPath))
result = coreinit::FSChangeDirAsync(client, block, fullPath, errHandling, (FSAsyncParamsNew_t*)asyncParams); result = coreinit::FSChangeDirAsync(client, block, fullPath, errHandling, (FSAsyncParams*)asyncParams);
} }
else else
result = (FSStatus)FS_RESULT::NOT_FOUND; result = (FSStatus)FS_RESULT::NOT_FOUND;
@ -1423,7 +1291,7 @@ namespace save
ppcDefineParamU8(accountSlot, 2); ppcDefineParamU8(accountSlot, 2);
ppcDefineParamMEMPTR(path, const char, 3); ppcDefineParamMEMPTR(path, const char, 3);
ppcDefineParamU32(errHandling, 4); ppcDefineParamU32(errHandling, 4);
ppcDefineParamMEMPTR(asyncParams, FSAsyncParams_t, 5); ppcDefineParamMEMPTR(asyncParams, FSAsyncParams, 5);
const SAVEStatus result = SAVEChangeDirAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), accountSlot, path.GetPtr(), errHandling, asyncParams.GetPtr()); const SAVEStatus result = SAVEChangeDirAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), accountSlot, path.GetPtr(), errHandling, asyncParams.GetPtr());
cemuLog_log(LogType::Save, "SAVEChangeDirAsync(0x{:08x}, 0x{:08x}, {:x}, {}, {:x}) -> {:x}", fsClient.GetMPTR(), fsCmdBlock.GetMPTR(), accountSlot, path.GetPtr(), errHandling, result); cemuLog_log(LogType::Save, "SAVEChangeDirAsync(0x{:08x}, 0x{:08x}, {:x}, {}, {:x}) -> {:x}", fsClient.GetMPTR(), fsCmdBlock.GetMPTR(), accountSlot, path.GetPtr(), errHandling, result);
osLib_returnFromFunction(hCPU, result); osLib_returnFromFunction(hCPU, result);
@ -1432,14 +1300,14 @@ namespace save
SAVEStatus SAVEChangeDir(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FS_ERROR_MASK errHandling) SAVEStatus SAVEChangeDir(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FS_ERROR_MASK errHandling)
{ {
MEMPTR<OSThread_t> currentThread{coreinit::OSGetCurrentThread()}; MEMPTR<OSThread_t> currentThread{coreinit::OSGetCurrentThread()};
FSAsyncParams_t asyncParams; FSAsyncParams asyncParams;
asyncParams.ioMsgQueue = MPTR_NULL; asyncParams.ioMsgQueue = nullptr;
asyncParams.userCallback = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(AsyncCallback)); asyncParams.userCallback = RPLLoader_MakePPCCallable(AsyncCallback);
StackAllocator<AsyncCallbackParam_t> param; StackAllocator<AsyncCallbackParam_t> param;
param->thread = currentThread; param->thread = currentThread;
param->returnStatus = (FSStatus)FS_RESULT::SUCCESS; param->returnStatus = (FSStatus)FS_RESULT::SUCCESS;
asyncParams.userContext = param.GetMPTRBE(); asyncParams.userContext = &param;
SAVEStatus status = SAVEChangeDirAsync(client, block, accountSlot, path, errHandling, &asyncParams); SAVEStatus status = SAVEChangeDirAsync(client, block, accountSlot, path, errHandling, &asyncParams);
if (status == (FSStatus)FS_RESULT::SUCCESS) if (status == (FSStatus)FS_RESULT::SUCCESS)
@ -1464,7 +1332,7 @@ namespace save
osLib_returnFromFunction(hCPU, result); osLib_returnFromFunction(hCPU, result);
} }
SAVEStatus SAVEFlushQuotaAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, FS_ERROR_MASK errHandling, const FSAsyncParams_t* asyncParams) SAVEStatus SAVEFlushQuotaAsync(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, FS_ERROR_MASK errHandling, const FSAsyncParams* asyncParams)
{ {
SAVEStatus result = (FSStatus)(FS_RESULT::FATAL_ERROR); SAVEStatus result = (FSStatus)(FS_RESULT::FATAL_ERROR);
@ -1475,7 +1343,7 @@ namespace save
char fullPath[SAVE_MAX_PATH_SIZE]; char fullPath[SAVE_MAX_PATH_SIZE];
if (GetAbsoluteFullPath(persistentId, nullptr, fullPath)) if (GetAbsoluteFullPath(persistentId, nullptr, fullPath))
{ {
result = coreinit::FSFlushQuotaAsync(client, block, fullPath, errHandling, (FSAsyncParamsNew_t*)asyncParams); result = coreinit::FSFlushQuotaAsync(client, block, fullPath, errHandling, (FSAsyncParams*)asyncParams);
// if(OSGetUPID != 0xF) // if(OSGetUPID != 0xF)
UpdateSaveTimeStamp(persistentId); UpdateSaveTimeStamp(persistentId);
} }
@ -1493,7 +1361,7 @@ namespace save
ppcDefineParamMEMPTR(fsCmdBlock, coreinit::FSCmdBlock_t, 1); ppcDefineParamMEMPTR(fsCmdBlock, coreinit::FSCmdBlock_t, 1);
ppcDefineParamU8(accountSlot, 2); ppcDefineParamU8(accountSlot, 2);
ppcDefineParamU32(errHandling, 3); ppcDefineParamU32(errHandling, 3);
ppcDefineParamMEMPTR(asyncParams, FSAsyncParams_t, 4); ppcDefineParamMEMPTR(asyncParams, FSAsyncParams, 4);
const SAVEStatus result = SAVEFlushQuotaAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), accountSlot, errHandling, asyncParams.GetPtr()); const SAVEStatus result = SAVEFlushQuotaAsync(fsClient.GetPtr(), fsCmdBlock.GetPtr(), accountSlot, errHandling, asyncParams.GetPtr());
cemuLog_log(LogType::Save, "SAVEFlushQuotaAsync(0x{:08x}, 0x{:08x}, {:x}, {:x}) -> {:x}", fsClient.GetMPTR(), fsCmdBlock.GetMPTR(), accountSlot, errHandling, result); cemuLog_log(LogType::Save, "SAVEFlushQuotaAsync(0x{:08x}, 0x{:08x}, {:x}, {:x}) -> {:x}", fsClient.GetMPTR(), fsCmdBlock.GetMPTR(), accountSlot, errHandling, result);
osLib_returnFromFunction(hCPU, result); osLib_returnFromFunction(hCPU, result);
@ -1502,14 +1370,14 @@ namespace save
SAVEStatus SAVEFlushQuota(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, FS_ERROR_MASK errHandling) SAVEStatus SAVEFlushQuota(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, FS_ERROR_MASK errHandling)
{ {
MEMPTR<OSThread_t> currentThread{coreinit::OSGetCurrentThread()}; MEMPTR<OSThread_t> currentThread{coreinit::OSGetCurrentThread()};
FSAsyncParams_t asyncParams; FSAsyncParams asyncParams;
asyncParams.ioMsgQueue = MPTR_NULL; asyncParams.ioMsgQueue = nullptr;
asyncParams.userCallback = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(AsyncCallback)); asyncParams.userCallback = RPLLoader_MakePPCCallable(AsyncCallback);
StackAllocator<AsyncCallbackParam_t> param; StackAllocator<AsyncCallbackParam_t> param;
param->thread = currentThread; param->thread = currentThread;
param->returnStatus = (FSStatus)FS_RESULT::SUCCESS; param->returnStatus = (FSStatus)FS_RESULT::SUCCESS;
asyncParams.userContext = param.GetMPTRBE(); asyncParams.userContext = &param;
SAVEStatus status = SAVEFlushQuotaAsync(client, block, accountSlot, errHandling, &asyncParams); SAVEStatus status = SAVEFlushQuotaAsync(client, block, accountSlot, errHandling, &asyncParams);
if (status == (FSStatus)FS_RESULT::SUCCESS) if (status == (FSStatus)FS_RESULT::SUCCESS)
@ -1553,10 +1421,14 @@ namespace save
osLib_addFunction("nn_save", "SAVEGetStatOtherNormalApplication", export_SAVEGetStatOtherNormalApplication); osLib_addFunction("nn_save", "SAVEGetStatOtherNormalApplication", export_SAVEGetStatOtherNormalApplication);
osLib_addFunction("nn_save", "SAVEGetStatOtherNormalApplicationVariation", export_SAVEGetStatOtherNormalApplicationVariation); osLib_addFunction("nn_save", "SAVEGetStatOtherNormalApplicationVariation", export_SAVEGetStatOtherNormalApplicationVariation);
osLib_addFunction("nn_save", "SAVEOpenFile", export_SAVEOpenFile); cafeExportRegister("nn_save", SAVEOpenFile, LogType::Save);
osLib_addFunction("nn_save", "SAVEOpenFileOtherApplication", export_SAVEOpenFileOtherApplication); cafeExportRegister("nn_save", SAVEOpenFileAsync, LogType::Save);
osLib_addFunction("nn_save", "SAVEOpenFileOtherNormalApplication", export_SAVEOpenFileOtherNormalApplication); cafeExportRegister("nn_save", SAVEOpenFileOtherApplication, LogType::Save);
osLib_addFunction("nn_save", "SAVEOpenFileOtherNormalApplicationVariation", export_SAVEOpenFileOtherNormalApplicationVariation); cafeExportRegister("nn_save", SAVEOpenFileOtherApplicationAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenFileOtherNormalApplication, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenFileOtherNormalApplicationAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenFileOtherNormalApplicationVariation, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenFileOtherNormalApplicationVariationAsync, LogType::Save);
osLib_addFunction("nn_save", "SAVEOpenDir", export_SAVEOpenDir); osLib_addFunction("nn_save", "SAVEOpenDir", export_SAVEOpenDir);
osLib_addFunction("nn_save", "SAVEOpenDirOtherApplication", export_SAVEOpenDirOtherApplication); osLib_addFunction("nn_save", "SAVEOpenDirOtherApplication", export_SAVEOpenDirOtherApplication);
@ -1578,11 +1450,6 @@ namespace save
osLib_addFunction("nn_save", "SAVEGetStatOtherNormalApplicationAsync", export_SAVEGetStatOtherNormalApplicationAsync); osLib_addFunction("nn_save", "SAVEGetStatOtherNormalApplicationAsync", export_SAVEGetStatOtherNormalApplicationAsync);
osLib_addFunction("nn_save", "SAVEGetStatOtherNormalApplicationVariationAsync", export_SAVEGetStatOtherNormalApplicationVariationAsync); osLib_addFunction("nn_save", "SAVEGetStatOtherNormalApplicationVariationAsync", export_SAVEGetStatOtherNormalApplicationVariationAsync);
osLib_addFunction("nn_save", "SAVEOpenFileAsync", export_SAVEOpenFileAsync);
osLib_addFunction("nn_save", "SAVEOpenFileOtherApplicationAsync", export_SAVEOpenFileOtherApplicationAsync);
osLib_addFunction("nn_save", "SAVEOpenFileOtherNormalApplicationAsync", export_SAVEOpenFileOtherNormalApplicationAsync);
osLib_addFunction("nn_save", "SAVEOpenFileOtherNormalApplicationVariationAsync", export_SAVEOpenFileOtherNormalApplicationVariationAsync);
osLib_addFunction("nn_save", "SAVEOpenDirAsync", export_SAVEOpenDirAsync); osLib_addFunction("nn_save", "SAVEOpenDirAsync", export_SAVEOpenDirAsync);
osLib_addFunction("nn_save", "SAVEOpenDirOtherApplicationAsync", export_SAVEOpenDirOtherApplicationAsync); osLib_addFunction("nn_save", "SAVEOpenDirOtherApplicationAsync", export_SAVEOpenDirOtherApplicationAsync);
osLib_addFunction("nn_save", "SAVEOpenDirOtherNormalApplicationAsync", export_SAVEOpenDirOtherNormalApplicationAsync); osLib_addFunction("nn_save", "SAVEOpenDirOtherNormalApplicationAsync", export_SAVEOpenDirOtherNormalApplicationAsync);

View File

@ -511,7 +511,7 @@ namespace proc_ui
{ {
MEMPTR<void> fgBase; MEMPTR<void> fgBase;
uint32be fgFreeSize; uint32be fgFreeSize;
OSGetForegroundBucketFreeArea((MPTR*)&fgBase, (MPTR*)&fgFreeSize); OSGetForegroundBucketFreeArea(&fgBase, &fgFreeSize);
if(fgFreeSize < size) if(fgFreeSize < size)
cemuLog_log(LogType::Force, "ProcUISetBucketStorage: Buffer size too small"); cemuLog_log(LogType::Force, "ProcUISetBucketStorage: Buffer size too small");
s_bucketStorageBasePtr = memBase; s_bucketStorageBasePtr = memBase;
@ -521,7 +521,7 @@ namespace proc_ui
{ {
MEMPTR<void> memBound; MEMPTR<void> memBound;
uint32be memBoundSize; uint32be memBoundSize;
OSGetMemBound(1, (MPTR*)memBound.GetBEPtr(), (uint32*)&memBoundSize); OSGetMemBound(1, &memBound, &memBoundSize);
if(memBoundSize < size) if(memBoundSize < size)
cemuLog_log(LogType::Force, "ProcUISetMEM1Storage: Buffer size too small"); cemuLog_log(LogType::Force, "ProcUISetMEM1Storage: Buffer size too small");
s_mem1StorageBasePtr = memBase; s_mem1StorageBasePtr = memBase;
@ -751,14 +751,14 @@ namespace proc_ui
{ {
MEMPTR<void> memBound; MEMPTR<void> memBound;
uint32be memBoundSize; uint32be memBoundSize;
OSGetMemBound(1, (MPTR*)memBound.GetBEPtr(), (uint32*)&memBoundSize); OSGetMemBound(1, &memBound, &memBoundSize);
OSBlockMove(s_mem1StorageBasePtr.GetPtr(), memBound.GetPtr(), memBoundSize, true); OSBlockMove(s_mem1StorageBasePtr.GetPtr(), memBound.GetPtr(), memBoundSize, true);
} }
if (s_bucketStorageBasePtr) if (s_bucketStorageBasePtr)
{ {
MEMPTR<void> memBound; MEMPTR<void> memBound;
uint32be memBoundSize; uint32be memBoundSize;
OSGetForegroundBucketFreeArea((MPTR*)memBound.GetBEPtr(), (MPTR*)&memBoundSize); OSGetForegroundBucketFreeArea(&memBound, &memBoundSize);
OSBlockMove(s_bucketStorageBasePtr.GetPtr(), memBound.GetPtr(), memBoundSize, true); OSBlockMove(s_bucketStorageBasePtr.GetPtr(), memBound.GetPtr(), memBoundSize, true);
} }
} }
@ -769,7 +769,7 @@ namespace proc_ui
{ {
MEMPTR<void> memBound; MEMPTR<void> memBound;
uint32be memBoundSize; uint32be memBoundSize;
OSGetMemBound(1, (MPTR*)memBound.GetBEPtr(), (uint32*)&memBoundSize); OSGetMemBound(1, &memBound, &memBoundSize);
OSBlockMove(memBound.GetPtr(), s_mem1StorageBasePtr, memBoundSize, true); OSBlockMove(memBound.GetPtr(), s_mem1StorageBasePtr, memBoundSize, true);
GX2::GX2Invalidate(0x40, s_mem1StorageBasePtr.GetMPTR(), memBoundSize); GX2::GX2Invalidate(0x40, s_mem1StorageBasePtr.GetMPTR(), memBoundSize);
} }
@ -777,7 +777,7 @@ namespace proc_ui
{ {
MEMPTR<void> memBound; MEMPTR<void> memBound;
uint32be memBoundSize; uint32be memBoundSize;
OSGetForegroundBucketFreeArea((MPTR*)memBound.GetBEPtr(), (MPTR*)&memBoundSize); OSGetForegroundBucketFreeArea(&memBound, &memBoundSize);
OSBlockMove(memBound.GetPtr(), s_bucketStorageBasePtr, memBoundSize, true); OSBlockMove(memBound.GetPtr(), s_bucketStorageBasePtr, memBoundSize, true);
GX2::GX2Invalidate(0x40, memBound.GetMPTR(), memBoundSize); GX2::GX2Invalidate(0x40, memBound.GetMPTR(), memBoundSize);
} }

View File

@ -136,16 +136,10 @@ public:
C* GetPtr() const { return (C*)(GetPtr()); } C* GetPtr() const { return (C*)(GetPtr()); }
constexpr uint32 GetMPTR() const { return m_value.value(); } constexpr uint32 GetMPTR() const { return m_value.value(); }
constexpr uint32 GetRawValue() const { return m_value.bevalue(); } // accesses value using host-endianness
constexpr const uint32be& GetBEValue() const { return m_value; } constexpr const uint32be& GetBEValue() const { return m_value; }
constexpr bool IsNull() const { return m_value == 0; } constexpr bool IsNull() const { return m_value == 0; }
constexpr uint32 GetMPTRBE() const { return m_value.bevalue(); }
uint32be* GetBEPtr() { return &m_value; }
private: private:
uint32be m_value; uint32be m_value;
}; };

View File

@ -28,7 +28,6 @@ public:
T* GetPointer() const { return m_ptr; } T* GetPointer() const { return m_ptr; }
uint32 GetMPTR() const { return MEMPTR<T>(m_ptr).GetMPTR(); } uint32 GetMPTR() const { return MEMPTR<T>(m_ptr).GetMPTR(); }
uint32 GetMPTRBE() const { return MEMPTR<T>(m_ptr).GetMPTRBE(); }
T* operator&() { return GetPointer(); } T* operator&() { return GetPointer(); }
explicit operator T*() const { return GetPointer(); } explicit operator T*() const { return GetPointer(); }