From be834a67d188a72410aa40ab24b62d6ac401ed28 Mon Sep 17 00:00:00 2001 From: scribam Date: Sat, 13 Jan 2018 00:17:38 +0100 Subject: [PATCH] Add callbacks for cellPhotoDecode --- rpcs3/Emu/Cell/Modules/cellPhotoDecode.cpp | 56 ++++++++++++++++------ 1 file changed, 41 insertions(+), 15 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellPhotoDecode.cpp b/rpcs3/Emu/Cell/Modules/cellPhotoDecode.cpp index 222e9b5fe3..1ed03427c3 100644 --- a/rpcs3/Emu/Cell/Modules/cellPhotoDecode.cpp +++ b/rpcs3/Emu/Cell/Modules/cellPhotoDecode.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include "Emu/Cell/PPUModule.h" +#include "cellSysutil.h" @@ -16,42 +17,67 @@ enum CELL_PHOTO_DECODE_ERROR_DECODE = 0x8002c906, }; -// Datatypes struct CellPhotoDecodeSetParam { - u32 dstBuffer_addr; - u16 width; - u16 height; + vm::bptr dstBuffer; + be_t width; + be_t height; + vm::bptr reserved1; + vm::bptr reserved2; }; struct CellPhotoDecodeReturnParam { - u16 width; - u16 height; + be_t width; + be_t height; + vm::bptr reserved1; + vm::bptr reserved2; }; -// Functions -s32 cellPhotoDecodeInitialize() +using CellPhotoDecodeFinishCallback = void(s32 result, vm::ptr userdata); + +error_code cellPhotoDecodeInitialize(u32 version, u32 container1, u32 container2, vm::ptr funcFinish, vm::ptr userdata) { - UNIMPLEMENTED_FUNC(cellPhotoDecode); + cellPhotoDecode.todo("cellPhotoDecodeInitialize(version=0x%x, container1=0x%x, container2=0x%x, funcFinish=*0x%x, userdata=*0x%x)", version, container1, container2, funcFinish, userdata); + + sysutil_register_cb([=](ppu_thread& ppu) -> s32 + { + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); + return CELL_OK; } -s32 cellPhotoDecodeInitialize2() +error_code cellPhotoDecodeInitialize2(u32 version, u32 container2, vm::ptr funcFinish, vm::ptr userdata) { - UNIMPLEMENTED_FUNC(cellPhotoDecode); + cellPhotoDecode.todo("cellPhotoDecodeInitialize2(version=0x%x, container2=0x%x, funcFinish=*0x%x, userdata=*0x%x)", version, container2, funcFinish, userdata); + + sysutil_register_cb([=](ppu_thread& ppu) -> s32 + { + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); + return CELL_OK; } -s32 cellPhotoDecodeFinalize() +error_code cellPhotoDecodeFinalize(vm::ptr funcFinish, vm::ptr userdata) { - UNIMPLEMENTED_FUNC(cellPhotoDecode); + cellPhotoDecode.todo("cellPhotoDecodeFinalize(funcFinish=*0x%x, userdata=*0x%x)", funcFinish, userdata); + + sysutil_register_cb([=](ppu_thread& ppu) -> s32 + { + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); + return CELL_OK; } -s32 cellPhotoDecodeFromFile() +error_code cellPhotoDecodeFromFile(vm::cptr srcHddDir, vm::cptr srcHddFile, vm::ptr set_param, vm::ptr return_param) { - UNIMPLEMENTED_FUNC(cellPhotoDecode); + cellPhotoDecode.todo("cellPhotoDecodeFromFile(srcHddDir=%s, srcHddFile=%s, set_param=*0x%x, return_param=*0x%x)", srcHddDir, srcHddFile, set_param, return_param); return CELL_OK; }