sceMpegRingbufferPut fix (Handle numPackets <= 0)

This commit is contained in:
sum2012 2013-03-14 00:32:09 +08:00
parent 30df95c5e7
commit 024a61e058

View File

@ -1044,11 +1044,14 @@ u32 sceMpegRingbufferPut(u32 ringbufferAddr, u32 numPackets, u32 available)
return 0;
}
numPackets = std::min(numPackets, available);
if (numPackets <= 0) {
ERROR_LOG(HLE, "zero or sub-zero number of packets put");
return 0;
}
SceMpegRingBuffer ringbuffer;
Memory::ReadStruct(ringbufferAddr, &ringbuffer);
numPackets = std::min(numPackets, available);
MpegContext *ctx = getMpegCtx(ringbuffer.mpeg);
if (!ctx) {
WARN_LOG(HLE, "sceMpegRingbufferPut(%08x, %i, %i): bad mpeg handle %08x", ringbufferAddr, numPackets, available, ringbuffer.mpeg);