diff --git a/rpcs3/Emu/SysCalls/ModuleManager.cpp b/rpcs3/Emu/SysCalls/ModuleManager.cpp index 63f558f208..89db1b531a 100644 --- a/rpcs3/Emu/SysCalls/ModuleManager.cpp +++ b/rpcs3/Emu/SysCalls/ModuleManager.cpp @@ -9,6 +9,8 @@ extern void cellAudio_init(); extern Module *cellAudio; extern void cellDmux_init(); extern Module *cellDmux; +extern void cellFiber_init(); +extern Module *cellFiber; extern void cellFont_init(); extern void cellFont_load(); extern void cellFont_unload(); @@ -225,6 +227,8 @@ void ModuleManager::init() m_mod_init.emplace_back(0x0011, cellAudio_init); cellDmux = static_cast (&(m_mod_init.back())) + 1; m_mod_init.emplace_back(0x0007, cellDmux_init); + cellFiber = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x0043, cellFiber_init); cellFont = static_cast (&(m_mod_init.back())) + 1; m_mod_init.emplace_back(0x0019, cellFont_init, cellFont_load, cellFont_unload); cellFontFT = static_cast (&(m_mod_init.back())) + 1; diff --git a/rpcs3/Emu/SysCalls/Modules/cellFiber.cpp b/rpcs3/Emu/SysCalls/Modules/cellFiber.cpp index eadca3d19f..7a5dec9d14 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellFiber.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellFiber.cpp @@ -1,24 +1,13 @@ #include "stdafx.h" -#if 0 +#include "Emu/Memory/Memory.h" +#include "Emu/System.h" +#include "Emu/SysCalls/Modules.h" -void cellFiber_init(); -Module cellFiber(0x0043, cellFiber_init); +#include "cellFiber.h" -// Return Codes -enum -{ - CELL_FIBER_ERROR_AGAIN = 0x80760001, - CELL_FIBER_ERROR_INVAL = 0x80760002, - CELL_FIBER_ERROR_NOMEM = 0x80760004, - CELL_FIBER_ERROR_DEADLK = 0x80760008, - CELL_FIBER_ERROR_PERM = 0x80760009, - CELL_FIBER_ERROR_BUSY = 0x8076000A, - CELL_FIBER_ERROR_ABORT = 0x8076000C, - CELL_FIBER_ERROR_STAT = 0x8076000F, - CELL_FIBER_ERROR_ALIGN = 0x80760010, - CELL_FIBER_ERROR_NULL_POINTER = 0x80760011, - CELL_FIBER_ERROR_NOSYSINIT = 0x80760020, -}; +//void cellFiber_init(); +//Module cellFiber(0x0043, cellFiber_init); +Module* cellFiber = nullptr; int _cellFiberPpuInitialize() { @@ -92,10 +81,12 @@ int cellFiberPpuJoinFiber() return CELL_OK; } -int cellFiberPpuSelf() +u32 cellFiberPpuSelf() { - UNIMPLEMENTED_FUNC(cellFiber); - return CELL_OK; + cellFiber->Log("cellFiberPpuSelf() -> nullptr"); // TODO + + // returns fiber structure (zero for simple PPU thread) + return 0; } int cellFiberPpuSendSignal() @@ -304,58 +295,57 @@ int cellFiberPpuUtilWorkerControlInitializeWithAttribute() void cellFiber_init() { - cellFiber.AddFunc(0x55870804, _cellFiberPpuInitialize); + cellFiber->AddFunc(0x55870804, _cellFiberPpuInitialize); - cellFiber.AddFunc(0x9e25c72d, _cellFiberPpuSchedulerAttributeInitialize); - cellFiber.AddFunc(0xee3b604d, cellFiberPpuInitializeScheduler); - cellFiber.AddFunc(0x8b6baa01, cellFiberPpuFinalizeScheduler); - cellFiber.AddFunc(0x12b1acf0, cellFiberPpuRunFibers); - cellFiber.AddFunc(0xf6c6900c, cellFiberPpuCheckFlags); - cellFiber.AddFunc(0xe492a675, cellFiberPpuHasRunnableFiber); + cellFiber->AddFunc(0x9e25c72d, _cellFiberPpuSchedulerAttributeInitialize); + cellFiber->AddFunc(0xee3b604d, cellFiberPpuInitializeScheduler); + cellFiber->AddFunc(0x8b6baa01, cellFiberPpuFinalizeScheduler); + cellFiber->AddFunc(0x12b1acf0, cellFiberPpuRunFibers); + cellFiber->AddFunc(0xf6c6900c, cellFiberPpuCheckFlags); + cellFiber->AddFunc(0xe492a675, cellFiberPpuHasRunnableFiber); - cellFiber.AddFunc(0xc11f8056, _cellFiberPpuAttributeInitialize); - cellFiber.AddFunc(0x7c2f4034, cellFiberPpuCreateFiber); - cellFiber.AddFunc(0xfa8d5f95, cellFiberPpuExit); - cellFiber.AddFunc(0x0c44f441, cellFiberPpuYield); - cellFiber.AddFunc(0xa6004249, cellFiberPpuJoinFiber); - cellFiber.AddFunc(0x5d9a7034, cellFiberPpuSelf); - cellFiber.AddFunc(0x8afb8356, cellFiberPpuSendSignal); - cellFiber.AddFunc(0x6c164b3b, cellFiberPpuWaitSignal); - cellFiber.AddFunc(0xa4599cf3, cellFiberPpuWaitFlag); - cellFiber.AddFunc(0xb0594b2d, cellFiberPpuGetScheduler); - cellFiber.AddFunc(0xfbf5fe40, cellFiberPpuSetPriority); - cellFiber.AddFunc(0xf3e81219, cellFiberPpuCheckStackLimit); + cellFiber->AddFunc(0xc11f8056, _cellFiberPpuAttributeInitialize); + cellFiber->AddFunc(0x7c2f4034, cellFiberPpuCreateFiber); + cellFiber->AddFunc(0xfa8d5f95, cellFiberPpuExit); + cellFiber->AddFunc(0x0c44f441, cellFiberPpuYield); + cellFiber->AddFunc(0xa6004249, cellFiberPpuJoinFiber); + cellFiber->AddFunc(0x5d9a7034, cellFiberPpuSelf); + cellFiber->AddFunc(0x8afb8356, cellFiberPpuSendSignal); + cellFiber->AddFunc(0x6c164b3b, cellFiberPpuWaitSignal); + cellFiber->AddFunc(0xa4599cf3, cellFiberPpuWaitFlag); + cellFiber->AddFunc(0xb0594b2d, cellFiberPpuGetScheduler); + cellFiber->AddFunc(0xfbf5fe40, cellFiberPpuSetPriority); + cellFiber->AddFunc(0xf3e81219, cellFiberPpuCheckStackLimit); - cellFiber.AddFunc(0x31252ec3, _cellFiberPpuContextAttributeInitialize); - cellFiber.AddFunc(0x72086315, cellFiberPpuContextInitialize); - cellFiber.AddFunc(0xb3a48079, cellFiberPpuContextFinalize); - cellFiber.AddFunc(0xaba1c563, cellFiberPpuContextRun); - cellFiber.AddFunc(0xd0066b17, cellFiberPpuContextSwitch); - cellFiber.AddFunc(0x34a81091, cellFiberPpuContextSelf); - cellFiber.AddFunc(0x01036193, cellFiberPpuContextReturnToThread); - cellFiber.AddFunc(0xb90c871b, cellFiberPpuContextCheckStackLimit); + cellFiber->AddFunc(0x31252ec3, _cellFiberPpuContextAttributeInitialize); + cellFiber->AddFunc(0x72086315, cellFiberPpuContextInitialize); + cellFiber->AddFunc(0xb3a48079, cellFiberPpuContextFinalize); + cellFiber->AddFunc(0xaba1c563, cellFiberPpuContextRun); + cellFiber->AddFunc(0xd0066b17, cellFiberPpuContextSwitch); + cellFiber->AddFunc(0x34a81091, cellFiberPpuContextSelf); + cellFiber->AddFunc(0x01036193, cellFiberPpuContextReturnToThread); + cellFiber->AddFunc(0xb90c871b, cellFiberPpuContextCheckStackLimit); - cellFiber.AddFunc(0x081c98be, cellFiberPpuContextRunScheduler); - cellFiber.AddFunc(0x0a25b6c8, cellFiberPpuContextEnterScheduler); + cellFiber->AddFunc(0x081c98be, cellFiberPpuContextRunScheduler); + cellFiber->AddFunc(0x0a25b6c8, cellFiberPpuContextEnterScheduler); - cellFiber.AddFunc(0xbf9cd933, cellFiberPpuSchedulerTraceInitialize); - cellFiber.AddFunc(0x3860a12a, cellFiberPpuSchedulerTraceFinalize); - cellFiber.AddFunc(0xadedbebf, cellFiberPpuSchedulerTraceStart); - cellFiber.AddFunc(0xe665f9a9, cellFiberPpuSchedulerTraceStop); + cellFiber->AddFunc(0xbf9cd933, cellFiberPpuSchedulerTraceInitialize); + cellFiber->AddFunc(0x3860a12a, cellFiberPpuSchedulerTraceFinalize); + cellFiber->AddFunc(0xadedbebf, cellFiberPpuSchedulerTraceStart); + cellFiber->AddFunc(0xe665f9a9, cellFiberPpuSchedulerTraceStop); - cellFiber.AddFunc(0x68ba4568, _cellFiberPpuUtilWorkerControlAttributeInitialize); - cellFiber.AddFunc(0x1e7a247a, cellFiberPpuUtilWorkerControlRunFibers); - cellFiber.AddFunc(0x3204b146, cellFiberPpuUtilWorkerControlInitialize); - cellFiber.AddFunc(0x392c5aa5, cellFiberPpuUtilWorkerControlSetPollingMode); - cellFiber.AddFunc(0x3b417f82, cellFiberPpuUtilWorkerControlJoinFiber); - cellFiber.AddFunc(0x4fc86b2c, cellFiberPpuUtilWorkerControlDisconnectEventQueue); - cellFiber.AddFunc(0x5d3992dd, cellFiberPpuUtilWorkerControlSendSignal); - cellFiber.AddFunc(0x62a20f0d, cellFiberPpuUtilWorkerControlConnectEventQueueToSpurs); - cellFiber.AddFunc(0xa27c95ca, cellFiberPpuUtilWorkerControlFinalize); - cellFiber.AddFunc(0xbabf714b, cellFiberPpuUtilWorkerControlWakeup); - cellFiber.AddFunc(0xbfca88d3, cellFiberPpuUtilWorkerControlCreateFiber); - cellFiber.AddFunc(0xc04e2438, cellFiberPpuUtilWorkerControlShutdown); - cellFiber.AddFunc(0xea6dc1ad, cellFiberPpuUtilWorkerControlCheckFlags); - cellFiber.AddFunc(0xf2ccad4f, cellFiberPpuUtilWorkerControlInitializeWithAttribute); + cellFiber->AddFunc(0x68ba4568, _cellFiberPpuUtilWorkerControlAttributeInitialize); + cellFiber->AddFunc(0x1e7a247a, cellFiberPpuUtilWorkerControlRunFibers); + cellFiber->AddFunc(0x3204b146, cellFiberPpuUtilWorkerControlInitialize); + cellFiber->AddFunc(0x392c5aa5, cellFiberPpuUtilWorkerControlSetPollingMode); + cellFiber->AddFunc(0x3b417f82, cellFiberPpuUtilWorkerControlJoinFiber); + cellFiber->AddFunc(0x4fc86b2c, cellFiberPpuUtilWorkerControlDisconnectEventQueue); + cellFiber->AddFunc(0x5d3992dd, cellFiberPpuUtilWorkerControlSendSignal); + cellFiber->AddFunc(0x62a20f0d, cellFiberPpuUtilWorkerControlConnectEventQueueToSpurs); + cellFiber->AddFunc(0xa27c95ca, cellFiberPpuUtilWorkerControlFinalize); + cellFiber->AddFunc(0xbabf714b, cellFiberPpuUtilWorkerControlWakeup); + cellFiber->AddFunc(0xbfca88d3, cellFiberPpuUtilWorkerControlCreateFiber); + cellFiber->AddFunc(0xc04e2438, cellFiberPpuUtilWorkerControlShutdown); + cellFiber->AddFunc(0xea6dc1ad, cellFiberPpuUtilWorkerControlCheckFlags); + cellFiber->AddFunc(0xf2ccad4f, cellFiberPpuUtilWorkerControlInitializeWithAttribute); } -#endif diff --git a/rpcs3/Emu/SysCalls/Modules/cellFiber.h b/rpcs3/Emu/SysCalls/Modules/cellFiber.h new file mode 100644 index 0000000000..cfeaac2323 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellFiber.h @@ -0,0 +1,17 @@ +#pragma once + +// Return Codes +enum +{ + CELL_FIBER_ERROR_AGAIN = 0x80760001, + CELL_FIBER_ERROR_INVAL = 0x80760002, + CELL_FIBER_ERROR_NOMEM = 0x80760004, + CELL_FIBER_ERROR_DEADLK = 0x80760008, + CELL_FIBER_ERROR_PERM = 0x80760009, + CELL_FIBER_ERROR_BUSY = 0x8076000A, + CELL_FIBER_ERROR_ABORT = 0x8076000C, + CELL_FIBER_ERROR_STAT = 0x8076000F, + CELL_FIBER_ERROR_ALIGN = 0x80760010, + CELL_FIBER_ERROR_NULL_POINTER = 0x80760011, + CELL_FIBER_ERROR_NOSYSINIT = 0x80760020, +}; diff --git a/rpcs3/Emu/SysCalls/Modules/cellSpursJq.cpp b/rpcs3/Emu/SysCalls/Modules/cellSpursJq.cpp index a831d27012..9a74ec0904 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSpursJq.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSpursJq.cpp @@ -770,7 +770,7 @@ void cellSpursJq_init() extern Module* sysPrxForUser; extern Module* cellSpurs; - //extern Module* cellFiber; + extern Module* cellFiber; FIX_IMPORT(cellSpurs, cellSpursSendWorkloadSignal , libspurs_jq + 0x6728); FIX_IMPORT(cellSpurs, cellSpursWorkloadAttributeSetName , libspurs_jq + 0x6748); @@ -781,8 +781,8 @@ void cellSpursJq_init() FIX_IMPORT(cellSpurs, cellSpursAddWorkloadWithAttribute , libspurs_jq + 0x67E8); FIX_IMPORT(cellSpurs, cellSpursSetExceptionEventHandler , libspurs_jq + 0x6808); FIX_IMPORT(cellSpurs, _cellSpursWorkloadAttributeInitialize , libspurs_jq + 0x6828); - FIX_IMPORT(cellSpurs, cellFiberPpuSelf , libspurs_jq + 0x6848); // ! - FIX_IMPORT(cellSpurs, cellFiberPpuWaitSignal , libspurs_jq + 0x6868); // ! + FIX_IMPORT(cellFiber, cellFiberPpuSelf , libspurs_jq + 0x6848); + FIX_IMPORT(cellFiber, cellFiberPpuWaitSignal , libspurs_jq + 0x6868); FIX_IMPORT(sysPrxForUser, _sys_strncmp , libspurs_jq + 0x6888); FIX_IMPORT(sysPrxForUser, _sys_snprintf , libspurs_jq + 0x68A8); FIX_IMPORT(sysPrxForUser, sys_lwcond_destroy , libspurs_jq + 0x68C8); diff --git a/rpcs3/Emu/SysCalls/Modules/cellSync2.cpp b/rpcs3/Emu/SysCalls/Modules/cellSync2.cpp index d02b46683e..fdfe773f65 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSync2.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSync2.cpp @@ -415,13 +415,13 @@ void cellSync2_init() extern Module* sysPrxForUser; extern Module* cellSpurs; extern Module* cellSpursJq; - //extern Module* cellFiber; + extern Module* cellFiber; FIX_IMPORT(cellSpurs, _cellSpursSendSignal , libsync2 + 0x61F0); FIX_IMPORT(cellSpursJq, cellSpursJobQueueSendSignal , libsync2 + 0x6210); - FIX_IMPORT(cellSync2, cellFiberPpuUtilWorkerControlSendSignal , libsync2 + 0x6230); // ! - FIX_IMPORT(cellSync2, cellFiberPpuSelf , libsync2 + 0x6250); // ! - FIX_IMPORT(cellSync2, cellFiberPpuWaitSignal , libsync2 + 0x6270); // ! + FIX_IMPORT(cellFiber, cellFiberPpuUtilWorkerControlSendSignal , libsync2 + 0x6230); + FIX_IMPORT(cellFiber, cellFiberPpuSelf , libsync2 + 0x6250); + FIX_IMPORT(cellFiber, cellFiberPpuWaitSignal , libsync2 + 0x6270); FIX_IMPORT(sysPrxForUser, sys_lwmutex_lock , libsync2 + 0x6290); FIX_IMPORT(sysPrxForUser, sys_lwmutex_unlock , libsync2 + 0x62B0); FIX_IMPORT(sysPrxForUser, sys_lwmutex_create , libsync2 + 0x62D0); diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj index 70bef9dbd1..061fe05aab 100644 --- a/rpcs3/emucore.vcxproj +++ b/rpcs3/emucore.vcxproj @@ -355,6 +355,7 @@ + diff --git a/rpcs3/emucore.vcxproj.filters b/rpcs3/emucore.vcxproj.filters index 023f4c67fd..bb9b9ad7e6 100644 --- a/rpcs3/emucore.vcxproj.filters +++ b/rpcs3/emucore.vcxproj.filters @@ -380,9 +380,6 @@ Emu\SysCalls\currently_unused - - Emu\SysCalls\currently_unused - Emu\SysCalls\Modules @@ -608,6 +605,9 @@ Emu\SysCalls\Modules + + Emu\SysCalls\Modules + @@ -1168,5 +1168,8 @@ Emu\SysCalls\Modules + + Emu\SysCalls\Modules + \ No newline at end of file