Skip to content

Commit

Permalink
Various cellSailPlayer improvements
Browse files Browse the repository at this point in the history
Added default attributes, fixed a Travis error and added currently
broken player booting that I can't figure out.
  • Loading branch information
tambry authored and Nekotekina committed Sep 7, 2015
1 parent c9f3871 commit 5a73274
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 12 deletions.
48 changes: 42 additions & 6 deletions rpcs3/Emu/SysCalls/Modules/cellSail.cpp
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -8,7 +10,25 @@

extern Module cellSail;

// TODO: Create an internal cellSail thread
void playerBoot(vm::ptr<CellSailPlayer> pSelf, u64 userParam)
{
Emu.GetCallbackManager().Async([=](CPUThread& cpu)
{
CellSailEvent evnt;
evnt.minor = 0;
pSelf->callback(static_cast<PPUThread&>(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<PPUThread&>(CPU), pSelf->callbackArg, evnt, 0, 0);
});*/
}

s32 cellSailMemAllocatorInitialize(vm::ptr<CellSailMemAllocator> pSelf, vm::ptr<CellSailMemAllocatorFuncs> pCallbacks)
{
Expand Down Expand Up @@ -607,6 +627,7 @@ s32 cellSailPlayerInitialize2(
pSelf->callbackArg = callbackArg;
pSelf->attribute = *pAttribute;
pSelf->resource = *pResource;
pSelf->booted = false;
pSelf->paused = true;

return CELL_OK;
Expand Down Expand Up @@ -693,13 +714,25 @@ s32 cellSailPlayerSetRendererVideo()

s32 cellSailPlayerSetParameter(vm::ptr<CellSailPlayer> 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<CellSailPlayer> pSelf, s32 parameterType, vm::ptr<u64> pParam0, vm::ptr<u64> 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;
}

Expand All @@ -721,9 +754,12 @@ s32 cellSailPlayerReplaceEventHandler()
return CELL_OK;
}

s32 cellSailPlayerBoot()
s32 cellSailPlayerBoot(PPUThread& ppu, vm::ptr<CellSailPlayer> pSelf, u64 userParam)
{
UNIMPLEMENTED_FUNC(cellSail);
cellSail.Todo("cellSailPlayerBoot(pSelf=*0x%x, userParam=%d)", pSelf, userParam);

playerBoot(pSelf, userParam);

return CELL_OK;
}

Expand Down
20 changes: 14 additions & 6 deletions rpcs3/Emu/SysCalls/Modules/cellSail.h
Original file line number Diff line number Diff line change
Expand Up @@ -610,16 +610,23 @@ struct CellSailSourceStreamingProfile

union CellSailEvent
{
struct u32x2
struct
{
be_t<u32> major;
be_t<u32> minor;
};

struct ui64
be_t<u64> value;
};

template<typename T, bool is_enum> struct cast_ppu_gpr;

template<> struct cast_ppu_gpr<CellSailEvent, false>
{
inline static u64 to_gpr(const CellSailEvent& event)
{
be_t<u64> value;
};
return event.value;
}
};

using CellSailMemAllocatorFuncAlloc = vm::ptr<void>(vm::ptr<void> pArg, u32 boundary, u32 size);
Expand Down Expand Up @@ -679,7 +686,7 @@ using CellSailRendererVideoFuncCancel = void(vm::ptr<void> pArg);
using CellSailRendererVideoFuncCheckout = s32(vm::ptr<void> pArg, vm::pptr<CellSailVideoFrameInfo> ppInfo);
using CellSailRendererVideoFuncCheckin = s32(vm::ptr<void> pArg, vm::ptr<CellSailVideoFrameInfo> pInfo);

using CellSailPlayerFuncNotified = void(vm::ptr<void> pArg, CellSailEvent event, u64 arg0, u64 arg1);
using CellSailPlayerFuncNotified = void(vm::ptr<void> pArg, CellSailEvent evnt, u64 arg0, u64 arg1);

struct CellSailMemAllocatorFuncs
{
Expand All @@ -689,7 +696,7 @@ struct CellSailMemAllocatorFuncs

struct CellSailMemAllocator
{
vm::ptr<CellSailMemAllocatorFuncs> callbacks;
vm::bptr<CellSailMemAllocatorFuncs> callbacks;
be_t<u32> pArg;
};

Expand Down Expand Up @@ -1130,6 +1137,7 @@ struct CellSailPlayer
s32 descriptors;
vm::ptr<CellSailDescriptor> registeredDescriptors[2];
bool paused;
bool booted;
vm::ptr<CellSailSoundAdapter> sAdapter;
vm::ptr<CellSailGraphicsAdapter> gAdapter;
};
Expand Down

0 comments on commit 5a73274

Please sign in to comment.