diff --git a/rpcs3/Emu/SysCalls/Modules/cellSail.cpp b/rpcs3/Emu/SysCalls/Modules/cellSail.cpp index b200d7821c..f90a50ef13 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSail.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSail.cpp @@ -1,5 +1,7 @@ #include "stdafx.h" +#include "Emu/System.h" #include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Callback.h" #include "Emu/SysCalls/Modules.h" #include "Emu/FS/vfsFile.h" @@ -8,7 +10,25 @@ extern Module cellSail; -// TODO: Create an internal cellSail thread +void playerBoot(vm::ptr pSelf, u64 userParam) +{ + Emu.GetCallbackManager().Async([=](CPUThread& cpu) + { + CellSailEvent evnt; + evnt.minor = 0; + pSelf->callback(static_cast(cpu), pSelf->callbackArg, evnt, CELL_SAIL_PLAYER_STATE_BOOT_TRANSITION, 0); + }); + + // TODO: Do stuff here + pSelf->booted = true; + + /*Emu.GetCallbackManager().Async([=](CPUThread& CPU) + { + CellSailEvent evnt; + evnt.u32x2.minor = CELL_SAIL_PLAYER_CALL_BOOT; + pSelf->callback(static_cast(CPU), pSelf->callbackArg, evnt, 0, 0); + });*/ +} s32 cellSailMemAllocatorInitialize(vm::ptr pSelf, vm::ptr pCallbacks) { @@ -607,6 +627,7 @@ s32 cellSailPlayerInitialize2( pSelf->callbackArg = callbackArg; pSelf->attribute = *pAttribute; pSelf->resource = *pResource; + pSelf->booted = false; pSelf->paused = true; return CELL_OK; @@ -693,13 +714,25 @@ s32 cellSailPlayerSetRendererVideo() s32 cellSailPlayerSetParameter(vm::ptr pSelf, s32 parameterType, u64 param0, u64 param1) { - cellSail.Todo("cellSailPlayerSetParameter(pSelf=*0x%x, parameterType=0x%x (%s), param0=0x%llx, param1=0x%llx)", pSelf, parameterType, ParameterCodeToName(parameterType), param0, param1); + cellSail.Todo("cellSailPlayerSetParameter(pSelf=*0x%x, parameterType=0x%x, param0=0x%llx, param1=0x%llx)", pSelf, parameterType, param0, param1); + + switch (parameterType) + { + default: cellSail.Error("cellSailPlayerSetParameter(): unimplemented parameter %s", ParameterCodeToName(parameterType)); + } + return CELL_OK; } -s32 cellSailPlayerGetParameter() +s32 cellSailPlayerGetParameter(vm::ptr pSelf, s32 parameterType, vm::ptr pParam0, vm::ptr pParam1) { - UNIMPLEMENTED_FUNC(cellSail); + cellSail.Todo("cellSailPlayerGetParameter(pSelf=*0x%x, parameterType=0x%x, param0=*0x%x, param1=*0x%x)", pSelf, parameterType, pParam0, pParam1); + + switch (parameterType) + { + default: cellSail.Error("cellSailPlayerGetParameter(): unimplemented parameter %s", ParameterCodeToName(parameterType)); + } + return CELL_OK; } @@ -721,9 +754,12 @@ s32 cellSailPlayerReplaceEventHandler() return CELL_OK; } -s32 cellSailPlayerBoot() +s32 cellSailPlayerBoot(PPUThread& ppu, vm::ptr pSelf, u64 userParam) { - UNIMPLEMENTED_FUNC(cellSail); + cellSail.Todo("cellSailPlayerBoot(pSelf=*0x%x, userParam=%d)", pSelf, userParam); + + playerBoot(pSelf, userParam); + return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/Modules/cellSail.h b/rpcs3/Emu/SysCalls/Modules/cellSail.h index e289f81b92..e3716c7af9 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSail.h +++ b/rpcs3/Emu/SysCalls/Modules/cellSail.h @@ -610,16 +610,23 @@ struct CellSailSourceStreamingProfile union CellSailEvent { - struct u32x2 + struct { be_t major; be_t minor; }; - struct ui64 + be_t value; +}; + +template struct cast_ppu_gpr; + +template<> struct cast_ppu_gpr +{ + inline static u64 to_gpr(const CellSailEvent& event) { - be_t value; - }; + return event.value; + } }; using CellSailMemAllocatorFuncAlloc = vm::ptr(vm::ptr pArg, u32 boundary, u32 size); @@ -679,7 +686,7 @@ using CellSailRendererVideoFuncCancel = void(vm::ptr pArg); using CellSailRendererVideoFuncCheckout = s32(vm::ptr pArg, vm::pptr ppInfo); using CellSailRendererVideoFuncCheckin = s32(vm::ptr pArg, vm::ptr pInfo); -using CellSailPlayerFuncNotified = void(vm::ptr pArg, CellSailEvent event, u64 arg0, u64 arg1); +using CellSailPlayerFuncNotified = void(vm::ptr pArg, CellSailEvent evnt, u64 arg0, u64 arg1); struct CellSailMemAllocatorFuncs { @@ -689,7 +696,7 @@ struct CellSailMemAllocatorFuncs struct CellSailMemAllocator { - vm::ptr callbacks; + vm::bptr callbacks; be_t pArg; }; @@ -1130,6 +1137,7 @@ struct CellSailPlayer s32 descriptors; vm::ptr registeredDescriptors[2]; bool paused; + bool booted; vm::ptr sAdapter; vm::ptr gAdapter; };