diff --git a/Core/HLE/sceAtrac.cpp b/Core/HLE/sceAtrac.cpp index 819142ef72..0502c37155 100644 --- a/Core/HLE/sceAtrac.cpp +++ b/Core/HLE/sceAtrac.cpp @@ -318,8 +318,8 @@ struct Atrac { p.Do(resetBuffer_); } - int Analyze(); - int AnalyzeAA3(); + int Analyze(u32 addr, u32 size); + int AnalyzeAA3(u32 addr, u32 size, u32 filesize); u32 SamplesPerFrame() const { return codecType_ == PSP_MODE_AT_3_PLUS ? ATRAC3PLUS_MAX_SAMPLES : ATRAC3_MAX_SAMPLES; @@ -665,7 +665,10 @@ struct RIFFFmtChunk { u16_le blockAlign; }; -int Atrac::Analyze() { +int Atrac::Analyze(u32 addr, u32 size) { + first_.addr = addr; + first_.size = size; + AnalyzeReset(); // 72 is about the size of the minimum required data to even be valid. @@ -851,7 +854,11 @@ int Atrac::Analyze() { return 0; } -int Atrac::AnalyzeAA3() { +int Atrac::AnalyzeAA3(u32 addr, u32 size, u32 filesize) { + first_.addr = addr; + first_.size = size; + first_.filesize = filesize; + AnalyzeReset(); if (first_.size < 10) { @@ -1565,7 +1572,7 @@ static u32 sceAtracReleaseAtracID(int atracID) { if (result < 0) { return hleLogError(ME, result, "did not exist"); } - return hleLogSuccessI(ME, result); + return hleLogSuccessInfoI(ME, result); } // This is called when a game wants to seek (or "reset") to a specific position in the audio data. @@ -1690,8 +1697,7 @@ int __AtracSetContext(Atrac *atrac) { } else if (atrac->codecType_ == PSP_MODE_AT_3_PLUS) { ff_codec = AV_CODEC_ID_ATRAC3P; } else { - ERROR_LOG_REPORT(ME, "Unexpected codec type %d", atrac->codecType_); - return -1; + return hleReportError(ME, ATRAC_ERROR_UNKNOWN_FORMAT, "unknown codec type in set context"); } const AVCodec *codec = avcodec_find_decoder(ff_codec); @@ -1719,11 +1725,9 @@ int __AtracSetContext(Atrac *atrac) { atrac->codecCtx_->channels = 2; atrac->codecCtx_->channel_layout = AV_CH_LAYOUT_STEREO; } else { - ERROR_LOG_REPORT(ME, "Unexpected channel count %d", atrac->channels_); - return -1; + return hleReportError(ME, ATRAC_ERROR_UNKNOWN_FORMAT, "unknown channel layout in set context"); } - // Explicitly set the block_align value (needed by newer FFmpeg versions, see #5772.) if (atrac->codecCtx_->block_align == 0) { atrac->codecCtx_->block_align = atrac->bytesPerFrame_; @@ -1734,13 +1738,12 @@ int __AtracSetContext(Atrac *atrac) { atrac->codecCtx_->request_sample_fmt = AV_SAMPLE_FMT_S16; int ret; if ((ret = avcodec_open2(atrac->codecCtx_, codec, nullptr)) < 0) { - ERROR_LOG(ME, "avcodec_open2: Cannot open audio decoder %d", ret); // This can mean that the frame size is wrong or etc. - return ATRAC_ERROR_BAD_CODEC_PARAMS; + return hleLogError(ME, ATRAC_ERROR_BAD_CODEC_PARAMS, "failed to open decoder %d", ret); } if ((ret = __AtracUpdateOutputMode(atrac, atrac->outputChannels_)) < 0) - return ret; + return hleLogError(ME, ret, "failed to set the output mode"); // alloc audio frame atrac->frame_ = av_frame_alloc(); @@ -1755,7 +1758,10 @@ int __AtracSetContext(Atrac *atrac) { return 0; } -static int _AtracSetData(Atrac *atrac, u32 buffer, u32 bufferSize) { +static int _AtracSetData(Atrac *atrac, u32 buffer, u32 readSize, u32 bufferSize) { + atrac->first_.addr = buffer; + atrac->first_.size = readSize; + if (atrac->first_.size > atrac->first_.filesize) atrac->first_.size = atrac->first_.filesize; atrac->first_.fileoffset = atrac->first_.size; @@ -1769,6 +1775,12 @@ static int _AtracSetData(Atrac *atrac, u32 buffer, u32 bufferSize) { atrac->ResetData(); atrac->SetBufferState(); + if (atrac->codecType_ != PSP_MODE_AT_3 && atrac->codecType_ != PSP_MODE_AT_3_PLUS) { + // Shouldn't have gotten here, Analyze() checks this. + atrac->bufferState_ = ATRAC_STATUS_NO_DATA; + return hleReportError(ME, ATRAC_ERROR_UNKNOWN_FORMAT, "unexpected codec type in set data"); + } + if (atrac->bufferState_ == ATRAC_STATUS_ALL_DATA_LOADED || atrac->bufferState_ == ATRAC_STATUS_HALFWAY_BUFFER) { // This says, don't use the dataBuf_ array, use the PSP RAM. // This way, games can load data async into the buffer, and it still works. @@ -1776,71 +1788,50 @@ static int _AtracSetData(Atrac *atrac, u32 buffer, u32 bufferSize) { atrac->ignoreDataBuf_ = true; } - if (atrac->codecType_ == PSP_MODE_AT_3) { - if (atrac->channels_ == 1) { - WARN_LOG(ME, "This is an atrac3 mono audio"); - } else { - WARN_LOG(ME, "This is an atrac3 stereo audio"); - } + const char *codecName = atrac->codecType_ == PSP_MODE_AT_3 ? "atrac3" : "atrac3+"; + const char *channelName = atrac->channels_ == 1 ? "mono" : "stereo"; - atrac->dataBuf_ = new u8[atrac->first_.filesize]; - if (!atrac->ignoreDataBuf_) { - u32 copybytes = std::min(bufferSize, atrac->first_.filesize); - Memory::Memcpy(atrac->dataBuf_, buffer, copybytes); - } - return __AtracSetContext(atrac); - - } else if (atrac->codecType_ == PSP_MODE_AT_3_PLUS) { - if (atrac->channels_ == 1) { - WARN_LOG(ME, "This is an atrac3+ mono audio"); - } else { - WARN_LOG(ME, "This is an atrac3+ stereo audio"); - } - atrac->dataBuf_ = new u8[atrac->first_.filesize]; - if (!atrac->ignoreDataBuf_) { - u32 copybytes = std::min(bufferSize, atrac->first_.filesize); - Memory::Memcpy(atrac->dataBuf_, buffer, copybytes); - } - return __AtracSetContext(atrac); - } else { - // Should not get here, but just in case, force it. - atrac->bufferState_ = ATRAC_STATUS_NO_DATA; + atrac->dataBuf_ = new u8[atrac->first_.filesize]; + if (!atrac->ignoreDataBuf_) { + u32 copybytes = std::min(bufferSize, atrac->first_.filesize); + Memory::Memcpy(atrac->dataBuf_, buffer, copybytes); } - - return 0; + int ret = __AtracSetContext(atrac); + if (ret < 0) { + // Already logged. + return ret; + } + return hleLogSuccessInfoI(ME, ret, "%s %s audio", codecName, channelName); } -static int _AtracSetData(int atracID, u32 buffer, u32 bufferSize, bool needReturnAtracID = false) { +static int _AtracSetData(int atracID, u32 buffer, u32 readSize, u32 bufferSize, bool needReturnAtracID = false) { Atrac *atrac = getAtrac(atracID); if (!atrac) - return -1; - int ret = _AtracSetData(atrac, buffer, bufferSize); + return hleLogError(ME, ATRAC_ERROR_BAD_ATRACID, "invalid atrac ID"); + int ret = _AtracSetData(atrac, buffer, readSize, bufferSize); if (needReturnAtracID && ret >= 0) ret = atracID; // not sure the real delay time return hleDelayResult(ret, "atrac set data", 100); } -static u32 sceAtracSetHalfwayBuffer(int atracID, u32 halfBuffer, u32 readSize, u32 halfBufferSize) { +static u32 sceAtracSetHalfwayBuffer(int atracID, u32 buffer, u32 readSize, u32 bufferSize) { Atrac *atrac = getAtrac(atracID); if (!atrac) { - ERROR_LOG(ME, "sceAtracSetHalfwayBuffer(%i, %08x, %8x, %8x): bad atrac ID", atracID, halfBuffer, readSize, halfBufferSize); - return ATRAC_ERROR_BAD_ATRACID; + return hleLogError(ME, ATRAC_ERROR_BAD_ATRACID, "bad atrac ID"); + } + if (readSize > bufferSize) { + return hleLogError(ME, ATRAC_ERROR_INCORRECT_READ_SIZE, "read size too large"); } - INFO_LOG(ME, "sceAtracSetHalfwayBuffer(%i, %08x, %8x, %8x)", atracID, halfBuffer, readSize, halfBufferSize); - if (readSize > halfBufferSize) - return ATRAC_ERROR_INCORRECT_READ_SIZE; - - atrac->first_.addr = halfBuffer; - atrac->first_.size = readSize; - int ret = atrac->Analyze(); + int ret = atrac->Analyze(buffer, readSize); if (ret < 0) { // Already logged. return ret; } + atrac->outputChannels_ = 2; - return _AtracSetData(atracID, halfBuffer, halfBufferSize); + return _AtracSetData(atracID, buffer, readSize, bufferSize); } static u32 sceAtracSetSecondBuffer(int atracID, u32 secondBuffer, u32 secondBufferSize) { @@ -1871,25 +1862,23 @@ static u32 sceAtracSetSecondBuffer(int atracID, u32 secondBuffer, u32 secondBuff static u32 sceAtracSetData(int atracID, u32 buffer, u32 bufferSize) { Atrac *atrac = getAtrac(atracID); - if (atrac != NULL) { - INFO_LOG(ME, "sceAtracSetData(%i, %08x, %08x)", atracID, buffer, bufferSize); - atrac->first_.addr = buffer; - atrac->first_.size = bufferSize; - int ret = atrac->Analyze(); - if (ret < 0) { - // Already logged. - } else if (atrac->codecType_ != atracIDTypes[atracID]) { - ERROR_LOG_REPORT(ME, "sceAtracSetData(%i, %08x, %08x): atracID uses different codec type than data", atracID, buffer, bufferSize); - ret = ATRAC_ERROR_WRONG_CODECTYPE; - } else { - atrac->outputChannels_ = 2; - ret = _AtracSetData(atracID, buffer, bufferSize); - } - return ret; - } else { - ERROR_LOG(ME, "sceAtracSetData(%i, %08x, %08x): bad atrac ID", atracID, buffer, bufferSize); - return ATRAC_ERROR_BAD_ATRACID; + if (!atrac) { + return hleLogError(ME, ATRAC_ERROR_BAD_ATRACID, "bad atrac ID"); } + + int ret = atrac->Analyze(buffer, bufferSize); + if (ret < 0) { + // Already logged. + return ret; + } + + if (atrac->codecType_ != atracIDTypes[atracID]) { + // TODO: Should this not change the buffer size? + return hleReportError(ME, ATRAC_ERROR_WRONG_CODECTYPE, "atracID uses different codec type than data"); + } + + atrac->outputChannels_ = 2; + return _AtracSetData(atracID, buffer, bufferSize, bufferSize); } static int sceAtracSetDataAndGetID(u32 buffer, int bufferSize) { @@ -1899,49 +1888,43 @@ static int sceAtracSetDataAndGetID(u32 buffer, int bufferSize) { WARN_LOG(ME, "sceAtracSetDataAndGetID(%08x, %08x): negative bufferSize", buffer, bufferSize); bufferSize = 0x10000000; } + Atrac *atrac = new Atrac(); - atrac->first_.addr = buffer; - atrac->first_.size = bufferSize; - int ret = atrac->Analyze(); + int ret = atrac->Analyze(buffer, bufferSize); if (ret < 0) { // Already logged. delete atrac; return ret; } - atrac->outputChannels_ = 2; int atracID = createAtrac(atrac); if (atracID < 0) { - ERROR_LOG(ME, "sceAtracSetDataAndGetID(%08x, %08x): no free ID", buffer, bufferSize); delete atrac; - return atracID; + return hleLogError(ME, atracID, "no free ID"); } - INFO_LOG(ME, "%d=sceAtracSetDataAndGetID(%08x, %08x)", atracID, buffer, bufferSize); - return _AtracSetData(atracID, buffer, bufferSize, true); + + atrac->outputChannels_ = 2; + return _AtracSetData(atracID, buffer, bufferSize, bufferSize, true); } -static int sceAtracSetHalfwayBufferAndGetID(u32 halfBuffer, u32 readSize, u32 halfBufferSize) { - if (readSize > halfBufferSize) { - ERROR_LOG(ME, "sceAtracSetHalfwayBufferAndGetID(%08x, %08x, %08x): incorrect read size", halfBuffer, readSize, halfBufferSize); - return ATRAC_ERROR_INCORRECT_READ_SIZE; +static int sceAtracSetHalfwayBufferAndGetID(u32 buffer, u32 readSize, u32 bufferSize) { + if (readSize > bufferSize) { + return hleLogError(ME, ATRAC_ERROR_INCORRECT_READ_SIZE, "read size too large"); } Atrac *atrac = new Atrac(); - atrac->first_.addr = halfBuffer; - atrac->first_.size = readSize; - int ret = atrac->Analyze(); + int ret = atrac->Analyze(buffer, readSize); if (ret < 0) { // Already logged. delete atrac; return ret; } - atrac->outputChannels_ = 2; int atracID = createAtrac(atrac); if (atracID < 0) { - ERROR_LOG(ME, "sceAtracSetHalfwayBufferAndGetID(%08x, %08x, %08x): no free ID", halfBuffer, readSize, halfBufferSize); delete atrac; - return atracID; + return hleLogError(ME, atracID, "no free ID"); } - INFO_LOG(ME, "%d=sceAtracSetHalfwayBufferAndGetID(%08x, %08x, %08x)", atracID, halfBuffer, readSize, halfBufferSize); - return _AtracSetData(atracID, halfBuffer, halfBufferSize, true); + + atrac->outputChannels_ = 2; + return _AtracSetData(atracID, buffer, readSize, bufferSize, true); } static u32 sceAtracStartEntry() { @@ -2056,131 +2039,104 @@ static int sceAtracIsSecondBufferNeeded(int atracID) { static int sceAtracSetMOutHalfwayBuffer(int atracID, u32 buffer, u32 readSize, u32 bufferSize) { Atrac *atrac = getAtrac(atracID); if (!atrac) { - ERROR_LOG(ME, "sceAtracSetMOutHalfwayBuffer(%i, %08x, %08x, %08x): bad atrac ID", atracID, buffer, readSize, bufferSize); - return ATRAC_ERROR_BAD_ATRACID; + return hleLogError(ME, ATRAC_ERROR_BAD_ATRACID, "bad atrac ID"); + } + if (readSize > bufferSize) { + return hleLogError(ME, ATRAC_ERROR_INCORRECT_READ_SIZE, "read size too large"); } - INFO_LOG(ME, "sceAtracSetMOutHalfwayBuffer(%i, %08x, %08x, %08x)", atracID, buffer, readSize, bufferSize); - if (readSize > bufferSize) - return ATRAC_ERROR_INCORRECT_READ_SIZE; - - atrac->first_.addr = buffer; - atrac->first_.size = readSize; - int ret = atrac->Analyze(); + int ret = atrac->Analyze(buffer, readSize); if (ret < 0) { // Already logged. return ret; } if (atrac->channels_ != 1) { - ERROR_LOG_REPORT(ME, "sceAtracSetMOutHalfwayBuffer(%i, %08x, %08x, %08x): not mono data", atracID, buffer, readSize, bufferSize); - ret = ATRAC_ERROR_NOT_MONO; // It seems it still sets the data. atrac->outputChannels_ = 2; - _AtracSetData(atrac, buffer, bufferSize); - return ret; + _AtracSetData(atrac, buffer, readSize, bufferSize); + return hleReportError(ME, ATRAC_ERROR_NOT_MONO, "not mono data"); } else { atrac->outputChannels_ = 1; - ret = _AtracSetData(atracID, buffer, bufferSize); + ret = _AtracSetData(atracID, buffer, readSize, bufferSize); } return ret; } +// Note: This doesn't seem to be part of any available libatrac3plus library. static u32 sceAtracSetMOutData(int atracID, u32 buffer, u32 bufferSize) { Atrac *atrac = getAtrac(atracID); if (!atrac) { - ERROR_LOG(ME, "sceAtracSetMOutData(%i, %08x, %08x): bad atrac ID", atracID, buffer, bufferSize); - return ATRAC_ERROR_BAD_ATRACID; + return hleLogError(ME, ATRAC_ERROR_BAD_ATRACID, "bad atrac ID"); } - // This doesn't seem to be part of any available libatrac3plus library. - WARN_LOG_REPORT(ME, "sceAtracSetMOutData(%i, %08x, %08x)", atracID, buffer, bufferSize); - - int ret = 0; - atrac->first_.addr = buffer; - atrac->first_.size = bufferSize; - ret = atrac->Analyze(); + int ret = atrac->Analyze(buffer, bufferSize); if (ret < 0) { // Already logged. return ret; } if (atrac->channels_ != 1) { - ERROR_LOG_REPORT(ME, "sceAtracSetMOutData(%i, %08x, %08x): not mono data", atracID, buffer, bufferSize); - ret = ATRAC_ERROR_NOT_MONO; // It seems it still sets the data. atrac->outputChannels_ = 2; - _AtracSetData(atrac, buffer, bufferSize); - // Not sure of the real delay time. - return ret; + _AtracSetData(atrac, buffer, bufferSize, bufferSize); + return hleReportError(ME, ATRAC_ERROR_NOT_MONO, "not mono data"); } else { atrac->outputChannels_ = 1; - ret = _AtracSetData(atracID, buffer, bufferSize); + ret = _AtracSetData(atracID, buffer, bufferSize, bufferSize); } return ret; } +// Note: This doesn't seem to be part of any available libatrac3plus library. static int sceAtracSetMOutDataAndGetID(u32 buffer, u32 bufferSize) { Atrac *atrac = new Atrac(); - atrac->first_.addr = buffer; - atrac->first_.size = bufferSize; - int ret = atrac->Analyze(); + int ret = atrac->Analyze(buffer, bufferSize); if (ret < 0) { // Already logged. delete atrac; return ret; } if (atrac->channels_ != 1) { - ERROR_LOG_REPORT(ME, "sceAtracSetMOutDataAndGetID(%08x, %08x): not mono data", buffer, bufferSize); delete atrac; - return ATRAC_ERROR_NOT_MONO; + return hleReportError(ME, ATRAC_ERROR_NOT_MONO, "not mono data"); } - atrac->outputChannels_ = 1; int atracID = createAtrac(atrac); if (atracID < 0) { - ERROR_LOG(ME, "sceAtracSetMOutDataAndGetID(%08x, %08x): no free ID", buffer, bufferSize); delete atrac; - return atracID; + return hleLogError(ME, atracID, "no free ID"); } - // This doesn't seem to be part of any available libatrac3plus library. - WARN_LOG_REPORT(ME, "%d=sceAtracSetMOutDataAndGetID(%08x, %08x)", atracID, buffer, bufferSize); - return _AtracSetData(atracID, buffer, bufferSize, true); + + atrac->outputChannels_ = 1; + return _AtracSetData(atracID, buffer, bufferSize, bufferSize, true); } -static int sceAtracSetMOutHalfwayBufferAndGetID(u32 halfBuffer, u32 readSize, u32 halfBufferSize) { - if (readSize > halfBufferSize) { - ERROR_LOG(ME, "sceAtracSetMOutHalfwayBufferAndGetID(%08x, %08x, %08x): incorrect read size", halfBuffer, readSize, halfBufferSize); - return ATRAC_ERROR_INCORRECT_READ_SIZE; +static int sceAtracSetMOutHalfwayBufferAndGetID(u32 buffer, u32 readSize, u32 bufferSize) { + if (readSize > bufferSize) { + return hleLogError(ME, ATRAC_ERROR_INCORRECT_READ_SIZE, "read size too large"); } Atrac *atrac = new Atrac(); - atrac->first_.addr = halfBuffer; - atrac->first_.size = readSize; - int ret = atrac->Analyze(); + int ret = atrac->Analyze(buffer, readSize); if (ret < 0) { // Already logged. delete atrac; return ret; } if (atrac->channels_ != 1) { - ERROR_LOG_REPORT(ME, "sceAtracSetMOutHalfwayBufferAndGetID(%08x, %08x, %08x): not mono data", halfBuffer, readSize, halfBufferSize); delete atrac; - return ATRAC_ERROR_NOT_MONO; + return hleReportError(ME, ATRAC_ERROR_NOT_MONO, "not mono data"); } - atrac->outputChannels_ = 1; int atracID = createAtrac(atrac); if (atracID < 0) { - ERROR_LOG(ME, "sceAtracSetMOutHalfwayBufferAndGetID(%08x, %08x, %08x): no free ID", halfBuffer, readSize, halfBufferSize); delete atrac; - return atracID; + return hleLogError(ME, atracID, "no free ID"); } - INFO_LOG(ME, "%d=sceAtracSetMOutHalfwayBufferAndGetID(%08x, %08x, %08x)", atracID, halfBuffer, readSize, halfBufferSize); - return _AtracSetData(atracID, halfBuffer, halfBufferSize, true); + + atrac->outputChannels_ = 1; + return _AtracSetData(atracID, buffer, readSize, bufferSize, true); } static int sceAtracSetAA3DataAndGetID(u32 buffer, u32 bufferSize, u32 fileSize, u32 metadataSizeAddr) { Atrac *atrac = new Atrac(); - atrac->first_.addr = buffer; - atrac->first_.size = bufferSize; - atrac->first_.filesize = fileSize; - int ret = atrac->AnalyzeAA3(); + int ret = atrac->AnalyzeAA3(buffer, bufferSize, fileSize); if (ret < 0) { // Already logged. delete atrac; @@ -2188,12 +2144,11 @@ static int sceAtracSetAA3DataAndGetID(u32 buffer, u32 bufferSize, u32 fileSize, } int atracID = createAtrac(atrac); if (atracID < 0) { - ERROR_LOG(ME, "sceAtracSetAA3DataAndGetID(%08x, %i, %i, %08x): no free ID", buffer, bufferSize, fileSize, metadataSizeAddr); delete atrac; - return atracID; + return hleLogError(ME, atracID, "no free ID"); } - WARN_LOG(ME, "%d=sceAtracSetAA3DataAndGetID(%08x, %i, %i, %08x)", atracID, buffer, bufferSize, fileSize, metadataSizeAddr); - return _AtracSetData(atracID, buffer, bufferSize, true); + + return _AtracSetData(atracID, buffer, bufferSize, bufferSize, true); } int _AtracGetIDByContext(u32 contextAddr) { @@ -2463,17 +2418,13 @@ static int sceAtracLowLevelDecode(int atracID, u32 sourceAddr, u32 sourceBytesCo return 0; } -static int sceAtracSetAA3HalfwayBufferAndGetID(u32 halfBuffer, u32 readSize, u32 halfBufferSize, u32 fileSize) { - if (readSize > halfBufferSize) { - ERROR_LOG(ME, "sceAtracSetAA3HalfwayBufferAndGetID(%08x, %08x, %08x, %08x): invalid read size", halfBuffer, readSize, halfBufferSize, fileSize); - return ATRAC_ERROR_INCORRECT_READ_SIZE; +static int sceAtracSetAA3HalfwayBufferAndGetID(u32 buffer, u32 readSize, u32 bufferSize, u32 fileSize) { + if (readSize > bufferSize) { + return hleLogError(ME, ATRAC_ERROR_INCORRECT_READ_SIZE, "read size too large"); } Atrac *atrac = new Atrac(); - atrac->first_.addr = halfBuffer; - atrac->first_.size = halfBufferSize; - atrac->first_.filesize = fileSize; - int ret = atrac->AnalyzeAA3(); + int ret = atrac->AnalyzeAA3(buffer, readSize, fileSize); if (ret < 0) { // Already logged. delete atrac; @@ -2481,12 +2432,11 @@ static int sceAtracSetAA3HalfwayBufferAndGetID(u32 halfBuffer, u32 readSize, u32 } int atracID = createAtrac(atrac); if (atracID < 0) { - ERROR_LOG(ME, "sceAtracSetAA3HalfwayBufferAndGetID(%08x, %08x, %08x, %08x): no free ID", halfBuffer, readSize, halfBufferSize, fileSize); delete atrac; - return atracID; + return hleLogError(ME, atracID, "no free ID"); } - ERROR_LOG(ME, "UNIMPL %d=sceAtracSetAA3HalfwayBufferAndGetID(%08x, %08x, %08x)", atracID, halfBuffer, readSize, halfBufferSize); - return _AtracSetData(atracID, halfBuffer, halfBufferSize, true); + + return _AtracSetData(atracID, buffer, readSize, bufferSize, true); } const HLEFunction sceAtrac3plus[] = {