diff --git a/rpcs3/Emu/RSX/sysutil_video.h b/rpcs3/Emu/RSX/sysutil_video.h index e501f73b03..9975a33046 100644 --- a/rpcs3/Emu/RSX/sysutil_video.h +++ b/rpcs3/Emu/RSX/sysutil_video.h @@ -31,11 +31,12 @@ enum CellVideoOutResolutionId CELL_VIDEO_OUT_RESOLUTION_1440x1080 = 11, CELL_VIDEO_OUT_RESOLUTION_1280x1080 = 12, CELL_VIDEO_OUT_RESOLUTION_960x1080 = 13, - CELL_VIDEO_OUT_RESOLUTION_720_3D_FRAME_PACKING = 0x81, - CELL_VIDEO_OUT_RESOLUTION_1024x720_3D_FRAME_PACKING = 0x88, - CELL_VIDEO_OUT_RESOLUTION_960x720_3D_FRAME_PACKING = 0x89, - CELL_VIDEO_OUT_RESOLUTION_800x720_3D_FRAME_PACKING = 0x8a, - CELL_VIDEO_OUT_RESOLUTION_640x720_3D_FRAME_PACKING = 0x8b, + CELL_VIDEO_OUT_RESOLUTION_720_3D_FRAME_PACKING = 0x81, + CELL_VIDEO_OUT_RESOLUTION_1024x720_3D_FRAME_PACKING = 0x88, + CELL_VIDEO_OUT_RESOLUTION_960x720_3D_FRAME_PACKING = 0x89, + CELL_VIDEO_OUT_RESOLUTION_800x720_3D_FRAME_PACKING = 0x8a, + CELL_VIDEO_OUT_RESOLUTION_640x720_3D_FRAME_PACKING = 0x8b, + CELL_VIDEO_OUT_RESOLUTION_720_SIMULVIEW_FRAME_PACKING = 0x91, }; enum CellVideoOutScanMode diff --git a/rpcs3/Emu/SysCalls/Modules/cellPamf.h b/rpcs3/Emu/SysCalls/Modules/cellPamf.h index 13a051285c..33904beb97 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPamf.h +++ b/rpcs3/Emu/SysCalls/Modules/cellPamf.h @@ -391,3 +391,5 @@ struct CellPamfReader }; static_assert(sizeof(CellPamfReader) == 128, "Invalid CellPamfReader size"); + +s32 cellPamfReaderInitialize(vm::ptr pSelf, vm::ptr pAddr, u64 fileSize, u32 attribute); \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/Modules/cellSail.cpp b/rpcs3/Emu/SysCalls/Modules/cellSail.cpp index c06942ecc7..3c5bdad60e 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSail.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSail.cpp @@ -1,8 +1,10 @@ #include "stdafx.h" #include "Emu/Memory/Memory.h" #include "Emu/SysCalls/Modules.h" +#include "Emu/FS/vfsFile.h" #include "cellSail.h" +#include "cellPamf.h" Module *cellSail = nullptr; @@ -92,9 +94,22 @@ int cellSailDescriptorIsAutoSelection(vm::ptr pSelf) return CELL_OK; } -int cellSailDescriptorCreateDatabase() +int cellSailDescriptorCreateDatabase(vm::ptr pSelf, vm::ptr pDatabase, be_t size, be_t arg) { - UNIMPLEMENTED_FUNC(cellSail); + cellSail->Warning("cellSailDescriptorCreateDatabase(pSelf=0x%x, pDatabase=0x%x, size=0x%x, arg=0x%x", pSelf.addr(), pDatabase.addr(), size, arg); + + switch (pSelf->streamType) { + case CELL_SAIL_STREAM_PAMF: + { + u32 addr = pSelf->internalData[1]; + auto ptr = vm::ptr::make(addr); + memcpy(pDatabase.get_ptr(), ptr.get_ptr(), sizeof(CellPamfReader)); + break; + } + default: + cellSail->Error("Unhandled stream type: %d", pSelf->streamType); + } + return CELL_OK; } @@ -619,11 +634,9 @@ int cellSailPlayerAddDescriptor(vm::ptr pSelf, vm::ptr pSelf, s32 streamType, vm::ptr pMediaInfo, vm::ptr pUri, vm::ptr ppDesc) { - cellSail->Todo("cellSailPlayerCreateDescriptor(pSelf_addr=0x%x, streamType=%d, pMediaInfo_addr=0x%x, pUri_addr=0x%x, ppDesc_addr=0x%x)", pSelf.addr(), streamType, + cellSail->Warning("cellSailPlayerCreateDescriptor(pSelf_addr=0x%x, streamType=%d, pMediaInfo_addr=0x%x, pUri_addr=0x%x, ppDesc_addr=0x%x)", pSelf.addr(), streamType, pMediaInfo.addr(), pUri.addr(), ppDesc.addr()); - // TODO: Let the game allocate memory for the descriptor, setup the descriptor and pass it back to the game - u32 descriptorAddress = Memory.Alloc(sizeof(CellSailDescriptor), 1); auto descriptor = vm::ptr::make(descriptorAddress); *ppDesc = descriptorAddress; @@ -633,6 +646,39 @@ int cellSailPlayerCreateDescriptor(vm::ptr pSelf, s32 streamType //pSelf->descriptors = 0; pSelf->repeatMode = 0; + switch (streamType) + { + case CELL_SAIL_STREAM_PAMF: + { + std::string uri = pUri.get_ptr(); + if (uri.substr(0, 12) == "x-cell-fs://") { + std::string path = uri.substr(12); + vfsFile f; + if (f.Open(path)) { + u64 size = f.GetSize(); + u32 buf_ = Memory.Alloc(size, 1); + auto bufPtr = vm::ptr::make(buf_); + PamfHeader *buf = const_cast(bufPtr.get_ptr()); + assert(f.Read(buf, size) == size); + u32 sp_ = Memory.Alloc(sizeof(CellPamfReader), 1); + auto sp = vm::ptr::make(sp_); + u32 r = cellPamfReaderInitialize(sp, bufPtr, size, 0); + + descriptor->internalData[0] = buf_; + descriptor->internalData[1] = sp_; + } + else + cellSail->Warning("Couldn't open PAMF: %s", uri.c_str()); + + } + else + cellSail->Warning("Unhandled uri: %s", uri.c_str()); + break; + } + default: + cellSail->Error("Unhandled stream type: %d", streamType); + } + //cellSail->Todo("pSelf_addr=0x%x, pDesc_addr=0x%x", pSelf.addr(), descriptor.addr()); //cellSailPlayerAddDescriptor(pSelf, ppDesc); diff --git a/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp b/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp index becafff4c5..8b1d80dcd7 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp @@ -112,7 +112,7 @@ void setSaveDataList(std::vector& saveEntries, vm::ptrdirName == (char*)fixedList[j].dirName) { diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp index aa7458e940..d620fd22ab 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp @@ -286,13 +286,13 @@ int cellVideoOutGetNumberOfDevice(u32 videoOut) int cellVideoOutGetResolutionAvailability(u32 videoOut, u32 resolutionId, u32 aspect, u32 option) { - cellSysutil->Warning("cellVideoOutGetResolutionAvailability(videoOut=%d, resolutionId=0x%x, option_addr=0x%x, aspect=0x%x, option=0x%x)", + cellSysutil->Warning("cellVideoOutGetResolutionAvailability(videoOut=%d, resolutionId=0x%x, option_addr=0x%x, aspect=%d, option=%d)", videoOut, resolutionId, aspect, option); - if(!ResolutionIdToNum(resolutionId)) - { - return CELL_EINVAL; - } + if (!Ini.GS3DTV.GetValue() && resolutionId == CELL_VIDEO_OUT_RESOLUTION_720_3D_FRAME_PACKING || resolutionId == CELL_VIDEO_OUT_RESOLUTION_1024x720_3D_FRAME_PACKING || + resolutionId == CELL_VIDEO_OUT_RESOLUTION_960x720_3D_FRAME_PACKING || resolutionId == CELL_VIDEO_OUT_RESOLUTION_800x720_3D_FRAME_PACKING || + resolutionId == CELL_VIDEO_OUT_RESOLUTION_640x720_3D_FRAME_PACKING) + return 0; switch(videoOut) {