diff --git a/Utilities/SMutex.h b/Utilities/SMutex.h index 3746620526..cd987b27f6 100644 --- a/Utilities/SMutex.h +++ b/Utilities/SMutex.h @@ -35,6 +35,11 @@ public: { } + void initialize() + { + (T&)owner = free_value; + } + ~SMutexBase() { lock((T)dead_value); @@ -46,6 +51,16 @@ public: return (T&)owner; } + __forceinline T GetFreeValue() const + { + return (T)free_value; + } + + __forceinline T GetDeadValue() const + { + return (T)dead_value; + } + SMutexResult trylock(T tid) { if (Emu.IsStopped()) diff --git a/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp b/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp index e24f361c62..76a88533ef 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp @@ -1,20 +1,11 @@ #include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" +#include "cellAdec.h" void cellAdec_init(); Module cellAdec(0x0006, cellAdec_init); -// Error Codes -enum -{ - CELL_ADEC_ERROR_FATAL = 0x80610001, - CELL_ADEC_ERROR_SEQ = 0x80610002, - CELL_ADEC_ERROR_ARG = 0x80610003, - CELL_ADEC_ERROR_BUSY = 0x80610004, - CELL_ADEC_ERROR_EMPTY = 0x80610005, -}; - int cellAdecQueryAttr() { UNIMPLEMENTED_FUNC(cellAdec); diff --git a/rpcs3/Emu/SysCalls/Modules/cellAdec.h b/rpcs3/Emu/SysCalls/Modules/cellAdec.h new file mode 100644 index 0000000000..d5e816291b --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellAdec.h @@ -0,0 +1,11 @@ +#pragma once + +// Error Codes +enum +{ + CELL_ADEC_ERROR_FATAL = 0x80610001, + CELL_ADEC_ERROR_SEQ = 0x80610002, + CELL_ADEC_ERROR_ARG = 0x80610003, + CELL_ADEC_ERROR_BUSY = 0x80610004, + CELL_ADEC_ERROR_EMPTY = 0x80610005, +}; \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp b/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp index 149076149d..84e54578c2 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp @@ -7,142 +7,142 @@ void cellDmux_init(); Module cellDmux(0x0007, cellDmux_init); -int cellDmuxQueryAttr(mem_ptr_t demuxerType, mem_ptr_t demuxerAttr) +int cellDmuxQueryAttr(const mem_ptr_t demuxerType, mem_ptr_t demuxerAttr) { cellDmux.Error("cellDmuxQueryAttr(demuxerType_addr=0x%x, demuxerAttr_addr=0x%x)", demuxerType.GetAddr(), demuxerAttr.GetAddr()); return CELL_OK; } -int cellDmuxQueryAttr2(mem_ptr_t demuxerType2, mem_ptr_t demuxerAttr) +int cellDmuxQueryAttr2(const mem_ptr_t demuxerType2, mem_ptr_t demuxerAttr) { cellDmux.Error("cellDmuxQueryAttr2(demuxerType2_addr=0x%x, demuxerAttr_addr=0x%x)", demuxerType2.GetAddr(), demuxerAttr.GetAddr()); return CELL_OK; } -int cellDmuxOpen(mem_ptr_t demuxerType, mem_ptr_t demuxerResource, - mem_ptr_t demuxerCb, u32 demuxerHandle_addr) +int cellDmuxOpen(const mem_ptr_t demuxerType, const mem_ptr_t demuxerResource, + const mem_ptr_t demuxerCb, mem32_t demuxerHandle) { cellDmux.Error("cellDmuxOpen(demuxerType_addr=0x%x, demuxerResource_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)", - demuxerType.GetAddr(), demuxerResource.GetAddr(), demuxerCb.GetAddr(), demuxerHandle_addr); + demuxerType.GetAddr(), demuxerResource.GetAddr(), demuxerCb.GetAddr(), demuxerHandle.GetAddr()); return CELL_OK; } -int cellDmuxOpenEx(mem_ptr_t demuxerType, mem_ptr_t demuxerResourceEx, - mem_ptr_t demuxerCb, u32 demuxerHandle_addr) +int cellDmuxOpenEx(const mem_ptr_t demuxerType, const mem_ptr_t demuxerResourceEx, + const mem_ptr_t demuxerCb, mem32_t demuxerHandle) { cellDmux.Error("cellDmuxOpenEx(demuxerType_addr=0x%x, demuxerResourceEx_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)", - demuxerType.GetAddr(), demuxerResourceEx.GetAddr(), demuxerCb.GetAddr(), demuxerHandle_addr); + demuxerType.GetAddr(), demuxerResourceEx.GetAddr(), demuxerCb.GetAddr(), demuxerHandle.GetAddr()); return CELL_OK; } -int cellDmuxOpen2(mem_ptr_t demuxerType2, mem_ptr_t demuxerResource2, - mem_ptr_t demuxerCb, u32 demuxerHandle_addr) +int cellDmuxOpen2(const mem_ptr_t demuxerType2, const mem_ptr_t demuxerResource2, + const mem_ptr_t demuxerCb, mem32_t demuxerHandle) { cellDmux.Error("cellDmuxOpen2(demuxerType2_addr=0x%x, demuxerResource2_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)", - demuxerType2.GetAddr(), demuxerResource2.GetAddr(), demuxerCb.GetAddr(), demuxerHandle_addr); + demuxerType2.GetAddr(), demuxerResource2.GetAddr(), demuxerCb.GetAddr(), demuxerHandle.GetAddr()); return CELL_OK; } -int cellDmuxClose(u32 demuxerHandle_addr) +int cellDmuxClose(u32 demuxerHandle) { - cellDmux.Error("cellDmuxClose(demuxerHandle_addr=0x%x)", demuxerHandle_addr); + cellDmux.Error("cellDmuxClose(demuxerHandle=0x%x)", demuxerHandle); return CELL_OK; } -int cellDmuxSetStream(u32 demuxerHandle_addr, u32 streamAddress, u32 streamSize, bool discontinuity, u64 userData) +int cellDmuxSetStream(u32 demuxerHandle, const u32 streamAddress, u32 streamSize, bool discontinuity, u64 userData) { - cellDmux.Error("cellDmuxSetStream(demuxerHandle_addr=0x%x, streamAddress=0x%x, streamSize=%d, discontinuity=%d, userData=0x%llx", - demuxerHandle_addr, streamAddress, streamSize, discontinuity, userData); + cellDmux.Error("cellDmuxSetStream(demuxerHandle=0x%x, streamAddress=0x%x, streamSize=%d, discontinuity=%d, userData=0x%llx", + demuxerHandle, streamAddress, streamSize, discontinuity, userData); return CELL_OK; } -int cellDmuxResetStream(u32 demuxerHandle_addr) +int cellDmuxResetStream(u32 demuxerHandle) { - cellDmux.Error("cellDmuxResetStream(demuxerHandle_addr=0x%x)", demuxerHandle_addr); + cellDmux.Error("cellDmuxResetStream(demuxerHandle=0x%x)", demuxerHandle); return CELL_OK; } -int cellDmuxResetStreamAndWaitDone(u32 demuxerHandle_addr) +int cellDmuxResetStreamAndWaitDone(u32 demuxerHandle) { - cellDmux.Error("cellDmuxResetStreamAndWaitDone(demuxerHandle_addr=0x%x)", demuxerHandle_addr); + cellDmux.Error("cellDmuxResetStreamAndWaitDone(demuxerHandle=0x%x)", demuxerHandle); return CELL_OK; } -int cellDmuxQueryEsAttr(mem_ptr_t demuxerType, mem_ptr_t esFilterId, - u32 esSpecificInfo_addr, mem_ptr_t esAttr) +int cellDmuxQueryEsAttr(const mem_ptr_t demuxerType, const mem_ptr_t esFilterId, + const u32 esSpecificInfo_addr, mem_ptr_t esAttr) { cellDmux.Error("cellDmuxQueryEsAttr(demuxerType_addr=0x%x, esFilterId_addr=0x%x, esSpecificInfo_addr=0x%x, esAttr_addr=0x%x)", demuxerType.GetAddr(), esFilterId.GetAddr(), esSpecificInfo_addr, esAttr.GetAddr()); return CELL_OK; } -int cellDmuxQueryEsAttr2(mem_ptr_t demuxerType2, mem_ptr_t esFilterId, - u32 esSpecificInfo_addr, mem_ptr_t esAttr) +int cellDmuxQueryEsAttr2(const mem_ptr_t demuxerType2, const mem_ptr_t esFilterId, + const u32 esSpecificInfo_addr, mem_ptr_t esAttr) { cellDmux.Error("cellDmuxQueryEsAttr2(demuxerType2_addr=0x%x, esFilterId_addr=0x%x, esSpecificInfo_addr=0x%x, esAttr_addr=0x%x)", demuxerType2.GetAddr(), esFilterId.GetAddr(), esSpecificInfo_addr, esAttr.GetAddr()); return CELL_OK; } -int cellDmuxEnableEs(u32 demuxerHandle_addr, mem_ptr_t esFilterId, - mem_ptr_t esResourceInfo, mem_ptr_t esCb, - u32 esSpecificInfo_addr, u32 esHandle_addr) +int cellDmuxEnableEs(u32 demuxerHandle, const mem_ptr_t esFilterId, + const mem_ptr_t esResourceInfo, const mem_ptr_t esCb, + const u32 esSpecificInfo_addr, mem32_t esHandle) { - cellDmux.Error("cellDmuxEnableEs(demuxerHandle_addr=0x%x, esFilterId_addr=0x%x, esResourceInfo_addr=0x%x, esCb_addr=0x%x, " - "esSpecificInfo_addr=0x%x, esHandle_addr=0x%x)", demuxerHandle_addr, esFilterId.GetAddr(), esResourceInfo.GetAddr(), - esCb.GetAddr(), esSpecificInfo_addr, esHandle_addr); + cellDmux.Error("cellDmuxEnableEs(demuxerHandle=0x%x, esFilterId_addr=0x%x, esResourceInfo_addr=0x%x, esCb_addr=0x%x, " + "esSpecificInfo_addr=0x%x, esHandle_addr=0x%x)", demuxerHandle, esFilterId.GetAddr(), esResourceInfo.GetAddr(), + esCb.GetAddr(), esSpecificInfo_addr, esHandle.GetAddr()); return CELL_OK; } -int cellDmuxDisableEs(u32 esHandle_addr) +int cellDmuxDisableEs(u32 esHandle) { - cellDmux.Error("cellDmuxDisableEs(esHandle_addr=0x%x)", esHandle_addr); + cellDmux.Error("cellDmuxDisableEs(esHandle=0x%x)", esHandle); return CELL_OK; } -int cellDmuxResetEs(u32 esHandle_addr) +int cellDmuxResetEs(u32 esHandle) { - cellDmux.Error("cellDmuxResetEs(esHandle_addr=0x%x)", esHandle_addr); + cellDmux.Error("cellDmuxResetEs(esHandle=0x%x)", esHandle); return CELL_OK; } -int cellDmuxGetAu(u32 esHandle_addr, u32 auInfo_ptr_addr, u32 auSpecificInfo_ptr_addr) +int cellDmuxGetAu(u32 esHandle, const u32 auInfo_ptr_addr, u32 auSpecificInfo_ptr_addr) { - cellDmux.Error("cellDmuxGetAu(esHandle_addr=0x%x, auInfo_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", - esHandle_addr, auInfo_ptr_addr, auSpecificInfo_ptr_addr); + cellDmux.Error("cellDmuxGetAu(esHandle=0x%x, auInfo_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", + esHandle, auInfo_ptr_addr, auSpecificInfo_ptr_addr); return CELL_OK; } -int cellDmuxPeekAu(u32 esHandle_addr, u32 auInfo_ptr_addr, u32 auSpecificInfo_ptr_addr) +int cellDmuxPeekAu(u32 esHandle, const u32 auInfo_ptr_addr, u32 auSpecificInfo_ptr_addr) { - cellDmux.Error("cellDmuxPeekAu(esHandle_addr=0x%x, auInfo_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", - esHandle_addr, auInfo_ptr_addr, auSpecificInfo_ptr_addr); + cellDmux.Error("cellDmuxPeekAu(esHandle=0x%x, auInfo_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", + esHandle, auInfo_ptr_addr, auSpecificInfo_ptr_addr); return CELL_OK; } -int cellDmuxGetAuEx(u32 esHandle_addr, u32 auInfoEx_ptr_addr, u32 auSpecificInfo_ptr_addr) +int cellDmuxGetAuEx(u32 esHandle, const u32 auInfoEx_ptr_addr, u32 auSpecificInfo_ptr_addr) { - cellDmux.Error("cellDmuxGetAuEx(esHandle_addr=0x%x, auInfoEx_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", - esHandle_addr, auInfoEx_ptr_addr, auSpecificInfo_ptr_addr); + cellDmux.Error("cellDmuxGetAuEx(esHandle=0x%x, auInfoEx_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", + esHandle, auInfoEx_ptr_addr, auSpecificInfo_ptr_addr); return CELL_OK; } -int cellDmuxPeekAuEx(u32 esHandle_addr, u32 auInfoEx_ptr_addr, u32 auSpecificInfo_ptr_addr) +int cellDmuxPeekAuEx(u32 esHandle, const u32 auInfoEx_ptr_addr, u32 auSpecificInfo_ptr_addr) { - cellDmux.Error("cellDmuxPeekAuEx(esHandle_addr=0x%x, auInfoEx_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", - esHandle_addr, auInfoEx_ptr_addr, auSpecificInfo_ptr_addr); + cellDmux.Error("cellDmuxPeekAuEx(esHandle=0x%x, auInfoEx_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", + esHandle, auInfoEx_ptr_addr, auSpecificInfo_ptr_addr); return CELL_OK; } -int cellDmuxReleaseAu(u32 esHandle_addr) +int cellDmuxReleaseAu(u32 esHandle) { - cellDmux.Error("cellDmuxReleaseAu(esHandle_addr=0x%x)", esHandle_addr); + cellDmux.Error("cellDmuxReleaseAu(esHandle=0x%x)", esHandle); return CELL_OK; } -int cellDmuxFlushEs(u32 esHandle_addr) +int cellDmuxFlushEs(u32 esHandle) { - cellDmux.Error("cellDmuxFlushEs(esHandle_addr=0x%x)", esHandle_addr); + cellDmux.Error("cellDmuxFlushEs(esHandle=0x%x)", esHandle); return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp b/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp index c8a7dbe26d..1559788875 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp @@ -118,8 +118,8 @@ int cellPamfGetHeaderSize(mem_ptr_t pAddr, u64 fileSize, mem64_t pSi cellPamf.Warning("cellPamfGetHeaderSize(pAddr=0x%x, fileSize=%d, pSize_addr=0x%x)", pAddr.GetAddr(), fileSize, pSize.GetAddr()); - if ((u32)pAddr->magic != 0x464d4150) - return CELL_PAMF_ERROR_UNKNOWN_TYPE; + //if ((u32)pAddr->magic != 0x464d4150) + //return CELL_PAMF_ERROR_UNKNOWN_TYPE; const u64 offset = (u64)pAddr->data_offset << 11; pSize = offset /*? offset : 2048*/; //hack diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp index 7f83764416..ccbd0e3c08 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp @@ -469,6 +469,9 @@ int cellVideoOutGetResolutionAvailability(u32 videoOut, u32 resolutionId, u32 as return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; } +extern std::atomic g_FsAioReadID; +extern std::atomic g_FsAioReadCur; + int cellSysutilCheckCallback() { cellSysutil.Log("cellSysutilCheckCallback()"); @@ -477,7 +480,7 @@ int cellSysutilCheckCallback() CPUThread& thr = Emu.GetCallbackThread(); - while (thr.IsAlive()) + while (thr.IsAlive() || (g_FsAioReadCur < g_FsAioReadID)) { Sleep(1); if (Emu.IsStopped()) diff --git a/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp b/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp index 794d962251..74d3599841 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp @@ -1,83 +1,76 @@ #include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" +#include "cellVdec.h" void cellVdec_init(); Module cellVdec(0x0005, cellVdec_init); -// Error Codes -enum +int cellVdecQueryAttr(const mem_ptr_t type, mem_ptr_t attr) { - CELL_VDEC_ERROR_ARG = 0x80610101, - CELL_VDEC_ERROR_SEQ = 0x80610102, - CELL_VDEC_ERROR_BUSY = 0x80610103, - CELL_VDEC_ERROR_EMPTY = 0x80610104, - CELL_VDEC_ERROR_FATAL = 0x80610180, -}; - -int cellVdecQueryAttr() -{ - UNIMPLEMENTED_FUNC(cellVdec); + cellVdec.Error("cellVdecQueryAttr(type_addr=0x%x, attr_addr=0x%x)", type.GetAddr(), attr.GetAddr()); return CELL_OK; } -int cellVdecQueryAttrEx() +int cellVdecQueryAttrEx(const mem_ptr_t type, mem_ptr_t attr) { - UNIMPLEMENTED_FUNC(cellVdec); + cellVdec.Error("cellVdecQueryAttrEx(type_addr=0x%x, attr_addr=0x%x)", type.GetAddr(), attr.GetAddr()); return CELL_OK; } -int cellVdecOpen() +int cellVdecOpen(const mem_ptr_t type, const mem_ptr_t res, const mem_ptr_t cb, mem32_t handle) { - UNIMPLEMENTED_FUNC(cellVdec); + cellVdec.Error("cellVdecOpen(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)", + type.GetAddr(), res.GetAddr(), cb.GetAddr(), handle.GetAddr()); return CELL_OK; } -int cellVdecOpenEx() +int cellVdecOpenEx(const mem_ptr_t type, const mem_ptr_t res, const mem_ptr_t cb, mem32_t handle) { - UNIMPLEMENTED_FUNC(cellVdec); + cellVdec.Error("cellVdecOpenEx(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)", + type.GetAddr(), res.GetAddr(), cb.GetAddr(), handle.GetAddr()); return CELL_OK; } -int cellVdecClose() +int cellVdecClose(u32 handle) { - UNIMPLEMENTED_FUNC(cellVdec); + cellVdec.Error("cellVdecClose(handle=0x%x)", handle); return CELL_OK; } -int cellVdecStartSeq() +int cellVdecStartSeq(u32 handle) { - UNIMPLEMENTED_FUNC(cellVdec); + cellVdec.Error("cellVdecStartSeq(handle=0x%x)", handle); return CELL_OK; } -int cellVdecEndSeq() +int cellVdecEndSeq(u32 handle) { - UNIMPLEMENTED_FUNC(cellVdec); + cellVdec.Error("cellVdecEndSeq(handle=0x%x)", handle); return CELL_OK; } -int cellVdecDecodeAu() +int cellVdecDecodeAu(u32 handle, CellVdecDecodeMode mode, const mem_ptr_t auInfo) { - UNIMPLEMENTED_FUNC(cellVdec); + cellVdec.Error("cellVdecDecodeAu(handle=0x%x, mode=0x%x, auInfo_addr=0x%x)", handle, mode, auInfo.GetAddr()); return CELL_OK; } -int cellVdecGetPicture() +int cellVdecGetPicture(u32 handle, const mem_ptr_t format, u32 out_addr) { - UNIMPLEMENTED_FUNC(cellVdec); + cellVdec.Error("cellVdecGetPicture(handle=0x%x, format_addr=0x%x, out_addr=0x%x)", handle, format.GetAddr(), out_addr); return CELL_OK; } -int cellVdecGetPicItem() +int cellVdecGetPicItem(u32 handle, const u32 picItem_ptr_addr) { - UNIMPLEMENTED_FUNC(cellVdec); + cellVdec.Error("cellVdecGetPicItem(handle=0x%x, picItem_ptr_addr=0x%x)", handle, picItem_ptr_addr); return CELL_OK; } -int cellVdecSetFrameRate() +int cellVdecSetFrameRate(u32 handle, CellVdecFrameRate frc) { - UNIMPLEMENTED_FUNC(cellVdec); + cellVdec.Error("cellVdecSetFrameRate(handle=0x%x, frc=0x%x)", handle, frc); return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/Modules/cellVdec.h b/rpcs3/Emu/SysCalls/Modules/cellVdec.h new file mode 100644 index 0000000000..771924fea5 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellVdec.h @@ -0,0 +1,637 @@ +#pragma once +#include "cellPamf.h" + +// Error Codes +enum +{ + CELL_VDEC_ERROR_ARG = 0x80610101, + CELL_VDEC_ERROR_SEQ = 0x80610102, + CELL_VDEC_ERROR_BUSY = 0x80610103, + CELL_VDEC_ERROR_EMPTY = 0x80610104, + CELL_VDEC_ERROR_AU = 0x80610105, + CELL_VDEC_ERROR_PIC = 0x80610106, + CELL_VDEC_ERROR_FATAL = 0x80610180, +}; + +enum CellVdecCodecType +{ + CELL_VDEC_CODEC_TYPE_MPEG2 = 0x00000000, + CELL_VDEC_CODEC_TYPE_AVC = 0x00000001, + CELL_VDEC_CODEC_TYPE_DIVX = 0x00000005, +}; + +// Callback Messages +enum CellVdecMsgType +{ + CELL_VDEC_MSG_TYPE_AUDONE, // decoding finished + CELL_VDEC_MSG_TYPE_PICOUT, // picture done + CELL_VDEC_MSG_TYPE_SEQDONE, // finishing done + CELL_VDEC_MSG_TYPE_ERROR, +}; + +// Decoder Operation Mode +enum CellVdecDecodeMode +{ + CELL_VDEC_DEC_MODE_NORMAL, + CELL_VDEC_DEC_MODE_B_SKIP, + CELL_VDEC_DEC_MODE_PB_SKIP, +}; + +// Output Picture Format Type +enum CellVdecPicFormatType +{ + CELL_VDEC_PICFMT_ARGB32_ILV, + CELL_VDEC_PICFMT_RGBA32_ILV, + CELL_VDEC_PICFMT_UYVY422_ILV, + CELL_VDEC_PICFMT_YUV420_PLANAR, +}; + +// Output Color Matrix Coef +enum CellVdecColorMatrixType +{ + CELL_VDEC_COLOR_MATRIX_TYPE_BT601, + CELL_VDEC_COLOR_MATRIX_TYPE_BT709, +}; + +enum CellVdecPicAttr +{ + CELL_VDEC_PICITEM_ATTR_NORMAL, + CELL_VDEC_PICITEM_ATTR_SKIPPED, +}; + +// Universal Frame Rate Code +enum CellVdecFrameRate : u8 +{ + CELL_VDEC_FRC_24000DIV1001 = 0x80, + CELL_VDEC_FRC_24 = 0x81, + CELL_VDEC_FRC_25 = 0x82, + CELL_VDEC_FRC_30000DIV1001 = 0x83, + CELL_VDEC_FRC_30 = 0x84, + CELL_VDEC_FRC_50 = 0x85, + CELL_VDEC_FRC_60000DIV1001 = 0x86, + CELL_VDEC_FRC_60 = 0x87, +}; + +// Codec Type Information +struct CellVdecType +{ + be_t codecType; + be_t profileLevel; +}; + +// Extended Codec Type Information +struct CellVdecTypeEx +{ + be_t codecType; + be_t profileLevel; + be_t codecSpecificInfo_addr; +}; + +// Library Attributes +struct CellVdecAttr +{ + be_t memSize; // required memory + u8 cmdDepth; // command queue depth + be_t decoderVerUpper; + be_t decoderVerLower; +}; + +// Configurable Information +struct CellVdecResource +{ + be_t memAddr; + be_t memSize; + be_t ppuThreadPriority; + be_t ppuThreadStackSize; + be_t spuThreadPriority; + be_t numOfSpus; +}; + +// SPURS Information +struct CellVdecResourceSpurs +{ + be_t spursAddr; + u8 tasksetPriority[8]; + be_t tasksetMaxContention; +}; + +// Extended Configurable Information +struct CellVdecResourceEx +{ + be_t memAddr; + be_t memSize; + be_t ppuThreadPriority; + be_t ppuThreadStackSize; + be_t spuThreadPriority; + be_t numOfSpus; + be_t spursResource_addr; +}; + +// Presentation Time Stamp +typedef CellCodecTimeStamp CellVdecTimeStamp; + +// Access Unit Information +struct CellVdecAuInfo +{ + be_t startAddr; + be_t size; + CellCodecTimeStamp pts; + CellCodecTimeStamp dts; + be_t userData; + be_t codecSpecificData; +}; + +// Output Picture Information +struct CellVdecPicItem +{ + be_t codecType; + be_t startAddr; + be_t size; + u8 auNum; + CellCodecTimeStamp auPts[2]; + CellCodecTimeStamp auDts[2]; + be_t auUserData[2]; + be_t status; + be_t attr; + be_t picInfo_addr; +}; + +// Output Picture Format +struct CellVdecPicFormat +{ + be_t formatType; + be_t colorMatrixType; + u8 alpha; +}; + +// Callback Function Information +struct CellVdecCb +{ + be_t> cbFunc; + be_t cbArg_addr; +}; + +// Max CC Data Length +enum +{ + CELL_VDEC_AVC_CCD_MAX = 128, +}; + +enum AVC_level : u8 +{ + CELL_VDEC_AVC_LEVEL_1P0 = 10, + CELL_VDEC_AVC_LEVEL_1P1 = 11, + CELL_VDEC_AVC_LEVEL_1P2 = 12, + CELL_VDEC_AVC_LEVEL_1P3 = 13, + CELL_VDEC_AVC_LEVEL_2P0 = 20, + CELL_VDEC_AVC_LEVEL_2P1 = 21, + CELL_VDEC_AVC_LEVEL_2P2 = 22, + CELL_VDEC_AVC_LEVEL_3P0 = 30, + CELL_VDEC_AVC_LEVEL_3P1 = 31, + CELL_VDEC_AVC_LEVEL_3P2 = 32, + CELL_VDEC_AVC_LEVEL_4P0 = 40, + CELL_VDEC_AVC_LEVEL_4P1 = 41, + CELL_VDEC_AVC_LEVEL_4P2 = 42, +}; + +struct CellVdecAvcSpecificInfo +{ + be_t thisSize; + be_t maxDecodedFrameWidth; + be_t maxDecodedFrameHeight; + bool disableDeblockingFilter; + u8 numberOfDecodedFrameBuffer; +}; + +enum AVC_video_format : u8 +{ + CELL_VDEC_AVC_VF_COMPONENT = 0x00, + CELL_VDEC_AVC_VF_PAL = 0x01, + CELL_VDEC_AVC_VF_NTSC = 0x02, + CELL_VDEC_AVC_VF_SECAM = 0x03, + CELL_VDEC_AVC_VF_MAC = 0x04, + CELL_VDEC_AVC_VF_UNSPECIFIED = 0x05, +}; + +enum AVC_colour_primaries : u8 +{ + CELL_VDEC_AVC_CP_ITU_R_BT_709_5 = 0x01, + CELL_VDEC_AVC_CP_UNSPECIFIED = 0x02, + CELL_VDEC_AVC_CP_ITU_R_BT_470_6_SYS_M = 0x04, + CELL_VDEC_AVC_CP_ITU_R_BT_470_6_SYS_BG = 0x05, + CELL_VDEC_AVC_CP_SMPTE_170_M = 0x06, + CELL_VDEC_AVC_CP_SMPTE_240_M = 0x07, + CELL_VDEC_AVC_CP_GENERIC_FILM = 0x08, +}; + +enum AVC_transfer_characteristics : u8 +{ + CELL_VDEC_AVC_TC_ITU_R_BT_709_5 = 0x01, + CELL_VDEC_AVC_TC_UNSPECIFIED = 0x02, + CELL_VDEC_AVC_TC_ITU_R_BT_470_6_SYS_M = 0x04, + CELL_VDEC_AVC_TC_ITU_R_BT_470_6_SYS_BG = 0x05, + CELL_VDEC_AVC_TC_SMPTE_170_M = 0x06, + CELL_VDEC_AVC_TC_SMPTE_240_M = 0x07, + CELL_VDEC_AVC_TC_LINEAR = 0x08, + CELL_VDEC_AVC_TC_LOG_100_1 = 0x09, + CELL_VDEC_AVC_TC_LOG_316_1 = 0x0a, +}; + +enum AVC_matrix_coefficients : u8 +{ + CELL_VDEC_AVC_MXC_GBR = 0x00, + CELL_VDEC_AVC_MXC_ITU_R_BT_709_5 = 0x01, + CELL_VDEC_AVC_MXC_UNSPECIFIED = 0x02, + CELL_VDEC_AVC_MXC_FCC = 0x04, + CELL_VDEC_AVC_MXC_ITU_R_BT_470_6_SYS_BG = 0x05, + CELL_VDEC_AVC_MXC_SMPTE_170_M = 0x06, + CELL_VDEC_AVC_MXC_SMPTE_240_M = 0x07, + CELL_VDEC_AVC_MXC_YCGCO = 0x08, +}; + +enum AVC_FrameRateCode : u8 +{ + CELL_VDEC_AVC_FRC_24000DIV1001 = 0x00, + CELL_VDEC_AVC_FRC_24 = 0x01, + CELL_VDEC_AVC_FRC_25 = 0x02, + CELL_VDEC_AVC_FRC_30000DIV1001 = 0x03, + CELL_VDEC_AVC_FRC_30 = 0x04, + CELL_VDEC_AVC_FRC_50 = 0x05, + CELL_VDEC_AVC_FRC_60000DIV1001 = 0x06, + CELL_VDEC_AVC_FRC_60 = 0x07, +}; + +enum AVC_NulUnitPresentFlags : u16 +{ + CELL_VDEC_AVC_FLG_SPS = 0x0001, + CELL_VDEC_AVC_FLG_PPS = 0x0002, + CELL_VDEC_AVC_FLG_AUD = 0x0004, + CELL_VDEC_AVC_FLG_EO_SEQ = 0x0008, + CELL_VDEC_AVC_FLG_EO_STREAM = 0x0100, + CELL_VDEC_AVC_FLG_FILLER_DATA = 0x0200, + CELL_VDEC_AVC_FLG_PIC_TIMING_SEI = 0x0400, + CELL_VDEC_AVC_FLG_BUFF_PERIOD_SEI = 0x0800, + CELL_VDEC_AVC_FLG_USER_DATA_UNREG_SEI = 0x1000, +}; + +enum AVC_aspect_ratio_idc : u8 +{ + CELL_VDEC_AVC_ARI_SAR_UNSPECIFIED = 0x00, + CELL_VDEC_AVC_ARI_SAR_1_1 = 0x01, + CELL_VDEC_AVC_ARI_SAR_12_11 = 0x02, + CELL_VDEC_AVC_ARI_SAR_10_11 = 0x03, + CELL_VDEC_AVC_ARI_SAR_16_11 = 0x04, + CELL_VDEC_AVC_ARI_SAR_40_33 = 0x05, + CELL_VDEC_AVC_ARI_SAR_24_11 = 0x06, + CELL_VDEC_AVC_ARI_SAR_20_11 = 0x07, + CELL_VDEC_AVC_ARI_SAR_32_11 = 0x08, + CELL_VDEC_AVC_ARI_SAR_80_33 = 0x09, + CELL_VDEC_AVC_ARI_SAR_18_11 = 0x0a, + CELL_VDEC_AVC_ARI_SAR_15_11 = 0x0b, + CELL_VDEC_AVC_ARI_SAR_64_33 = 0x0c, + CELL_VDEC_AVC_ARI_SAR_160_99 = 0x0d, + CELL_VDEC_AVC_ARI_SAR_4_3 = 0x0e, + CELL_VDEC_AVC_ARI_SAR_3_2 = 0x0f, + CELL_VDEC_AVC_ARI_SAR_2_1 = 0x10, + CELL_VDEC_AVC_ARI_SAR_EXTENDED_SAR = 0xff, +}; + +enum AVC_PictureType : u8 +{ + CELL_VDEC_AVC_PCT_I = 0x00, + CELL_VDEC_AVC_PCT_P = 0x01, + CELL_VDEC_AVC_PCT_B = 0x02, + CELL_VDEC_AVC_PCT_UNKNOWN = 0x03, +}; + +enum AVC_pic_struct : u8 +{ + CELL_VDEC_AVC_PSTR_FRAME = 0x00, + CELL_VDEC_AVC_PSTR_FIELD_TOP = 0x01, + CELL_VDEC_AVC_PSTR_FIELD_BTM = 0x02, + CELL_VDEC_AVC_PSTR_FIELD_TOP_BTM = 0x03, + CELL_VDEC_AVC_PSTR_FIELD_BTM_TOP = 0x04, + CELL_VDEC_AVC_PSTR_FIELD_TOP_BTM_TOP = 0x05, + CELL_VDEC_AVC_PSTR_FIELD_BTM_TOP_BTM = 0x06, + CELL_VDEC_AVC_PSTR_FRAME_DOUBLING = 0x07, + CELL_VDEC_AVC_PSTR_FRAME_TRIPLING = 0x08, +}; + +struct CellVdecAvcInfo +{ + be_t horizontalSize; + be_t verticalSize; + AVC_PictureType pictureType[2]; + bool idrPictureFlag; + AVC_aspect_ratio_idc aspect_ratio_idc; + be_t sar_height; + be_t sar_width; + AVC_pic_struct pic_struct; + be_t picOrderCount[2]; + bool vui_parameters_present_flag; + bool frame_mbs_only_flag; + bool video_signal_type_present_flag; + AVC_video_format video_format; + bool video_full_range_flag; + bool colour_description_present_flag; + AVC_colour_primaries colour_primaries; + AVC_transfer_characteristics transfer_characteristics; + AVC_matrix_coefficients matrix_coefficients; + bool timing_info_present_flag; + CellVdecFrameRate frameRateCode; + bool fixed_frame_rate_flag; + bool low_delay_hrd_flag; + bool entropy_coding_mode_flag; + be_t nalUnitPresentFlags; + u8 ccDataLength[2]; + u8 ccData[2][CELL_VDEC_AVC_CCD_MAX]; + be_t reserved[2]; +}; + +// DIVX Profile +enum DIVX_level : u8 +{ + CELL_VDEC_DIVX_QMOBILE = 10, + CELL_VDEC_DIVX_MOBILE = 11, + CELL_VDEC_DIVX_HOME_THEATER = 12, + CELL_VDEC_DIVX_HD_720 = 13, + CELL_VDEC_DIVX_HD_1080 = 14, +}; + +struct CellVdecDivxSpecificInfo +{ + be_t thisSize; + be_t maxDecodedFrameWidth; + be_t maxDecodedFrameHeight; +}; + +struct CellVdecDivxSpecificInfo2 +{ + be_t thisSize; + be_t maxDecodedFrameWidth; + be_t maxDecodedFrameHeight; + be_t numberOfDecodedFrameBuffer; +}; + +enum DIVX_frameRateCode : u16 +{ + CELL_VDEC_DIVX_FRC_UNDEFINED = 0x00, + CELL_VDEC_DIVX_FRC_24000DIV1001 = 0x01, + CELL_VDEC_DIVX_FRC_24 = 0x02, + CELL_VDEC_DIVX_FRC_25 = 0x03, + CELL_VDEC_DIVX_FRC_30000DIV1001 = 0x04, + CELL_VDEC_DIVX_FRC_30 = 0x05, + CELL_VDEC_DIVX_FRC_50 = 0x06, + CELL_VDEC_DIVX_FRC_60000DIV1001 = 0x07, + CELL_VDEC_DIVX_FRC_60 = 0x08, +}; + +enum DIVX_pixelAspectRatio : u8 +{ + CELL_VDEC_DIVX_ARI_PAR_1_1 = 0x1, + CELL_VDEC_DIVX_ARI_PAR_12_11 = 0x2, + CELL_VDEC_DIVX_ARI_PAR_10_11 = 0x3, + CELL_VDEC_DIVX_ARI_PAR_16_11 = 0x4, + CELL_VDEC_DIVX_ARI_PAR_40_33 = 0x5, + CELL_VDEC_DIVX_ARI_PAR_EXTENDED_PAR = 0xF, +}; + +enum DIVX_pictureType : u8 +{ + CELL_VDEC_DIVX_VCT_I = 0x0, + CELL_VDEC_DIVX_VCT_P = 0x1, + CELL_VDEC_DIVX_VCT_B = 0x2, +}; + +enum DIVX_pictureStruct : u8 +{ + CELL_VDEC_DIVX_PSTR_FRAME = 0x0, + CELL_VDEC_DIVX_PSTR_TOP_BTM = 0x1, + CELL_VDEC_DIVX_PSTR_BTM_TOP = 0x2, +}; + +enum DIVX_colourPrimaries : u8 +{ + CELL_VDEC_DIVX_CP_ITU_R_BT_709 = 0x01, + CELL_VDEC_DIVX_CP_UNSPECIFIED = 0x02, + CELL_VDEC_DIVX_CP_ITU_R_BT_470_SYS_M = 0x04, + CELL_VDEC_DIVX_CP_ITU_R_BT_470_SYS_BG = 0x05, + CELL_VDEC_DIVX_CP_SMPTE_170_M = 0x06, + CELL_VDEC_DIVX_CP_SMPTE_240_M = 0x07, + CELL_VDEC_DIVX_CP_GENERIC_FILM = 0x08, +}; + +enum DIVX_transferCharacteristics : u8 +{ + CELL_VDEC_DIVX_TC_ITU_R_BT_709 = 0x01, + CELL_VDEC_DIVX_TC_UNSPECIFIED = 0x02, + CELL_VDEC_DIVX_TC_ITU_R_BT_470_SYS_M = 0x04, + CELL_VDEC_DIVX_TC_ITU_R_BT_470_SYS_BG = 0x05, + CELL_VDEC_DIVX_TC_SMPTE_170_M = 0x06, + CELL_VDEC_DIVX_TC_SMPTE_240_M = 0x07, + CELL_VDEC_DIVX_TC_LINEAR = 0x08, + CELL_VDEC_DIVX_TC_LOG_100_1 = 0x09, + CELL_VDEC_DIVX_TC_LOG_316_1 = 0x0a, +}; + +enum DIVX_matrixCoefficients : u8 +{ + CELL_VDEC_DIVX_MXC_ITU_R_BT_709 = 0x01, + CELL_VDEC_DIVX_MXC_UNSPECIFIED = 0x02, + CELL_VDEC_DIVX_MXC_FCC = 0x04, + CELL_VDEC_DIVX_MXC_ITU_R_BT_470_SYS_BG = 0x05, + CELL_VDEC_DIVX_MXC_SMPTE_170_M = 0x06, + CELL_VDEC_DIVX_MXC_SMPTE_240_M = 0x07, + CELL_VDEC_DIVX_MXC_YCGCO = 0x08, +}; + +struct CellVdecDivxInfo +{ + DIVX_pictureType pictureType; + be_t horizontalSize; + be_t verticalSize; + DIVX_pixelAspectRatio pixelAspectRatio; + u8 parWidth; + u8 parHeight; + bool colourDescription; + DIVX_colourPrimaries colourPrimaries; + DIVX_transferCharacteristics transferCharacteristics; + DIVX_matrixCoefficients matrixCoefficients; + DIVX_pictureStruct pictureStruct; + be_t frameRateCode; +}; + +enum MPEG2_level +{ + CELL_VDEC_MPEG2_MP_LL, + CELL_VDEC_MPEG2_MP_ML, + CELL_VDEC_MPEG2_MP_H14, + CELL_VDEC_MPEG2_MP_HL, +}; + +struct CellVdecMpeg2SpecificInfo +{ + be_t thisSize; + be_t maxDecodedFrameWidth; + be_t maxDecodedFrameHeight; +}; + +enum MPEG2_headerFlags : u32 +{ + CELL_VDEC_MPEG2_FLG_SEQ_HDR = 0x00000001, + CELL_VDEC_MPEG2_FLG_SEQ_EXT = 0x00000002, + CELL_VDEC_MPEG2_FLG_SEQ_DSP_EXT = 0x00000004, + CELL_VDEC_MPEG2_FLG_SEQ_USR_DAT = 0x00000008, + CELL_VDEC_MPEG2_FLG_SEQ_END = 0x00000010, + CELL_VDEC_MPEG2_FLG_GOP_HDR = 0x00000020, + CELL_VDEC_MPEG2_FLG_GOP_USR_DAT = 0x00000040, + CELL_VDEC_MPEG2_FLG_PIC_HDR_1 = 0x00000100, + CELL_VDEC_MPEG2_FLG_PIC_EXT_1 = 0x00000200, + CELL_VDEC_MPEG2_FLG_PIC_DSP_EXT_1 = 0x00000400, + CELL_VDEC_MPEG2_FLG_PIC_USR_DAT_1 = 0x00000800, + CELL_VDEC_MPEG2_FLG_PIC_HDR_2 = 0x00001000, + CELL_VDEC_MPEG2_FLG_PIC_EXT_2 = 0x00002000, + CELL_VDEC_MPEG2_FLG_PIC_DSP_EXT_2 = 0x00004000, + CELL_VDEC_MPEG2_FLG_PIC_USR_DAT_2 = 0x00008000, +}; + +enum MPEG2_aspectRatio : u8 +{ + CELL_VDEC_MPEG2_ARI_SAR_1_1 = 0x01, + CELL_VDEC_MPEG2_ARI_DAR_4_3 = 0x02, + CELL_VDEC_MPEG2_ARI_DAR_16_9 = 0x03, + CELL_VDEC_MPEG2_ARI_DAR_2P21_1 = 0x04, +}; + +enum MPEG1_aspectRatio : u8 +{ + CELL_VDEC_MPEG1_ARI_SAR_1P0 = 0x01, + CELL_VDEC_MPEG1_ARI_SAR_0P6735 = 0x02, + CELL_VDEC_MPEG1_ARI_SAR_0P7031 = 0x03, + CELL_VDEC_MPEG1_ARI_SAR_0P7615 = 0x04, + CELL_VDEC_MPEG1_ARI_SAR_0P8055 = 0x05, + CELL_VDEC_MPEG1_ARI_SAR_0P8437 = 0x06, + CELL_VDEC_MPEG1_ARI_SAR_0P8935 = 0x07, + CELL_VDEC_MPEG1_ARI_SAR_0P9157 = 0x08, + CELL_VDEC_MPEG1_ARI_SAR_0P9815 = 0x09, + CELL_VDEC_MPEG1_ARI_SAR_1P0255 = 0x0a, + CELL_VDEC_MPEG1_ARI_SAR_1P0695 = 0x0b, + CELL_VDEC_MPEG1_ARI_SAR_1P0950 = 0x0c, + CELL_VDEC_MPEG1_ARI_SAR_1P1575 = 0x0d, + CELL_VDEC_MPEG1_ARI_SAR_1P2015 = 0x0e, +}; + +enum MPEG2_frameRate : u8 +{ + CELL_VDEC_MPEG2_FRC_FORBIDDEN = 0x00, + CELL_VDEC_MPEG2_FRC_24000DIV1001 = 0x01, + CELL_VDEC_MPEG2_FRC_24 = 0x02, + CELL_VDEC_MPEG2_FRC_25 = 0x03, + CELL_VDEC_MPEG2_FRC_30000DIV1001 = 0x04, + CELL_VDEC_MPEG2_FRC_30 = 0x05, + CELL_VDEC_MPEG2_FRC_50 = 0x06, + CELL_VDEC_MPEG2_FRC_60000DIV1001 = 0x07, + CELL_VDEC_MPEG2_FRC_60 = 0x08, +}; + +enum MPEG2_videoFormat : u8 +{ + CELL_VDEC_MPEG2_VF_COMPONENT = 0x00, + CELL_VDEC_MPEG2_VF_PAL = 0x01, + CELL_VDEC_MPEG2_VF_NTSC = 0x02, + CELL_VDEC_MPEG2_VF_SECAM = 0x03, + CELL_VDEC_MPEG2_VF_MAC = 0x04, + CELL_VDEC_MPEG2_VF_UNSPECIFIED = 0x05, +}; + +enum MPEG2_colourPrimaries : u8 +{ + CELL_VDEC_MPEG2_CP_FORBIDDEN = 0x00, + CELL_VDEC_MPEG2_CP_ITU_R_BT_709 = 0x01, + CELL_VDEC_MPEG2_CP_UNSPECIFIED = 0x02, + CELL_VDEC_MPEG2_CP_ITU_R_BT_470_2_SYS_M = 0x04, + CELL_VDEC_MPEG2_CP_ITU_R_BT_470_2_SYS_BG = 0x05, + CELL_VDEC_MPEG2_CP_SMPTE_170_M = 0x06, + CELL_VDEC_MPEG2_CP_SMPTE_240_M = 0x07, +}; + +enum MPEG2_transferCharacteristics : u8 +{ + CELL_VDEC_MPEG2_TC_FORBIDDEN = 0x00, + CELL_VDEC_MPEG2_TC_ITU_R_BT_709 = 0x01, + CELL_VDEC_MPEG2_TC_UNSPECIFIED = 0x02, + CELL_VDEC_MPEG2_TC_ITU_R_BT_470_2_SYS_M = 0x04, + CELL_VDEC_MPEG2_TC_ITU_R_BT_470_2_SYS_BG = 0x05, + CELL_VDEC_MPEG2_TC_SMPTE_170_M = 0x06, + CELL_VDEC_MPEG2_TC_SMPTE_240_M = 0x07, + CELL_VDEC_MPEG2_TC_LINEAR = 0x08, + CELL_VDEC_MPEG2_TC_LOG_100_1 = 0x09, + CELL_VDEC_MPEG2_TC_LOG_316_1 = 0x0a, +}; + +enum MPEG2_matrixCoefficients : u8 +{ + CELL_VDEC_MPEG2_MXC_FORBIDDEN = 0x00, + CELL_VDEC_MPEG2_MXC_ITU_R_BT_709 = 0x01, + CELL_VDEC_MPEG2_MXC_UNSPECIFIED = 0x02, + CELL_VDEC_MPEG2_MXC_FCC = 0x04, + CELL_VDEC_MPEG2_MXC_ITU_R_BT_470_2_SYS_BG = 0x05, + CELL_VDEC_MPEG2_MXC_SMPTE_170_M = 0x06, + CELL_VDEC_MPEG2_MXC_SMPTE_240_M = 0x07, +}; + +enum MPEG2_pictureCodingType : u8 +{ + CELL_VDEC_MPEG2_PCT_FORBIDDEN = 0x00, + CELL_VDEC_MPEG2_PCT_I = 0x01, + CELL_VDEC_MPEG2_PCT_P = 0x02, + CELL_VDEC_MPEG2_PCT_B = 0x03, + CELL_VDEC_MPEG2_PCT_D = 0x04, +}; + +enum MPEG2_pictureStructure : u8 +{ + CELL_VDEC_MPEG2_PSTR_TOP_FIELD = 0x01, + CELL_VDEC_MPEG2_PSTR_BOTTOM_FIELD = 0x02, + CELL_VDEC_MPEG2_PSTR_FRAME = 0x03, +}; + +struct CellVdecMpeg2Info +{ + be_t horizontal_size; + be_t vertical_size; + union + { + MPEG2_aspectRatio aspect_ratio_information; + MPEG1_aspectRatio aspect_ratio_information1; + }; + MPEG2_frameRate frame_rate_code; + bool progressive_sequence; + bool low_delay; + MPEG2_videoFormat video_format; + bool colour_description; + MPEG2_colourPrimaries colour_primaries; + MPEG2_transferCharacteristics transfer_characteristics; + MPEG2_matrixCoefficients matrix_coefficients; + be_t temporal_reference[2]; + MPEG2_pictureCodingType picture_coding_type[2]; + MPEG2_pictureStructure picture_structure[2]; + bool top_field_first; + bool repeat_first_field; + bool progressive_frame; + be_t time_code; + bool closed_gop; + bool broken_link; + be_t vbv_delay[2]; + be_t display_horizontal_size; + be_t display_vertical_size; + u8 number_of_frame_centre_offsets[2]; + be_t frame_centre_horizontal_offset[2][3]; + be_t frame_centre_vertical_offset[2][3]; + be_t headerPresentFlags; + be_t headerRetentionFlags; + bool mpeg1Flag; + u8 ccDataLength[2]; + u8 ccData[2][128]; + be_t reserved[2]; +}; \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/Modules/cellVpost.cpp b/rpcs3/Emu/SysCalls/Modules/cellVpost.cpp index 27113ad092..d4e3d46d05 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellVpost.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellVpost.cpp @@ -1,147 +1,11 @@ #include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" +#include "cellVpost.h" void cellVpost_init(); Module cellVpost(0x0008, cellVpost_init); -// Error Codes -enum -{ - CELL_VPOST_ERROR_Q_ARG_CFG_NULL = 0x80610410, - CELL_VPOST_ERROR_Q_ARG_CFG_INVALID = 0x80610411, - CELL_VPOST_ERROR_Q_ARG_ATTR_NULL = 0x80610412, - CELL_VPOST_ERROR_O_ARG_CFG_NULL = 0x80610440, - CELL_VPOST_ERROR_O_ARG_CFG_INVALID = 0x80610441, - CELL_VPOST_ERROR_O_ARG_RSRC_NULL = 0x80610442, - CELL_VPOST_ERROR_O_ARG_RSRC_INVALID = 0x80610443, - CELL_VPOST_ERROR_O_ARG_HDL_NULL = 0x80610444, - CELL_VPOST_ERROR_O_FATAL_QUERY_FAIL = 0x80610460, - CELL_VPOST_ERROR_O_FATAL_CREATEMON_FAIL = 0x80610461, - CELL_VPOST_ERROR_O_FATAL_INITSPURS_FAIL = 0x80610462, - CELL_VPOST_ERROR_C_ARG_HDL_NULL = 0x80610470, - CELL_VPOST_ERROR_C_ARG_HDL_INVALID = 0x80610471, - CELL_VPOST_ERROR_C_FATAL_LOCKMON_FAIL = 0x80610490, - CELL_VPOST_ERROR_C_FATAL_UNLOCKMON_FAIL = 0x80610491, - CELL_VPOST_ERROR_C_FATAL_DESTROYMON_FAIL = 0x80610492, - CELL_VPOST_ERROR_C_FATAL_FINSPURS_FAIL = 0x80610463, - CELL_VPOST_ERROR_E_ARG_HDL_NULL = 0x806104a0, - CELL_VPOST_ERROR_E_ARG_HDL_INVALID = 0x806104a1, - CELL_VPOST_ERROR_E_ARG_INPICBUF_NULL = 0x806104a2, - CELL_VPOST_ERROR_E_ARG_INPICBUF_INVALID = 0x806104a3, - CELL_VPOST_ERROR_E_ARG_CTRL_NULL = 0x806104a4, - CELL_VPOST_ERROR_E_ARG_CTRL_INVALID = 0x806104a5, - CELL_VPOST_ERROR_E_ARG_OUTPICBUF_NULL = 0x806104a6, - CELL_VPOST_ERROR_E_ARG_OUTPICBUF_INVALID = 0x806104a7, - CELL_VPOST_ERROR_E_ARG_PICINFO_NULL = 0x806104a8, - CELL_VPOST_ERROR_E_FATAL_LOCKMON_FAIL = 0x806104c0, - CELL_VPOST_ERROR_E_FATAL_UNLOCKMON_FAIL = 0x806104c1, - CELL_VPOST_ENT_ERROR_Q_ARG_ATTR_NULL = 0x80618110, - CELL_VPOST_ENT_ERROR_O_ARG_RSRC_NULL = 0x80618140, - CELL_VPOST_ENT_ERROR_O_ARG_RSRC_INVALID = 0x80618141, - CELL_VPOST_ENT_ERROR_O_ARG_HDL_NULL = 0x80618142, - CELL_VPOST_ENT_ERROR_O_FATAL_QUERY_FAIL = 0x80618160, - CELL_VPOST_ENT_ERROR_O_FATAL_CSPUCORE_FAIL = 0x80618161, - CELL_VPOST_ENT_ERROR_C_ARG_HDL_NULL = 0x80618170, - CELL_VPOST_ENT_ERROR_C_ARG_HDL_INVALID = 0x80618171, - CELL_VPOST_ENT_ERROR_C_FATAL_SNDCMD_FAIL = 0x80618190, - CELL_VPOST_ENT_ERROR_C_FATAL_RCVRES_FAIL = 0x80618191, - CELL_VPOST_ENT_ERROR_C_FATAL_DSPUCORE_FAIL = 0x80618192, - CELL_VPOST_ENT_ERROR_E_ARG_HDL_NULL = 0x806181a0, - CELL_VPOST_ENT_ERROR_E_ARG_HDL_INVALID = 0x806181a1, - CELL_VPOST_ENT_ERROR_E_ARG_INPICBUF_NULL = 0x806181a2, - CELL_VPOST_ENT_ERROR_E_ARG_INPICBUF_INVALID = 0x806181a3, - CELL_VPOST_ENT_ERROR_E_ARG_INPICINFO_NULL = 0x806181a4, - CELL_VPOST_ENT_ERROR_E_ARG_INPICINFO_INVALID = 0x806181a5, - CELL_VPOST_ENT_ERROR_E_ARG_CTRL_NULL = 0x806181a6, - CELL_VPOST_ENT_ERROR_E_ARG_CTRL_INVALID = 0x806181a7, - CELL_VPOST_ENT_ERROR_E_ARG_COMB_INVALID = 0x806181a8, - CELL_VPOST_ENT_ERROR_E_ARG_OUTPICBUF_NULL = 0x806181a9, - CELL_VPOST_ENT_ERROR_E_ARG_OUTPICBUF_INVALID = 0x806181aa, - CELL_VPOST_ENT_ERROR_E_ARG_OUTPICINFO_NULL = 0x806181ab, - CELL_VPOST_ENT_ERROR_E_FATAL_SNDCMD_FAIL = 0x806181c0, - CELL_VPOST_ENT_ERROR_E_FATAL_RCVRES_FAIL = 0x806181c1, - CELL_VPOST_ENT_ERROR_E_FATAL_SPUCORE_FAIL = 0x806181c2, - CELL_VPOST_IPC_ERROR_Q_ARG_ATTR_NULL = 0x80618210, - CELL_VPOST_IPC_ERROR_O_ARG_RSRC_NULL = 0x80618240, - CELL_VPOST_IPC_ERROR_O_ARG_RSRC_INVALID = 0x80618241, - CELL_VPOST_IPC_ERROR_O_ARG_HDL_NULL = 0x80618242, - CELL_VPOST_IPC_ERROR_O_FATAL_QUERY_FAIL = 0x80618260, - CELL_VPOST_IPC_ERROR_O_FATAL_CSPUCORE_FAIL = 0x80618261, - CELL_VPOST_IPC_ERROR_C_ARG_HDL_NULL = 0x80618270, - CELL_VPOST_IPC_ERROR_C_ARG_HDL_INVALID = 0x80618271, - CELL_VPOST_IPC_ERROR_C_FATAL_SNDCMD_FAIL = 0x80618290, - CELL_VPOST_IPC_ERROR_C_FATAL_RCVRES_FAIL = 0x80618291, - CELL_VPOST_IPC_ERROR_C_FATAL_DSPUCORE_FAIL = 0x80618292, - CELL_VPOST_IPC_ERROR_E_ARG_HDL_NULL = 0x806182a0, - CELL_VPOST_IPC_ERROR_E_ARG_HDL_INVALID = 0x806182a1, - CELL_VPOST_IPC_ERROR_E_ARG_INPICBUF_NULL = 0x806182a2, - CELL_VPOST_IPC_ERROR_E_ARG_INPICBUF_INVALID = 0x806182a3, - CELL_VPOST_IPC_ERROR_E_ARG_INPICINFO_NULL = 0x806182a4, - CELL_VPOST_IPC_ERROR_E_ARG_INPICINFO_INVALID = 0x806182a5, - CELL_VPOST_IPC_ERROR_E_ARG_CTRL_NULL = 0x806182a6, - CELL_VPOST_IPC_ERROR_E_ARG_CTRL_INVALID = 0x806182a7, - CELL_VPOST_IPC_ERROR_E_ARG_COMB_INVALID = 0x806182a8, - CELL_VPOST_IPC_ERROR_E_ARG_OUTPICBUF_NULL = 0x806182a9, - CELL_VPOST_IPC_ERROR_E_ARG_OUTPICBUF_INVALID = 0x806182aa, - CELL_VPOST_IPC_ERROR_E_ARG_OUTPICINFO_NULL = 0x806182ab, - CELL_VPOST_IPC_ERROR_E_FATAL_SNDCMD_FAIL = 0x806182c0, - CELL_VPOST_IPC_ERROR_E_FATAL_RCVRES_FAIL = 0x806182c1, - CELL_VPOST_IPC_ERROR_E_FATAL_SPUCORE_FAIL = 0x806182c2, - CELL_VPOST_VSC_ERROR_Q_ARG_ATTR_NULL = 0x80618310, - CELL_VPOST_VSC_ERROR_O_ARG_RSRC_NULL = 0x80618340, - CELL_VPOST_VSC_ERROR_O_ARG_RSRC_INVALID = 0x80618341, - CELL_VPOST_VSC_ERROR_O_ARG_HDL_NULL = 0x80618342, - CELL_VPOST_VSC_ERROR_O_FATAL_QUERY_FAIL = 0x80618360, - CELL_VPOST_VSC_ERROR_O_FATAL_CSPUCORE_FAIL = 0x80618361, - CELL_VPOST_VSC_ERROR_C_ARG_HDL_NULL = 0x80618370, - CELL_VPOST_VSC_ERROR_C_ARG_HDL_INVALID = 0x80618371, - CELL_VPOST_VSC_ERROR_C_FATAL_SNDCMD_FAIL = 0x80618390, - CELL_VPOST_VSC_ERROR_C_FATAL_RCVRES_FAIL = 0x80618391, - CELL_VPOST_VSC_ERROR_C_FATAL_DSPUCORE_FAIL = 0x80618392, - CELL_VPOST_VSC_ERROR_E_ARG_HDL_NULL = 0x806183a0, - CELL_VPOST_VSC_ERROR_E_ARG_HDL_INVALID = 0x806183a1, - CELL_VPOST_VSC_ERROR_E_ARG_INPICBUF_NULL = 0x806183a2, - CELL_VPOST_VSC_ERROR_E_ARG_INPICBUF_INVALID = 0x806183a3, - CELL_VPOST_VSC_ERROR_E_ARG_INPICINFO_NULL = 0x806183a4, - CELL_VPOST_VSC_ERROR_E_ARG_INPICINFO_INVALID = 0x806183a5, - CELL_VPOST_VSC_ERROR_E_ARG_CTRL_NULL = 0x806183a6, - CELL_VPOST_VSC_ERROR_E_ARG_CTRL_INVALID = 0x806183a7, - CELL_VPOST_VSC_ERROR_E_ARG_COMB_INVALID = 0x806183a8, - CELL_VPOST_VSC_ERROR_E_ARG_OUTPICBUF_NULL = 0x806183a9, - CELL_VPOST_VSC_ERROR_E_ARG_OUTPICBUF_INVALID = 0x806183aa, - CELL_VPOST_VSC_ERROR_E_ARG_OUTPICINFO_NULL = 0x806183ab, - CELL_VPOST_VSC_ERROR_E_FATAL_SNDCMD_FAIL = 0x806183c0, - CELL_VPOST_VSC_ERROR_E_FATAL_RCVRES_FAIL = 0x806183c1, - CELL_VPOST_VSC_ERROR_E_FATAL_SPUCORE_FAIL = 0x806183c2, - CELL_VPOST_CSC_ERROR_Q_ARG_ATTR_NULL = 0x80618410, - CELL_VPOST_CSC_ERROR_O_ARG_RSRC_NULL = 0x80618440, - CELL_VPOST_CSC_ERROR_O_ARG_RSRC_INVALID = 0x80618441, - CELL_VPOST_CSC_ERROR_O_ARG_HDL_NULL = 0x80618442, - CELL_VPOST_CSC_ERROR_O_FATAL_QUERY_FAIL = 0x80618460, - CELL_VPOST_CSC_ERROR_O_FATAL_CSPUCORE_FAIL = 0x80618461, - CELL_VPOST_CSC_ERROR_C_ARG_HDL_NULL = 0x80618470, - CELL_VPOST_CSC_ERROR_C_ARG_HDL_INVALID = 0x80618471, - CELL_VPOST_CSC_ERROR_C_FATAL_SNDCMD_FAIL = 0x80618490, - CELL_VPOST_CSC_ERROR_C_FATAL_RCVRES_FAIL = 0x80618491, - CELL_VPOST_CSC_ERROR_C_FATAL_DSPUCORE_FAIL = 0x80618492, - CELL_VPOST_CSC_ERROR_E_ARG_HDL_NULL = 0x806184a0, - CELL_VPOST_CSC_ERROR_E_ARG_HDL_INVALID = 0x806184a1, - CELL_VPOST_CSC_ERROR_E_ARG_INPICBUF_NULL = 0x806184a2, - CELL_VPOST_CSC_ERROR_E_ARG_INPICBUF_INVALID = 0x806184a3, - CELL_VPOST_CSC_ERROR_E_ARG_INPICINFO_NULL = 0x806184a4, - CELL_VPOST_CSC_ERROR_E_ARG_INPICINFO_INVALID = 0x806184a5, - CELL_VPOST_CSC_ERROR_E_ARG_CTRL_NULL = 0x806184a6, - CELL_VPOST_CSC_ERROR_E_ARG_CTRL_INVALID = 0x806184a7, - CELL_VPOST_CSC_ERROR_E_ARG_COMB_INVALID = 0x806184a8, - CELL_VPOST_CSC_ERROR_E_ARG_OUTPICBUF_NULL = 0x806184a9, - CELL_VPOST_CSC_ERROR_E_ARG_OUTPICBUF_INVALID = 0x806184aa, - CELL_VPOST_CSC_ERROR_E_ARG_OUTPICINFO_NULL = 0x806184ab, - CELL_VPOST_CSC_ERROR_E_FATAL_SNDCMD_FAIL = 0x806184c0, - CELL_VPOST_CSC_ERROR_E_FATAL_RCVRES_FAIL = 0x806184c1, - CELL_VPOST_CSC_ERROR_E_FATAL_SPUCORE_FAIL = 0x806184c2, -}; - int cellVpostQueryAttr() { UNIMPLEMENTED_FUNC(cellVpost); diff --git a/rpcs3/Emu/SysCalls/Modules/cellVpost.h b/rpcs3/Emu/SysCalls/Modules/cellVpost.h new file mode 100644 index 0000000000..b0eda0951b --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellVpost.h @@ -0,0 +1,138 @@ +#pragma once + +// Error Codes +enum +{ + CELL_VPOST_ERROR_Q_ARG_CFG_NULL = 0x80610410, + CELL_VPOST_ERROR_Q_ARG_CFG_INVALID = 0x80610411, + CELL_VPOST_ERROR_Q_ARG_ATTR_NULL = 0x80610412, + CELL_VPOST_ERROR_O_ARG_CFG_NULL = 0x80610440, + CELL_VPOST_ERROR_O_ARG_CFG_INVALID = 0x80610441, + CELL_VPOST_ERROR_O_ARG_RSRC_NULL = 0x80610442, + CELL_VPOST_ERROR_O_ARG_RSRC_INVALID = 0x80610443, + CELL_VPOST_ERROR_O_ARG_HDL_NULL = 0x80610444, + CELL_VPOST_ERROR_O_FATAL_QUERY_FAIL = 0x80610460, + CELL_VPOST_ERROR_O_FATAL_CREATEMON_FAIL = 0x80610461, + CELL_VPOST_ERROR_O_FATAL_INITSPURS_FAIL = 0x80610462, + CELL_VPOST_ERROR_C_ARG_HDL_NULL = 0x80610470, + CELL_VPOST_ERROR_C_ARG_HDL_INVALID = 0x80610471, + CELL_VPOST_ERROR_C_FATAL_LOCKMON_FAIL = 0x80610490, + CELL_VPOST_ERROR_C_FATAL_UNLOCKMON_FAIL = 0x80610491, + CELL_VPOST_ERROR_C_FATAL_DESTROYMON_FAIL = 0x80610492, + CELL_VPOST_ERROR_C_FATAL_FINSPURS_FAIL = 0x80610463, + CELL_VPOST_ERROR_E_ARG_HDL_NULL = 0x806104a0, + CELL_VPOST_ERROR_E_ARG_HDL_INVALID = 0x806104a1, + CELL_VPOST_ERROR_E_ARG_INPICBUF_NULL = 0x806104a2, + CELL_VPOST_ERROR_E_ARG_INPICBUF_INVALID = 0x806104a3, + CELL_VPOST_ERROR_E_ARG_CTRL_NULL = 0x806104a4, + CELL_VPOST_ERROR_E_ARG_CTRL_INVALID = 0x806104a5, + CELL_VPOST_ERROR_E_ARG_OUTPICBUF_NULL = 0x806104a6, + CELL_VPOST_ERROR_E_ARG_OUTPICBUF_INVALID = 0x806104a7, + CELL_VPOST_ERROR_E_ARG_PICINFO_NULL = 0x806104a8, + CELL_VPOST_ERROR_E_FATAL_LOCKMON_FAIL = 0x806104c0, + CELL_VPOST_ERROR_E_FATAL_UNLOCKMON_FAIL = 0x806104c1, + CELL_VPOST_ENT_ERROR_Q_ARG_ATTR_NULL = 0x80618110, + CELL_VPOST_ENT_ERROR_O_ARG_RSRC_NULL = 0x80618140, + CELL_VPOST_ENT_ERROR_O_ARG_RSRC_INVALID = 0x80618141, + CELL_VPOST_ENT_ERROR_O_ARG_HDL_NULL = 0x80618142, + CELL_VPOST_ENT_ERROR_O_FATAL_QUERY_FAIL = 0x80618160, + CELL_VPOST_ENT_ERROR_O_FATAL_CSPUCORE_FAIL = 0x80618161, + CELL_VPOST_ENT_ERROR_C_ARG_HDL_NULL = 0x80618170, + CELL_VPOST_ENT_ERROR_C_ARG_HDL_INVALID = 0x80618171, + CELL_VPOST_ENT_ERROR_C_FATAL_SNDCMD_FAIL = 0x80618190, + CELL_VPOST_ENT_ERROR_C_FATAL_RCVRES_FAIL = 0x80618191, + CELL_VPOST_ENT_ERROR_C_FATAL_DSPUCORE_FAIL = 0x80618192, + CELL_VPOST_ENT_ERROR_E_ARG_HDL_NULL = 0x806181a0, + CELL_VPOST_ENT_ERROR_E_ARG_HDL_INVALID = 0x806181a1, + CELL_VPOST_ENT_ERROR_E_ARG_INPICBUF_NULL = 0x806181a2, + CELL_VPOST_ENT_ERROR_E_ARG_INPICBUF_INVALID = 0x806181a3, + CELL_VPOST_ENT_ERROR_E_ARG_INPICINFO_NULL = 0x806181a4, + CELL_VPOST_ENT_ERROR_E_ARG_INPICINFO_INVALID = 0x806181a5, + CELL_VPOST_ENT_ERROR_E_ARG_CTRL_NULL = 0x806181a6, + CELL_VPOST_ENT_ERROR_E_ARG_CTRL_INVALID = 0x806181a7, + CELL_VPOST_ENT_ERROR_E_ARG_COMB_INVALID = 0x806181a8, + CELL_VPOST_ENT_ERROR_E_ARG_OUTPICBUF_NULL = 0x806181a9, + CELL_VPOST_ENT_ERROR_E_ARG_OUTPICBUF_INVALID = 0x806181aa, + CELL_VPOST_ENT_ERROR_E_ARG_OUTPICINFO_NULL = 0x806181ab, + CELL_VPOST_ENT_ERROR_E_FATAL_SNDCMD_FAIL = 0x806181c0, + CELL_VPOST_ENT_ERROR_E_FATAL_RCVRES_FAIL = 0x806181c1, + CELL_VPOST_ENT_ERROR_E_FATAL_SPUCORE_FAIL = 0x806181c2, + CELL_VPOST_IPC_ERROR_Q_ARG_ATTR_NULL = 0x80618210, + CELL_VPOST_IPC_ERROR_O_ARG_RSRC_NULL = 0x80618240, + CELL_VPOST_IPC_ERROR_O_ARG_RSRC_INVALID = 0x80618241, + CELL_VPOST_IPC_ERROR_O_ARG_HDL_NULL = 0x80618242, + CELL_VPOST_IPC_ERROR_O_FATAL_QUERY_FAIL = 0x80618260, + CELL_VPOST_IPC_ERROR_O_FATAL_CSPUCORE_FAIL = 0x80618261, + CELL_VPOST_IPC_ERROR_C_ARG_HDL_NULL = 0x80618270, + CELL_VPOST_IPC_ERROR_C_ARG_HDL_INVALID = 0x80618271, + CELL_VPOST_IPC_ERROR_C_FATAL_SNDCMD_FAIL = 0x80618290, + CELL_VPOST_IPC_ERROR_C_FATAL_RCVRES_FAIL = 0x80618291, + CELL_VPOST_IPC_ERROR_C_FATAL_DSPUCORE_FAIL = 0x80618292, + CELL_VPOST_IPC_ERROR_E_ARG_HDL_NULL = 0x806182a0, + CELL_VPOST_IPC_ERROR_E_ARG_HDL_INVALID = 0x806182a1, + CELL_VPOST_IPC_ERROR_E_ARG_INPICBUF_NULL = 0x806182a2, + CELL_VPOST_IPC_ERROR_E_ARG_INPICBUF_INVALID = 0x806182a3, + CELL_VPOST_IPC_ERROR_E_ARG_INPICINFO_NULL = 0x806182a4, + CELL_VPOST_IPC_ERROR_E_ARG_INPICINFO_INVALID = 0x806182a5, + CELL_VPOST_IPC_ERROR_E_ARG_CTRL_NULL = 0x806182a6, + CELL_VPOST_IPC_ERROR_E_ARG_CTRL_INVALID = 0x806182a7, + CELL_VPOST_IPC_ERROR_E_ARG_COMB_INVALID = 0x806182a8, + CELL_VPOST_IPC_ERROR_E_ARG_OUTPICBUF_NULL = 0x806182a9, + CELL_VPOST_IPC_ERROR_E_ARG_OUTPICBUF_INVALID = 0x806182aa, + CELL_VPOST_IPC_ERROR_E_ARG_OUTPICINFO_NULL = 0x806182ab, + CELL_VPOST_IPC_ERROR_E_FATAL_SNDCMD_FAIL = 0x806182c0, + CELL_VPOST_IPC_ERROR_E_FATAL_RCVRES_FAIL = 0x806182c1, + CELL_VPOST_IPC_ERROR_E_FATAL_SPUCORE_FAIL = 0x806182c2, + CELL_VPOST_VSC_ERROR_Q_ARG_ATTR_NULL = 0x80618310, + CELL_VPOST_VSC_ERROR_O_ARG_RSRC_NULL = 0x80618340, + CELL_VPOST_VSC_ERROR_O_ARG_RSRC_INVALID = 0x80618341, + CELL_VPOST_VSC_ERROR_O_ARG_HDL_NULL = 0x80618342, + CELL_VPOST_VSC_ERROR_O_FATAL_QUERY_FAIL = 0x80618360, + CELL_VPOST_VSC_ERROR_O_FATAL_CSPUCORE_FAIL = 0x80618361, + CELL_VPOST_VSC_ERROR_C_ARG_HDL_NULL = 0x80618370, + CELL_VPOST_VSC_ERROR_C_ARG_HDL_INVALID = 0x80618371, + CELL_VPOST_VSC_ERROR_C_FATAL_SNDCMD_FAIL = 0x80618390, + CELL_VPOST_VSC_ERROR_C_FATAL_RCVRES_FAIL = 0x80618391, + CELL_VPOST_VSC_ERROR_C_FATAL_DSPUCORE_FAIL = 0x80618392, + CELL_VPOST_VSC_ERROR_E_ARG_HDL_NULL = 0x806183a0, + CELL_VPOST_VSC_ERROR_E_ARG_HDL_INVALID = 0x806183a1, + CELL_VPOST_VSC_ERROR_E_ARG_INPICBUF_NULL = 0x806183a2, + CELL_VPOST_VSC_ERROR_E_ARG_INPICBUF_INVALID = 0x806183a3, + CELL_VPOST_VSC_ERROR_E_ARG_INPICINFO_NULL = 0x806183a4, + CELL_VPOST_VSC_ERROR_E_ARG_INPICINFO_INVALID = 0x806183a5, + CELL_VPOST_VSC_ERROR_E_ARG_CTRL_NULL = 0x806183a6, + CELL_VPOST_VSC_ERROR_E_ARG_CTRL_INVALID = 0x806183a7, + CELL_VPOST_VSC_ERROR_E_ARG_COMB_INVALID = 0x806183a8, + CELL_VPOST_VSC_ERROR_E_ARG_OUTPICBUF_NULL = 0x806183a9, + CELL_VPOST_VSC_ERROR_E_ARG_OUTPICBUF_INVALID = 0x806183aa, + CELL_VPOST_VSC_ERROR_E_ARG_OUTPICINFO_NULL = 0x806183ab, + CELL_VPOST_VSC_ERROR_E_FATAL_SNDCMD_FAIL = 0x806183c0, + CELL_VPOST_VSC_ERROR_E_FATAL_RCVRES_FAIL = 0x806183c1, + CELL_VPOST_VSC_ERROR_E_FATAL_SPUCORE_FAIL = 0x806183c2, + CELL_VPOST_CSC_ERROR_Q_ARG_ATTR_NULL = 0x80618410, + CELL_VPOST_CSC_ERROR_O_ARG_RSRC_NULL = 0x80618440, + CELL_VPOST_CSC_ERROR_O_ARG_RSRC_INVALID = 0x80618441, + CELL_VPOST_CSC_ERROR_O_ARG_HDL_NULL = 0x80618442, + CELL_VPOST_CSC_ERROR_O_FATAL_QUERY_FAIL = 0x80618460, + CELL_VPOST_CSC_ERROR_O_FATAL_CSPUCORE_FAIL = 0x80618461, + CELL_VPOST_CSC_ERROR_C_ARG_HDL_NULL = 0x80618470, + CELL_VPOST_CSC_ERROR_C_ARG_HDL_INVALID = 0x80618471, + CELL_VPOST_CSC_ERROR_C_FATAL_SNDCMD_FAIL = 0x80618490, + CELL_VPOST_CSC_ERROR_C_FATAL_RCVRES_FAIL = 0x80618491, + CELL_VPOST_CSC_ERROR_C_FATAL_DSPUCORE_FAIL = 0x80618492, + CELL_VPOST_CSC_ERROR_E_ARG_HDL_NULL = 0x806184a0, + CELL_VPOST_CSC_ERROR_E_ARG_HDL_INVALID = 0x806184a1, + CELL_VPOST_CSC_ERROR_E_ARG_INPICBUF_NULL = 0x806184a2, + CELL_VPOST_CSC_ERROR_E_ARG_INPICBUF_INVALID = 0x806184a3, + CELL_VPOST_CSC_ERROR_E_ARG_INPICINFO_NULL = 0x806184a4, + CELL_VPOST_CSC_ERROR_E_ARG_INPICINFO_INVALID = 0x806184a5, + CELL_VPOST_CSC_ERROR_E_ARG_CTRL_NULL = 0x806184a6, + CELL_VPOST_CSC_ERROR_E_ARG_CTRL_INVALID = 0x806184a7, + CELL_VPOST_CSC_ERROR_E_ARG_COMB_INVALID = 0x806184a8, + CELL_VPOST_CSC_ERROR_E_ARG_OUTPICBUF_NULL = 0x806184a9, + CELL_VPOST_CSC_ERROR_E_ARG_OUTPICBUF_INVALID = 0x806184aa, + CELL_VPOST_CSC_ERROR_E_ARG_OUTPICINFO_NULL = 0x806184ab, + CELL_VPOST_CSC_ERROR_E_FATAL_SNDCMD_FAIL = 0x806184c0, + CELL_VPOST_CSC_ERROR_E_FATAL_RCVRES_FAIL = 0x806184c1, + CELL_VPOST_CSC_ERROR_E_FATAL_SPUCORE_FAIL = 0x806184c2, +}; \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp b/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp index 27f22ab243..776dab9ee4 100644 --- a/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp @@ -131,9 +131,9 @@ int cellFsSdataOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size) std::atomic g_FsAioReadID = 0; std::atomic g_FsAioReadCur = 0; -bool aio_init; +bool aio_init = false; -void fsAioRead(u32 fd, mem_ptr_t aio, int xid, mem_func_ptr_t xaio, u32 error, int xid, u64 size)> func) +void fsAioRead(u32 fd, mem_ptr_t aio, int xid, mem_func_ptr_t xaio, int error, int xid, u64 size)> func) { while (g_FsAioReadCur != xid) { @@ -184,14 +184,26 @@ void fsAioRead(u32 fd, mem_ptr_t aio, int xid, mem_func_ptr_toffset, buf_addr, (u64)aio->size, res, xid, path.wx_str()); - //start callback thread - if(func) + if (func) // start callback thread + { func.async(aio, error, xid, res); + } + + CPUThread& thr = Emu.GetCallbackThread(); + while (thr.IsAlive()) + { + Sleep(1); + if (Emu.IsStopped()) + { + ConLog.Warning("fsAioRead() aborted"); + break; + } + } g_FsAioReadCur++; } -int cellFsAioRead(mem_ptr_t aio, mem32_t aio_id, mem_func_ptr_t xaio, u32 error, int xid, u64 size)> func) +int cellFsAioRead(mem_ptr_t aio, mem32_t aio_id, mem_func_ptr_t xaio, int error, int xid, u64 size)> func) { sys_fs.Warning("cellFsAioRead(aio_addr=0x%x, id_addr=0x%x, func_addr=0x%x)", aio.GetAddr(), aio_id.GetAddr(), func.GetAddr()); @@ -202,7 +214,7 @@ int cellFsAioRead(mem_ptr_t aio, mem32_t aio_id, mem_func_ptr_tmutex; u32 tid = GetCurrentPPUThread().GetId(); - if (u32 target = mutex->protocol == SYS_SYNC_PRIORITY ? mutex->m_queue.pop_prio() : mutex->m_queue.pop()) + if (u32 target = (mutex->protocol == SYS_SYNC_PRIORITY ? mutex->m_queue.pop_prio() : mutex->m_queue.pop())) { if (mutex->m_mutex.trylock(target) != SMR_OK) { @@ -159,7 +159,7 @@ int sys_cond_signal_all(u32 cond_id) Mutex* mutex = cond->mutex; u32 tid = GetCurrentPPUThread().GetId(); - while (u32 target = mutex->protocol == SYS_SYNC_PRIORITY ? mutex->m_queue.pop_prio() : mutex->m_queue.pop()) + while (u32 target = (mutex->protocol == SYS_SYNC_PRIORITY ? mutex->m_queue.pop_prio() : mutex->m_queue.pop())) { if (mutex->m_mutex.trylock(target) != SMR_OK) { diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Lwcond.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Lwcond.cpp index 89dd8c7409..fc367333a3 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Lwcond.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Lwcond.cpp @@ -84,7 +84,7 @@ int sys_lwcond_signal(mem_ptr_t lwcond) mem_ptr_t mutex(lwcond->lwmutex); be_t tid = GetCurrentPPUThread().GetId(); - if (be_t target = mutex->attribute.ToBE() == se32(SYS_SYNC_PRIORITY) ? sq->pop_prio() : sq->pop()) + if (be_t target = (mutex->attribute.ToBE() == se32(SYS_SYNC_PRIORITY) ? sq->pop_prio() : sq->pop())) { if (mutex->owner.trylock(target) != SMR_OK) { @@ -120,7 +120,7 @@ int sys_lwcond_signal_all(mem_ptr_t lwcond) mem_ptr_t mutex(lwcond->lwmutex); be_t tid = GetCurrentPPUThread().GetId(); - while (be_t target = mutex->attribute.ToBE() == se32(SYS_SYNC_PRIORITY) ? sq->pop_prio() : sq->pop()) + while (be_t target = (mutex->attribute.ToBE() == se32(SYS_SYNC_PRIORITY) ? sq->pop_prio() : sq->pop())) { if (mutex->owner.trylock(target) != SMR_OK) { diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Lwmutex.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Lwmutex.cpp index db07fbed3b..87d3968d10 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Lwmutex.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Lwmutex.cpp @@ -28,7 +28,8 @@ int sys_lwmutex_create(mem_ptr_t lwmutex, mem_ptr_tattribute = attr->attr_protocol | attr->attr_recursive; - lwmutex->all_info = 0; + lwmutex->owner.initialize(); + lwmutex->waiter = lwmutex->owner.GetOwner(); lwmutex->pad = 0; lwmutex->recursive_count = 0; @@ -51,9 +52,10 @@ int sys_lwmutex_destroy(mem_ptr_t lwmutex) if (!Emu.GetIdManager().CheckID(sq_id)) return CELL_ESRCH; // try to make it unable to lock - switch (int res = lwmutex->trylock(~0)) + switch (int res = lwmutex->trylock(lwmutex->owner.GetDeadValue())) { case CELL_OK: + lwmutex->all_info = 0; lwmutex->attribute = 0; lwmutex->sleep_queue = 0; Emu.GetIdManager().RemoveID(sq_id); @@ -245,8 +247,10 @@ int sys_lwmutex_t::unlock(be_t tid) SleepQueue* sq; if (!Emu.GetIdManager().GetIDData(sleep_queue, sq)) return CELL_ESRCH; target = attribute.ToBE() & se32(SYS_SYNC_FIFO) ? sq->pop() : sq->pop_prio(); - case se32(SYS_SYNC_RETRY): default: owner.unlock(tid, target); break; + case se32(SYS_SYNC_RETRY): break; } + if (target) owner.unlock(tid, target); + else owner.unlock(tid); } return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Lwmutex.h b/rpcs3/Emu/SysCalls/lv2/SC_Lwmutex.h index 4d104a556b..6ec67c0cc6 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Lwmutex.h +++ b/rpcs3/Emu/SysCalls/lv2/SC_Lwmutex.h @@ -69,7 +69,7 @@ struct sys_lwmutex_t { struct // sys_lwmutex_lock_info_t { - /* volatile */ SMutexBE owner; + /* volatile */ SMutexBase, 0xffffffff, 0> owner; /* volatile */ be_t waiter; // not used }; struct diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Mutex.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Mutex.cpp index 165bcf3896..4ae474631b 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Mutex.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Mutex.cpp @@ -91,8 +91,9 @@ int sys_mutex_lock(u32 mutex_id, u64 timeout) } u32 tid = GetCurrentPPUThread().GetId(); + u32 owner = mutex->m_mutex.GetOwner(); - if (mutex->m_mutex.GetOwner() == tid) + if (owner == tid) { if (mutex->is_recursive) { @@ -107,6 +108,13 @@ int sys_mutex_lock(u32 mutex_id, u64 timeout) return CELL_EDEADLK; } } + else if (owner && !Emu.GetIdManager().CheckID(owner)) + { + sys_mtx.Error("sys_mutex_lock(%d): deadlock on invalid thread(%d)", mutex_id, owner); + mutex->m_mutex.unlock(owner, tid); + mutex->recursive = 1; + return CELL_OK; + } switch (mutex->m_mutex.trylock(tid)) { @@ -119,16 +127,20 @@ int sys_mutex_lock(u32 mutex_id, u64 timeout) switch (mutex->m_mutex.lock(tid, timeout ? ((timeout < 1000) ? 1 : (timeout / 1000)) : 0)) { - case SMR_OK: mutex->m_queue.invalidate(tid); - case SMR_SIGNAL: mutex->recursive = 1; return CELL_OK; - case SMR_TIMEOUT: return CELL_ETIMEDOUT; - default: goto abort; + case SMR_OK: + mutex->m_queue.invalidate(tid); + case SMR_SIGNAL: + mutex->recursive = 1; return CELL_OK; + case SMR_TIMEOUT: + mutex->m_queue.invalidate(tid); return CELL_ETIMEDOUT; + default: + mutex->m_queue.invalidate(tid); goto abort; } abort: if (Emu.IsStopped()) { - ConLog.Warning("sys_mutex_lock(id=%d) aborted", mutex_id); + sys_mtx.Warning("sys_mutex_lock(id=%d) aborted", mutex_id); return CELL_OK; } return CELL_ESRCH; @@ -145,8 +157,9 @@ int sys_mutex_trylock(u32 mutex_id) } u32 tid = GetCurrentPPUThread().GetId(); + u32 owner = mutex->m_mutex.GetOwner(); - if (mutex->m_mutex.GetOwner() == tid) + if (owner == tid) { if (mutex->is_recursive) { @@ -161,6 +174,13 @@ int sys_mutex_trylock(u32 mutex_id) return CELL_EDEADLK; } } + else if (owner && !Emu.GetIdManager().CheckID(owner)) + { + sys_mtx.Error("sys_mutex_trylock(%d): deadlock on invalid thread(%d)", mutex_id, owner); + mutex->m_mutex.unlock(owner, tid); + mutex->recursive = 1; + return CELL_OK; + } switch (mutex->m_mutex.trylock(tid)) { @@ -184,6 +204,10 @@ int sys_mutex_unlock(u32 mutex_id) if (mutex->m_mutex.GetOwner() == tid) { + if (!mutex->recursive || (mutex->recursive > 1 && !mutex->is_recursive)) + { + sys_mtx.Warning("sys_mutex_unlock(%d): wrong recursive value (%d)", mutex_id, mutex->recursive); + } mutex->recursive--; if (!mutex->recursive) { diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Time.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Time.cpp index 045a17172f..764b47f71e 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Time.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Time.cpp @@ -24,14 +24,14 @@ int sys_time_get_timezone(mem32_t timezone, mem32_t summertime) return CELL_OK; } -u64 get_system_time() +u64 get_time() { #ifdef _WIN32 LARGE_INTEGER cycle; LARGE_INTEGER freq; QueryPerformanceCounter(&cycle); QueryPerformanceFrequency(&freq); - return cycle.QuadPart * 1000000 / freq.QuadPart; + return cycle.QuadPart * 10000000 / freq.QuadPart; #else struct timespec ts; if (!clock_gettime(CLOCK_MONOTONIC, &ts)) @@ -39,14 +39,20 @@ u64 get_system_time() #endif } +u64 get_system_time() +{ + // returns some relative time in microseconds, don't change this fact + return get_time() / 10; +} + int sys_time_get_current_time(u32 sec_addr, u32 nsec_addr) { sys_time.Log("sys_time_get_current_time(sec_addr=0x%x, nsec_addr=0x%x)", sec_addr, nsec_addr); - u64 time = get_system_time(); + u64 time = get_time(); - Memory.Write64(sec_addr, time / 1000000); - Memory.Write64(nsec_addr, time % 1000000); + Memory.Write64(sec_addr, time / 10000000); + Memory.Write64(nsec_addr, (time % 10000000) * 100); return CELL_OK; } @@ -60,17 +66,5 @@ s64 sys_time_get_system_time() u64 sys_time_get_timebase_frequency() { sys_time.Log("sys_time_get_timebase_frequency()"); - return 1000000; - - /* -#ifdef _WIN32 - static LARGE_INTEGER frequency = {0ULL}; - - if(!frequency.QuadPart) QueryPerformanceFrequency(&frequency); - - return frequency.QuadPart; -#else return 10000000; -#endif - */ } diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index dd103943cc..c9b3ad0722 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -279,6 +279,7 @@ + @@ -295,6 +296,8 @@ + + diff --git a/rpcs3/rpcs3.vcxproj.filters b/rpcs3/rpcs3.vcxproj.filters index 67d1df150a..041ee71a3a 100644 --- a/rpcs3/rpcs3.vcxproj.filters +++ b/rpcs3/rpcs3.vcxproj.filters @@ -406,6 +406,15 @@ Emu\FS + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules +