u32 scePsmfGetNumberOfSpecificStreams(u32 psmfStruct, u32 streamType) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { ERROR_LOG(HLE, "scePsmfGetNumberOfSpecificStreams - invalid psmf"); return ERROR_PSMF_NOT_FOUND; } INFO_LOG(HLE, "scePsmfGetNumberOfSpecificStreams(%08x, %08x)", psmfStruct, streamType); return 1; }
u32 scePsmfGetPsmfVersion(u32 psmfStruct) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { ERROR_LOG(HLE, "scePsmfGetHeaderSize(%08x): invalid psmf", psmfStruct); return ERROR_PSMF_NOT_FOUND; } DEBUG_LOG(HLE, "scePsmfGetPsmfVersion(%08x)", psmfStruct); return psmf->version; }
u32 scePsmfSpecifyStream(u32 psmfStruct, int streamNum) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { ERROR_LOG(HLE, "scePsmfSpecifyStream(%08x, %i): invalid psmf", psmfStruct, streamNum); return ERROR_PSMF_NOT_FOUND; } INFO_LOG(HLE, "scePsmfSpecifyStream(%08x, %i)", psmfStruct, streamNum); psmf->setStreamNum(streamNum); return 0; }
u32 scePsmfGetNumberOfStreams(u32 psmfStruct) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { ERROR_LOG(HLE, "scePsmfGetNumberOfStreams(%08x): invalid psmf", psmfStruct); return ERROR_PSMF_NOT_FOUND; } DEBUG_LOG(HLE, "scePsmfGetNumberOfStreams(%08x)", psmfStruct); return psmf->numStreams; }
u32 scePsmfGetNumberOfEPentries(u32 psmfStruct) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { ERROR_LOG(HLE, "scePsmfGetNumberOfEPentries(%08x): invalid psmf", psmfStruct); return ERROR_PSMF_NOT_FOUND; } DEBUG_LOG(HLE, "scePsmfGetNumberOfEPentries(%08x)", psmfStruct); return psmf->EPMapEntriesNum; }
u32 scePsmfSpecifyStreamWithStreamTypeNumber(u32 psmfStruct, u32 streamType, u32 typeNum) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { ERROR_LOG(HLE, "scePsmfSpecifyStream - invalid psmf"); return ERROR_PSMF_NOT_FOUND; } ERROR_LOG(HLE, "UNIMPL scePsmfSpecifyStreamWithStreamTypeNumber(%08x, %08x, %08x)", psmfStruct, streamType, typeNum); return 0; }
u32 scePsmfGetCurrentStreamNumber(u32 psmfStruct) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { ERROR_LOG(HLE, "scePsmfGetCurrentStreamNumber(%08x): invalid psmf", psmfStruct); return ERROR_PSMF_NOT_FOUND; } DEBUG_LOG(HLE, "scePsmfGetCurrentStreamNumber(%08x)", psmfStruct); return psmf->currentStreamNum; }
u32 scePsmfGetVideoInfo(u32 psmfStruct, u32 videoInfoAddr) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { ERROR_LOG(HLE, "scePsmfGetVideoInfo(%08x, %08x): invalid psmf", psmfStruct, videoInfoAddr); return ERROR_PSMF_NOT_FOUND; } INFO_LOG(HLE, "scePsmfGetVideoInfo(%08x, %08x)", psmfStruct, videoInfoAddr); if (Memory::IsValidAddress(videoInfoAddr)) { Memory::Write_U32(psmf->videoWidth, videoInfoAddr); Memory::Write_U32(psmf->videoHeight, videoInfoAddr + 4); } return 0; }
u32 scePsmfSpecifyStreamWithStreamType(u32 psmfStruct, u32 streamType, u32 channel) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { ERROR_LOG(HLE, "scePsmfSpecifyStreamWithStreamType(%08x, %08x, %i): invalid psmf", psmfStruct, streamType, channel); return ERROR_PSMF_NOT_FOUND; } INFO_LOG(HLE, "scePsmfSpecifyStreamWithStreamType(%08x, %08x, %i)", psmfStruct, streamType, channel); if (!psmf->setStreamWithType(streamType, channel)) { psmf->setStreamNum(-1); } return 0; }
u32 scePsmfGetPresentationStartTime(u32 psmfStruct, u32 startTimeAddr) { DEBUG_LOG(HLE, "scePsmfGetPresentationStartTime(%08x, %08x)", psmfStruct, startTimeAddr); Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { ERROR_LOG(HLE, "scePsmfGetPresentationStartTime - invalid psmf"); return ERROR_PSMF_NOT_FOUND; } if (Memory::IsValidAddress(startTimeAddr)) { Memory::Write_U32(psmf->presentationStartTime, startTimeAddr); } return 0; }
u32 scePsmfGetHeaderSize(u32 psmfStruct, u32 sizeAddr) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { ERROR_LOG(HLE, "scePsmfGetHeaderSize(%08x, %08x): invalid psmf", psmfStruct, sizeAddr); return ERROR_PSMF_NOT_FOUND; } DEBUG_LOG(HLE, "scePsmfGetHeaderSize(%08x, %08x)", psmfStruct, sizeAddr); if (Memory::IsValidAddress(sizeAddr)) { Memory::Write_U32(psmf->headerSize, sizeAddr); } return 0; }
u32 scePsmfGetAudioInfo(u32 psmfStruct, u32 audioInfoAddr) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { ERROR_LOG(HLE, "scePsmfGetAudioInfo(%08x, %08x): invalid psmf", psmfStruct, audioInfoAddr); return ERROR_PSMF_NOT_FOUND; } INFO_LOG(HLE, "scePsmfGetAudioInfo(%08x, %08x)", psmfStruct, audioInfoAddr); if (Memory::IsValidAddress(audioInfoAddr)) { Memory::Write_U32(psmf->audioChannels, audioInfoAddr); Memory::Write_U32(psmf->audioFrequency, audioInfoAddr + 4); } return 0; }
u32 scePsmfGetPresentationEndTime(u32 psmfStruct, u32 endTimeAddr) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { ERROR_LOG(HLE, "scePsmfGetPresentationEndTime(%08x, %08x): invalid psmf", psmfStruct, endTimeAddr); return ERROR_PSMF_NOT_FOUND; } DEBUG_LOG(HLE, "scePsmfGetPresentationEndTime(%08x, %08x)", psmfStruct, endTimeAddr); if (Memory::IsValidAddress(endTimeAddr)) { Memory::Write_U32(psmf->presentationEndTime, endTimeAddr); } return 0; }
u32 scePsmfGetEPidWithTimestamp(u32 psmfStruct, u32 ts) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { ERROR_LOG(HLE, "scePsmfGetEPidWithTimestamp(%08x, %i): invalid psmf", psmfStruct, ts); return ERROR_PSMF_NOT_FOUND; } DEBUG_LOG(HLE, "scePsmfGetEPidWithTimestamp(%08x, %i)", psmfStruct, ts); if (ts < psmf->presentationStartTime) { return ERROR_PSMF_INVALID_TIMESTAMP; } return psmf->psmfEntry.id; }
u32 scePsmfSpecifyStreamWithStreamTypeNumber(u32 psmfStruct, u32 streamType, u32 typeNum) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { ERROR_LOG(HLE, "scePsmfSpecifyStreamWithStreamTypeNumber(%08x, %08x, %08x): invalid psmf", psmfStruct, streamType, typeNum); return ERROR_PSMF_NOT_FOUND; } INFO_LOG_REPORT(HLE, "scePsmfSpecifyStreamWithStreamTypeNumber(%08x, %08x, %08x)", psmfStruct, streamType, typeNum); // right now typeNum and channel are the same... if (!psmf->setStreamWithType(streamType, typeNum)) { psmf->setStreamNum(-1); } return 0; }
u32 scePsmfGetEPWithId(u32 psmfStruct, int id, u32 outAddr) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { ERROR_LOG(HLE, "scePsmfGetEPWithId(%08x, %i, %08x): invalid psmf", psmfStruct, id, outAddr); return ERROR_PSMF_NOT_FOUND; } DEBUG_LOG(HLE, "scePsmfGetEPWithId(%08x, %i, %08x)", psmfStruct, id, outAddr); if (Memory::IsValidAddress(outAddr)) { Memory::Write_U32(psmf->psmfEntry.EPPts, outAddr); Memory::Write_U32(psmf->psmfEntry.EPOffset, outAddr + 4); Memory::Write_U32(psmf->psmfEntry.EPIndex, outAddr + 8); Memory::Write_U32(psmf->psmfEntry.EPPicOffset, outAddr + 12); } return 0; }
u32 scePsmfGetNumberOfSpecificStreams(u32 psmfStruct, int streamType) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { ERROR_LOG(HLE, "scePsmfGetNumberOfSpecificStreams(%08x, %08x): invalid psmf", psmfStruct, streamType); return ERROR_PSMF_NOT_FOUND; } WARN_LOG(HLE, "scePsmfGetNumberOfSpecificStreams(%08x, %08x)", psmfStruct, streamType); int streamNum = 0; int type = (streamType == PSMF_AUDIO_STREAM ? PSMF_ATRAC_STREAM : streamType); for (int i = (int)psmf->streamMap.size() - 1; i >= 0; i--) { if (psmf->streamMap[i]->type == type) streamNum++; } return streamNum; }
u32 scePsmfGetCurrentStreamType(u32 psmfStruct, u32 typeAddr, u32 channelAddr) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { ERROR_LOG(HLE, "scePsmfGetCurrentStreamType(%08x, %08x, %08x): invalid psmf", psmfStruct, typeAddr, channelAddr); return ERROR_PSMF_NOT_FOUND; } INFO_LOG(HLE, "scePsmfGetCurrentStreamType(%08x, %08x, %08x)", psmfStruct, typeAddr, channelAddr); if (Memory::IsValidAddress(typeAddr)) { u32 type = 0, channel = 0; if (psmf->streamMap.find(psmf->currentStreamNum) != psmf->streamMap.end()) type = psmf->streamMap[psmf->currentStreamNum]->type; if (psmf->streamMap.find(psmf->currentStreamNum) != psmf->streamMap.end()) channel = psmf->streamMap[psmf->currentStreamNum]->channel; Memory::Write_U32(type, typeAddr); Memory::Write_U32(channel, channelAddr); } return 0; }
u32 scePsmfGetEPWithTimestamp(u32 psmfStruct, u32 ts, u32 entryAddr) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { ERROR_LOG(HLE, "scePsmfGetEPWithTimestamp(%08x, %i, %08x): invalid psmf", psmfStruct, ts, entryAddr); return ERROR_PSMF_NOT_FOUND; } DEBUG_LOG(HLE, "scePsmfGetEPWithTimestamp(%08x, %i, %08x)", psmfStruct, ts, entryAddr); if (ts < psmf->presentationStartTime) { return ERROR_PSMF_INVALID_TIMESTAMP; } if (Memory::IsValidAddress(entryAddr)) { Memory::Write_U32(psmf->psmfEntry.EPPts, entryAddr); Memory::Write_U32(psmf->psmfEntry.EPOffset, entryAddr + 4); Memory::Write_U32(psmf->psmfEntry.EPIndex, entryAddr + 8); Memory::Write_U32(psmf->psmfEntry.EPPicOffset, entryAddr + 12); } return 0; }