From b8fe20e84e473036647a34923b61af3a73da94d5 Mon Sep 17 00:00:00 2001 From: death2droid Date: Mon, 11 May 2009 13:10:19 +0000 Subject: [PATCH] A fix to the RE0 Audio fix (Hopefully this fixes it once and for all. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3200 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/ConfigManager.cpp | 11 +++++++++++ Source/Core/Core/Src/ConfigManager.h | 6 ++++++ Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp | 12 ++++++++++++ 3 files changed, 29 insertions(+) diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index 07650541e1..0cd3803c07 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -30,6 +30,8 @@ SConfig::SConfig() { // Make sure we have log manager LoadSettings(); + //Mkae sure we load settings + LoadSettingsHLE(); } @@ -247,4 +249,13 @@ void SConfig::LoadSettings() ini.Get("Core", "WiiMote1Plugin", &m_LocalCoreStartupParameter.m_strWiimotePlugin[0], m_DefaultWiiMotePlugin.c_str()); } } +void SConfig::LoadSettingsHLE() +{ + IniFile ini; + // + ini.Load(FULL_CONFIG_DIR "DSP.ini"); + ini.Get("Config", "EnableRE0AudioFix", &m_EnableRE0Fix, false); // RE0 Hack +} + + diff --git a/Source/Core/Core/Src/ConfigManager.h b/Source/Core/Core/Src/ConfigManager.h index 9e6608a298..73e46b793d 100644 --- a/Source/Core/Core/Src/ConfigManager.h +++ b/Source/Core/Core/Src/ConfigManager.h @@ -40,6 +40,9 @@ enum INTERFACE_LANGUAGE struct SConfig { + //DSP HLE Audio fix + bool m_EnableRE0Fix; + // hard coded default plugins ... std::string m_DefaultGFXPlugin; std::string m_DefaultDSPPlugin; @@ -80,6 +83,9 @@ struct SConfig // load settings void LoadSettings(); + //Special load settings + void LoadSettingsHLE(); + /* Return the permanent and somewhat globally used instance of this struct there is also a Core::GetStartupParameter() instance of it with almost the same values */ diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp index 94bf8cb406..e1f70835c3 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp @@ -26,6 +26,7 @@ #include "../../PatchEngine.h" #include "../../CoreTiming.h" #include "../../Debugger/Debugger_BreakPoints.h" +#include "../../ConfigManager.h" #include "../PowerPC.h" #include "../Profiler.h" #include "../PPCTables.h" @@ -160,6 +161,7 @@ ps_adds1 */ + Jit64 jit; int CODE_SIZE = 1024*1024*16; @@ -232,6 +234,8 @@ namespace CPUCompare // This is only called by Default() in this file. It will execute an instruction with the interpreter functions. void Jit64::WriteCallInterpreter(UGeckoInstruction inst) { + + gpr.Flush(FLUSH_ALL); fpr.Flush(FLUSH_ALL); if (js.isLastInstruction) @@ -241,6 +245,14 @@ namespace CPUCompare } Interpreter::_interpreterInstruction instr = GetInterpreterOp(inst); ABI_CallFunctionC((void*)instr, inst.hex); + + if (js.isLastInstruction && SConfig::GetInstance().m_EnableRE0Fix ) + { + + SConfig::GetInstance().LoadSettingsHLE();//Make sure the settings are up to date + MOV(32, R(EAX), M(&NPC)); + WriteRfiExitDestInEAX(); + } } void Jit64::unknown_instruction(UGeckoInstruction inst)