From 41c5e26e4a92569b28092e319ad701e0a6673b3d Mon Sep 17 00:00:00 2001 From: LegendOfDragoon Date: Sun, 12 Apr 2015 16:53:39 -0700 Subject: [PATCH] Make an rdb option for the save state audio fix Now it is a per game config option. --- Source/Project64/N64 System/N64 Class.cpp | 10 +++++++--- Source/Project64/Settings.h | 2 ++ Source/Project64/Settings/Settings Class.cpp | 2 ++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Source/Project64/N64 System/N64 Class.cpp b/Source/Project64/N64 System/N64 Class.cpp index 9cd97e810..8f6726406 100644 --- a/Source/Project64/N64 System/N64 Class.cpp +++ b/Source/Project64/N64 System/N64 Class.cpp @@ -1571,7 +1571,7 @@ bool CN64System::LoadState(void) bool CN64System::LoadState(LPCSTR FileName) { DWORD dwRead, Value,SaveRDRAMSize, NextVITimer = 0; - bool LoadedZipFile = false; + bool LoadedZipFile = false, AudioResetOnLoad; WriteTraceF((TraceType)(TraceDebug | TraceRecompiler),__FUNCTION__ "(%s): Start",FileName); @@ -1727,8 +1727,12 @@ bool CN64System::LoadState(LPCSTR FileName) } //Fix losing audio in certain games with certain plugins - m_Reg.m_AudioIntrReg |= MI_INTR_AI; - m_Reg.AI_STATUS_REG &= ~AI_STATUS_FIFO_FULL; + AudioResetOnLoad = g_Settings->LoadBool(Game_AudioResetOnLoad); + if (AudioResetOnLoad) + { + m_Reg.m_AudioIntrReg |= MI_INTR_AI; + m_Reg.AI_STATUS_REG &= ~AI_STATUS_FIFO_FULL; + } //Fix Random Register while ((int)m_Reg.RANDOM_REGISTER < (int)m_Reg.WIRED_REGISTER) diff --git a/Source/Project64/Settings.h b/Source/Project64/Settings.h index 8a09add1a..3ea6a1138 100644 --- a/Source/Project64/Settings.h +++ b/Source/Project64/Settings.h @@ -95,6 +95,7 @@ enum SettingID { Rdb_GameCheatFixPlugin, Rdb_ViRefreshRate, Rdb_AiCountPerBytes, + Rdb_AudioResetOnLoad, //Individual Game Settings Game_IniKey, @@ -139,6 +140,7 @@ enum SettingID { Game_LoadRomToMemory, Game_ViRefreshRate, Game_AiCountPerBytes, + Game_AudioResetOnLoad, // General Game running info GameRunning_LoadingInProgress, diff --git a/Source/Project64/Settings/Settings Class.cpp b/Source/Project64/Settings/Settings Class.cpp index a10494d3f..a6fe58e20 100644 --- a/Source/Project64/Settings/Settings Class.cpp +++ b/Source/Project64/Settings/Settings Class.cpp @@ -167,6 +167,7 @@ void CSettings::AddHowToHandleSetting () AddHandler(Rdb_GameCheatFixPlugin, new CSettingTypeRomDatabaseIndex("CheatPlugin","","")); AddHandler(Rdb_ViRefreshRate, new CSettingTypeRomDatabase("ViRefresh",1500)); AddHandler(Rdb_AiCountPerBytes, new CSettingTypeRomDatabase("AiCountPerBytes",400)); + AddHandler(Rdb_AudioResetOnLoad, new CSettingTypeRDBYesNo("AudioResetOnLoad", false)); AddHandler(Game_IniKey, new CSettingTypeTempString("")); AddHandler(Game_GameName, new CSettingTypeTempString("")); @@ -210,6 +211,7 @@ void CSettings::AddHowToHandleSetting () AddHandler(Game_SMM_ValidFunc, new CSettingTypeGame("SMM-FUNC",Rdb_SMM_ValidFunc)); AddHandler(Game_ViRefreshRate, new CSettingTypeGame("ViRefresh",Rdb_ViRefreshRate)); AddHandler(Game_AiCountPerBytes, new CSettingTypeGame("AiCountPerBytes",Rdb_AiCountPerBytes)); + AddHandler(Game_AudioResetOnLoad, new CSettingTypeGame("AudioResetOnLoad", Rdb_AudioResetOnLoad)); //User Interface AddHandler(UserInterface_BasicMode, new CSettingTypeApplication("","Basic Mode", (DWORD)true));