diff --git a/Core/HLE/sceAtrac.cpp b/Core/HLE/sceAtrac.cpp index c0645d462d..8d2dc085a9 100644 --- a/Core/HLE/sceAtrac.cpp +++ b/Core/HLE/sceAtrac.cpp @@ -292,7 +292,7 @@ struct Atrac { } u32 getFileOffsetBySample(int sample) const { - int offsetSample = sample + firstSampleoffset + firstOffsetExtra(); + int offsetSample = sample + firstSampleoffset; int frameOffset = offsetSample / (int)samplesPerFrame(); return (u32)(dataOff + atracBytesPerFrame + frameOffset * atracBytesPerFrame); } @@ -312,7 +312,7 @@ struct Atrac { } // Since the first frame is shorter by this offset, add to round up at this offset. - const int remainingBytes = first.fileoffset - getFileOffsetBySample(currentSample - samplesPerFrame()); + const int remainingBytes = first.fileoffset - getFileOffsetBySample(currentSample - samplesPerFrame() + firstOffsetExtra()); return remainingBytes / atracBytesPerFrame; } @@ -1154,7 +1154,7 @@ static void AtracGetResetBufferInfo(Atrac *atrac, AtracResetBufferInfo *bufferIn // This is because we're filling the buffer start to finish, not streaming. bufferInfo->first.writePosPtr = atrac->first.addr + atrac->first.size; bufferInfo->first.writableBytes = atrac->first.filesize - atrac->first.size; - int minWriteBytes = atrac->getFileOffsetBySample(sample - atrac->firstOffsetExtra()) - atrac->first.size; + int minWriteBytes = atrac->getFileOffsetBySample(sample) - atrac->first.size; if (minWriteBytes > 0) { bufferInfo->first.minWriteBytes = minWriteBytes; } else { @@ -1165,7 +1165,7 @@ static void AtracGetResetBufferInfo(Atrac *atrac, AtracResetBufferInfo *bufferIn atrac->first.writableBytes = bufferInfo->first.writableBytes; } else { // This is without the sample offset. The file offset also includes the previous batch of samples? - int sampleFileOffset = atrac->getFileOffsetBySample(sample - atrac->firstSampleoffset - atrac->samplesPerFrame() - atrac->firstOffsetExtra()); + int sampleFileOffset = atrac->getFileOffsetBySample(sample - atrac->firstSampleoffset - atrac->samplesPerFrame()); // Update the writable bytes. When streaming, this is just the number of bytes until the end. const u32 bufSizeAligned = (atrac->atracBufSize / atrac->atracBytesPerFrame) * atrac->atracBytesPerFrame;