Return an error when the atrac stream is full.

This commit is contained in:
Unknown W. Brackets 2015-04-05 17:22:38 -07:00
parent d43368f4ca
commit 0fc64dc717

View File

@ -825,16 +825,14 @@ u32 _AtracAddStreamData(int atracID, u32 bufPtr, u32 bytesToAdd) {
static u32 sceAtracAddStreamData(int atracID, u32 bytesToAdd) {
Atrac *atrac = getAtrac(atracID);
if (!atrac) {
ERROR_LOG(ME, "sceAtracAddStreamData(%i, %08x): bad atrac ID", atracID, bytesToAdd);
return ATRAC_ERROR_BAD_ATRACID;
return hleLogError(ME, ATRAC_ERROR_BAD_ATRACID, "bad atrac ID");
} else if (!atrac->data_buf) {
ERROR_LOG(ME, "sceAtracAddStreamData(%i, %08x): no data", atracID, bytesToAdd);
return ATRAC_ERROR_NO_DATA;
return hleLogError(ME, ATRAC_ERROR_NO_DATA, "no data");
} else {
DEBUG_LOG(ME, "sceAtracAddStreamData(%i, %08x)", atracID, bytesToAdd);
// TODO
if (atrac->first.size >= atrac->first.filesize)
return hleLogWarning(ME, ATRAC_ERROR_ALL_DATA_LOADED, "stream entirely loaded");
if (bytesToAdd > atrac->first.writableBytes)
return ATRAC_ERROR_ADD_DATA_IS_TOO_BIG;
return hleLogWarning(ME, ATRAC_ERROR_ADD_DATA_IS_TOO_BIG, "too many bytes");
if (bytesToAdd > 0) {
int addbytes = std::min(bytesToAdd, atrac->first.filesize - atrac->first.fileoffset);
@ -848,7 +846,7 @@ static u32 sceAtracAddStreamData(int atracID, u32 bytesToAdd) {
atrac->first.writableBytes -= bytesToAdd;
atrac->first.offset += bytesToAdd;
}
return 0;
return hleLogSuccessI(ME, 0);
}
u32 _AtracDecodeData(int atracID, u8 *outbuf, u32 outbufPtr, u32 *SamplesNum, u32 *finish, int *remains) {