From 8fa843bbc317bcd62aca99edc138da7a81766fa0 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 10 Oct 2015 20:23:34 -0700 Subject: [PATCH] Atrac: attempt to power through bad frames. --- Core/HLE/sceAtrac.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Core/HLE/sceAtrac.cpp b/Core/HLE/sceAtrac.cpp index 870a6904e6..d873b4b2ec 100644 --- a/Core/HLE/sceAtrac.cpp +++ b/Core/HLE/sceAtrac.cpp @@ -102,6 +102,7 @@ enum AtracDecodeResult { ATDECODE_FAILED = -1, ATDECODE_FEEDME = 0, ATDECODE_GOTFRAME = 1, + ATDECODE_BADFRAME = 2, }; struct InputBuffer { @@ -387,8 +388,7 @@ struct Atrac { ERROR_LOG(ME, "Unsupported feature in ATRAC audio."); // Let's try the next packet. packet->size = 0; - // TODO: Or actually, should we return a blank frame and pretend it worked? - return ATDECODE_FEEDME; + return ATDECODE_BADFRAME; } else if (bytes_read < 0) { ERROR_LOG_REPORT(ME, "avcodec_decode_audio4: Error decoding audio %d / %08x", bytes_read, bytes_read); failedDecode = true; @@ -911,7 +911,7 @@ u32 _AtracDecodeData(int atracID, u8 *outbuf, u32 outbufPtr, u32 *SamplesNum, u3 } } } - if (res == ATDECODE_GOTFRAME) { + if (res == ATDECODE_GOTFRAME || res == ATDECODE_BADFRAME) { // We only want one frame per call, let's continue the next time. break; } @@ -2110,6 +2110,8 @@ static int sceAtracLowLevelDecode(int atracID, u32 sourceAddr, u32 sourceBytesCo ERROR_LOG(ME, "swr_convert: Error while converting %d", avret); } break; + } else if (res == ATDECODE_BADFRAME) { + break; } } }