SPU: Fix some reverb registers not being saved to state

This commit is contained in:
Connor McLaughlin 2020-03-23 00:29:10 +10:00
parent d47a82d591
commit 7a89c787b8
2 changed files with 11 additions and 5 deletions

View File

@ -2,4 +2,4 @@
#include "types.h"
static constexpr u32 SAVE_STATE_MAGIC = 0x43435544;
static constexpr u32 SAVE_STATE_VERSION = 10;
static constexpr u32 SAVE_STATE_VERSION = 11;

View File

@ -10,9 +10,6 @@
#include <imgui.h>
Log_SetChannel(SPU);
// TODO:
// - Noise
SPU::SPU() = default;
SPU::~SPU() = default;
@ -54,8 +51,12 @@ void SPU::Reset()
m_reverb_on_register = 0;
m_reverb_registers = {};
m_reverb_registers.mBASE = 0xE128;
m_reverb_registers.mBASE = 0;
m_reverb_current_address = ZeroExtend32(m_reverb_registers.mBASE) * 8;
m_reverb_left_input = 0;
m_reverb_left_output = 0;
m_reverb_right_input = 0;
m_reverb_right_output = 0;
for (u32 i = 0; i < NUM_VOICES; i++)
{
@ -102,6 +103,9 @@ bool SPU::DoState(StateWrapper& sw)
sw.Do(&m_noise_level);
sw.Do(&m_reverb_on_register);
sw.Do(&m_reverb_current_address);
sw.Do(&m_reverb_registers.vLOUT);
sw.Do(&m_reverb_registers.vROUT);
sw.Do(&m_reverb_registers.mBASE);
sw.DoArray(m_reverb_registers.rev, NUM_REVERB_REGS);
sw.Do(&m_reverb_left_input);
sw.Do(&m_reverb_right_input);
@ -1243,6 +1247,8 @@ std::tuple<s32, s32> SPU::SampleVoice(u32 voice_index)
sample = voice.Interpolate();
const s32 volume = ApplyVolume(sample, voice.regs.adsr_volume);
// if (voice_index == 3 || voice_index == 4)
// Log_WarningPrintf("voice %u %d", voice_index, volume);
voice.last_volume = volume;
voice.TickADSR();