From ec2d88cf172f33dbcbfbd6fff23a665f5bbe2836 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Wed, 27 May 2015 21:05:09 -0700 Subject: [PATCH] Make the vag block buffer s16. The values are clamped already, anyway. --- Core/HW/SasAudio.cpp | 12 ++++++++++-- Core/HW/SasAudio.h | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Core/HW/SasAudio.cpp b/Core/HW/SasAudio.cpp index 15598c1c5b..bd3fd442a1 100644 --- a/Core/HW/SasAudio.cpp +++ b/Core/HW/SasAudio.cpp @@ -152,11 +152,19 @@ void VagDecoder::GetSamples(s16 *outSamples, int numSamples) { } void VagDecoder::DoState(PointerWrap &p) { - auto s = p.Section("VagDecoder", 1); + auto s = p.Section("VagDecoder", 1, 2); if (!s) return; - p.DoArray(samples, ARRAY_SIZE(samples)); + if (s >= 2) { + p.DoArray(samples, ARRAY_SIZE(samples)); + } else { + int samplesOld[ARRAY_SIZE(samples)]; + p.DoArray(samplesOld, ARRAY_SIZE(samples)); + for (size_t i = 0; i < ARRAY_SIZE(samples); ++i) { + samples[i] = samplesOld[i]; + } + } p.Do(curSample); p.Do(data_); diff --git a/Core/HW/SasAudio.h b/Core/HW/SasAudio.h index 9e2216b5b5..5ad009180f 100644 --- a/Core/HW/SasAudio.h +++ b/Core/HW/SasAudio.h @@ -104,7 +104,7 @@ public: void DoState(PointerWrap &p); private: - int samples[28]; + s16 samples[28]; int curSample; u32 data_;