Skip to content

Commit

Permalink
Few more updates to sceAtracGetSoundSample() & sceAtracGetSecondBuffe…
Browse files Browse the repository at this point in the history
…rInfo
  • Loading branch information
raven02 committed Apr 16, 2013
1 parent b9b01cc commit fd1bc40
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions Core/HLE/sceAtrac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,10 +454,10 @@ u32 sceAtracGetNextDecodePosition(int atracID, u32 outposAddr)
if (!atrac) {
//return -1;
}
if (atrac->currentSample >= atrac->endSample)
if (atrac->first.writableBytes - atrac->firstSampleoffset < atrac->atracBytesPerFrame || atrac->endSample < atrac->decodePos)
return ATRAC_ERROR_ALL_DATA_DECODED;
Memory::Write_U32(atrac->currentSample, outposAddr); // outpos
return 0;
Memory::Write_U32(atrac->decodePos - atrac->currentSample, outposAddr); // outpos
return 0;
}

u32 sceAtracGetNextSample(int atracID, u32 outNAddr)
Expand Down Expand Up @@ -503,7 +503,9 @@ u32 sceAtracGetSecondBufferInfo(int atracID, u32 outposAddr, u32 outBytesAddr)
Memory::Write_U32(0, outBytesAddr);
return ATRAC_ERROR_SECOND_BUFFER_NOT_NEEDED;
}
//TODO
u32 pos = (((atrac->loopEndSample >> (0x100B - atrac->codeType)) + 1) * atrac->atracBytesPerFrame + atrac->second.fileoffset - 1 ) + 1;
Memory::Write_U32(pos, outposAddr);
Memory::Write_U32(atrac->second.writableBytes - pos, outBytesAddr);

This comment has been minimized.

Copy link
@unknownbrackets

unknownbrackets Apr 21, 2013

Collaborator

These changes appear to have broken Valkyrie Profile (which already had major graphics issues.)

I think it is missing cases when ATRAC_ERROR_SECOND_BUFFER_NOT_NEEDED should be returned.

-[Unknown]

This comment has been minimized.

Copy link
@unknownbrackets

unknownbrackets Apr 28, 2013

Collaborator

These changes also broke Holy Invasion of Privacy, it seems.

Did the change in this function overall fix anything?

-[Unknown]

return 0;
}

Expand All @@ -514,9 +516,14 @@ u32 sceAtracGetSoundSample(int atracID, u32 outEndSampleAddr, u32 outLoopStartSa
if (!atrac) {
//return -1;
}
Memory::Write_U32(atrac->endSample, outEndSampleAddr); // outEndSample
Memory::Write_U32(atrac->loopStartSample, outLoopStartSampleAddr); // outLoopStartSample
Memory::Write_U32(atrac->loopEndSample, outLoopEndSampleAddr); // outLoopEndSample
if (atrac->loopEndSample != 0) {
Memory::Write_U32(atrac->endSample - atrac->currentSample, outEndSampleAddr); // outEndSample
Memory::Write_U32(atrac->loopStartSample - atrac->currentSample, outLoopStartSampleAddr); // outLoopStartSample
Memory::Write_U32(atrac->loopEndSample - atrac->currentSample, outLoopEndSampleAddr); // outLoopEndSample
} else {
Memory::Write_U32(-1, outLoopStartSampleAddr);
Memory::Write_U32(-1, outLoopEndSampleAddr);
}
return 0;
}

Expand Down

0 comments on commit fd1bc40

Please sign in to comment.