Atrac: Fix savestates.

Darn, totally forgot.  This should populate acceptable values for old
streamed atrac as well.
This commit is contained in:
Unknown W. Brackets 2016-01-17 10:05:15 -08:00
parent d5196b44f9
commit 63aa4291eb
2 changed files with 23 additions and 4 deletions

View File

@ -232,7 +232,7 @@ struct Atrac {
}
void DoState(PointerWrap &p) {
auto s = p.Section("Atrac", 1, 8);
auto s = p.Section("Atrac", 1, 9);
if (!s)
return;
@ -269,8 +269,10 @@ struct Atrac {
p.Do(second_);
p.Do(decodePos_);
u32 oldDecodeEnd = 0;
p.Do(oldDecodeEnd);
if (s < 9) {
u32 oldDecodeEnd = 0;
p.Do(oldDecodeEnd);
}
if (s >= 4) {
p.Do(bufferPos_);
} else {
@ -281,6 +283,10 @@ struct Atrac {
p.Do(bytesPerFrame_);
p.Do(loopinfo_);
if (s < 9) {
int oldLoopInfoNum = 42;
p.Do(oldLoopInfoNum);
}
p.Do(loopStartSample_);
p.Do(loopEndSample_);
@ -303,6 +309,17 @@ struct Atrac {
ignoreDataBuf_ = false;
}
if (s >= 9) {
p.Do(bufferValidBytes_);
p.Do(bufferHeaderSize_);
} else {
bufferHeaderSize_ = dataOff_;
bufferValidBytes_ = std::min(first_.size - dataOff_, StreamBufferEnd() - dataOff_);
if ((bufferState_ & ATRAC_STATUS_STREAMED_MASK) == ATRAC_STATUS_STREAMED_MASK) {
bufferPos_ = dataOff_;
}
}
if (s < 8 && bufferState_ == ATRAC_STATUS_STREAMED_LOOP_WITH_TRAILER) {
// We didn't actually allow the second buffer to be set this far back.
// Pretend it's a regular loop, we'll just try our best.
@ -314,7 +331,7 @@ struct Atrac {
__AtracSetContext(this);
}
if (s >= 2) {
if (s >= 2 && s < 9) {
bool oldResetBuffer = false;
p.Do(oldResetBuffer);
}

View File

@ -38,6 +38,8 @@ enum AtracStatus : u8 {
ATRAC_STATUS_STREAMED_LOOP_WITH_TRAILER = 6,
ATRAC_STATUS_LOW_LEVEL = 8,
ATRAC_STATUS_FOR_SCESAS = 16,
ATRAC_STATUS_STREAMED_MASK = 4,
};
#if COMMON_LITTLE_ENDIAN