Correctly read the epmap from the right place.

This commit is contained in:
Unknown W. Brackets 2014-01-10 12:57:40 -08:00
parent 26a700df57
commit 4a4f89eeac

View File

@ -202,7 +202,7 @@ public:
this->channel = channel;
}
void readMPEGVideoStreamParams(u32 addr, Psmf *psmf) {
void readMPEGVideoStreamParams(u32 addr, u32 data, Psmf *psmf) {
int streamId = Memory::Read_U8(addr);
int privateStreamId = Memory::Read_U8(addr + 1);
// two unknowns here
@ -214,12 +214,12 @@ public:
const u32 EP_MAP_STRIDE = 1 + 1 + 4 + 4;
psmf->EPMap.clear();
for (u32 i = 0; i < psmf->EPMapEntriesNum; i++) {
const u32 entryAddr = addr + psmf->EPMapOffset + EP_MAP_STRIDE * i;
const u32 entryAddr = data + psmf->EPMapOffset + EP_MAP_STRIDE * i;
PsmfEntry entry;
entry.EPIndex = Memory::Read_U8(entryAddr + 0);
entry.EPPicOffset = Memory::Read_U8(entryAddr + 1);
entry.EPPts = Memory::Read_U32(entryAddr + 2);
entry.EPOffset = Memory::Read_U32(entryAddr + 6);
entry.EPPts = *(u32_be*) Memory::GetPointer(entryAddr + 2);
entry.EPOffset = *(u32_be*) Memory::GetPointer(entryAddr + 6);
psmf->EPMap.push_back(entry);
}
@ -275,7 +275,7 @@ Psmf::Psmf(u32 data) {
int streamId = Memory::Read_U8(currentStreamAddr);
if ((streamId & PSMF_VIDEO_STREAM_ID) == PSMF_VIDEO_STREAM_ID) {
stream = new PsmfStream(PSMF_AVC_STREAM, ++currentVideoStreamNum);
stream->readMPEGVideoStreamParams(currentStreamAddr, this);
stream->readMPEGVideoStreamParams(currentStreamAddr, data, this);
} else if ((streamId & PSMF_AUDIO_STREAM_ID) == PSMF_AUDIO_STREAM_ID) {
stream = new PsmfStream(PSMF_ATRAC_STREAM, ++currentAudioStreamNum);
stream->readPrivateAudioStreamParams(currentStreamAddr, this);
@ -759,7 +759,7 @@ u32 scePsmfCheckEPMap(u32 psmfStruct)
}
DEBUG_LOG(ME, "scePsmfCheckEPMap(%08x)", psmfStruct);
return 0; // Should be okay according to JPCSP
return psmf->EPMap.empty() ? ERROR_PSMF_NOT_FOUND : 0;
}
u32 scePsmfGetEPWithId(u32 psmfStruct, int epid, u32 entryAddr)