diff --git a/rpcs3/Emu/Cell/Modules/cellVdec.cpp b/rpcs3/Emu/Cell/Modules/cellVdec.cpp index 9268acb45c..f333e79303 100644 --- a/rpcs3/Emu/Cell/Modules/cellVdec.cpp +++ b/rpcs3/Emu/Cell/Modules/cellVdec.cpp @@ -26,6 +26,26 @@ std::mutex g_mutex_avcodec_open2; LOG_CHANNEL(cellVdec); +template<> +void fmt_class_string::format(std::string& out, u64 arg) +{ + format_enum(out, arg, [](auto error) + { + switch (error) + { + STR_CASE(CELL_VDEC_ERROR_ARG); + STR_CASE(CELL_VDEC_ERROR_SEQ); + STR_CASE(CELL_VDEC_ERROR_BUSY); + STR_CASE(CELL_VDEC_ERROR_EMPTY); + STR_CASE(CELL_VDEC_ERROR_AU); + STR_CASE(CELL_VDEC_ERROR_PIC); + STR_CASE(CELL_VDEC_ERROR_FATAL); + } + + return unknown; + }); +} + vm::gvar _cell_vdec_prx_ver; // ??? constexpr struct vdec_start_seq_t{} vdec_start_seq{}; @@ -398,7 +418,7 @@ static void vdecEntry(ppu_thread& ppu, u32 vid) ppu.state += cpu_flag::exit; } -static u32 vdecQueryAttr(s32 type, u32 profile, u32 spec_addr /* may be 0 */, vm::ptr attr) +static error_code vdecQueryAttr(s32 type, u32 profile, u32 spec_addr /* may be 0 */, vm::ptr attr) { switch (type) // TODO: check profile levels { @@ -416,14 +436,14 @@ static u32 vdecQueryAttr(s32 type, u32 profile, u32 spec_addr /* may be 0 */, vm return CELL_OK; } -s32 cellVdecQueryAttr(vm::cptr type, vm::ptr attr) +error_code cellVdecQueryAttr(vm::cptr type, vm::ptr attr) { cellVdec.warning("cellVdecQueryAttr(type=*0x%x, attr=*0x%x)", type, attr); return vdecQueryAttr(type->codecType, type->profileLevel, 0, attr); } -s32 cellVdecQueryAttrEx(vm::cptr type, vm::ptr attr) +error_code cellVdecQueryAttrEx(vm::cptr type, vm::ptr attr) { cellVdec.warning("cellVdecQueryAttrEx(type=*0x%x, attr=*0x%x)", type, attr); @@ -431,7 +451,7 @@ s32 cellVdecQueryAttrEx(vm::cptr type, vm::ptr att } template -static s32 vdecOpen(ppu_thread& ppu, T type, U res, vm::cptr cb, vm::ptr handle) +static error_code vdecOpen(ppu_thread& ppu, T type, U res, vm::cptr cb, vm::ptr handle) { if (!type || !res || !cb || !handle) { @@ -467,21 +487,21 @@ static s32 vdecOpen(ppu_thread& ppu, T type, U res, vm::cptr cb, vm: return CELL_OK; } -s32 cellVdecOpen(ppu_thread& ppu, vm::cptr type, vm::cptr res, vm::cptr cb, vm::ptr handle) +error_code cellVdecOpen(ppu_thread& ppu, vm::cptr type, vm::cptr res, vm::cptr cb, vm::ptr handle) { cellVdec.warning("cellVdecOpen(type=*0x%x, res=*0x%x, cb=*0x%x, handle=*0x%x)", type, res, cb, handle); return vdecOpen(ppu, type, res, cb, handle); } -s32 cellVdecOpenEx(ppu_thread& ppu, vm::cptr type, vm::cptr res, vm::cptr cb, vm::ptr handle) +error_code cellVdecOpenEx(ppu_thread& ppu, vm::cptr type, vm::cptr res, vm::cptr cb, vm::ptr handle) { cellVdec.warning("cellVdecOpenEx(type=*0x%x, res=*0x%x, cb=*0x%x, handle=*0x%x)", type, res, cb, handle); return vdecOpen(ppu, type, res, cb, handle); } -s32 cellVdecClose(ppu_thread& ppu, u32 handle) +error_code cellVdecClose(ppu_thread& ppu, u32 handle) { cellVdec.warning("cellVdecClose(handle=0x%x)", handle); @@ -506,7 +526,7 @@ s32 cellVdecClose(ppu_thread& ppu, u32 handle) return CELL_OK; } -s32 cellVdecStartSeq(u32 handle) +error_code cellVdecStartSeq(u32 handle) { cellVdec.trace("cellVdecStartSeq(handle=0x%x)", handle); @@ -521,7 +541,7 @@ s32 cellVdecStartSeq(u32 handle) return CELL_OK; } -s32 cellVdecEndSeq(u32 handle) +error_code cellVdecEndSeq(u32 handle) { cellVdec.warning("cellVdecEndSeq(handle=0x%x)", handle); @@ -536,7 +556,7 @@ s32 cellVdecEndSeq(u32 handle) return CELL_OK; } -s32 cellVdecDecodeAu(u32 handle, CellVdecDecodeMode mode, vm::cptr auInfo) +error_code cellVdecDecodeAu(u32 handle, CellVdecDecodeMode mode, vm::cptr auInfo) { cellVdec.trace("cellVdecDecodeAu(handle=0x%x, mode=%d, auInfo=*0x%x)", handle, (s32)mode, auInfo); @@ -557,13 +577,13 @@ s32 cellVdecDecodeAu(u32 handle, CellVdecDecodeMode mode, vm::cptr format, vm::ptr outBuff) +error_code cellVdecGetPicture(u32 handle, vm::cptr format, vm::ptr outBuff) { cellVdec.trace("cellVdecGetPicture(handle=0x%x, format=*0x%x, outBuff=*0x%x)", handle, format, outBuff); @@ -670,7 +690,7 @@ s32 cellVdecGetPicture(u32 handle, vm::cptr format, vm::ptr format2, vm::ptr outBuff, u32 arg4) +error_code cellVdecGetPictureExt(u32 handle, vm::cptr format2, vm::ptr outBuff, u32 arg4) { cellVdec.warning("cellVdecGetPictureExt(handle=0x%x, format2=*0x%x, outBuff=*0x%x, arg4=*0x%x)", handle, format2, outBuff, arg4); @@ -687,7 +707,7 @@ s32 cellVdecGetPictureExt(u32 handle, vm::cptr format2, vm:: return cellVdecGetPicture(handle, format, outBuff); } -s32 cellVdecGetPicItem(u32 handle, vm::pptr picItem) +error_code cellVdecGetPicItem(u32 handle, vm::pptr picItem) { cellVdec.trace("cellVdecGetPicItem(handle=0x%x, picItem=**0x%x)", handle, picItem); @@ -891,7 +911,7 @@ s32 cellVdecGetPicItem(u32 handle, vm::pptr picItem) return CELL_OK; } -s32 cellVdecSetFrameRate(u32 handle, CellVdecFrameRate frc) +error_code cellVdecSetFrameRate(u32 handle, CellVdecFrameRate frc) { cellVdec.trace("cellVdecSetFrameRate(handle=0x%x, frc=0x%x)", handle, (s32)frc); @@ -907,37 +927,37 @@ s32 cellVdecSetFrameRate(u32 handle, CellVdecFrameRate frc) return CELL_OK; } -s32 cellVdecOpenExt() +error_code cellVdecOpenExt() { UNIMPLEMENTED_FUNC(cellVdec); return CELL_OK; } -s32 cellVdecStartSeqExt() +error_code cellVdecStartSeqExt() { UNIMPLEMENTED_FUNC(cellVdec); return CELL_OK; } -s32 cellVdecGetPicItemEx() +error_code cellVdecGetPicItemEx() { UNIMPLEMENTED_FUNC(cellVdec); return CELL_OK; } -s32 cellVdecGetPicItemExt() +error_code cellVdecGetPicItemExt() { UNIMPLEMENTED_FUNC(cellVdec); return CELL_OK; } -s32 cellVdecSetFrameRateExt() +error_code cellVdecSetFrameRateExt() { UNIMPLEMENTED_FUNC(cellVdec); return CELL_OK; } -s32 cellVdecSetPts() +error_code cellVdecSetPts() { UNIMPLEMENTED_FUNC(cellVdec); return CELL_OK; diff --git a/rpcs3/Emu/Cell/Modules/cellVdec.h b/rpcs3/Emu/Cell/Modules/cellVdec.h index f67e48f913..b99b4ccb98 100644 --- a/rpcs3/Emu/Cell/Modules/cellVdec.h +++ b/rpcs3/Emu/Cell/Modules/cellVdec.h @@ -3,7 +3,7 @@ #include "Utilities/BEType.h" // Error Codes -enum +enum CellVdecError : u32 { CELL_VDEC_ERROR_ARG = 0x80610101, CELL_VDEC_ERROR_SEQ = 0x80610102,