@@ -42,17 +42,16 @@ bool strcpy_whole(char* dst, size_t dstLength, const char* src)
42
42
43
43
namespace coreinit
44
44
{
45
- std::mutex sFSClientLock ;
46
- std::recursive_mutex sFSGlobalMutex ;
45
+ SysAllocator<OSMutex> s_fsGlobalMutex;
47
46
48
47
inline void FSLockMutex ()
49
48
{
50
- sFSGlobalMutex . lock ( );
49
+ OSLockMutex (&s_fsGlobalMutex );
51
50
}
52
51
53
52
inline void FSUnlockMutex ()
54
53
{
55
- sFSGlobalMutex . unlock ( );
54
+ OSUnlockMutex (&s_fsGlobalMutex );
56
55
}
57
56
58
57
void _debugVerifyCommand (const char * stage, FSCmdBlockBody_t* fsCmdBlockBody);
@@ -251,7 +250,7 @@ namespace coreinit
251
250
fsCmdQueueBE->dequeueHandlerFuncMPTR = _swapEndianU32 (dequeueHandlerFuncMPTR);
252
251
fsCmdQueueBE->numCommandsInFlight = 0 ;
253
252
fsCmdQueueBE->numMaxCommandsInFlight = numMaxCommandsInFlight;
254
- coreinit::OSInitMutexEx (&fsCmdQueueBE->mutex , nullptr );
253
+ coreinit::OSFastMutex_Init (&fsCmdQueueBE->fastMutex , nullptr );
255
254
fsCmdQueueBE->firstMPTR = _swapEndianU32 (0 );
256
255
fsCmdQueueBE->lastMPTR = _swapEndianU32 (0 );
257
256
}
@@ -672,12 +671,12 @@ namespace coreinit
672
671
_debugVerifyCommand (" FSCmdSubmitResult" , fsCmdBlockBody);
673
672
674
673
FSClientBody_t* fsClientBody = fsCmdBlockBody->fsClientBody .GetPtr ();
675
- sFSClientLock . lock (); // OSFastMutex_Lock(&fsClientBody->fsCmdQueue.mutex)
674
+ OSFastMutex_Lock (&fsClientBody->fsCmdQueue .fastMutex );
676
675
fsCmdBlockBody->cancelState &= ~(1 << 0 ); // clear cancel bit
677
676
if (fsClientBody->currentCmdBlockBody .GetPtr () == fsCmdBlockBody)
678
677
fsClientBody->currentCmdBlockBody = nullptr ;
679
678
fsCmdBlockBody->statusCode = _swapEndianU32 (FSA_CMD_STATUS_CODE_D900A24);
680
- sFSClientLock . unlock ( );
679
+ OSFastMutex_Unlock (&fsClientBody-> fsCmdQueue . fastMutex );
681
680
// send result via msg queue or callback
682
681
cemu_assert_debug (!fsCmdBlockBody->asyncResult .fsAsyncParamsNew .ioMsgQueue != !fsCmdBlockBody->asyncResult .fsAsyncParamsNew .userCallback ); // either must be set
683
682
fsCmdBlockBody->ukn09EA = 0 ;
@@ -1433,7 +1432,7 @@ namespace coreinit
1433
1432
return (FSStatus)FS_RESULT::SUCCESS;
1434
1433
}
1435
1434
1436
- sint32 FSAppendFile (FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 size, uint32 count, uint32 fileHandle, uint32 errorMask)
1435
+ sint32 FSAppendFile (FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 size, uint32 count, uint32 fileHandle, uint32 errorMask)
1437
1436
{
1438
1437
StackAllocator<FSAsyncParamsNew_t> asyncParams;
1439
1438
__FSAsyncToSyncInit (fsClient, fsCmdBlock, asyncParams);
@@ -2640,6 +2639,8 @@ namespace coreinit
2640
2639
2641
2640
void InitializeFS ()
2642
2641
{
2642
+ OSInitMutex (&s_fsGlobalMutex);
2643
+
2643
2644
cafeExportRegister (" coreinit" , FSInit, LogType::CoreinitFile);
2644
2645
cafeExportRegister (" coreinit" , FSShutdown, LogType::CoreinitFile);
2645
2646
0 commit comments