Add comment

This commit is contained in:
Henrik Rydgård 2024-04-14 16:30:05 +02:00
parent 2a3b6b8cfb
commit c9f5ccee3e
2 changed files with 6 additions and 7 deletions

View file

@ -162,25 +162,22 @@ struct Atrac {
int RemainingFrames() const;
int atracID_ = -1;
u8 *dataBuf_ = nullptr;
// Offset of the first sample in the input buffer
int dataOff_ = 0;
// Indicates that the dataBuf_ array should not be used.
bool ignoreDataBuf_ = false;
u32 decodePos_ = 0;
int atracID_ = -1;
u16 channels_ = 0;
u16 outputChannels_ = 2;
int currentSample_ = 0;
int endSample_ = 0;
int firstSampleOffset_ = 0;
// Offset of the first sample in the input buffer
int dataOff_ = 0;
std::vector<AtracLoopInfo> loopinfo_;
int loopStartSample_ = -1;
int loopEndSample_ = -1;
int loopNum_ = 0;
@ -255,7 +252,7 @@ private:
u32 bufferMaxSize_ = 0;
int jointStereo_ = 0;
// Used by low-level decoding and to track streaming.
// Used to track streaming.
u32 bufferPos_ = 0;
u32 bufferValidBytes_ = 0;
u32 bufferHeaderSize_ = 0;

View file

@ -291,6 +291,7 @@ static u32 sceAtracGetBufferInfoForResetting(int atracID, int sample, u32 buffer
} else if (atrac->BufferState() == ATRAC_STATUS_STREAMED_LOOP_WITH_TRAILER && atrac->second_.size == 0) {
return hleReportError(ME, ATRAC_ERROR_SECOND_BUFFER_NEEDED, "no second buffer");
} else if ((u32)sample + atrac->firstSampleOffset_ > (u32)atrac->endSample_ + atrac->firstSampleOffset_) {
// NOTE: Above we have to add firstSampleOffset to both sides - we seem to rely on wraparound.
return hleLogWarning(ME, ATRAC_ERROR_BAD_SAMPLE, "invalid sample position");
} else {
atrac->GetResetBufferInfo(bufferInfo, sample);
@ -544,6 +545,7 @@ static u32 sceAtracResetPlayPosition(int atracID, int sample, int bytesWrittenFi
if (atrac->BufferState() == ATRAC_STATUS_STREAMED_LOOP_WITH_TRAILER && atrac->second_.size == 0) {
return hleReportError(ME, ATRAC_ERROR_SECOND_BUFFER_NEEDED, "no second buffer");
} else if ((u32)sample + atrac->firstSampleOffset_ > (u32)atrac->endSample_ + atrac->firstSampleOffset_) {
// NOTE: Above we have to add firstSampleOffset to both sides - we seem to rely on wraparound.
return hleLogWarning(ME, ATRAC_ERROR_BAD_SAMPLE, "invalid sample position");
}