From d751e350c686c8aaa78cfd89f4f128e54b09cfca Mon Sep 17 00:00:00 2001 From: raven02 Date: Mon, 7 Jul 2014 02:26:05 +0800 Subject: [PATCH] cellPamf : add error log for CELL_PAMF_ERROR_INVALID_ARG --- rpcs3/Emu/SysCalls/Modules/cellPamf.cpp | 155 +++++++++++++++++------- 1 file changed, 111 insertions(+), 44 deletions(-) diff --git a/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp b/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp index c1b3b3d21e..ccda72ca4a 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp @@ -92,8 +92,7 @@ u8 pamfGetStreamType(mem_ptr_t pSelf, u8 stream) case 0x80: return CELL_PAMF_STREAM_TYPE_PAMF_LPCM; case 0xdd: return CELL_PAMF_STREAM_TYPE_USER_DATA; default: - cellPamf->Error("pamfGetStreamType: (TODO) unsupported stream type found(0x%x)", - pAddr->stream_headers[stream].type); + cellPamf->Error("*** TODO: pamfGetStreamType: unsupported stream type found(0x%x)", pAddr->stream_headers[stream].type); return 0; } } @@ -103,23 +102,43 @@ u8 pamfGetStreamChannel(mem_ptr_t pSelf, u8 stream) //TODO: get stream channel correctly const mem_ptr_t pAddr(pSelf->pAddr); - if ((pAddr->stream_headers[stream].type == 0x1b) && - (pAddr->stream_headers[stream].stream_id >= 0xe0) && - (pAddr->stream_headers[stream].stream_id <= 0xef)) + switch (pAddr->stream_headers[stream].type) { - return pAddr->stream_headers[stream].stream_id - 0xe0; + case 0x1b: + if ((pAddr->stream_headers[stream].stream_id >= 0xe0) && (pAddr->stream_headers[stream].stream_id <= 0xef)) + { + return pAddr->stream_headers[stream].stream_id - 0xe0; + } + else + { + cellPamf->Error("pamfGetStreamChannel: stream type %x got invalid stream id=%x", pAddr->stream_headers[stream].type, pAddr->stream_headers[stream].stream_id); + return 0; + } + case 0xdc: + cellPamf->Error("*** TODO: pamfGetStreamChannel: CELL_PAMF_STREAM_TYPE_ATRAC3PLUS"); + return 0; + case 0x80: + cellPamf->Error("*** TODO: pamfGetStreamChannel: CELL_PAMF_STREAM_TYPE_PAMF_LPCM"); + return 0; + case 0xdd: + cellPamf->Error("*** TODO: pamfGetStreamChannel: CELL_PAMF_STREAM_TYPE_USER_DATA"); + return 0; + default: + cellPamf->Error("*** TODO: pamfGetStreamType: unsupported stream type found(0x%x)", pAddr->stream_headers[stream].type); + return 0; } - cellPamf->Error("TODO: pamfGetStreamChannel (-> 0)"); - return 0; + } int cellPamfGetHeaderSize(mem_ptr_t pAddr, u64 fileSize, mem64_t pSize) { - cellPamf->Warning("cellPamfGetHeaderSize(pAddr=0x%x, fileSize=%d, pSize_addr=0x%x)", - pAddr.GetAddr(), fileSize, pSize.GetAddr()); + cellPamf->Warning("cellPamfGetHeaderSize(pAddr=0x%x, fileSize=%d, pSize_addr=0x%x)", pAddr.GetAddr(), fileSize, pSize.GetAddr()); if (!Memory.IsGoodAddr(pAddr.GetAddr(), 2048) || !pSize.IsGood()) + { + cellPamf->Error("cellPamfGetHeaderSize: CELL_PAMF_ERROR_INVALID_ARG"); return CELL_PAMF_ERROR_INVALID_ARG; + } //if ((u32)pAddr->magic != 0x464d4150) //return CELL_PAMF_ERROR_UNKNOWN_TYPE; @@ -131,11 +150,13 @@ int cellPamfGetHeaderSize(mem_ptr_t pAddr, u64 fileSize, mem64_t pSi int cellPamfGetHeaderSize2(mem_ptr_t pAddr, u64 fileSize, u32 attribute, mem64_t pSize) { - cellPamf->Warning("cellPamfGetHeaderSize2(pAddr=0x%x, fileSize=%d, attribute=0x%x, pSize_addr=0x%x)", - pAddr.GetAddr(), fileSize, attribute, pSize.GetAddr()); + cellPamf->Warning("cellPamfGetHeaderSize2(pAddr=0x%x, fileSize=%d, attribute=0x%x, pSize_addr=0x%x)", pAddr.GetAddr(), fileSize, attribute, pSize.GetAddr()); if (!Memory.IsGoodAddr(pAddr.GetAddr(), 2048) || !pSize.IsGood()) + { + cellPamf->Error("cellPamfGetHeaderSize2: CELL_PAMF_ERROR_INVALID_ARG"); return CELL_PAMF_ERROR_INVALID_ARG; + } //if ((u32)pAddr->magic != 0x464d4150) //return CELL_PAMF_ERROR_UNKNOWN_TYPE; @@ -147,11 +168,13 @@ int cellPamfGetHeaderSize2(mem_ptr_t pAddr, u64 fileSize, u32 attrib int cellPamfGetStreamOffsetAndSize(mem_ptr_t pAddr, u64 fileSize, mem64_t pOffset, mem64_t pSize) { - cellPamf->Warning("cellPamfGetStreamOffsetAndSize(pAddr=0x%x, fileSize=%d, pOffset_addr=0x%x, pSize_addr=0x%x)", - pAddr.GetAddr(), fileSize, pOffset.GetAddr(), pSize.GetAddr()); + cellPamf->Warning("cellPamfGetStreamOffsetAndSize(pAddr=0x%x, fileSize=%d, pOffset_addr=0x%x, pSize_addr=0x%x)", pAddr.GetAddr(), fileSize, pOffset.GetAddr(), pSize.GetAddr()); if (!Memory.IsGoodAddr(pAddr.GetAddr(), 2048) || !pOffset.IsGood() || !pSize.IsGood()) + { + cellPamf->Error("cellPamfGetStreamOffsetAndSize: CELL_PAMF_ERROR_INVALID_ARG"); return CELL_PAMF_ERROR_INVALID_ARG; + } //if ((u32)pAddr->magic != 0x464d4150) //return CELL_PAMF_ERROR_UNKNOWN_TYPE; @@ -168,19 +191,25 @@ int cellPamfVerify(mem_ptr_t pAddr, u64 fileSize) cellPamf->Warning("cellPamfVerify(pAddr=0x%x, fileSize=%d)", pAddr.GetAddr(), fileSize); if (!Memory.IsGoodAddr(pAddr.GetAddr(), 2048)) + { + cellPamf->Error("cellPamfVerify: CELL_PAMF_ERROR_INVALID_ARG"); return CELL_PAMF_ERROR_INVALID_ARG; + } return CELL_OK; } int cellPamfReaderInitialize(mem_ptr_t pSelf, mem_ptr_t pAddr, u64 fileSize, u32 attribute) { - cellPamf->Warning("cellPamfReaderInitialize(pSelf=0x%x, pAddr=0x%x, fileSize=%d, attribute=0x%x)", - pSelf.GetAddr(), pAddr.GetAddr(), fileSize, attribute); + cellPamf->Warning("cellPamfReaderInitialize(pSelf=0x%x, pAddr=0x%x, fileSize=%d, attribute=0x%x)", pSelf.GetAddr(), pAddr.GetAddr(), fileSize, attribute); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pAddr.GetAddr(), 2048)) + { + cellPamf->Error("cellPamfReaderInitialize: CELL_PAMF_ERROR_INVALID_ARG"); return CELL_PAMF_ERROR_INVALID_ARG; + } + if (fileSize) { pSelf->fileSize = fileSize; @@ -202,11 +231,13 @@ int cellPamfReaderInitialize(mem_ptr_t pSelf, mem_ptr_t pSelf, mem_ptr_t pTimeStamp) { - cellPamf->Warning("cellPamfReaderGetPresentationStartTime(pSelf=0x%x, pTimeStamp_addr=0x%x)", - pSelf.GetAddr(), pTimeStamp.GetAddr()); + cellPamf->Warning("cellPamfReaderGetPresentationStartTime(pSelf=0x%x, pTimeStamp_addr=0x%x)", pSelf.GetAddr(), pTimeStamp.GetAddr()); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) + { + cellPamf->Error("cellPamfReaderGetPresentationStartTime: CELL_PAMF_ERROR_INVALID_ARG"); return CELL_PAMF_ERROR_INVALID_ARG; + } const mem_ptr_t pAddr(pSelf->pAddr); const u32 upper = (u16)pAddr->start_pts_high; @@ -217,11 +248,13 @@ int cellPamfReaderGetPresentationStartTime(mem_ptr_t pSelf, mem_ int cellPamfReaderGetPresentationEndTime(mem_ptr_t pSelf, mem_ptr_t pTimeStamp) { - cellPamf->Warning("cellPamfReaderGetPresentationEndTime(pSelf=0x%x, pTimeStamp_addr=0x%x)", - pSelf.GetAddr(), pTimeStamp.GetAddr()); + cellPamf->Warning("cellPamfReaderGetPresentationEndTime(pSelf=0x%x, pTimeStamp_addr=0x%x)", pSelf.GetAddr(), pTimeStamp.GetAddr()); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) + { + cellPamf->Error("cellPamfReaderGetPresentationEndTime: CELL_PAMF_ERROR_INVALID_ARG"); return CELL_PAMF_ERROR_INVALID_ARG; + } const mem_ptr_t pAddr(pSelf->pAddr); const u32 upper = (u16)pAddr->end_pts_high; @@ -235,7 +268,10 @@ int cellPamfReaderGetMuxRateBound(mem_ptr_t pSelf) cellPamf->Warning("cellPamfReaderGetMuxRateBound(pSelf=0x%x)", pSelf.GetAddr()); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) + { + cellPamf->Error("cellPamfReaderGetMuxRateBound: CELL_PAMF_ERROR_INVALID_ARG"); return CELL_PAMF_ERROR_INVALID_ARG; + } const mem_ptr_t pAddr(pSelf->pAddr); return pAddr->mux_rate_max; @@ -246,7 +282,10 @@ int cellPamfReaderGetNumberOfStreams(mem_ptr_t pSelf) cellPamf->Warning("cellPamfReaderGetNumberOfStreams(pSelf=0x%x)", pSelf.GetAddr()); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) + { + cellPamf->Error("cellPamfReaderGetNumberOfStreams: CELL_PAMF_ERROR_INVALID_ARG"); return CELL_PAMF_ERROR_INVALID_ARG; + } const mem_ptr_t pAddr(pSelf->pAddr); return pAddr->stream_count; @@ -254,11 +293,13 @@ int cellPamfReaderGetNumberOfStreams(mem_ptr_t pSelf) int cellPamfReaderGetNumberOfSpecificStreams(mem_ptr_t pSelf, u8 streamType) { - cellPamf->Warning("cellPamfReaderGetNumberOfSpecificStreams(pSelf=0x%x, streamType=%d)", - pSelf.GetAddr(), streamType); + cellPamf->Warning("cellPamfReaderGetNumberOfSpecificStreams(pSelf=0x%x, streamType=%d)", pSelf.GetAddr(), streamType); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) + { + cellPamf->Error("cellPamfReaderGetNumberOfSpecificStreams: CELL_PAMF_ERROR_INVALID_ARG"); return CELL_PAMF_ERROR_INVALID_ARG; + } const mem_ptr_t pAddr(pSelf->pAddr); @@ -281,8 +322,7 @@ int cellPamfReaderGetNumberOfSpecificStreams(mem_ptr_t pSelf, u8 case CELL_PAMF_STREAM_TYPE_VIDEO: return counts[CELL_PAMF_STREAM_TYPE_AVC] + counts[CELL_PAMF_STREAM_TYPE_M2V]; case CELL_PAMF_STREAM_TYPE_AUDIO: - return counts[CELL_PAMF_STREAM_TYPE_ATRAC3PLUS] + - counts[CELL_PAMF_STREAM_TYPE_PAMF_LPCM] + counts[CELL_PAMF_STREAM_TYPE_AC3]; + return counts[CELL_PAMF_STREAM_TYPE_ATRAC3PLUS] + counts[CELL_PAMF_STREAM_TYPE_PAMF_LPCM] + counts[CELL_PAMF_STREAM_TYPE_AC3]; default: return 0; } @@ -290,11 +330,13 @@ int cellPamfReaderGetNumberOfSpecificStreams(mem_ptr_t pSelf, u8 int cellPamfReaderSetStreamWithIndex(mem_ptr_t pSelf, u8 streamIndex) { - cellPamf->Warning("cellPamfReaderSetStreamWithIndex(pSelf=0x%x, streamIndex=%d)", - pSelf.GetAddr(), streamIndex); + cellPamf->Warning("cellPamfReaderSetStreamWithIndex(pSelf=0x%x, streamIndex=%d)", pSelf.GetAddr(), streamIndex); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) + { + cellPamf->Error("cellPamfReaderSetStreamWithIndex: CELL_PAMF_ERROR_INVALID_ARG"); return CELL_PAMF_ERROR_INVALID_ARG; + } const mem_ptr_t pAddr(pSelf->pAddr); @@ -305,17 +347,20 @@ int cellPamfReaderSetStreamWithIndex(mem_ptr_t pSelf, u8 streamI } else { + cellPamf->Error("cellPamfReaderSetStreamWithIndex: CELL_PAMF_ERROR_INVALID_ARG"); return CELL_PAMF_ERROR_INVALID_ARG; } } int cellPamfReaderSetStreamWithTypeAndChannel(mem_ptr_t pSelf, u8 streamType, u8 ch) { - cellPamf->Warning("cellPamfReaderSetStreamWithTypeAndChannel(pSelf=0x%x, streamType=%d, ch=%d)", - pSelf.GetAddr(), streamType, ch); + cellPamf->Warning("cellPamfReaderSetStreamWithTypeAndChannel(pSelf=0x%x, streamType=%d, ch=%d)", pSelf.GetAddr(), streamType, ch); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) + { + cellPamf->Error("cellPamfReaderSetStreamWithTypeAndChannel: CELL_PAMF_ERROR_INVALID_ARG"); return CELL_PAMF_ERROR_INVALID_ARG; + } const mem_ptr_t pAddr(pSelf->pAddr); @@ -343,11 +388,13 @@ int cellPamfReaderSetStreamWithTypeAndChannel(mem_ptr_t pSelf, u int cellPamfReaderSetStreamWithTypeAndIndex(mem_ptr_t pSelf, u8 streamType, u8 streamIndex) { - cellPamf->Warning("cellPamfReaderSetStreamWithTypeAndIndex(pSelf=0x%x, streamType=%d, streamIndex=%d)", - pSelf.GetAddr(), streamType, streamIndex); + cellPamf->Warning("cellPamfReaderSetStreamWithTypeAndIndex(pSelf=0x%x, streamType=%d, streamIndex=%d)", pSelf.GetAddr(), streamType, streamIndex); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) + { + cellPamf->Error("cellPamfReaderSetStreamWithTypeAndIndex: CELL_PAMF_ERROR_INVALID_ARG"); return CELL_PAMF_ERROR_INVALID_ARG; + } const mem_ptr_t pAddr(pSelf->pAddr); @@ -394,11 +441,13 @@ int cellPamfReaderSetStreamWithTypeAndIndex(mem_ptr_t pSelf, u8 int cellPamfStreamTypeToEsFilterId(u8 type, u8 ch, mem_ptr_t pEsFilterId) { - cellPamf->Warning("cellPamfStreamTypeToEsFilterId(type=%d, ch=%d, pEsFilterId_addr=0x%x)", - type, ch, pEsFilterId.GetAddr()); + cellPamf->Warning("cellPamfStreamTypeToEsFilterId(type=%d, ch=%d, pEsFilterId_addr=0x%x)", type, ch, pEsFilterId.GetAddr()); if (!pEsFilterId.IsGood()) + { + cellPamf->Error("cellPamfStreamTypeToEsFilterId: CELL_PAMF_ERROR_INVALID_ARG"); return CELL_PAMF_ERROR_INVALID_ARG; + } return pamfStreamTypeToEsFilterId(type, ch, pEsFilterId); } @@ -408,18 +457,23 @@ int cellPamfReaderGetStreamIndex(mem_ptr_t pSelf) cellPamf->Log("cellPamfReaderGetStreamIndex(pSelf=0x%x)", pSelf.GetAddr()); if (!pSelf.IsGood()) + { + cellPamf->Error("cellPamfReaderGetStreamIndex: CELL_PAMF_ERROR_INVALID_ARG"); return CELL_PAMF_ERROR_INVALID_ARG; + } return pSelf->stream; } int cellPamfReaderGetStreamTypeAndChannel(mem_ptr_t pSelf, mem8_t pType, mem8_t pCh) { - cellPamf->Warning("cellPamfReaderGetStreamTypeAndChannel(pSelf=0x%x (stream=%d), pType_addr=0x%x, pCh_addr=0x%x", - pSelf.GetAddr(), pSelf->stream, pType.GetAddr(), pCh.GetAddr()); + cellPamf->Warning("cellPamfReaderGetStreamTypeAndChannel(pSelf=0x%x (stream=%d), pType_addr=0x%x, pCh_addr=0x%x", pSelf.GetAddr(), pSelf->stream, pType.GetAddr(), pCh.GetAddr()); if (!pSelf.IsGood() || !pCh.IsGood()) + { + cellPamf->Error("cellPamfReaderGetStreamTypeAndChannel: CELL_PAMF_ERROR_INVALID_ARG"); return CELL_PAMF_ERROR_INVALID_ARG; + } pType = pamfGetStreamType(pSelf, pSelf->stream); pCh = pamfGetStreamChannel(pSelf, pSelf->stream); @@ -428,11 +482,13 @@ int cellPamfReaderGetStreamTypeAndChannel(mem_ptr_t pSelf, mem8_ int cellPamfReaderGetEsFilterId(mem_ptr_t pSelf, mem_ptr_t pEsFilterId) { - cellPamf->Warning("cellPamfReaderGetEsFilterId(pSelf=0x%x (stream=%d), pEsFilterId_addr=0x%x)", - pSelf.GetAddr(), pSelf->stream, pEsFilterId.GetAddr()); + cellPamf->Warning("cellPamfReaderGetEsFilterId(pSelf=0x%x (stream=%d), pEsFilterId_addr=0x%x)", pSelf.GetAddr(), pSelf->stream, pEsFilterId.GetAddr()); if (!pSelf.IsGood() || !pEsFilterId.IsGood()) + { + cellPamf->Error("cellPamfReaderGetEsFilterId: CELL_PAMF_ERROR_INVALID_ARG"); return CELL_PAMF_ERROR_INVALID_ARG; + } return pamfStreamTypeToEsFilterId(pamfGetStreamType(pSelf, pSelf->stream), pamfGetStreamChannel(pSelf, pSelf->stream), pEsFilterId); @@ -440,11 +496,13 @@ int cellPamfReaderGetEsFilterId(mem_ptr_t pSelf, mem_ptr_t pSelf, u32 pInfo_addr, u32 size) { - cellPamf->Warning("cellPamfReaderGetStreamInfo(pSelf=0x%x (stream=%d), pInfo_addr=0x%x, size=%d)", - pSelf.GetAddr(), pSelf->stream, pInfo_addr, size); + cellPamf->Warning("cellPamfReaderGetStreamInfo(pSelf=0x%x, stream=%d, pInfo_addr=0x%x, size=%d)", pSelf.GetAddr(), pSelf->stream, pInfo_addr, size); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) + { + cellPamf->Error("cellPamfReaderGetStreamInfo: CELL_PAMF_ERROR_INVALID_ARG"); return CELL_PAMF_ERROR_INVALID_ARG; + } const mem_ptr_t pAddr(pSelf->pAddr); @@ -551,11 +609,13 @@ int cellPamfReaderGetStreamInfo(mem_ptr_t pSelf, u32 pInfo_addr, int cellPamfReaderGetNumberOfEp(mem_ptr_t pSelf) { - cellPamf->Warning("cellPamfReaderGetNumberOfEp(pSelf=0x%x (stream=%d))", - pSelf.GetAddr(), pSelf->stream); + cellPamf->Warning("cellPamfReaderGetNumberOfEp(pSelf=0x%x, stream=%d)", pSelf.GetAddr(), pSelf->stream); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) + { + cellPamf->Error("cellPamfReaderGetNumberOfEp: CELL_PAMF_ERROR_INVALID_ARG"); return CELL_PAMF_ERROR_INVALID_ARG; + } const mem_ptr_t pAddr(pSelf->pAddr); return pAddr->stream_headers[pSelf->stream].ep_num; @@ -563,11 +623,13 @@ int cellPamfReaderGetNumberOfEp(mem_ptr_t pSelf) int cellPamfReaderGetEpIteratorWithIndex(mem_ptr_t pSelf, u32 epIndex, mem_ptr_t pIt) { - cellPamf->Error("cellPamfReaderGetEpIteratorWithIndex(pSelf=0x%x (stream=%d), epIndex=%d, pIt_addr=0x%x)", - pSelf.GetAddr(), pSelf->stream, epIndex, pIt.GetAddr()); + cellPamf->Error("cellPamfReaderGetEpIteratorWithIndex(pSelf=0x%x, stream=%d, epIndex=%d, pIt_addr=0x%x)", pSelf.GetAddr(), pSelf->stream, epIndex, pIt.GetAddr()); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) + { + cellPamf->Error("cellPamfReaderGetEpIteratorWithIndex: CELL_PAMF_ERROR_INVALID_ARG"); return CELL_PAMF_ERROR_INVALID_ARG; + } const mem_ptr_t pAddr(pSelf->pAddr); //TODO: @@ -576,25 +638,30 @@ int cellPamfReaderGetEpIteratorWithIndex(mem_ptr_t pSelf, u32 ep int cellPamfReaderGetEpIteratorWithTimeStamp(mem_ptr_t pSelf, mem_ptr_t pTimeStamp, mem_ptr_t pIt) { - cellPamf->Error("cellPamfReaderGetEpIteratorWithTimeStamp(pSelf=0x%x, pTimeStamp_addr=0x%x, pIt_addr=0x%x)", - pSelf.GetAddr(), pTimeStamp.GetAddr(), pIt.GetAddr()); + cellPamf->Error("cellPamfReaderGetEpIteratorWithTimeStamp(pSelf=0x%x, pTimeStamp_addr=0x%x, pIt_addr=0x%x)", pSelf.GetAddr(), pTimeStamp.GetAddr(), pIt.GetAddr()); const mem_ptr_t pAddr(pSelf->pAddr); + //TODO: + return CELL_OK; } int cellPamfEpIteratorGetEp(mem_ptr_t pIt, mem_ptr_t pEp) { cellPamf->Error("cellPamfEpIteratorGetEp(pIt_addr=0x%x, pEp_addr=0x%x)", pIt.GetAddr(), pEp.GetAddr()); + //TODO: + return CELL_OK; } int cellPamfEpIteratorMove(mem_ptr_t pIt, s32 steps, mem_ptr_t pEp) { cellPamf->Error("cellPamfEpIteratorMove(pIt_addr=0x%x, steps=%d, pEp_addr=0x%x)", pIt.GetAddr(), steps, pEp.GetAddr()); + //TODO: + return CELL_OK; }