From c9f3871c68d559f8792ff3c200cf88ee0928c92c Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Mon, 10 Aug 2015 15:10:16 +0300 Subject: [PATCH] cellSail improvements --- rpcs3/Emu/SysCalls/Modules/cellSail.cpp | 216 ++++++++++++++---- rpcs3/Emu/SysCalls/Modules/cellSail.h | 278 +++++++++++++++--------- 2 files changed, 346 insertions(+), 148 deletions(-) diff --git a/rpcs3/Emu/SysCalls/Modules/cellSail.cpp b/rpcs3/Emu/SysCalls/Modules/cellSail.cpp index 28d7353ca997..b200d7821c42 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSail.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSail.cpp @@ -77,7 +77,8 @@ s32 cellSailDescriptorSetAutoSelection(vm::ptr pSelf, b8 aut { cellSail.Warning("cellSailDescriptorSetAutoSelection(pSelf=*0x%x, autoSelection=%d)", pSelf, autoSelection); - if (pSelf) { + if (pSelf) + { pSelf->autoSelection = autoSelection; return autoSelection; } @@ -90,19 +91,22 @@ s32 cellSailDescriptorIsAutoSelection(vm::ptr pSelf) cellSail.Warning("cellSailDescriptorIsAutoSelection(pSelf=*0x%x)", pSelf); if (pSelf) + { return pSelf->autoSelection; + } return CELL_OK; } s32 cellSailDescriptorCreateDatabase(vm::ptr pSelf, vm::ptr pDatabase, u32 size, u64 arg) { - cellSail.Warning("cellSailDescriptorCreateDatabase(pSelf=*0x%x, pDatabase=*0x%x, size=0x%x, arg=0x%x", pSelf, pDatabase, size, arg); + cellSail.Warning("cellSailDescriptorCreateDatabase(pSelf=*0x%x, pDatabase=*0x%x, size=0x%x, arg=0x%llx)", pSelf, pDatabase, size, arg); - switch ((s32)pSelf->streamType) { + switch ((s32)pSelf->streamType) + { case CELL_SAIL_STREAM_PAMF: { - u32 addr = pSelf->internalData[1]; + u32 addr = pSelf->sp_; auto ptr = vm::ptr::make(addr); memcpy(pDatabase.get_ptr(), ptr.get_ptr(), sizeof(CellPamfReader)); break; @@ -162,33 +166,84 @@ s32 cellSailDescriptorSetParameter() return CELL_OK; } -s32 cellSailSoundAdapterInitialize() +s32 cellSailSoundAdapterInitialize(vm::ptr pSelf, vm::cptr pCallbacks, vm::ptr pArg) { - UNIMPLEMENTED_FUNC(cellSail); + cellSail.Warning("cellSailSoundAdapterInitialize(pSelf=*0x%x, pCallbacks=*0x%x, pArg=*0x%x)", pSelf, pCallbacks, pArg); + + if (pSelf->initialized) + { + return CELL_SAIL_ERROR_INVALID_STATE; + } + + if (pSelf->registered) + { + return CELL_SAIL_ERROR_INVALID_STATE; + } + + pSelf->pMakeup = pCallbacks->pMakeup; + pSelf->pCleanup = pCallbacks->pCleanup; + pSelf->pFormatChanged = pCallbacks->pFormatChanged; + pSelf->arg = pArg; + pSelf->initialized = true; + pSelf->registered = false; + return CELL_OK; } -s32 cellSailSoundAdapterFinalize() +s32 cellSailSoundAdapterFinalize(vm::ptr pSelf) { - UNIMPLEMENTED_FUNC(cellSail); + cellSail.Warning("cellSailSoundAdapterFinalize(pSelf=*0x%x)", pSelf); + + if (!pSelf->initialized) + { + return CELL_SAIL_ERROR_INVALID_STATE; + } + + if (pSelf->registered) + { + return CELL_SAIL_ERROR_INVALID_STATE; + } + return CELL_OK; } -s32 cellSailSoundAdapterSetPreferredFormat() +s32 cellSailSoundAdapterSetPreferredFormat(vm::ptr pSelf, vm::cptr pFormat) { - UNIMPLEMENTED_FUNC(cellSail); + cellSail.Warning("cellSailSoundAdapterSetPreferredFormat(pSelf=*0x%x, pFormat=*0x%x)", pSelf, pFormat); + + pSelf->format = *pFormat; + return CELL_OK; } -s32 cellSailSoundAdapterGetFrame() +s32 cellSailSoundAdapterGetFrame(vm::ptr pSelf, u32 samples, vm::ptr pInfo) { - UNIMPLEMENTED_FUNC(cellSail); + cellSail.Todo("cellSailSoundAdapterGetFrame(pSelf=*0x%x, samples=%d, pInfo=*0x%x)", pSelf, samples, pInfo); + + if (!pSelf->initialized) + { + return CELL_SAIL_ERROR_INVALID_STATE; + } + + if (pSelf->registered) + { + return CELL_SAIL_ERROR_INVALID_STATE; + } + + if (samples > 2048) + { + return CELL_SAIL_ERROR_INVALID_ARG; + } + return CELL_OK; } -s32 cellSailSoundAdapterGetFormat() +s32 cellSailSoundAdapterGetFormat(vm::ptr pSelf, vm::ptr pFormat) { - UNIMPLEMENTED_FUNC(cellSail); + cellSail.Warning("cellSailSoundAdapterGetFormat(pSelf=*0x%x, pFormat=*0x%x)", pSelf, pFormat); + + *pFormat = pSelf->format; + return CELL_OK; } @@ -204,39 +259,76 @@ s32 cellSailSoundAdapterPtsToTimePosition() return CELL_OK; } -s32 cellSailGraphicsAdapterInitialize() +s32 cellSailGraphicsAdapterInitialize(vm::ptr pSelf, vm::cptr pCallbacks, vm::ptr pArg) { - UNIMPLEMENTED_FUNC(cellSail); + cellSail.Warning("cellSailGraphicsAdapterInitialize(pSelf=*0x%x, pCallbacks=*0x%x, pArg=*0x%x)", pSelf, pCallbacks, pArg); + + if (pSelf->initialized) + { + return CELL_SAIL_ERROR_INVALID_STATE; + } + + if (pSelf->registered) + { + return CELL_SAIL_ERROR_INVALID_STATE; + } + + pSelf->pMakeup = pCallbacks->pMakeup; + pSelf->pCleanup = pCallbacks->pCleanup; + pSelf->pFormatChanged = pCallbacks->pFormatChanged; + pSelf->pAlloc = pCallbacks->pAlloc; + pSelf->pFree = pCallbacks->pFree; + pSelf->arg = pArg; + pSelf->initialized = true; + pSelf->registered = true; + return CELL_OK; } -s32 cellSailGraphicsAdapterFinalize() +s32 cellSailGraphicsAdapterFinalize(vm::ptr pSelf) { - UNIMPLEMENTED_FUNC(cellSail); + cellSail.Todo("cellSailGraphicsAdapterFinalize(pSelf=*0x%x)", pSelf); + + if (!pSelf->initialized) + { + return CELL_SAIL_ERROR_INVALID_STATE; + } + + if (pSelf->registered) + { + return CELL_SAIL_ERROR_INVALID_STATE; + } + return CELL_OK; } -s32 cellSailGraphicsAdapterSetPreferredFormat() +s32 cellSailGraphicsAdapterSetPreferredFormat(vm::ptr pSelf, vm::cptr pFormat) { - UNIMPLEMENTED_FUNC(cellSail); + cellSail.Warning("cellSailGraphicsAdapterSetPreferredFormat(pSelf=*0x%x, pFormat=*0x%x)", pSelf, pFormat); + + pSelf->format = *pFormat; + return CELL_OK; } -s32 cellSailGraphicsAdapterGetFrame() +s32 cellSailGraphicsAdapterGetFrame(vm::ptr pSelf, vm::ptr pInfo) { - UNIMPLEMENTED_FUNC(cellSail); + cellSail.Todo("cellSailGraphicsAdapterGetFrame(pSelf=*0x%x, pInfo=*0x%x)", pSelf, pInfo); return CELL_OK; } -s32 cellSailGraphicsAdapterGetFrame2() +s32 cellSailGraphicsAdapterGetFrame2(vm::ptr pSelf, vm::ptr pInfo, vm::ptr pPrevInfo, vm::ptr pFlipTime, u64 flags) { - UNIMPLEMENTED_FUNC(cellSail); + cellSail.Todo("cellSailGraphicsAdapterGetFrame2(pSelf=*0x%x, pInfo=*0x%x, pPrevInfo=*0x%x, flipTime=*0x%x, flags=0x%llx)", pSelf, pInfo, pPrevInfo, pFlipTime, flags); return CELL_OK; } -s32 cellSailGraphicsAdapterGetFormat() +s32 cellSailGraphicsAdapterGetFormat(vm::ptr pSelf, vm::ptr pFormat) { - UNIMPLEMENTED_FUNC(cellSail); + cellSail.Warning("cellSailGraphicsAdapterGetFormat(pSelf=*0x%x, pFormat=*0x%x)", pSelf, pFormat); + + *pFormat = pSelf->format; + return CELL_OK; } @@ -520,9 +612,20 @@ s32 cellSailPlayerInitialize2( return CELL_OK; } -s32 cellSailPlayerFinalize() +s32 cellSailPlayerFinalize(vm::ptr pSelf) { - UNIMPLEMENTED_FUNC(cellSail); + cellSail.Todo("cellSailPlayerFinalize(pSelf=*0x%x)", pSelf); + + if (pSelf->sAdapter) + { + pSelf->sAdapter->registered = false; + } + + if (pSelf->gAdapter) + { + pSelf->gAdapter->registered = false; + } + return CELL_OK; } @@ -538,15 +641,35 @@ s32 cellSailPlayerGetRegisteredProtocols() return CELL_OK; } -s32 cellSailPlayerSetSoundAdapter() +s32 cellSailPlayerSetSoundAdapter(vm::ptr pSelf, u32 index, vm::ptr pAdapter) { - UNIMPLEMENTED_FUNC(cellSail); + cellSail.Warning("cellSailPlayerSetSoundAdapter(pSelf=*0x%x, index=%d, pAdapter=*0x%x)", pSelf, index, pAdapter); + + if (index > pSelf->attribute.maxAudioStreamNum) + { + return CELL_SAIL_ERROR_INVALID_ARG; + } + + pSelf->sAdapter = pAdapter; + pAdapter->index = index; + pAdapter->registered = true; + return CELL_OK; } -s32 cellSailPlayerSetGraphicsAdapter() +s32 cellSailPlayerSetGraphicsAdapter(vm::ptr pSelf, u32 index, vm::ptr pAdapter) { - UNIMPLEMENTED_FUNC(cellSail); + cellSail.Warning("cellSailPlayerSetGraphicsAdapter(pSelf=*0x%x, index=%d, pAdapter=*0x%x)", pSelf, index, pAdapter); + + if (index > pSelf->attribute.maxVideoStreamNum) + { + return CELL_SAIL_ERROR_INVALID_ARG; + } + + pSelf->gAdapter = pAdapter; + pAdapter->index = index; + pAdapter->registered = true; + return CELL_OK; } @@ -568,9 +691,9 @@ s32 cellSailPlayerSetRendererVideo() return CELL_OK; } -s32 cellSailPlayerSetParameter() +s32 cellSailPlayerSetParameter(vm::ptr pSelf, s32 parameterType, u64 param0, u64 param1) { - UNIMPLEMENTED_FUNC(cellSail); + cellSail.Todo("cellSailPlayerSetParameter(pSelf=*0x%x, parameterType=0x%x (%s), param0=0x%llx, param1=0x%llx)", pSelf, parameterType, ParameterCodeToName(parameterType), param0, param1); return CELL_OK; } @@ -622,9 +745,9 @@ s32 cellSailPlayerAddDescriptor(vm::ptr pSelf, vm::ptr pSelf, s32 streamType, vm::ptr pMediaInfo, vm::cptr pUri, vm::pptr ppDesc) +s32 cellSailPlayerCreateDescriptor(vm::ptr pSelf, s32 streamType, vm::ptr pMediaInfo, vm::cptr pUri, vm::pptr ppDesc) { - cellSail.Warning("cellSailPlayerCreateDescriptor(pSelf=*0x%x, streamType=%d, pMediaInfo=*0x%x, pUri=*0x%x, ppDesc=**0x%x)", pSelf, streamType, pMediaInfo, pUri, ppDesc); + cellSail.Todo("cellSailPlayerCreateDescriptor(pSelf=*0x%x, streamType=%d, pMediaInfo=*0x%x, pUri=*0x%x, ppDesc=**0x%x)", pSelf, streamType, pMediaInfo, pUri, ppDesc); u32 descriptorAddress = vm::alloc(sizeof(CellSailDescriptor), vm::main); auto descriptor = vm::ptr::make(descriptorAddress); @@ -640,28 +763,33 @@ s32 cellSailPlayerCreateDescriptor(vm::ptr pSelf, s32 streamType case CELL_SAIL_STREAM_PAMF: { std::string uri = pUri.get_ptr(); - if (uri.substr(0, 12) == "x-cell-fs://") { + if (uri.substr(0, 12) == "x-cell-fs://") + { std::string path = uri.substr(12); vfsFile f; - if (f.Open(path)) { + if (f.Open(path)) + { u64 size = f.GetSize(); - u32 buf_ = vm::alloc(size, vm::main); - auto bufPtr = vm::cptr::make(buf_); + u32 buffer = vm::alloc(size, vm::main); + auto bufPtr = vm::cptr::make(buffer); PamfHeader *buf = const_cast(bufPtr.get_ptr()); assert(f.Read(buf, size) == size); u32 sp_ = vm::alloc(sizeof(CellPamfReader), vm::main); auto sp = vm::ptr::make(sp_); - u32 r = cellPamfReaderInitialize(sp, bufPtr, size, 0); + u32 reader = cellPamfReaderInitialize(sp, bufPtr, size, 0); - descriptor->internalData[0] = buf_; - descriptor->internalData[1] = sp_; + descriptor->buffer = buffer; + descriptor->sp_ = sp_; } else + { cellSail.Warning("Couldn't open PAMF: %s", uri.c_str()); - + } } else + { cellSail.Warning("Unhandled uri: %s", uri.c_str()); + } break; } default: diff --git a/rpcs3/Emu/SysCalls/Modules/cellSail.h b/rpcs3/Emu/SysCalls/Modules/cellSail.h index 182bf00cd49d..e289f81b926e 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSail.h +++ b/rpcs3/Emu/SysCalls/Modules/cellSail.h @@ -610,74 +610,76 @@ struct CellSailSourceStreamingProfile union CellSailEvent { - struct u32x2 { + struct u32x2 + { be_t major; be_t minor; }; - struct ui64 { + struct ui64 + { be_t value; }; }; -typedef vm::ptr(CellSailMemAllocatorFuncAlloc)(vm::ptr pArg, u32 boundary, u32 size); -typedef void(CellSailMemAllocatorFuncFree)(vm::ptr pArg, u32 boundary, vm::ptr pMemory); - -typedef s32(CellSailSoundAdapterFuncMakeup)(vm::ptr pArg); -typedef s32(CellSailSoundAdapterFuncCleanup)(vm::ptr pArg); -typedef void(CellSailSoundAdapterFuncFormatChanged)(vm::ptr pArg, vm::ptr pFormat, u32 sessionId); - -typedef s32(CellSailGraphicsAdapterFuncMakeup)(vm::ptr pArg); -typedef s32(CellSailGraphicsAdapterFuncCleanup)(vm::ptr pArg); -typedef void(CellSailGraphicsAdapterFuncFormatChanged)(vm::ptr pArg, vm::ptr pFormat, u32 sessionId); -typedef s32(CellSailGraphicsAdapterFuncAllocFrame)(vm::ptr pArg, u32 size, s32 num, vm::pptr ppFrame); -typedef s32(CellSailGraphicsAdapterFuncFreeFrame)(vm::ptr pArg, s32 num, vm::pptr ppFrame); - -typedef s32(CellSailSourceFuncMakeup)(vm::ptr pArg, vm::cptr pProtocolNames); -typedef s32(CellSailSourceFuncCleanup)(vm::ptr pArg); -typedef void(CellSailSourceFuncOpen)(vm::ptr pArg, s32 streamType, vm::ptr pMediaInfo, vm::cptr pUri, vm::ptr pProfile); -typedef void(CellSailSourceFuncClose)(vm::ptr pArg); -typedef void(CellSailSourceFuncStart)(vm::ptr pArg, vm::ptr pCommand, u32 sessionId); -typedef void(CellSailSourceFuncStop)(vm::ptr pArg); -typedef void(CellSailSourceFuncCancel)(vm::ptr pArg); -typedef s32(CellSailSourceFuncCheckout)(vm::ptr pArg, vm::pptr ppItem); -typedef s32(CellSailSourceFuncCheckin)(vm::ptr pArg, vm::ptr pItem); -typedef s32(CellSailSourceFuncClear)(vm::ptr pArg); -typedef s32(CellSailSourceFuncRead)(vm::ptr pArg, s32 streamType, vm::ptr pMediaInfo, vm::cptr pUri, u64 offset, vm::ptr pBuf, u32 size, vm::ptr pTotalSize); -typedef s32(CellSailSourceFuncReadSync)(vm::ptr pArg, s32 streamType, vm::ptr pMediaInfo, vm::cptr pUri, u64 offset, vm::ptr pBuf, u32 size, vm::ptr pTotalSize); -typedef s32(CellSailSourceFuncGetCapabilities)(vm::ptr pArg, s32 streamType, vm::ptr pMediaInfo, vm::cptr pUri, vm::ptr pCapabilities); -typedef s32(CellSailSourceFuncInquireCapability)(vm::ptr pArg, s32 streamType, vm::ptr pMediaInfo, vm::cptr pUri, vm::ptr pCommand); -typedef void(CellSailSourceCheckFuncError)(vm::ptr pArg, vm::cptr pMsg, s32 line); - -typedef s32(CellSailFsFuncOpen)(vm::cptr pPath, s32 flag, vm::ptr pFd, vm::ptr pArg, u64 size); -typedef s32(CellSailFsFuncOpenSecond)(vm::cptr pPath, s32 flag, s32 fd, vm::ptr pArg, u64 size); -typedef s32(CellSailFsFuncClose)(s32 fd); -typedef s32(CellSailFsFuncFstat)(s32 fd, vm::ptr pStat_addr); -typedef s32(CellSailFsFuncRead)(s32 fd, vm::ptr pBuf, u64 numBytes, vm::ptr pNumRead); -typedef s32(CellSailFsFuncLseek)(s32 fd, s64 offset, s32 whence, vm::ptr pPosition); -typedef s32(CellSailFsFuncCancel)(s32 fd); - -typedef s32(CellSailRendererAudioFuncMakeup)(vm::ptr pArg); -typedef s32(CellSailRendererAudioFuncCleanup)(vm::ptr pArg); -typedef void(CellSailRendererAudioFuncOpen)(vm::ptr pArg, vm::ptr pInfo, u32 frameNum); -typedef void(CellSailRendererAudioFuncClose)(vm::ptr pArg); -typedef void(CellSailRendererAudioFuncStart)(vm::ptr pArg, b8 buffering); -typedef void(CellSailRendererAudioFuncStop)(vm::ptr pArg, b8 flush); -typedef void(CellSailRendererAudioFuncCancel)(vm::ptr pArg); -typedef s32(CellSailRendererAudioFuncCheckout)(vm::ptr pArg, vm::pptr ppInfo); -typedef s32(CellSailRendererAudioFuncCheckin)(vm::ptr pArg, vm::ptr pInfo); - -typedef s32(CellSailRendererVideoFuncMakeup)(vm::ptr pArg); -typedef s32(CellSailRendererVideoFuncCleanup)(vm::ptr pArg); -typedef void(CellSailRendererVideoFuncOpen)(vm::ptr pArg, vm::ptr pInfo, u32 frameNum, u32 minFrameNum); -typedef void(CellSailRendererVideoFuncClose)(vm::ptr pArg); -typedef void(CellSailRendererVideoFuncStart)(vm::ptr pArg, b8 buffering); -typedef void(CellSailRendererVideoFuncStop)(vm::ptr pArg, b8 flush, b8 keepRendering); -typedef void(CellSailRendererVideoFuncCancel)(vm::ptr pArg); -typedef s32(CellSailRendererVideoFuncCheckout)(vm::ptr pArg, vm::pptr ppInfo); -typedef s32(CellSailRendererVideoFuncCheckin)(vm::ptr pArg, vm::ptr pInfo); - -typedef void(CellSailPlayerFuncNotified)(vm::ptr pArg, CellSailEvent event, u64 arg0, u64 arg1); +using CellSailMemAllocatorFuncAlloc = vm::ptr(vm::ptr pArg, u32 boundary, u32 size); +using CellSailMemAllocatorFuncFree = void(vm::ptr pArg, u32 boundary, vm::ptr pMemory); + +using CellSailSoundAdapterFuncMakeup = s32(vm::ptr pArg); +using CellSailSoundAdapterFuncCleanup = s32(vm::ptr pArg); +using CellSailSoundAdapterFuncFormatChanged = void(vm::ptr pArg, vm::ptr pFormat, u32 sessionId); + +using CellSailGraphicsAdapterFuncMakeup = s32(vm::ptr pArg); +using CellSailGraphicsAdapterFuncCleanup = s32(vm::ptr pArg); +using CellSailGraphicsAdapterFuncFormatChanged = void(vm::ptr pArg, vm::ptr pFormat, u32 sessionId); +using CellSailGraphicsAdapterFuncAllocFrame = s32(vm::ptr pArg, u32 size, s32 num, vm::pptr ppFrame); +using CellSailGraphicsAdapterFuncFreeFrame = s32(vm::ptr pArg, s32 num, vm::pptr ppFrame); + +using CellSailSourceFuncMakeup = s32(vm::ptr pArg, vm::cptr pProtocolNames); +using CellSailSourceFuncCleanup = s32(vm::ptr pArg); +using CellSailSourceFuncOpen = void(vm::ptr pArg, s32 streamType, vm::ptr pMediaInfo, vm::cptr pUri, vm::ptr pProfile); +using CellSailSourceFuncClose = void(vm::ptr pArg); +using CellSailSourceFuncStart = void(vm::ptr pArg, vm::ptr pCommand, u32 sessionId); +using CellSailSourceFuncStop = void(vm::ptr pArg); +using CellSailSourceFuncCancel = void(vm::ptr pArg); +using CellSailSourceFuncCheckout = s32(vm::ptr pArg, vm::pptr ppItem); +using CellSailSourceFuncCheckin = s32(vm::ptr pArg, vm::ptr pItem); +using CellSailSourceFuncClear = s32(vm::ptr pArg); +using CellSailSourceFuncRead = s32(vm::ptr pArg, s32 streamType, vm::ptr pMediaInfo, vm::cptr pUri, u64 offset, vm::ptr pBuf, u32 size, vm::ptr pTotalSize); +using CellSailSourceFuncReadSync = s32(vm::ptr pArg, s32 streamType, vm::ptr pMediaInfo, vm::cptr pUri, u64 offset, vm::ptr pBuf, u32 size, vm::ptr pTotalSize); +using CellSailSourceFuncGetCapabilities = s32(vm::ptr pArg, s32 streamType, vm::ptr pMediaInfo, vm::cptr pUri, vm::ptr pCapabilities); +using CellSailSourceFuncInquireCapability = s32(vm::ptr pArg, s32 streamType, vm::ptr pMediaInfo, vm::cptr pUri, vm::ptr pCommand); +using CellSailSourceCheckFuncError = void(vm::ptr pArg, vm::cptr pMsg, s32 line); + +using CellSailFsFuncOpen = s32(vm::cptr pPath, s32 flag, vm::ptr pFd, vm::ptr pArg, u64 size); +using CellSailFsFuncOpenSecond = s32(vm::cptr pPath, s32 flag, s32 fd, vm::ptr pArg, u64 size); +using CellSailFsFuncClose = s32(s32 fd); +using CellSailFsFuncFstat = s32(s32 fd, vm::ptr pStat); +using CellSailFsFuncRead = s32(s32 fd, vm::ptr pBuf, u64 numBytes, vm::ptr pNumRead); +using CellSailFsFuncLseek = s32(s32 fd, s64 offset, s32 whence, vm::ptr pPosition); +using CellSailFsFuncCancel = s32(s32 fd); + +using CellSailRendererAudioFuncMakeup = s32(vm::ptr pArg); +using CellSailRendererAudioFuncCleanup = s32(vm::ptr pArg); +using CellSailRendererAudioFuncOpen = void(vm::ptr pArg, vm::ptr pInfo, u32 frameNum); +using CellSailRendererAudioFuncClose = void(vm::ptr pArg); +using CellSailRendererAudioFuncStart = void(vm::ptr pArg, b8 buffering); +using CellSailRendererAudioFuncStop = void(vm::ptr pArg, b8 flush); +using CellSailRendererAudioFuncCancel = void(vm::ptr pArg); +using CellSailRendererAudioFuncCheckout = s32(vm::ptr pArg, vm::pptr ppInfo); +using CellSailRendererAudioFuncCheckin = s32(vm::ptr pArg, vm::ptr pInfo); + +using CellSailRendererVideoFuncMakeup = s32(vm::ptr pArg); +using CellSailRendererVideoFuncCleanup = s32(vm::ptr pArg); +using CellSailRendererVideoFuncOpen = void(vm::ptr pArg, vm::ptr pInfo, u32 frameNum, u32 minFrameNum); +using CellSailRendererVideoFuncClose = void(vm::ptr pArg); +using CellSailRendererVideoFuncStart = void(vm::ptr pArg, b8 buffering); +using CellSailRendererVideoFuncStop = void(vm::ptr pArg, b8 flush, b8 keepRendering); +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); struct CellSailMemAllocatorFuncs { @@ -702,9 +704,9 @@ struct CellSailFuture struct CellSailSoundAdapterFuncs { - CellSailSoundAdapterFuncMakeup pMakeup; - CellSailSoundAdapterFuncCleanup pCleanup; - CellSailSoundAdapterFuncFormatChanged pFormatChanged; + vm::bptr pMakeup; + vm::bptr pCleanup; + vm::bptr pFormatChanged; }; struct CellSailSoundFrameInfo @@ -718,16 +720,25 @@ struct CellSailSoundFrameInfo struct CellSailSoundAdapter { - be_t internalData[32]; + bool initialized; + bool registered; + vm::ptr pMakeup; + vm::ptr pCleanup; + vm::ptr pFormatChanged; + vm::ptr arg; + be_t index; + CellSailAudioFormat format; }; +CHECK_MAX_SIZE(CellSailSoundAdapter, 0x100); + struct CellSailGraphicsAdapterFuncs { - CellSailGraphicsAdapterFuncMakeup pMakeup; - CellSailGraphicsAdapterFuncCleanup pCleanup; - CellSailGraphicsAdapterFuncFormatChanged pFormatChanged; - CellSailGraphicsAdapterFuncAllocFrame pAlloc; - CellSailGraphicsAdapterFuncFreeFrame pFree; + vm::bptr pMakeup; + vm::bptr pCleanup; + vm::bptr pFormatChanged; + vm::bptr pAlloc; + vm::bptr pFree; }; struct CellSailGraphicsFrameInfo @@ -741,9 +752,20 @@ struct CellSailGraphicsFrameInfo struct CellSailGraphicsAdapter { - be_t internalData[32]; + bool initialized; + bool registered; + vm::ptr pMakeup; + vm::ptr pCleanup; + vm::ptr pFormatChanged; + vm::ptr pAlloc; + vm::ptr pFree; + vm::ptr arg; + CellSailVideoFormat format; + be_t index; }; +CHECK_MAX_SIZE(CellSailGraphicsAdapter, 0x100); + struct CellSailAuInfo { be_t pAu; @@ -762,15 +784,15 @@ struct CellSailAuReceiver struct CellSailRendererAudioFuncs { - CellSailRendererAudioFuncMakeup pMakeup; - CellSailRendererAudioFuncCleanup pCleanup; - CellSailRendererAudioFuncOpen pOpen; - CellSailRendererAudioFuncClose pClose; - CellSailRendererAudioFuncStart pStart; - CellSailRendererAudioFuncStop pStop; - CellSailRendererAudioFuncCancel pCancel; - CellSailRendererAudioFuncCheckout pCheckout; - CellSailRendererAudioFuncCheckin pCheckin; + vm::bptr pMakeup; + vm::bptr pCleanup; + vm::bptr pOpen; + vm::bptr pClose; + vm::bptr pStart; + vm::bptr pStop; + vm::bptr pCancel; + vm::bptr pCheckout; + vm::bptr pCheckin; }; struct CellSailRendererAudioAttribute @@ -786,15 +808,15 @@ struct CellSailRendererAudio struct CellSailRendererVideoFuncs { - CellSailRendererVideoFuncMakeup pMakeup; - CellSailRendererVideoFuncCleanup pCleanup; - CellSailRendererVideoFuncOpen pOpen; - CellSailRendererVideoFuncClose pClose; - CellSailRendererVideoFuncStart pStart; - CellSailRendererVideoFuncStop pStop; - CellSailRendererVideoFuncCancel pCancel; - CellSailRendererVideoFuncCheckout pCheckout; - CellSailRendererVideoFuncCheckin pCheckin; + vm::bptr pMakeup; + vm::bptr pCleanup; + vm::bptr pOpen; + vm::bptr pClose; + vm::bptr pStart; + vm::bptr pStop; + vm::bptr pCancel; + vm::bptr pCheckout; + vm::bptr pCheckin; }; struct CellSailRendererVideoAttribute @@ -810,20 +832,20 @@ struct CellSailRendererVideo struct CellSailSourceFuncs { - CellSailSourceFuncMakeup pMakeup; - CellSailSourceFuncCleanup pCleanup; - CellSailSourceFuncOpen pOpen; - CellSailSourceFuncClose pClose; - CellSailSourceFuncStart pStart; - CellSailSourceFuncStop pStop; - CellSailSourceFuncCancel pCancel; - CellSailSourceFuncCheckout pCheckout; - CellSailSourceFuncCheckin pCheckin; - CellSailSourceFuncClear pClear; - CellSailSourceFuncRead pRead; - CellSailSourceFuncReadSync pReadSync; - CellSailSourceFuncGetCapabilities pGetCapabilities; - CellSailSourceFuncInquireCapability pInquireCapability; + vm::bptr pMakeup; + vm::bptr pCleanup; + vm::bptr pOpen; + vm::bptr pClose; + vm::bptr pStart; + vm::bptr pStop; + vm::bptr pCancel; + vm::bptr pCheckout; + vm::bptr pCheckin; + vm::bptr pClear; + vm::bptr pRead; + vm::bptr pReadSync; + vm::bptr pGetCapabilities; + vm::bptr pInquireCapability; }; struct CellSailSource @@ -1040,10 +1062,11 @@ struct CellSailDescriptor b8 autoSelection; b8 registered; be_t streamType; - be_t internalData[31]; + be_t buffer; + be_t sp_; }; -CHECK_SIZE(CellSailDescriptor, 0x100); +CHECK_MAX_SIZE(CellSailDescriptor, 0x100); struct CellSailStartCommand { @@ -1107,6 +1130,53 @@ struct CellSailPlayer s32 descriptors; vm::ptr registeredDescriptors[2]; bool paused; + vm::ptr sAdapter; + vm::ptr gAdapter; }; CHECK_MAX_SIZE(CellSailPlayer, 0x100); + +inline static const char* ParameterCodeToName(s32 code) +{ + switch (code) + { + case CELL_SAIL_PARAMETER_ENABLE_VPOST: return "ENABLE_VPOST"; + case CELL_SAIL_PARAMETER_CONTROL_QUEUE_DEPTH: return "CONTROL_QUEUE_DEPTH"; + case CELL_SAIL_PARAMETER_CONTROL_PPU_THREAD_PRIORITY: return "CONTROL_PPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_SPURS_NUM_OF_SPUS: return "SPURS_NUM_OF_SPUS"; + case CELL_SAIL_PARAMETER_SPURS_SPU_THREAD_PRIORITY: return "SPURS_SPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_SPURS_PPU_THREAD_PRIORITY: return "SPURS_PPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_SPURS_EXIT_IF_NO_WORK: return "SPURS_EXIT_IF_NO_WORK"; + case CELL_SAIL_PARAMETER_IO_PPU_THREAD_PRIORITY: return "IO_PPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_DMUX_PPU_THREAD_PRIORITY: return "DMUX_PPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_DMUX_SPU_THREAD_PRIORITY: return "DMUX_SPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_DMUX_NUM_OF_SPUS: return "DMUX_NUM_OF_SPUS"; + case CELL_SAIL_PARAMETER_DMUX_SPURS_TASK_PRIORITIES: return "DMUX_SPURS_TASK_PRIORITIES"; + case CELL_SAIL_PARAMETER_ADEC_PPU_THREAD_PRIORITY: return "ADEC_PPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_ADEC_SPU_THREAD_PRIORITY: return "ADEC_SPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_ADEC_NUM_OF_SPUS: return "ADEC_NUM_OF_SPUS"; + case CELL_SAIL_PARAMETER_ADEC_SPURS_TASK_PRIORITIES: return "ADEC_SPURS_TASK_PRIORITIES"; + case CELL_SAIL_PARAMETER_VDEC_PPU_THREAD_PRIORITY: return "VDEC_PPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_VDEC_SPU_THREAD_PRIORITY: return "VDEC_SPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_VDEC_M2V_NUM_OF_SPUS: return "VDEC_M2V_NUM_OF_SPUS"; + case CELL_SAIL_PARAMETER_VDEC_AVC_NUM_OF_SPUS: return "VDEC_AVC_NUM_OF_SPUS"; + case CELL_SAIL_PARAMETER_VDEC_SPURS_TASK_PRIORITIES: return "VDEC_SPURS_TASK_PRIORITIES"; + case CELL_SAIL_PARAMETER_VPOST_PPU_THREAD_PRIORITY: return "VPOST_PPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_VPOST_SPU_THREAD_PRIORITY: return "VPOST_SPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_VPOST_NUM_OF_SPUS: return "VPOST_NUM_OF_SPUS"; + case CELL_SAIL_PARAMETER_VPOST_SPURS_TASK_PRIORITIES: return "VPOST_SPURS_TASK_PRIORITIES"; + case CELL_SAIL_PARAMETER_GRAPHICS_ADAPTER_BUFFER_RELEASE_DELAY: return "GRAPHICS_ADAPTER_BUFFER_RELEASE_DELAY"; + case CELL_SAIL_PARAMETER_AV_SYNC_ES_AUDIO: return "AV_SYNC_ES_AUDIO"; + case CELL_SAIL_PARAMETER_AV_SYNC_ES_VIDEO: return "AV_SYNC_ES_VIDEO"; + case CELL_SAIL_PARAMETER_AV_SYNC_ES_USER: return "AV_SYNC_ES_USER"; + case CELL_SAIL_PARAMETER_CONTROL_PPU_THREAD_STACK_SIZE: return "CONTROL_PPU_THREAD_STACK_SIZE"; + case CELL_SAIL_PARAMETER_RESERVED0_: return "RESERVED0_"; + case CELL_SAIL_PARAMETER_RESERVED1: return "RESERVED1"; + case CELL_SAIL_PARAMETER_ENABLE_APOST_SRC: return "ENABLE_APOST_SRC"; + case CELL_SAIL_PARAMETER_FS: return "FS"; + case CELL_SAIL_PARAMETER_IO_PPU_THREAD_STACK_SIZE: return "IO_PPU_THREAD_STACK_SIZE"; + case CELL_SAIL_PARAMETER_VIDEO_PERFORMANCE_POLICY: return "VIDEO_PERFORMANCE_POLICY"; + case _CELL_SAIL_PARAMETER_TYPE_NUM_OF_ELEMENTS: return "TYPE_NUM_OF_ELEMENTS"; + default: return "???"; + } +}