Added an option to the HLE plugin that fixes sound in RE0 and maybe some other games.

Please tell me if I've done this wrong or need explaining why i did something :P.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3191 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
death2droid 2009-05-10 10:55:33 +00:00
parent be45b223bb
commit c0466334e4
5 changed files with 32 additions and 5 deletions

View File

@ -35,6 +35,7 @@ void CConfig::Load()
IniFile file;
file.Load(FULL_CONFIG_DIR "DSP.ini");
file.Get("Config", "EnableHLEAudio", &m_EnableHLEAudio, true); // Sound Settings
file.Get("Config", "EnableRE0AudioFix", &m_EnableRE0Fix, false); // RE0 Hack
ac_Config.Load(file);
}
@ -43,6 +44,7 @@ void CConfig::Save()
IniFile file;
file.Load(FULL_CONFIG_DIR "DSP.ini");
file.Set("Config", "EnableHLEAudio", m_EnableHLEAudio); // Sound Settings
file.Set("Config", "EnableRE0AudioFix", m_EnableRE0Fix); // RE0 Hack
ac_Config.Set(file);
file.Save(FULL_CONFIG_DIR "DSP.ini");

View File

@ -23,6 +23,7 @@
struct CConfig
{
bool m_EnableHLEAudio;
bool m_EnableRE0Fix;
CConfig();

View File

@ -24,6 +24,7 @@ EVT_BUTTON(wxID_OK, ConfigDialog::SettingsChanged)
EVT_CHECKBOX(ID_ENABLE_HLE_AUDIO, ConfigDialog::SettingsChanged)
EVT_CHECKBOX(ID_ENABLE_DTK_MUSIC, ConfigDialog::SettingsChanged)
EVT_CHECKBOX(ID_ENABLE_THROTTLE, ConfigDialog::SettingsChanged)
EVT_CHECKBOX(ID_ENABLE_RE0_FIX, ConfigDialog::SettingsChanged)
END_EVENT_TABLE()
ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
@ -41,11 +42,13 @@ ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &titl
m_buttonEnableHLEAudio = new wxCheckBox(this, ID_ENABLE_HLE_AUDIO, wxT("Enable HLE Audio"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_buttonEnableDTKMusic = new wxCheckBox(this, ID_ENABLE_DTK_MUSIC, wxT("Enable DTK Music"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_buttonEnableThrottle = new wxCheckBox(this, ID_ENABLE_THROTTLE, wxT("Enable Other Audio (Throttle)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_buttonEnableRE0Fix = new wxCheckBox(this, ID_ENABLE_RE0_FIX, wxT("Enable RE0 Audio Fix"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
wxStaticText *BackendText = new wxStaticText(this, wxID_ANY, wxT("Audio Backend"), wxDefaultPosition, wxDefaultSize, 0);
m_BackendSelection = new wxComboBox(this, ID_BACKEND, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxArrayBackends, wxCB_READONLY, wxDefaultValidator);
// Update values
m_buttonEnableHLEAudio->SetValue(g_Config.m_EnableHLEAudio ? true : false);
m_buttonEnableRE0Fix->SetValue(g_Config.m_EnableRE0Fix ? true : false);
m_buttonEnableDTKMusic->SetValue(ac_Config.m_EnableDTKMusic ? true : false);
m_buttonEnableThrottle->SetValue(ac_Config.m_EnableThrottle ? true : false);
@ -55,6 +58,7 @@ ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &titl
m_buttonEnableThrottle->SetToolTip(wxT("This is sometimes used together with pre-rendered movies.\n"
"Disabling this also disables the speed throttle which this causes,\n"
"meaning that there will be no upper limit on your FPS."));
m_buttonEnableRE0Fix->SetToolTip(wxT("This fixes audo in RE0 and maybe some other games."));
m_BackendSelection->SetToolTip(wxT("Changing this will have no effect while the emulator is running!"));
// Create sizer and add items to dialog
@ -63,6 +67,7 @@ ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &titl
sbSettings->Add(m_buttonEnableHLEAudio, 0, wxALL, 5);
sbSettings->Add(m_buttonEnableDTKMusic, 0, wxALL, 5);
sbSettings->Add(m_buttonEnableThrottle, 0, wxALL, 5);
sbSettings->Add(m_buttonEnableRE0Fix, 0, wxALL, 5);
wxBoxSizer *sBackend = new wxBoxSizer(wxHORIZONTAL);
sBackend->Add(BackendText, 0, wxALIGN_CENTRE_VERTICAL|wxALL, 5);
sBackend->Add(m_BackendSelection);
@ -95,6 +100,7 @@ ConfigDialog::~ConfigDialog()
void ConfigDialog::SettingsChanged(wxCommandEvent& event)
{
g_Config.m_EnableHLEAudio = m_buttonEnableHLEAudio->GetValue();
g_Config.m_EnableRE0Fix = m_buttonEnableRE0Fix->GetValue();
ac_Config.m_EnableDTKMusic = m_buttonEnableDTKMusic->GetValue();
ac_Config.m_EnableThrottle = m_buttonEnableThrottle->GetValue();
if (soundStream != NULL)

View File

@ -43,6 +43,7 @@ private:
wxCheckBox *m_buttonEnableHLEAudio;
wxCheckBox *m_buttonEnableDTKMusic;
wxCheckBox *m_buttonEnableThrottle;
wxCheckBox *m_buttonEnableRE0Fix;
wxArrayString wxArrayBackends;
wxComboBox *m_BackendSelection;
@ -52,6 +53,7 @@ private:
ID_ENABLE_HLE_AUDIO,
ID_ENABLE_DTK_MUSIC,
ID_ENABLE_THROTTLE,
ID_ENABLE_RE0_FIX,
ID_BACKEND
};

View File

@ -23,6 +23,7 @@
extern CDebugger* m_frame;
#endif
#include <sstream>
#include "../Config.h"
#include "../Globals.h"
#include "Mixer.h"
@ -343,11 +344,25 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
int numupd = upd0 + upd1 + upd2 + upd3 + upd4;
if(numupd > 64) numupd = 64; // prevent crazy values
const u32 updaddr = (u32)(upd_hi << 16) | upd_lo;
const u16 updpar = 0;
const u16 upddata = 0;
int on = false, off = false;
if(!g_Config.m_EnableRE0Fix)
{
for (int j = 0; j < numupd; j++)
{
const u16 updpar = Memory_Read_U16(updaddr + j);
const u16 upddata = Memory_Read_U16(updaddr + j + 2);
}
}
else
{
const u16 updpar = Memory_Read_U16(updaddr);
const u16 upddata = Memory_Read_U16(updaddr + 2);
}
if (!g_Config.m_EnableRE0Fix || g_Config.m_EnableRE0Fix)
{
// some safety checks, I hope it's enough
if(updaddr > 0x80000000 && updaddr < 0x817fffff
&& updpar < 63 && updpar > 3 && upddata >= 0 // updpar > 3 because we don't want to change
@ -360,10 +375,11 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
}
if (updpar == 7 && upddata == 1) on++;
if (updpar == 7 && upddata == 1) off++;
}
// hack: if we get both an on and an off select on rather than off
if (on > 0 && off > 0) pDest[7] = 1;
}
}
//PrintFile(1, "%08x %04x %04x\n", updaddr, updpar, upddata);
// ------------