Try to fix 'avail' test

This commit is contained in:
sum2012
2026-06-07 20:27:06 +08:00
parent dad0707412
commit b26dcb3f9a
+6 -1
View File
@@ -1376,7 +1376,12 @@ static int sceMpegRingbufferAvailableSize(u32 ringbufferAddr) {
}
ctx->mpegRingbufferAddr = ringbufferAddr;
if (ctx->mediaengine) {
// PPSSPP doesn't have a fully asynchronous Media Engine thread to constantly drain the buffer.
// Games like Ridge Racer 2 rely on this function to implicitly update the available size.
// However, we must NOT overwrite packetsAvail if the stream hasn't been initialized/analyzed yet.
// This protects manual struct modifications (like in the 'avail' test) prior to stream playback.
if (ctx->mediaengine && ctx->isAnalyzed) {
ringbuffer->packetsAvail = ringbuffer->packets - ctx->mediaengine->getRemainSize() / 2048;
}