diff --git a/rpcs3/Emu/SysCalls/Modules.cpp b/rpcs3/Emu/SysCalls/Modules.cpp index b1eeb20cfd..a73da6981c 100644 --- a/rpcs3/Emu/SysCalls/Modules.cpp +++ b/rpcs3/Emu/SysCalls/Modules.cpp @@ -119,16 +119,19 @@ void execute_ppu_func_by_index(PPUThread& CPU, u32 index) if (old_last_syscall) { + CPU.m_last_syscall = func->id; throw "Unfortunately, this function cannot be called from the callback."; } if (!func->lle_func) { + CPU.m_last_syscall = func->id; throw "Wrong usage: LLE function not set."; } if (func->flags & MFF_FORCED_HLE) { + CPU.m_last_syscall = func->id; throw "Wrong usage: Forced HLE enabled."; } @@ -139,6 +142,7 @@ void execute_ppu_func_by_index(PPUThread& CPU, u32 index) if (index & EIF_PERFORM_BLR) { + CPU.m_last_syscall = func->id; throw "TODO: Branch with link"; // CPU.LR = CPU.PC + 4; } diff --git a/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp index 352cedc091..c1717474df 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp @@ -18,23 +18,35 @@ extern "C" extern Module cellGifDec; -s32 cellGifDecCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam) +s32 cellGifDecCreate( + vm::ptr mainHandle, + vm::ptr threadInParam, + vm::ptr threadOutParam) { UNIMPLEMENTED_FUNC(cellGifDec); return CELL_OK; } -s32 cellGifDecExtCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam, u32 extThreadInParam, u32 extThreadOutParam) +s32 cellGifDecExtCreate( + vm::ptr mainHandle, + vm::ptr threadInParam, + vm::ptr threadOutParam, + vm::ptr extThreadInParam, + vm::ptr extThreadOutParam) { UNIMPLEMENTED_FUNC(cellGifDec); return CELL_OK; } -s32 cellGifDecOpen(u32 mainHandle, vm::ptr subHandle, vm::ptr src, vm::ptr openInfo) +s32 cellGifDecOpen( + CellGifDecMainHandle mainHandle, + vm::ptr subHandle, + vm::ptr src, + vm::ptr openInfo) { cellGifDec.Warning("cellGifDecOpen(mainHandle=0x%x, subHandle=*0x%x, src=*0x%x, openInfo=*0x%x)", mainHandle, subHandle, src, openInfo); - auto current_subHandle = std::make_shared(); + auto current_subHandle = std::make_shared(); current_subHandle->fd = 0; current_subHandle->src = *src; @@ -62,11 +74,14 @@ s32 cellGifDecOpen(u32 mainHandle, vm::ptr subHandle, vm::ptr info) +s32 cellGifDecReadHeader( + CellGifDecMainHandle mainHandle, + CellGifDecSubHandle subHandle, + vm::ptr info) { cellGifDec.Warning("cellGifDecReadHeader(mainHandle=0x%x, subHandle=0x%x, info=*0x%x)", mainHandle, subHandle, info); - const auto subHandle_data = Emu.GetIdManager().get(subHandle); + const auto subHandle_data = Emu.GetIdManager().get(subHandle); if (!subHandle_data) { @@ -83,7 +98,7 @@ s32 cellGifDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr switch(subHandle_data->src.srcSelect.data()) { case se32(CELL_GIFDEC_BUFFER): - memmove(buffer.begin(), vm::get_ptr(subHandle_data->src.streamPtr), buffer.size()); + memmove(buffer.begin(), subHandle_data->src.streamPtr.get_ptr(), buffer.size()); break; case se32(CELL_GIFDEC_FILE): @@ -116,11 +131,15 @@ s32 cellGifDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr return CELL_OK; } -s32 cellGifDecSetParameter(u32 mainHandle, u32 subHandle, vm::ptr inParam, vm::ptr outParam) +s32 cellGifDecSetParameter( + CellGifDecMainHandle mainHandle, + CellGifDecSubHandle subHandle, + vm::ptr inParam, + vm::ptr outParam) { cellGifDec.Warning("cellGifDecSetParameter(mainHandle=0x%x, subHandle=0x%x, inParam=*0x%x, outParam=*0x%x)", mainHandle, subHandle, inParam, outParam); - const auto subHandle_data = Emu.GetIdManager().get(subHandle); + const auto subHandle_data = Emu.GetIdManager().get(subHandle); if (!subHandle_data) { @@ -148,13 +167,18 @@ s32 cellGifDecSetParameter(u32 mainHandle, u32 subHandle, vm::ptr data, vm::ptr dataCtrlParam, vm::ptr dataOutInfo) +s32 cellGifDecDecodeData( + CellGifDecMainHandle mainHandle, + CellGifDecSubHandle subHandle, + vm::ptr data, + vm::ptr dataCtrlParam, + vm::ptr dataOutInfo) { cellGifDec.Warning("cellGifDecDecodeData(mainHandle=0x%x, subHandle=0x%x, data=*0x%x, dataCtrlParam=*0x%x, dataOutInfo=*0x%x)", mainHandle, subHandle, data, dataCtrlParam, dataOutInfo); dataOutInfo->status = CELL_GIFDEC_DEC_STATUS_STOP; - const auto subHandle_data = Emu.GetIdManager().get(subHandle); + const auto subHandle_data = Emu.GetIdManager().get(subHandle); if (!subHandle_data) { @@ -171,7 +195,7 @@ s32 cellGifDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr data, vm::pt switch(subHandle_data->src.srcSelect.data()) { case se32(CELL_GIFDEC_BUFFER): - memmove(gif.begin(), vm::get_ptr(subHandle_data->src.streamPtr), gif.size()); + memmove(gif.begin(), subHandle_data->src.streamPtr.get_ptr(), gif.size()); break; case se32(CELL_GIFDEC_FILE): @@ -269,11 +293,11 @@ s32 cellGifDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr data, vm::pt return CELL_OK; } -s32 cellGifDecClose(u32 mainHandle, u32 subHandle) +s32 cellGifDecClose(CellGifDecMainHandle mainHandle, CellGifDecSubHandle subHandle) { cellGifDec.Warning("cellGifDecClose(mainHandle=0x%x, subHandle=0x%x)", mainHandle, subHandle); - const auto subHandle_data = Emu.GetIdManager().get(subHandle); + const auto subHandle_data = Emu.GetIdManager().get(subHandle); if (!subHandle_data) { @@ -286,7 +310,7 @@ s32 cellGifDecClose(u32 mainHandle, u32 subHandle) return CELL_OK; } -s32 cellGifDecDestroy(u32 mainHandle) +s32 cellGifDecDestroy(CellGifDecMainHandle mainHandle) { UNIMPLEMENTED_FUNC(cellGifDec); return CELL_OK; diff --git a/rpcs3/Emu/SysCalls/Modules/cellGifDec.h b/rpcs3/Emu/SysCalls/Modules/cellGifDec.h index 9b599425ff..a324179faa 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGifDec.h +++ b/rpcs3/Emu/SysCalls/Modules/cellGifDec.h @@ -13,43 +13,96 @@ enum CELL_GIFDEC_ERROR_CB_PARAM = 0x80611307, }; -enum CellGifDecStreamSrcSel +enum CellGifDecStreamSrcSel : s32 { CELL_GIFDEC_FILE = 0, // Input from a file CELL_GIFDEC_BUFFER = 1, // Input from a buffer }; -enum CellGifDecSpuThreadEna +enum CellGifDecSpuThreadEna : s32 { CELL_GIFDEC_SPU_THREAD_DISABLE = 0, // Do not use SPU threads CELL_GIFDEC_SPU_THREAD_ENABLE = 1, // Use SPU threads }; -enum CellGifDecRecordType +enum CellGifDecRecordType : s32 { CELL_GIFDEC_RECORD_TYPE_IMAGE_DESC = 1, // Image data block CELL_GIFDEC_RECORD_TYPE_EXTENSION = 2, // Extension block CELL_GIFDEC_RECORD_TYPE_TERMINATE = 3, // Trailer block }; -enum CellGifDecColorSpace +enum CellGifDecColorSpace : s32 { CELL_GIFDEC_RGBA = 10, // RGBA CELL_GIFDEC_ARGB = 20, // ARGB }; -enum CellGifDecCommand +enum CellGifDecCommand : s32 { CELL_GIFDEC_CONTINUE = 0, // Continue decoding CELL_GIFDEC_STOP = 1, // Force decoding to stop }; -enum CellGifDecDecodeStatus +enum CellGifDecDecodeStatus : s32 { CELL_GIFDEC_DEC_STATUS_FINISH = 0, // Decoding finished CELL_GIFDEC_DEC_STATUS_STOP = 1, // Decoding was stopped }; +// Handles +using CellGifDecMainHandle = vm::ptr; +using CellGifDecSubHandle = u32; // vm::ptr; + +// Callbacks for memory management +using CellGifDecCbControlMalloc = func_def(u32 size, vm::ptr cbCtrlMallocArg)>; +using CellGifDecCbControlFree = func_def ptr, vm::ptr cbCtrlFreeArg)>; + +// Structs +struct CellGifDecThreadInParam +{ + be_t spuThreadEnable; // CellGifDecSpuThreadEna + be_t ppuThreadPriority; + be_t spuThreadPriority; + vm::bptr cbCtrlMallocFunc; + vm::bptr cbCtrlMallocArg; + vm::bptr cbCtrlFreeFunc; + vm::bptr cbCtrlFreeArg; +}; + +struct CellGifDecThreadOutParam +{ + be_t gifCodecVersion; +}; + +struct CellGifDecExtThreadInParam +{ + vm::bptr spurs; + u8 priority[8]; + be_t maxContention; +}; + +struct CellGifDecExtThreadOutParam +{ + be_t reserved; +}; + +struct CellGifDecSrc +{ + be_t srcSelect; // CellGifDecStreamSrcSel + vm::bptr fileName; + be_t fileOffset; + be_t fileSize; + vm::bptr streamPtr; + be_t streamSize; + be_t spuThreadEnable; // CellGifDecSpuThreadEna +}; + +struct CellGifDecOpnInfo +{ + be_t initSpaceAllocated; +}; + struct CellGifDecInfo { be_t SWidth; @@ -62,21 +115,10 @@ struct CellGifDecInfo be_t SPixelAspectRatio; }; -struct CellGifDecSrc -{ - be_t srcSelect; - vm::bptr fileName; - be_t fileOffset; - be_t fileSize; - be_t streamPtr; - be_t streamSize; - be_t spuThreadEnable; -}; - struct CellGifDecInParam { - be_t commandPtr; - be_t colorSpace; // CellGifDecColorSpace + vm::bptr commandPtr; // CellGifDecCommand + be_t colorSpace; // CellGifDecColorSpace u8 outputColorAlpha1; u8 outputColorAlpha2; u8 reserved[2]; @@ -89,7 +131,7 @@ struct CellGifDecOutParam be_t outputHeight; be_t outputComponents; be_t outputBitDepth; - be_t outputColorSpace; // CellGifDecColorSpace + be_t outputColorSpace; // CellGifDecColorSpace be_t useMemorySpace; }; @@ -101,14 +143,9 @@ struct CellGifDecExtension struct CellGifDecDataOutInfo { - be_t recordType; + be_t recordType; // CellGifDecRecordType CellGifDecExtension outExtension; - be_t status; -}; - -struct CellGifDecOpnInfo -{ - be_t initSpaceAllocated; + be_t status; // CellGifDecDecodeStatus }; struct CellGifDecDataCtrlParam @@ -117,7 +154,11 @@ struct CellGifDecDataCtrlParam }; //Custom structs -struct CellGifDecSubHandle +struct GifDecoder +{ +}; + +struct GifStream { u32 fd; u64 fileSize; diff --git a/rpcs3/Emu/SysCalls/Modules/cellPngDec.h b/rpcs3/Emu/SysCalls/Modules/cellPngDec.h index 4837b2024e..037019fe65 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPngDec.h +++ b/rpcs3/Emu/SysCalls/Modules/cellPngDec.h @@ -6,9 +6,6 @@ enum : u32 PNGDEC_CODEC_VERSION = 0x00420000, }; -using CellPngDecMainHandle = vm::ptr; -using CellPngDecSubHandle = vm::ptr; - // Return Codes enum { @@ -83,9 +80,13 @@ enum CellPngDecDecodeStatus : s32 CELL_PNGDEC_DEC_STATUS_STOP = 1, }; +// Handles +using CellPngDecMainHandle = vm::ptr; +using CellPngDecSubHandle = vm::ptr; + // Callbacks for memory management -typedef vm::ptr(CellPngDecCbControlMalloc)(u32 size, vm::ptr cbCtrlMallocArg); -typedef s32(CellPngDecCbControlFree)(vm::ptr ptr, vm::ptr cbCtrlFreeArg); +using CellPngDecCbControlMalloc = func_def(u32 size, vm::ptr cbCtrlMallocArg)>; +using CellPngDecCbControlFree = func_def ptr, vm::ptr cbCtrlFreeArg)>; // Structs struct CellPngDecThreadInParam @@ -179,47 +180,6 @@ struct CellPngDecDataOutInfo be_t status; // CellPngDecDecodeStatus }; -// Functions -s32 cellPngDecCreate( - vm::ptr mainHandle, - vm::ptr threadInParam, - vm::ptr threadOutParam); - -s32 cellPngDecExtCreate( - vm::ptr mainHandle, - vm::ptr threadInParam, - vm::ptr threadOutParam, - vm::ptr extThreadInParam, - vm::ptr extThreadOutParam); - -s32 cellPngDecOpen( - CellPngDecMainHandle mainHandle, - vm::ptr subHandle, - vm::ptr src, - vm::ptr openInfo); - -s32 cellPngDecReadHeader( - CellPngDecMainHandle mainHandle, - CellPngDecSubHandle subHandle, - vm::ptr info); - -s32 cellPngDecSetParameter( - CellPngDecMainHandle mainHandle, - CellPngDecSubHandle subHandle, - vm::ptr inParam, - vm::ptr outParam); - -s32 cellPngDecDecodeData( - CellPngDecMainHandle mainHandle, - CellPngDecSubHandle subHandle, - vm::ptr data, - vm::ptr dataCtrlParam, - vm::ptr dataOutInfo); - -s32 cellPngDecClose(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle); - -s32 cellPngDecDestroy(CellPngDecMainHandle mainHandle); - // Defines for decoding partial streams enum CellPngDecBufferMode : s32 { @@ -288,8 +248,8 @@ struct CellPngDecExtOutParam }; // Callbacks for decoding partial streams -typedef s32(CellPngDecCbControlStream)(vm::ptr strmInfo, vm::ptr strmParam, vm::ptr cbCtrlStrmArg); -typedef s32(CellPngDecCbControlDisp)(vm::ptr dispInfo, vm::ptr dispParam, vm::ptr cbCtrlDispArg); +using CellPngDecCbControlStream = func_def strmInfo, vm::ptr strmParam, vm::ptr cbCtrlStrmArg)>; +using CellPngDecCbControlDisp = func_def dispInfo, vm::ptr dispParam, vm::ptr cbCtrlDispArg)>; struct CellPngDecCbCtrlStrm { @@ -303,73 +263,6 @@ struct CellPngDecCbCtrlDisp vm::bptr cbCtrlDispArg; }; -// Functions for decoding partial streams -s32 cellPngDecExtOpen( - CellPngDecMainHandle mainHandle, - vm::ptr subHandle, - vm::ptr src, - vm::ptr openInfo, - vm::ptr cbCtrlStrm, - vm::ptr opnParam); - -s32 cellPngDecExtReadHeader( - CellPngDecMainHandle mainHandle, - CellPngDecSubHandle subHandle, - vm::ptr info, - vm::ptr extInfo); - -s32 cellPngDecExtSetParameter( - CellPngDecMainHandle mainHandle, - CellPngDecSubHandle subHandle, - vm::ptr inParam, - vm::ptr outParam, - vm::ptr extInParam, - vm::ptr extOutParam); - -s32 cellPngDecExtDecodeData( - CellPngDecMainHandle mainHandle, - CellPngDecSubHandle subHandle, - vm::ptr data, - vm::ptr dataCtrlParam, - vm::ptr dataOutInfo, - vm::ptr cbCtrlDisp, - vm::ptr dispParam); - -// Functions for accessing ancillary chunks -s32 cellPngDecGetTextChunk(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr textInfoNum, vm::ptr> textInfo); - -s32 cellPngDecGetPLTE(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr plte); - -s32 cellPngDecGetgAMA(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr gama); - -s32 cellPngDecGetsRGB(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr srgb); - -s32 cellPngDecGetiCCP(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr iccp); - -s32 cellPngDecGetsBIT(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr sbit); - -s32 cellPngDecGettRNS(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr trns); - -s32 cellPngDecGethIST(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr hist); - -s32 cellPngDecGettIME(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr time); - -s32 cellPngDecGetbKGD(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr bkgd); - -s32 cellPngDecGetsPLT(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr splt); - -s32 cellPngDecGetoFFs(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr offs); - -s32 cellPngDecGetpHYs(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr phys); - -s32 cellPngDecGetsCAL(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr scal); - -s32 cellPngDecGetcHRM(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr chrm); - -s32 cellPngDecGetpCAL(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr pcal); - -s32 cellPngDecGetUnknownChunks(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr> unknownChunk, vm::ptr unknownChunkNumber); - // Custom structs struct PngDecoder { @@ -392,4 +285,4 @@ struct PngStream CellPngDecStrmInfo streamInfo; CellPngDecStrmParam streamParam; -}; \ No newline at end of file +};