diff --git a/rpcs3/Emu/SysCalls/ModuleManager.cpp b/rpcs3/Emu/SysCalls/ModuleManager.cpp index bb5609cbc7..17cdd88a60 100644 --- a/rpcs3/Emu/SysCalls/ModuleManager.cpp +++ b/rpcs3/Emu/SysCalls/ModuleManager.cpp @@ -38,6 +38,7 @@ extern void cellRtc_init(Module *pxThis); extern void cellSail_init(Module *pxThis); extern void cellSpurs_init(Module *pxThis); extern void cellSpursJq_init(Module *pxThis); +extern void cellSubdisplay_init(Module *pxThis); extern void cellSync_init(Module *pxThis); extern void cellSync2_init(Module *pxThis); extern void cellSysutil_init(Module *pxThis); @@ -125,7 +126,7 @@ static const g_modules_list[] = { 0x0031, "cellAvconfExt", cellAvconfExt_init, nullptr, nullptr }, { 0x0032, "cellUserInfo", cellUserInfo_init, nullptr, nullptr }, { 0x0033, "cellSysutilSavedata", nullptr, nullptr, nullptr }, - { 0x0034, "cellSubdisplay", nullptr, nullptr, nullptr }, + { 0x0034, "cellSubdisplay", cellSubdisplay_init, nullptr, nullptr }, { 0x0035, "cellSysutilRec", nullptr, nullptr, nullptr }, { 0x0036, "cellVideoExport", nullptr, nullptr, nullptr }, { 0x0037, "cellGameExec", nullptr, nullptr, nullptr }, diff --git a/rpcs3/Emu/SysCalls/Modules/cellSubdisplay.cpp b/rpcs3/Emu/SysCalls/Modules/cellSubdisplay.cpp index ff0612316b..98f71097f4 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSubdisplay.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSubdisplay.cpp @@ -1,21 +1,10 @@ #include "stdafx.h" -#if 0 +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" -void cellSubdisplay_init(); -Module cellSubdisplay(0x0034, cellSubdisplay_init); +#include "cellSubdisplay.h" -// Return Codes -enum -{ - CELL_SUBDISPLAY_ERROR_OUT_OF_MEMORY = 0x80029851, - CELL_SUBDISPLAY_ERROR_FATAL = 0x80029852, - CELL_SUBDISPLAY_ERROR_NOT_FOUND = 0x80029853, - CELL_SUBDISPLAY_ERROR_INVALID_VALUE = 0x80029854, - CELL_SUBDISPLAY_ERROR_NOT_INITIALIZED = 0x80029855, - CELL_SUBDISPLAY_ERROR_SET_SAMPLE = 0x80029860, - CELL_SUBDISPLAY_ERROR_AUDIOOUT_IS_BUSY = 0x80029861, - CELL_SUBDISPLAY_ERROR_ZERO_REGISTERED = 0x80029813, -}; +Module *cellSubdisplay = nullptr; int cellSubDisplayInit() { @@ -29,10 +18,18 @@ int cellSubDisplayEnd() return CELL_OK; } -int cellSubDisplayGetRequiredMemory() +int cellSubDisplayGetRequiredMemory(vm::ptr pParam) { - UNIMPLEMENTED_FUNC(cellSubdisplay); - return CELL_OK; + cellSubdisplay->Warning("cellSubDisplayGetRequiredMemory(pParam_addr=0x%x)", pParam.addr()); + + if (pParam->version == CELL_SUBDISPLAY_VERSION_0002) + { + return CELL_SUBDISPLAY_0002_MEMORY_CONTAINER_SIZE; + } + else + { + return CELL_SUBDISPLAY_0001_MEMORY_CONTAINER_SIZE; + } } int cellSubDisplayStart() @@ -77,19 +74,20 @@ int cellSubDisplayGetPeerList() return CELL_OK; } -void cellSubdisplay_init() +void cellSubdisplay_init(Module *pxThis) { - cellSubdisplay.AddFunc(0xf9a7e8a5, cellSubDisplayInit); - cellSubdisplay.AddFunc(0x551d80a5, cellSubDisplayEnd); - cellSubdisplay.AddFunc(0x6595ce22, cellSubDisplayGetRequiredMemory); - cellSubdisplay.AddFunc(0xa5bccb47, cellSubDisplayStart); - cellSubdisplay.AddFunc(0x6d85ddb3, cellSubDisplayStop); + cellSubdisplay = pxThis; - cellSubdisplay.AddFunc(0x938ac642, cellSubDisplayGetVideoBuffer); - cellSubdisplay.AddFunc(0xaee1e0c2, cellSubDisplayAudioOutBlocking); - cellSubdisplay.AddFunc(0x5468d6b0, cellSubDisplayAudioOutNonBlocking); + cellSubdisplay->AddFunc(0xf9a7e8a5, cellSubDisplayInit); + cellSubdisplay->AddFunc(0x551d80a5, cellSubDisplayEnd); + cellSubdisplay->AddFunc(0x6595ce22, cellSubDisplayGetRequiredMemory); + cellSubdisplay->AddFunc(0xa5bccb47, cellSubDisplayStart); + cellSubdisplay->AddFunc(0x6d85ddb3, cellSubDisplayStop); - cellSubdisplay.AddFunc(0x8a264d71, cellSubDisplayGetPeerNum); - cellSubdisplay.AddFunc(0xe2485f79, cellSubDisplayGetPeerList); + cellSubdisplay->AddFunc(0x938ac642, cellSubDisplayGetVideoBuffer); + cellSubdisplay->AddFunc(0xaee1e0c2, cellSubDisplayAudioOutBlocking); + cellSubdisplay->AddFunc(0x5468d6b0, cellSubDisplayAudioOutNonBlocking); + + cellSubdisplay->AddFunc(0x8a264d71, cellSubDisplayGetPeerNum); + cellSubdisplay->AddFunc(0xe2485f79, cellSubDisplayGetPeerList); } -#endif diff --git a/rpcs3/Emu/SysCalls/Modules/cellSubdisplay.h b/rpcs3/Emu/SysCalls/Modules/cellSubdisplay.h new file mode 100644 index 0000000000..8321a606c0 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellSubdisplay.h @@ -0,0 +1,83 @@ +#pragma once + +// Return Codes +enum +{ + CELL_SUBDISPLAY_ERROR_OUT_OF_MEMORY = 0x80029851, + CELL_SUBDISPLAY_ERROR_FATAL = 0x80029852, + CELL_SUBDISPLAY_ERROR_NOT_FOUND = 0x80029853, + CELL_SUBDISPLAY_ERROR_INVALID_VALUE = 0x80029854, + CELL_SUBDISPLAY_ERROR_NOT_INITIALIZED = 0x80029855, + CELL_SUBDISPLAY_ERROR_SET_SAMPLE = 0x80029860, + CELL_SUBDISPLAY_ERROR_AUDIOOUT_IS_BUSY = 0x80029861, + CELL_SUBDISPLAY_ERROR_ZERO_REGISTERED = 0x80029813, +}; + +// Different constants +enum +{ + CELL_SUBDISPLAY_STATUS_JOIN = 1, + CELL_SUBDISPLAY_STATUS_LEAVE = 2, + CELL_SUBDISPLAY_STATUS_FATALERROR = 3, + CELL_SUBDISPLAY_VERSION_0001 = 1, + CELL_SUBDISPLAY_VERSION_0002 = 2, + CELL_SUBDISPLAY_MODE_REMOTEPLAY = 1, + CELL_SUBDISPLAY_VIDEO_FORMAT_A8R8G8B8 = 1, + CELL_SUBDISPLAY_VIDEO_FORMAT_R8G8B8A8 = 2, + CELL_SUBDISPLAY_VIDEO_ASPECT_RATIO_16_9 = 0, + CELL_SUBDISPLAY_VIDEO_ASPECT_RATIO_4_3 = 1, + CELL_SUBDISPLAY_VIDEO_MODE_SETDATA = 0, + CELL_SUBDISPLAY_VIDEO_MODE_CAPTURE = 1, + CELL_SUBDISPLAY_AUDIO_MODE_SETDATA = 0, + CELL_SUBDISPLAY_AUDIO_MODE_CAPTURE = 1, + CELL_SUBDISPLAY_0001_MEMORY_CONTAINER_SIZE = 8 * 1024 * 1024, + CELL_SUBDISPLAY_0002_MEMORY_CONTAINER_SIZE = 10 * 1024 * 1024, + CELL_SUBDISPLAY_NICKNAME_LEN = 256, + CELL_SUBDISPLAY_PSPID_LEN = 16, +}; + +struct CellSubDisplayVideoParam +{ + be_t format; + be_t width; + be_t height; + be_t pitch; + be_t aspectRatio; + be_t videoMode; +}; + +struct CellSubDisplayAudioParam +{ + be_t ch; + be_t audioMode; +}; + +struct CellSubDisplayParam +{ + be_t version; + be_t mode; + be_t nGroup; + be_t nPeer; + vm::ptr videoParam; + vm::ptr audioParam; +}; + +struct CellSubDisplayPSPId +{ + char data[CELL_SUBDISPLAY_PSPID_LEN]; +}; + +struct CellSubDisplayNickname +{ + char data[CELL_SUBDISPLAY_NICKNAME_LEN]; +}; + +struct CellSubDisplayPeerInfo +{ + be_t sessionId; + be_t portNo; + CellSubDisplayPSPId pspId; + CellSubDisplayNickname pspNickname; +}; + +typedef void(*CellSubDisplayHandler)(s32 cbMsg, u64 cbParam, u32 *userdata); \ No newline at end of file diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj index dcaf0010f5..65060fbd04 100644 --- a/rpcs3/emucore.vcxproj +++ b/rpcs3/emucore.vcxproj @@ -194,10 +194,10 @@ - + @@ -425,11 +425,12 @@ - + + diff --git a/rpcs3/emucore.vcxproj.filters b/rpcs3/emucore.vcxproj.filters index 01b67c4ce8..6cc6e711d0 100644 --- a/rpcs3/emucore.vcxproj.filters +++ b/rpcs3/emucore.vcxproj.filters @@ -209,6 +209,9 @@ Emu\SysCalls\Modules + + Emu\SysCalls\Modules + Emu\SysCalls\Modules @@ -452,9 +455,6 @@ Emu\SysCalls\currently_unused - - Emu\SysCalls\currently_unused - Emu\SysCalls\currently_unused @@ -784,6 +784,9 @@ Emu\SysCalls\Modules + + Emu\SysCalls\Modules + Emu\SysCalls\Modules