mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-15 07:20:31 +02:00
sceMpegBasePESpacketCopy used to gather each DMA into a buffer filed under the address of its first block, and sceVideocodecDecode looked one up by the address it was handed. That works only while an access unit arrives in a single call. It doesn't: mpeg.prx routinely DMAs one in several pieces at consecutive addresses, and the table then kept whichever piece happened to start where the decode later asked, and dropped the rest. So the DMA now writes each block at the address it names. The Media Engine's own memory moves to its real addresses - low ones, which mpeg.prx bounds-checks against 0x3FFFFF - and pieces written at consecutive addresses end up consecutive, which is all this ever needed. Our own allocations move to the top half, away from the addresses mpeg.prx picks for itself. That memory is the ME's, not the Allegrex's, and the two are separate address spaces: on hardware only the ME reaches it, so here it is a buffer of our own that nothing emulated can address. It gets its own MEIsValidRange and MEGetPointerRange rather than borrowing Memory::, which answers for the Allegrex's memory and has nothing to say about this one. An address only means something together with the space it came from, and mpeg.prx hands over bare integers. The three places that have to work it out from the value now ask the ME first, where they used to ask Memory:: first and so read every address as the CPU's. It separates the addresses these callers actually pass (ME memory well down in the first megabyte, PSP RAM at 0x08000000 and up), but that's those callers rather than a rule. Savestates from before this carry the old packet table; it's read and dropped, since the Media Engine's memory is saved and that's where the payloads live now. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>