Reformat all the things. Have fun with merge conflicts.

This commit is contained in:
Pierre Bourdon
2016-06-24 10:43:46 +02:00
parent 2115e8a4a6
commit 3570c7f03a
1116 changed files with 187405 additions and 180344 deletions

View File

@ -12,88 +12,93 @@
#include "Core/ConfigManager.h"
#include "DolphinWX/Config/AdvancedConfigPane.h"
AdvancedConfigPane::AdvancedConfigPane(wxWindow* parent, wxWindowID id)
: wxPanel(parent, id)
AdvancedConfigPane::AdvancedConfigPane(wxWindow* parent, wxWindowID id) : wxPanel(parent, id)
{
InitializeGUI();
LoadGUIValues();
InitializeGUI();
LoadGUIValues();
}
void AdvancedConfigPane::InitializeGUI()
{
m_clock_override_checkbox = new wxCheckBox(this, wxID_ANY, _("Enable CPU Clock Override"));
m_clock_override_slider = new wxSlider(this, wxID_ANY, 100, 0, 150, wxDefaultPosition, wxSize(200,-1));
m_clock_override_text = new wxStaticText(this, wxID_ANY, "");
m_clock_override_checkbox = new wxCheckBox(this, wxID_ANY, _("Enable CPU Clock Override"));
m_clock_override_slider =
new wxSlider(this, wxID_ANY, 100, 0, 150, wxDefaultPosition, wxSize(200, -1));
m_clock_override_text = new wxStaticText(this, wxID_ANY, "");
m_clock_override_checkbox->Bind(wxEVT_CHECKBOX, &AdvancedConfigPane::OnClockOverrideCheckBoxChanged, this);
m_clock_override_slider->Bind(wxEVT_SLIDER, &AdvancedConfigPane::OnClockOverrideSliderChanged, this);
m_clock_override_checkbox->Bind(wxEVT_CHECKBOX,
&AdvancedConfigPane::OnClockOverrideCheckBoxChanged, this);
m_clock_override_slider->Bind(wxEVT_SLIDER, &AdvancedConfigPane::OnClockOverrideSliderChanged,
this);
wxStaticText* const clock_override_description = new wxStaticText(this, wxID_ANY,
_("Higher values can make variable-framerate games "
"run at a higher framerate, at the expense of CPU. "
"Lower values can make variable-framerate games "
"run at a lower framerate, saving CPU.\n\n"
"WARNING: Changing this from the default (100%) "
"can and will break games and cause glitches. "
"Do so at your own risk. Please do not report "
"bugs that occur with a non-default clock. "));
wxStaticText* const clock_override_description =
new wxStaticText(this, wxID_ANY, _("Higher values can make variable-framerate games "
"run at a higher framerate, at the expense of CPU. "
"Lower values can make variable-framerate games "
"run at a lower framerate, saving CPU.\n\n"
"WARNING: Changing this from the default (100%) "
"can and will break games and cause glitches. "
"Do so at your own risk. Please do not report "
"bugs that occur with a non-default clock. "));
#ifdef __APPLE__
clock_override_description->Wrap(550);
clock_override_description->Wrap(550);
#else
clock_override_description->Wrap(400);
clock_override_description->Wrap(400);
#endif
wxBoxSizer* const clock_override_checkbox_sizer = new wxBoxSizer(wxHORIZONTAL);
clock_override_checkbox_sizer->Add(m_clock_override_checkbox, 1, wxALL, 5);
wxBoxSizer* const clock_override_checkbox_sizer = new wxBoxSizer(wxHORIZONTAL);
clock_override_checkbox_sizer->Add(m_clock_override_checkbox, 1, wxALL, 5);
wxBoxSizer* const clock_override_slider_sizer = new wxBoxSizer(wxHORIZONTAL);
clock_override_slider_sizer->Add(m_clock_override_slider, 1, wxALL, 5);
clock_override_slider_sizer->Add(m_clock_override_text, 1, wxALL, 5);
wxBoxSizer* const clock_override_slider_sizer = new wxBoxSizer(wxHORIZONTAL);
clock_override_slider_sizer->Add(m_clock_override_slider, 1, wxALL, 5);
clock_override_slider_sizer->Add(m_clock_override_text, 1, wxALL, 5);
wxBoxSizer* const clock_override_description_sizer = new wxBoxSizer(wxHORIZONTAL);
clock_override_description_sizer->Add(clock_override_description, 1, wxALL, 5);
wxBoxSizer* const clock_override_description_sizer = new wxBoxSizer(wxHORIZONTAL);
clock_override_description_sizer->Add(clock_override_description, 1, wxALL, 5);
wxStaticBoxSizer* const cpu_options_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("CPU Options"));
cpu_options_sizer->Add(clock_override_checkbox_sizer);
cpu_options_sizer->Add(clock_override_slider_sizer);
cpu_options_sizer->Add(clock_override_description_sizer);
wxStaticBoxSizer* const cpu_options_sizer =
new wxStaticBoxSizer(wxVERTICAL, this, _("CPU Options"));
cpu_options_sizer->Add(clock_override_checkbox_sizer);
cpu_options_sizer->Add(clock_override_slider_sizer);
cpu_options_sizer->Add(clock_override_description_sizer);
wxBoxSizer* const main_sizer = new wxBoxSizer(wxVERTICAL);
main_sizer->Add(cpu_options_sizer , 0, wxEXPAND | wxALL, 5);
wxBoxSizer* const main_sizer = new wxBoxSizer(wxVERTICAL);
main_sizer->Add(cpu_options_sizer, 0, wxEXPAND | wxALL, 5);
SetSizer(main_sizer);
SetSizer(main_sizer);
}
void AdvancedConfigPane::LoadGUIValues()
{
int ocFactor = (int)(std::log2f(SConfig::GetInstance().m_OCFactor) * 25.f + 100.f + 0.5f);
bool oc_enabled = SConfig::GetInstance().m_OCEnable;
m_clock_override_checkbox->SetValue(oc_enabled);
m_clock_override_slider ->SetValue(ocFactor);
m_clock_override_slider->Enable(oc_enabled);
UpdateCPUClock();
int ocFactor = (int)(std::log2f(SConfig::GetInstance().m_OCFactor) * 25.f + 100.f + 0.5f);
bool oc_enabled = SConfig::GetInstance().m_OCEnable;
m_clock_override_checkbox->SetValue(oc_enabled);
m_clock_override_slider->SetValue(ocFactor);
m_clock_override_slider->Enable(oc_enabled);
UpdateCPUClock();
}
void AdvancedConfigPane::OnClockOverrideCheckBoxChanged(wxCommandEvent& event)
{
SConfig::GetInstance().m_OCEnable = m_clock_override_checkbox->IsChecked();
m_clock_override_slider->Enable(SConfig::GetInstance().m_OCEnable);
UpdateCPUClock();
SConfig::GetInstance().m_OCEnable = m_clock_override_checkbox->IsChecked();
m_clock_override_slider->Enable(SConfig::GetInstance().m_OCEnable);
UpdateCPUClock();
}
void AdvancedConfigPane::OnClockOverrideSliderChanged(wxCommandEvent& event)
{
// Vaguely exponential scaling?
SConfig::GetInstance().m_OCFactor = std::exp2f((m_clock_override_slider->GetValue() - 100.f) / 25.f);
UpdateCPUClock();
// Vaguely exponential scaling?
SConfig::GetInstance().m_OCFactor =
std::exp2f((m_clock_override_slider->GetValue() - 100.f) / 25.f);
UpdateCPUClock();
}
void AdvancedConfigPane::UpdateCPUClock()
{
bool wii = SConfig::GetInstance().bWii;
int percent = (int)(std::roundf(SConfig::GetInstance().m_OCFactor * 100.f));
int clock = (int)(std::roundf(SConfig::GetInstance().m_OCFactor * (wii ? 729.f : 486.f)));
bool wii = SConfig::GetInstance().bWii;
int percent = (int)(std::roundf(SConfig::GetInstance().m_OCFactor * 100.f));
int clock = (int)(std::roundf(SConfig::GetInstance().m_OCFactor * (wii ? 729.f : 486.f)));
m_clock_override_text->SetLabel(SConfig::GetInstance().m_OCEnable ? wxString::Format("%d %% (%d mhz)", percent, clock) : "");
m_clock_override_text->SetLabel(
SConfig::GetInstance().m_OCEnable ? wxString::Format("%d %% (%d mhz)", percent, clock) : "");
}

View File

@ -13,18 +13,18 @@ class wxStaticText;
class AdvancedConfigPane final : public wxPanel
{
public:
AdvancedConfigPane(wxWindow* parent, wxWindowID id);
AdvancedConfigPane(wxWindow* parent, wxWindowID id);
private:
void InitializeGUI();
void LoadGUIValues();
void InitializeGUI();
void LoadGUIValues();
void OnClockOverrideCheckBoxChanged(wxCommandEvent&);
void OnClockOverrideSliderChanged(wxCommandEvent&);
void OnClockOverrideCheckBoxChanged(wxCommandEvent&);
void OnClockOverrideSliderChanged(wxCommandEvent&);
void UpdateCPUClock();
void UpdateCPUClock();
wxCheckBox* m_clock_override_checkbox;
wxSlider* m_clock_override_slider;
wxStaticText* m_clock_override_text;
wxCheckBox* m_clock_override_checkbox;
wxSlider* m_clock_override_slider;
wxStaticText* m_clock_override_text;
};

View File

@ -17,163 +17,179 @@
#include "Common/Common.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "DolphinWX/WxUtils.h"
#include "DolphinWX/Config/AudioConfigPane.h"
#include "DolphinWX/WxUtils.h"
AudioConfigPane::AudioConfigPane(wxWindow* parent, wxWindowID id)
: wxPanel(parent, id)
AudioConfigPane::AudioConfigPane(wxWindow* parent, wxWindowID id) : wxPanel(parent, id)
{
InitializeGUI();
LoadGUIValues();
RefreshGUI();
InitializeGUI();
LoadGUIValues();
RefreshGUI();
}
void AudioConfigPane::InitializeGUI()
{
m_dsp_engine_strings.Add(_("DSP HLE emulation (fast)"));
m_dsp_engine_strings.Add(_("DSP LLE recompiler"));
m_dsp_engine_strings.Add(_("DSP LLE interpreter (slow)"));
m_dsp_engine_strings.Add(_("DSP HLE emulation (fast)"));
m_dsp_engine_strings.Add(_("DSP LLE recompiler"));
m_dsp_engine_strings.Add(_("DSP LLE interpreter (slow)"));
m_dsp_engine_radiobox = new wxRadioBox(this, wxID_ANY, _("DSP Emulator Engine"), wxDefaultPosition, wxDefaultSize, m_dsp_engine_strings, 0, wxRA_SPECIFY_ROWS);
m_dpl2_decoder_checkbox = new wxCheckBox(this, wxID_ANY, _("Dolby Pro Logic II decoder"));
m_volume_slider = new wxSlider(this, wxID_ANY, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL | wxSL_INVERSE);
m_volume_text = new wxStaticText(this, wxID_ANY, "");
m_audio_backend_choice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_audio_backend_strings);
m_audio_latency_spinctrl = new wxSpinCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 30);
m_dsp_engine_radiobox =
new wxRadioBox(this, wxID_ANY, _("DSP Emulator Engine"), wxDefaultPosition, wxDefaultSize,
m_dsp_engine_strings, 0, wxRA_SPECIFY_ROWS);
m_dpl2_decoder_checkbox = new wxCheckBox(this, wxID_ANY, _("Dolby Pro Logic II decoder"));
m_volume_slider = new wxSlider(this, wxID_ANY, 0, 0, 100, wxDefaultPosition, wxDefaultSize,
wxSL_VERTICAL | wxSL_INVERSE);
m_volume_text = new wxStaticText(this, wxID_ANY, "");
m_audio_backend_choice =
new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_audio_backend_strings);
m_audio_latency_spinctrl =
new wxSpinCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 30);
m_dsp_engine_radiobox->Bind(wxEVT_RADIOBOX, &AudioConfigPane::OnDSPEngineRadioBoxChanged, this);
m_dpl2_decoder_checkbox->Bind(wxEVT_CHECKBOX, &AudioConfigPane::OnDPL2DecoderCheckBoxChanged, this);
m_volume_slider->Bind(wxEVT_SLIDER, &AudioConfigPane::OnVolumeSliderChanged, this);
m_audio_backend_choice->Bind(wxEVT_CHOICE, &AudioConfigPane::OnAudioBackendChanged, this);
m_audio_latency_spinctrl->Bind(wxEVT_SPINCTRL, &AudioConfigPane::OnLatencySpinCtrlChanged, this);
m_dsp_engine_radiobox->Bind(wxEVT_RADIOBOX, &AudioConfigPane::OnDSPEngineRadioBoxChanged, this);
m_dpl2_decoder_checkbox->Bind(wxEVT_CHECKBOX, &AudioConfigPane::OnDPL2DecoderCheckBoxChanged,
this);
m_volume_slider->Bind(wxEVT_SLIDER, &AudioConfigPane::OnVolumeSliderChanged, this);
m_audio_backend_choice->Bind(wxEVT_CHOICE, &AudioConfigPane::OnAudioBackendChanged, this);
m_audio_latency_spinctrl->Bind(wxEVT_SPINCTRL, &AudioConfigPane::OnLatencySpinCtrlChanged, this);
m_audio_backend_choice->SetToolTip(_("Changing this will have no effect while the emulator is running."));
m_audio_latency_spinctrl->SetToolTip(_("Sets the latency (in ms). Higher values may reduce audio crackling. OpenAL backend only."));
m_audio_backend_choice->SetToolTip(
_("Changing this will have no effect while the emulator is running."));
m_audio_latency_spinctrl->SetToolTip(_(
"Sets the latency (in ms). Higher values may reduce audio crackling. OpenAL backend only."));
#if defined(__APPLE__)
m_dpl2_decoder_checkbox->SetToolTip(_("Enables Dolby Pro Logic II emulation using 5.1 surround. Not available on OS X."));
m_dpl2_decoder_checkbox->SetToolTip(
_("Enables Dolby Pro Logic II emulation using 5.1 surround. Not available on OS X."));
#else
m_dpl2_decoder_checkbox->SetToolTip(_("Enables Dolby Pro Logic II emulation using 5.1 surround. OpenAL or Pulse backends only."));
m_dpl2_decoder_checkbox->SetToolTip(
_("Enables Dolby Pro Logic II emulation using 5.1 surround. OpenAL or Pulse backends only."));
#endif
wxStaticBoxSizer* const dsp_engine_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Sound Settings"));
dsp_engine_sizer->Add(m_dsp_engine_radiobox, 0, wxALL | wxEXPAND, 5);
dsp_engine_sizer->Add(m_dpl2_decoder_checkbox, 0, wxALL, 5);
wxStaticBoxSizer* const dsp_engine_sizer =
new wxStaticBoxSizer(wxVERTICAL, this, _("Sound Settings"));
dsp_engine_sizer->Add(m_dsp_engine_radiobox, 0, wxALL | wxEXPAND, 5);
dsp_engine_sizer->Add(m_dpl2_decoder_checkbox, 0, wxALL, 5);
wxStaticBoxSizer* const volume_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Volume"));
volume_sizer->Add(m_volume_slider, 1, wxLEFT | wxRIGHT, 13);
volume_sizer->Add(m_volume_text, 0, wxALIGN_CENTER | wxALL, 5);
wxStaticBoxSizer* const volume_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Volume"));
volume_sizer->Add(m_volume_slider, 1, wxLEFT | wxRIGHT, 13);
volume_sizer->Add(m_volume_text, 0, wxALIGN_CENTER | wxALL, 5);
wxGridBagSizer* const backend_grid_sizer = new wxGridBagSizer();
backend_grid_sizer->Add(new wxStaticText(this, wxID_ANY, _("Audio Backend:")), wxGBPosition(0, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
backend_grid_sizer->Add(m_audio_backend_choice, wxGBPosition(0, 1), wxDefaultSpan, wxALL, 5);
backend_grid_sizer->Add(new wxStaticText(this, wxID_ANY, _("Latency:")), wxGBPosition(1, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
backend_grid_sizer->Add(m_audio_latency_spinctrl, wxGBPosition(1, 1), wxDefaultSpan, wxALL, 5);
wxGridBagSizer* const backend_grid_sizer = new wxGridBagSizer();
backend_grid_sizer->Add(new wxStaticText(this, wxID_ANY, _("Audio Backend:")), wxGBPosition(0, 0),
wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
backend_grid_sizer->Add(m_audio_backend_choice, wxGBPosition(0, 1), wxDefaultSpan, wxALL, 5);
backend_grid_sizer->Add(new wxStaticText(this, wxID_ANY, _("Latency:")), wxGBPosition(1, 0),
wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
backend_grid_sizer->Add(m_audio_latency_spinctrl, wxGBPosition(1, 1), wxDefaultSpan, wxALL, 5);
wxStaticBoxSizer* const backend_static_box_sizer = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Backend Settings"));
backend_static_box_sizer->Add(backend_grid_sizer, 0, wxEXPAND);
wxStaticBoxSizer* const backend_static_box_sizer =
new wxStaticBoxSizer(wxHORIZONTAL, this, _("Backend Settings"));
backend_static_box_sizer->Add(backend_grid_sizer, 0, wxEXPAND);
wxBoxSizer* const dsp_audio_sizer = new wxBoxSizer(wxHORIZONTAL);
dsp_audio_sizer->Add(dsp_engine_sizer, 1, wxEXPAND | wxALL, 5);
dsp_audio_sizer->Add(volume_sizer, 0, wxEXPAND | wxALL, 5);
wxBoxSizer* const dsp_audio_sizer = new wxBoxSizer(wxHORIZONTAL);
dsp_audio_sizer->Add(dsp_engine_sizer, 1, wxEXPAND | wxALL, 5);
dsp_audio_sizer->Add(volume_sizer, 0, wxEXPAND | wxALL, 5);
wxBoxSizer* const main_sizer = new wxBoxSizer(wxVERTICAL);
main_sizer->Add(dsp_audio_sizer, 0, wxALL | wxEXPAND);
main_sizer->Add(backend_static_box_sizer, 0, wxALL | wxEXPAND, 5);
wxBoxSizer* const main_sizer = new wxBoxSizer(wxVERTICAL);
main_sizer->Add(dsp_audio_sizer, 0, wxALL | wxEXPAND);
main_sizer->Add(backend_static_box_sizer, 0, wxALL | wxEXPAND, 5);
SetSizerAndFit(main_sizer);
SetSizerAndFit(main_sizer);
}
void AudioConfigPane::LoadGUIValues()
{
PopulateBackendChoiceBox();
PopulateBackendChoiceBox();
const SConfig& startup_params = SConfig::GetInstance();
const SConfig& startup_params = SConfig::GetInstance();
// Audio DSP Engine
if (startup_params.bDSPHLE)
m_dsp_engine_radiobox->SetSelection(0);
else
m_dsp_engine_radiobox->SetSelection(SConfig::GetInstance().m_DSPEnableJIT ? 1 : 2);
// Audio DSP Engine
if (startup_params.bDSPHLE)
m_dsp_engine_radiobox->SetSelection(0);
else
m_dsp_engine_radiobox->SetSelection(SConfig::GetInstance().m_DSPEnableJIT ? 1 : 2);
m_volume_slider->Enable(SupportsVolumeChanges(SConfig::GetInstance().sBackend));
m_volume_slider->SetValue(SConfig::GetInstance().m_Volume);
m_volume_slider->Enable(SupportsVolumeChanges(SConfig::GetInstance().sBackend));
m_volume_slider->SetValue(SConfig::GetInstance().m_Volume);
m_volume_text->SetLabel(wxString::Format("%d %%", SConfig::GetInstance().m_Volume));
m_volume_text->SetLabel(wxString::Format("%d %%", SConfig::GetInstance().m_Volume));
m_dpl2_decoder_checkbox->Enable(std::string(SConfig::GetInstance().sBackend) == BACKEND_OPENAL
|| std::string(SConfig::GetInstance().sBackend) == BACKEND_PULSEAUDIO);
m_dpl2_decoder_checkbox->SetValue(startup_params.bDPL2Decoder);
m_dpl2_decoder_checkbox->Enable(std::string(SConfig::GetInstance().sBackend) == BACKEND_OPENAL ||
std::string(SConfig::GetInstance().sBackend) ==
BACKEND_PULSEAUDIO);
m_dpl2_decoder_checkbox->SetValue(startup_params.bDPL2Decoder);
m_audio_latency_spinctrl->Enable(std::string(SConfig::GetInstance().sBackend) == BACKEND_OPENAL);
m_audio_latency_spinctrl->SetValue(startup_params.iLatency);
m_audio_latency_spinctrl->Enable(std::string(SConfig::GetInstance().sBackend) == BACKEND_OPENAL);
m_audio_latency_spinctrl->SetValue(startup_params.iLatency);
}
void AudioConfigPane::RefreshGUI()
{
if (Core::IsRunning())
{
m_audio_latency_spinctrl->Disable();
m_audio_backend_choice->Disable();
m_dpl2_decoder_checkbox->Disable();
m_dsp_engine_radiobox->Disable();
}
if (Core::IsRunning())
{
m_audio_latency_spinctrl->Disable();
m_audio_backend_choice->Disable();
m_dpl2_decoder_checkbox->Disable();
m_dsp_engine_radiobox->Disable();
}
}
void AudioConfigPane::OnDSPEngineRadioBoxChanged(wxCommandEvent& event)
{
SConfig::GetInstance().bDSPHLE = m_dsp_engine_radiobox->GetSelection() == 0;
SConfig::GetInstance().m_DSPEnableJIT = m_dsp_engine_radiobox->GetSelection() == 1;
AudioCommon::UpdateSoundStream();
SConfig::GetInstance().bDSPHLE = m_dsp_engine_radiobox->GetSelection() == 0;
SConfig::GetInstance().m_DSPEnableJIT = m_dsp_engine_radiobox->GetSelection() == 1;
AudioCommon::UpdateSoundStream();
}
void AudioConfigPane::OnDPL2DecoderCheckBoxChanged(wxCommandEvent&)
{
SConfig::GetInstance().bDPL2Decoder = m_dpl2_decoder_checkbox->IsChecked();
SConfig::GetInstance().bDPL2Decoder = m_dpl2_decoder_checkbox->IsChecked();
}
void AudioConfigPane::OnVolumeSliderChanged(wxCommandEvent& event)
{
SConfig::GetInstance().m_Volume = m_volume_slider->GetValue();
AudioCommon::UpdateSoundStream();
m_volume_text->SetLabel(wxString::Format("%d %%", m_volume_slider->GetValue()));
SConfig::GetInstance().m_Volume = m_volume_slider->GetValue();
AudioCommon::UpdateSoundStream();
m_volume_text->SetLabel(wxString::Format("%d %%", m_volume_slider->GetValue()));
}
void AudioConfigPane::OnAudioBackendChanged(wxCommandEvent& event)
{
m_volume_slider->Enable(SupportsVolumeChanges(WxStrToStr(m_audio_backend_choice->GetStringSelection())));
m_audio_latency_spinctrl->Enable(WxStrToStr(m_audio_backend_choice->GetStringSelection()) == BACKEND_OPENAL);
m_dpl2_decoder_checkbox->Enable(WxStrToStr(m_audio_backend_choice->GetStringSelection()) == BACKEND_OPENAL ||
WxStrToStr(m_audio_backend_choice->GetStringSelection()) == BACKEND_PULSEAUDIO);
m_volume_slider->Enable(
SupportsVolumeChanges(WxStrToStr(m_audio_backend_choice->GetStringSelection())));
m_audio_latency_spinctrl->Enable(WxStrToStr(m_audio_backend_choice->GetStringSelection()) ==
BACKEND_OPENAL);
m_dpl2_decoder_checkbox->Enable(
WxStrToStr(m_audio_backend_choice->GetStringSelection()) == BACKEND_OPENAL ||
WxStrToStr(m_audio_backend_choice->GetStringSelection()) == BACKEND_PULSEAUDIO);
// Don't save the translated BACKEND_NULLSOUND string
SConfig::GetInstance().sBackend = m_audio_backend_choice->GetSelection() ?
WxStrToStr(m_audio_backend_choice->GetStringSelection()) : BACKEND_NULLSOUND;
// Don't save the translated BACKEND_NULLSOUND string
SConfig::GetInstance().sBackend = m_audio_backend_choice->GetSelection() ?
WxStrToStr(m_audio_backend_choice->GetStringSelection()) :
BACKEND_NULLSOUND;
AudioCommon::UpdateSoundStream();
AudioCommon::UpdateSoundStream();
}
void AudioConfigPane::OnLatencySpinCtrlChanged(wxCommandEvent& event)
{
SConfig::GetInstance().iLatency = m_audio_latency_spinctrl->GetValue();
SConfig::GetInstance().iLatency = m_audio_latency_spinctrl->GetValue();
}
void AudioConfigPane::PopulateBackendChoiceBox()
{
for (const std::string& backend : AudioCommon::GetSoundBackends())
{
m_audio_backend_choice->Append(wxGetTranslation(StrToWxStr(backend)));
for (const std::string& backend : AudioCommon::GetSoundBackends())
{
m_audio_backend_choice->Append(wxGetTranslation(StrToWxStr(backend)));
int num = m_audio_backend_choice->FindString(StrToWxStr(SConfig::GetInstance().sBackend));
m_audio_backend_choice->SetSelection(num);
}
int num = m_audio_backend_choice->FindString(StrToWxStr(SConfig::GetInstance().sBackend));
m_audio_backend_choice->SetSelection(num);
}
}
bool AudioConfigPane::SupportsVolumeChanges(const std::string& backend)
{
//FIXME: this one should ask the backend whether it supports it.
// but getting the backend from string etc. is probably
// too much just to enable/disable a stupid slider...
return (backend == BACKEND_COREAUDIO ||
backend == BACKEND_OPENAL ||
backend == BACKEND_XAUDIO2);
// FIXME: this one should ask the backend whether it supports it.
// but getting the backend from string etc. is probably
// too much just to enable/disable a stupid slider...
return (backend == BACKEND_COREAUDIO || backend == BACKEND_OPENAL || backend == BACKEND_XAUDIO2);
}

View File

@ -18,29 +18,29 @@ class wxStaticText;
class AudioConfigPane final : public wxPanel
{
public:
AudioConfigPane(wxWindow* parent, wxWindowID id);
AudioConfigPane(wxWindow* parent, wxWindowID id);
private:
void InitializeGUI();
void LoadGUIValues();
void RefreshGUI();
void InitializeGUI();
void LoadGUIValues();
void RefreshGUI();
void PopulateBackendChoiceBox();
static bool SupportsVolumeChanges(const std::string&);
void PopulateBackendChoiceBox();
static bool SupportsVolumeChanges(const std::string&);
void OnDSPEngineRadioBoxChanged(wxCommandEvent&);
void OnDPL2DecoderCheckBoxChanged(wxCommandEvent&);
void OnVolumeSliderChanged(wxCommandEvent&);
void OnAudioBackendChanged(wxCommandEvent&);
void OnLatencySpinCtrlChanged(wxCommandEvent&);
void OnDSPEngineRadioBoxChanged(wxCommandEvent&);
void OnDPL2DecoderCheckBoxChanged(wxCommandEvent&);
void OnVolumeSliderChanged(wxCommandEvent&);
void OnAudioBackendChanged(wxCommandEvent&);
void OnLatencySpinCtrlChanged(wxCommandEvent&);
wxArrayString m_dsp_engine_strings;
wxArrayString m_audio_backend_strings;
wxArrayString m_dsp_engine_strings;
wxArrayString m_audio_backend_strings;
wxRadioBox* m_dsp_engine_radiobox;
wxCheckBox* m_dpl2_decoder_checkbox;
wxSlider* m_volume_slider;
wxStaticText* m_volume_text;
wxChoice* m_audio_backend_choice;
wxSpinCtrl* m_audio_latency_spinctrl;
wxRadioBox* m_dsp_engine_radiobox;
wxCheckBox* m_dpl2_decoder_checkbox;
wxSlider* m_volume_slider;
wxStaticText* m_volume_text;
wxChoice* m_audio_backend_choice;
wxSpinCtrl* m_audio_latency_spinctrl;
};

View File

@ -11,7 +11,6 @@
#include "Core/ConfigManager.h"
#include "Core/Movie.h"
#include "Core/NetPlayProto.h"
#include "DolphinWX/WxUtils.h"
#include "DolphinWX/Config/AdvancedConfigPane.h"
#include "DolphinWX/Config/AudioConfigPane.h"
#include "DolphinWX/Config/ConfigMain.h"
@ -20,23 +19,24 @@
#include "DolphinWX/Config/InterfaceConfigPane.h"
#include "DolphinWX/Config/PathConfigPane.h"
#include "DolphinWX/Config/WiiConfigPane.h"
#include "DolphinWX/WxUtils.h"
// Sent by child panes to signify that the game list should
// be updated when this modal dialog closes.
wxDEFINE_EVENT(wxDOLPHIN_CFG_REFRESH_LIST, wxCommandEvent);
CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title,
const wxPoint& position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style)
const wxPoint& position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style)
{
// Control refreshing of the ISOs list
m_refresh_game_list_on_close = false;
// Control refreshing of the ISOs list
m_refresh_game_list_on_close = false;
Bind(wxEVT_CLOSE_WINDOW, &CConfigMain::OnClose, this);
Bind(wxEVT_BUTTON, &CConfigMain::OnOk, this, wxID_OK);
Bind(wxDOLPHIN_CFG_REFRESH_LIST, &CConfigMain::OnSetRefreshGameListOnClose, this);
Bind(wxEVT_CLOSE_WINDOW, &CConfigMain::OnClose, this);
Bind(wxEVT_BUTTON, &CConfigMain::OnOk, this, wxID_OK);
Bind(wxDOLPHIN_CFG_REFRESH_LIST, &CConfigMain::OnSetRefreshGameListOnClose, this);
CreateGUIControls();
CreateGUIControls();
}
CConfigMain::~CConfigMain()
@ -45,67 +45,67 @@ CConfigMain::~CConfigMain()
void CConfigMain::SetSelectedTab(int tab)
{
// TODO : this is just a quick and dirty way to do it, possible cleanup
// TODO : this is just a quick and dirty way to do it, possible cleanup
switch (tab)
{
case ID_AUDIOPAGE:
Notebook->SetSelection(2);
break;
}
switch (tab)
{
case ID_AUDIOPAGE:
Notebook->SetSelection(2);
break;
}
}
void CConfigMain::CreateGUIControls()
{
// Create the notebook and pages
Notebook = new wxNotebook(this, ID_NOTEBOOK);
wxPanel* const general_pane = new GeneralConfigPane(Notebook, ID_GENERALPAGE);
wxPanel* const interface_pane = new InterfaceConfigPane(Notebook, ID_DISPLAYPAGE);
wxPanel* const audio_pane = new AudioConfigPane(Notebook, ID_AUDIOPAGE);
wxPanel* const gamecube_pane = new GameCubeConfigPane(Notebook, ID_GAMECUBEPAGE);
wxPanel* const wii_pane = new WiiConfigPane(Notebook, ID_WIIPAGE);
wxPanel* const path_pane = new PathConfigPane(Notebook, ID_PATHSPAGE);
wxPanel* const advanced_pane = new AdvancedConfigPane(Notebook, ID_ADVANCEDPAGE);
// Create the notebook and pages
Notebook = new wxNotebook(this, ID_NOTEBOOK);
wxPanel* const general_pane = new GeneralConfigPane(Notebook, ID_GENERALPAGE);
wxPanel* const interface_pane = new InterfaceConfigPane(Notebook, ID_DISPLAYPAGE);
wxPanel* const audio_pane = new AudioConfigPane(Notebook, ID_AUDIOPAGE);
wxPanel* const gamecube_pane = new GameCubeConfigPane(Notebook, ID_GAMECUBEPAGE);
wxPanel* const wii_pane = new WiiConfigPane(Notebook, ID_WIIPAGE);
wxPanel* const path_pane = new PathConfigPane(Notebook, ID_PATHSPAGE);
wxPanel* const advanced_pane = new AdvancedConfigPane(Notebook, ID_ADVANCEDPAGE);
Notebook->AddPage(general_pane, _("General"));
Notebook->AddPage(interface_pane, _("Interface"));
Notebook->AddPage(audio_pane, _("Audio"));
Notebook->AddPage(gamecube_pane, _("GameCube"));
Notebook->AddPage(wii_pane, _("Wii"));
Notebook->AddPage(path_pane, _("Paths"));
Notebook->AddPage(advanced_pane, _("Advanced"));
if (Movie::IsMovieActive() || NetPlay::IsNetPlayRunning())
advanced_pane->Disable();
Notebook->AddPage(general_pane, _("General"));
Notebook->AddPage(interface_pane, _("Interface"));
Notebook->AddPage(audio_pane, _("Audio"));
Notebook->AddPage(gamecube_pane, _("GameCube"));
Notebook->AddPage(wii_pane, _("Wii"));
Notebook->AddPage(path_pane, _("Paths"));
Notebook->AddPage(advanced_pane, _("Advanced"));
if (Movie::IsMovieActive() || NetPlay::IsNetPlayRunning())
advanced_pane->Disable();
wxBoxSizer* const main_sizer = new wxBoxSizer(wxVERTICAL);
main_sizer->Add(Notebook, 1, wxEXPAND | wxALL, 5);
main_sizer->Add(CreateButtonSizer(wxOK), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
wxBoxSizer* const main_sizer = new wxBoxSizer(wxVERTICAL);
main_sizer->Add(Notebook, 1, wxEXPAND | wxALL, 5);
main_sizer->Add(CreateButtonSizer(wxOK), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
#ifdef __APPLE__
main_sizer->SetMinSize(550, 0);
main_sizer->SetMinSize(550, 0);
#else
main_sizer->SetMinSize(400, 0);
main_sizer->SetMinSize(400, 0);
#endif
SetSizerAndFit(main_sizer);
Center();
SetFocus();
SetSizerAndFit(main_sizer);
Center();
SetFocus();
}
void CConfigMain::OnClose(wxCloseEvent& WXUNUSED(event))
{
EndModal((m_refresh_game_list_on_close) ? wxID_OK : wxID_CANCEL);
EndModal((m_refresh_game_list_on_close) ? wxID_OK : wxID_CANCEL);
}
void CConfigMain::OnOk(wxCommandEvent& WXUNUSED(event))
{
Close();
Close();
// Save the config. Dolphin crashes too often to only save the settings on closing
SConfig::GetInstance().SaveSettings();
// Save the config. Dolphin crashes too often to only save the settings on closing
SConfig::GetInstance().SaveSettings();
}
void CConfigMain::OnSetRefreshGameListOnClose(wxCommandEvent& WXUNUSED(event))
{
m_refresh_game_list_on_close = true;
m_refresh_game_list_on_close = true;
}

View File

@ -15,35 +15,33 @@ wxDECLARE_EVENT(wxDOLPHIN_CFG_REFRESH_LIST, wxCommandEvent);
class CConfigMain : public wxDialog
{
public:
CConfigMain(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxString& title = _("Dolphin Configuration"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE);
virtual ~CConfigMain();
CConfigMain(wxWindow* parent, wxWindowID id = wxID_ANY,
const wxString& title = _("Dolphin Configuration"),
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE);
virtual ~CConfigMain();
void SetSelectedTab(int tab);
void SetSelectedTab(int tab);
enum
{
ID_NOTEBOOK = 1000,
ID_GENERALPAGE,
ID_DISPLAYPAGE,
ID_AUDIOPAGE,
ID_GAMECUBEPAGE,
ID_WIIPAGE,
ID_PATHSPAGE,
ID_ADVANCEDPAGE,
};
enum
{
ID_NOTEBOOK = 1000,
ID_GENERALPAGE,
ID_DISPLAYPAGE,
ID_AUDIOPAGE,
ID_GAMECUBEPAGE,
ID_WIIPAGE,
ID_PATHSPAGE,
ID_ADVANCEDPAGE,
};
private:
void CreateGUIControls();
void OnClose(wxCloseEvent& event);
void OnOk(wxCommandEvent& event);
void OnSetRefreshGameListOnClose(wxCommandEvent& event);
void CreateGUIControls();
void OnClose(wxCloseEvent& event);
void OnOk(wxCommandEvent& event);
void OnSetRefreshGameListOnClose(wxCommandEvent& event);
wxNotebook* Notebook;
wxNotebook* Notebook;
bool m_refresh_game_list_on_close;
bool m_refresh_game_list_on_close;
};

View File

@ -13,65 +13,64 @@
wxDEFINE_EVENT(wxEVT_ADAPTER_UPDATE, wxCommandEvent);
GCAdapterConfigDiag::GCAdapterConfigDiag(wxWindow* const parent, const wxString& name, const int tab_num)
: wxDialog(parent, wxID_ANY, name, wxPoint(128,-1)), m_pad_id(tab_num)
GCAdapterConfigDiag::GCAdapterConfigDiag(wxWindow* const parent, const wxString& name,
const int tab_num)
: wxDialog(parent, wxID_ANY, name, wxPoint(128, -1)), m_pad_id(tab_num)
{
wxBoxSizer* const szr = new wxBoxSizer(wxVERTICAL);
wxBoxSizer* const szr = new wxBoxSizer(wxVERTICAL);
wxCheckBox* const gamecube_rumble = new wxCheckBox(this, wxID_ANY, _("Rumble"));
gamecube_rumble->SetValue(SConfig::GetInstance().m_AdapterRumble[m_pad_id]);
gamecube_rumble->Bind(wxEVT_CHECKBOX, &GCAdapterConfigDiag::OnAdapterRumble, this);
wxCheckBox* const gamecube_rumble = new wxCheckBox(this, wxID_ANY, _("Rumble"));
gamecube_rumble->SetValue(SConfig::GetInstance().m_AdapterRumble[m_pad_id]);
gamecube_rumble->Bind(wxEVT_CHECKBOX, &GCAdapterConfigDiag::OnAdapterRumble, this);
wxCheckBox* const gamecube_konga = new wxCheckBox(this, wxID_ANY, _("Simulate DK Bongos"));
gamecube_konga->SetValue(SConfig::GetInstance().m_AdapterKonga[m_pad_id]);
gamecube_konga->Bind(wxEVT_CHECKBOX, &GCAdapterConfigDiag::OnAdapterKonga, this);
wxCheckBox* const gamecube_konga = new wxCheckBox(this, wxID_ANY, _("Simulate DK Bongos"));
gamecube_konga->SetValue(SConfig::GetInstance().m_AdapterKonga[m_pad_id]);
gamecube_konga->Bind(wxEVT_CHECKBOX, &GCAdapterConfigDiag::OnAdapterKonga, this);
m_adapter_status = new wxStaticText(this, wxID_ANY, _("Adapter Not Detected"));
m_adapter_status = new wxStaticText(this, wxID_ANY, _("Adapter Not Detected"));
if (!GCAdapter::IsDetected())
{
if (!GCAdapter::IsDriverDetected())
{
m_adapter_status->SetLabelText(_("Driver Not Detected"));
gamecube_rumble->Disable();
}
}
else
{
m_adapter_status->SetLabelText(_("Adapter Detected"));
}
GCAdapter::SetAdapterCallback(std::bind(&GCAdapterConfigDiag::ScheduleAdapterUpdate, this));
if (!GCAdapter::IsDetected())
{
if (!GCAdapter::IsDriverDetected())
{
m_adapter_status->SetLabelText(_("Driver Not Detected"));
gamecube_rumble->Disable();
}
}
else
{
m_adapter_status->SetLabelText(_("Adapter Detected"));
}
GCAdapter::SetAdapterCallback(std::bind(&GCAdapterConfigDiag::ScheduleAdapterUpdate, this));
szr->Add(m_adapter_status, 0, wxEXPAND);
szr->Add(gamecube_rumble, 0, wxEXPAND);
szr->Add(gamecube_konga, 0, wxEXPAND);
szr->Add(CreateButtonSizer(wxOK | wxNO_DEFAULT), 0, wxEXPAND | wxALL, 5);
szr->Add(m_adapter_status, 0, wxEXPAND);
szr->Add(gamecube_rumble, 0, wxEXPAND);
szr->Add(gamecube_konga, 0, wxEXPAND);
szr->Add(CreateButtonSizer(wxOK | wxNO_DEFAULT), 0, wxEXPAND|wxALL, 5);
SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED);
SetSizerAndFit(szr);
Center();
SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED);
SetSizerAndFit(szr);
Center();
Bind(wxEVT_ADAPTER_UPDATE, &GCAdapterConfigDiag::UpdateAdapter, this);
Bind(wxEVT_ADAPTER_UPDATE, &GCAdapterConfigDiag::UpdateAdapter, this);
}
void GCAdapterConfigDiag::ScheduleAdapterUpdate()
{
wxQueueEvent(this, new wxCommandEvent(wxEVT_ADAPTER_UPDATE));
wxQueueEvent(this, new wxCommandEvent(wxEVT_ADAPTER_UPDATE));
}
void GCAdapterConfigDiag::UpdateAdapter(wxCommandEvent& ev)
{
bool unpause = Core::PauseAndLock(true);
if (GCAdapter::IsDetected())
m_adapter_status->SetLabelText(_("Adapter Detected"));
else
m_adapter_status->SetLabelText(_("Adapter Not Detected"));
Core::PauseAndLock(false, unpause);
bool unpause = Core::PauseAndLock(true);
if (GCAdapter::IsDetected())
m_adapter_status->SetLabelText(_("Adapter Detected"));
else
m_adapter_status->SetLabelText(_("Adapter Not Detected"));
Core::PauseAndLock(false, unpause);
}
GCAdapterConfigDiag::~GCAdapterConfigDiag()
{
GCAdapter::SetAdapterCallback(nullptr);
GCAdapter::SetAdapterCallback(nullptr);
}

View File

@ -18,23 +18,23 @@
class GCAdapterConfigDiag : public wxDialog
{
public:
GCAdapterConfigDiag(wxWindow* const parent, const wxString& name, const int tab_num = 0);
~GCAdapterConfigDiag();
GCAdapterConfigDiag(wxWindow* const parent, const wxString& name, const int tab_num = 0);
~GCAdapterConfigDiag();
void ScheduleAdapterUpdate();
void UpdateAdapter(wxCommandEvent& ev);
void ScheduleAdapterUpdate();
void UpdateAdapter(wxCommandEvent& ev);
private:
wxStaticText* m_adapter_status;
int m_pad_id;
wxStaticText* m_adapter_status;
int m_pad_id;
void OnAdapterRumble(wxCommandEvent& event)
{
SConfig::GetInstance().m_AdapterRumble[m_pad_id] = event.IsChecked();
}
void OnAdapterRumble(wxCommandEvent& event)
{
SConfig::GetInstance().m_AdapterRumble[m_pad_id] = event.IsChecked();
}
void OnAdapterKonga(wxCommandEvent& event)
{
SConfig::GetInstance().m_AdapterKonga[m_pad_id] = event.IsChecked();
}
void OnAdapterKonga(wxCommandEvent& event)
{
SConfig::GetInstance().m_AdapterKonga[m_pad_id] = event.IsChecked();
}
};

View File

@ -18,369 +18,380 @@
#include "Common/FileUtil.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/NetPlayProto.h"
#include "Core/HW/EXI.h"
#include "Core/HW/GCMemcard.h"
#include "DolphinWX/WxUtils.h"
#include "Core/NetPlayProto.h"
#include "DolphinWX/Config/ConfigMain.h"
#include "DolphinWX/Config/GameCubeConfigPane.h"
#include "DolphinWX/WxUtils.h"
#define DEV_NONE_STR _trans("<Nothing>")
#define DEV_DUMMY_STR _trans("Dummy")
#define DEV_NONE_STR _trans("<Nothing>")
#define DEV_DUMMY_STR _trans("Dummy")
#define EXIDEV_MEMCARD_STR _trans("Memory Card")
#define EXIDEV_MEMDIR_STR _trans("GCI Folder")
#define EXIDEV_MIC_STR _trans("Microphone")
#define EXIDEV_BBA_STR _trans("Broadband Adapter")
#define EXIDEV_AGP_STR _trans("Advance Game Port")
#define EXIDEV_AM_BB_STR _trans("AM Baseboard")
#define EXIDEV_GECKO_STR _trans("USB Gecko")
#define EXIDEV_MEMCARD_STR _trans("Memory Card")
#define EXIDEV_MEMDIR_STR _trans("GCI Folder")
#define EXIDEV_MIC_STR _trans("Microphone")
#define EXIDEV_BBA_STR _trans("Broadband Adapter")
#define EXIDEV_AGP_STR _trans("Advance Game Port")
#define EXIDEV_AM_BB_STR _trans("AM Baseboard")
#define EXIDEV_GECKO_STR _trans("USB Gecko")
GameCubeConfigPane::GameCubeConfigPane(wxWindow* parent, wxWindowID id)
: wxPanel(parent, id)
GameCubeConfigPane::GameCubeConfigPane(wxWindow* parent, wxWindowID id) : wxPanel(parent, id)
{
InitializeGUI();
LoadGUIValues();
RefreshGUI();
InitializeGUI();
LoadGUIValues();
RefreshGUI();
}
void GameCubeConfigPane::InitializeGUI()
{
m_ipl_language_strings.Add(_("English"));
m_ipl_language_strings.Add(_("German"));
m_ipl_language_strings.Add(_("French"));
m_ipl_language_strings.Add(_("Spanish"));
m_ipl_language_strings.Add(_("Italian"));
m_ipl_language_strings.Add(_("Dutch"));
m_ipl_language_strings.Add(_("English"));
m_ipl_language_strings.Add(_("German"));
m_ipl_language_strings.Add(_("French"));
m_ipl_language_strings.Add(_("Spanish"));
m_ipl_language_strings.Add(_("Italian"));
m_ipl_language_strings.Add(_("Dutch"));
m_system_lang_choice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_ipl_language_strings);
m_system_lang_choice->SetToolTip(_("Sets the GameCube system language."));
m_system_lang_choice->Bind(wxEVT_CHOICE, &GameCubeConfigPane::OnSystemLanguageChange, this);
m_system_lang_choice =
new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_ipl_language_strings);
m_system_lang_choice->SetToolTip(_("Sets the GameCube system language."));
m_system_lang_choice->Bind(wxEVT_CHOICE, &GameCubeConfigPane::OnSystemLanguageChange, this);
m_override_lang_checkbox = new wxCheckBox(this, wxID_ANY, _("Override Language on NTSC Games"));
m_override_lang_checkbox->SetToolTip(_("Lets the system language be set to values that games were not designed for. This can allow the use of extra translations for a few games, but can also lead to text display issues."));
m_override_lang_checkbox->Bind(wxEVT_CHECKBOX, &GameCubeConfigPane::OnOverrideLanguageCheckBoxChanged, this);
m_override_lang_checkbox = new wxCheckBox(this, wxID_ANY, _("Override Language on NTSC Games"));
m_override_lang_checkbox->SetToolTip(_(
"Lets the system language be set to values that games were not designed for. This can allow "
"the use of extra translations for a few games, but can also lead to text display issues."));
m_override_lang_checkbox->Bind(wxEVT_CHECKBOX,
&GameCubeConfigPane::OnOverrideLanguageCheckBoxChanged, this);
m_skip_bios_checkbox = new wxCheckBox(this, wxID_ANY, _("Skip BIOS"));
m_skip_bios_checkbox->Bind(wxEVT_CHECKBOX, &GameCubeConfigPane::OnSkipBiosCheckBoxChanged, this);
m_skip_bios_checkbox = new wxCheckBox(this, wxID_ANY, _("Skip BIOS"));
m_skip_bios_checkbox->Bind(wxEVT_CHECKBOX, &GameCubeConfigPane::OnSkipBiosCheckBoxChanged, this);
if (!File::Exists(File::GetUserPath(D_GCUSER_IDX) + DIR_SEP + USA_DIR + DIR_SEP GC_IPL) &&
!File::Exists(File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + USA_DIR + DIR_SEP GC_IPL) &&
!File::Exists(File::GetUserPath(D_GCUSER_IDX) + DIR_SEP + JAP_DIR + DIR_SEP GC_IPL) &&
!File::Exists(File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + JAP_DIR + DIR_SEP GC_IPL) &&
!File::Exists(File::GetUserPath(D_GCUSER_IDX) + DIR_SEP + EUR_DIR + DIR_SEP GC_IPL) &&
!File::Exists(File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + EUR_DIR + DIR_SEP GC_IPL))
{
m_skip_bios_checkbox->Disable();
m_skip_bios_checkbox->SetToolTip(_("Put BIOS roms in User/GC/{region}."));
}
if (!File::Exists(File::GetUserPath(D_GCUSER_IDX) + DIR_SEP + USA_DIR + DIR_SEP GC_IPL) &&
!File::Exists(File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + USA_DIR + DIR_SEP GC_IPL) &&
!File::Exists(File::GetUserPath(D_GCUSER_IDX) + DIR_SEP + JAP_DIR + DIR_SEP GC_IPL) &&
!File::Exists(File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + JAP_DIR + DIR_SEP GC_IPL) &&
!File::Exists(File::GetUserPath(D_GCUSER_IDX) + DIR_SEP + EUR_DIR + DIR_SEP GC_IPL) &&
!File::Exists(File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + EUR_DIR + DIR_SEP GC_IPL))
{
m_skip_bios_checkbox->Disable();
m_skip_bios_checkbox->SetToolTip(_("Put BIOS roms in User/GC/{region}."));
}
// Device settings
// EXI Devices
wxStaticText* GCEXIDeviceText[3] = {
new wxStaticText(this, wxID_ANY, _("Slot A")),
new wxStaticText(this, wxID_ANY, _("Slot B")),
new wxStaticText(this, wxID_ANY, "SP1"),
};
// Device settings
// EXI Devices
wxStaticText* GCEXIDeviceText[3] = {
new wxStaticText(this, wxID_ANY, _("Slot A")), new wxStaticText(this, wxID_ANY, _("Slot B")),
new wxStaticText(this, wxID_ANY, "SP1"),
};
m_exi_devices[0] = new wxChoice(this, wxID_ANY);
m_exi_devices[0]->Bind(wxEVT_CHOICE, &GameCubeConfigPane::OnSlotAChanged, this);
m_exi_devices[1] = new wxChoice(this, wxID_ANY);
m_exi_devices[1]->Bind(wxEVT_CHOICE, &GameCubeConfigPane::OnSlotBChanged, this);
m_exi_devices[2] = new wxChoice(this, wxID_ANY);
m_exi_devices[2]->Bind(wxEVT_CHOICE, &GameCubeConfigPane::OnSP1Changed, this);
m_exi_devices[2]->SetToolTip(_("Serial Port 1 - This is the port which devices such as the net adapter use."));
m_exi_devices[0] = new wxChoice(this, wxID_ANY);
m_exi_devices[0]->Bind(wxEVT_CHOICE, &GameCubeConfigPane::OnSlotAChanged, this);
m_exi_devices[1] = new wxChoice(this, wxID_ANY);
m_exi_devices[1]->Bind(wxEVT_CHOICE, &GameCubeConfigPane::OnSlotBChanged, this);
m_exi_devices[2] = new wxChoice(this, wxID_ANY);
m_exi_devices[2]->Bind(wxEVT_CHOICE, &GameCubeConfigPane::OnSP1Changed, this);
m_exi_devices[2]->SetToolTip(
_("Serial Port 1 - This is the port which devices such as the net adapter use."));
m_memcard_path[0] = new wxButton(this, wxID_ANY, "...", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
m_memcard_path[0]->Bind(wxEVT_BUTTON, &GameCubeConfigPane::OnSlotAButtonClick, this);
m_memcard_path[1] = new wxButton(this, wxID_ANY, "...", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
m_memcard_path[1]->Bind(wxEVT_BUTTON, &GameCubeConfigPane::OnSlotBButtonClick, this);
m_memcard_path[0] =
new wxButton(this, wxID_ANY, "...", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
m_memcard_path[0]->Bind(wxEVT_BUTTON, &GameCubeConfigPane::OnSlotAButtonClick, this);
m_memcard_path[1] =
new wxButton(this, wxID_ANY, "...", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
m_memcard_path[1]->Bind(wxEVT_BUTTON, &GameCubeConfigPane::OnSlotBButtonClick, this);
// Populate the GameCube page
wxGridBagSizer* const sGamecubeIPLSettings = new wxGridBagSizer();
sGamecubeIPLSettings->Add(m_skip_bios_checkbox, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5);
sGamecubeIPLSettings->Add(new wxStaticText(this, wxID_ANY, _("System Language:")),
wxGBPosition(1, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM, 5);
sGamecubeIPLSettings->Add(m_system_lang_choice, wxGBPosition(1, 1), wxDefaultSpan, wxLEFT | wxRIGHT | wxBOTTOM, 5);
sGamecubeIPLSettings->Add(m_override_lang_checkbox, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5);
// Populate the GameCube page
wxGridBagSizer* const sGamecubeIPLSettings = new wxGridBagSizer();
sGamecubeIPLSettings->Add(m_skip_bios_checkbox, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5);
sGamecubeIPLSettings->Add(new wxStaticText(this, wxID_ANY, _("System Language:")),
wxGBPosition(1, 0), wxDefaultSpan,
wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM, 5);
sGamecubeIPLSettings->Add(m_system_lang_choice, wxGBPosition(1, 1), wxDefaultSpan,
wxLEFT | wxRIGHT | wxBOTTOM, 5);
sGamecubeIPLSettings->Add(m_override_lang_checkbox, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5);
wxStaticBoxSizer* const sbGamecubeIPLSettings = new wxStaticBoxSizer(wxVERTICAL, this, _("IPL Settings"));
sbGamecubeIPLSettings->Add(sGamecubeIPLSettings);
wxStaticBoxSizer* const sbGamecubeDeviceSettings = new wxStaticBoxSizer(wxVERTICAL, this, _("Device Settings"));
wxGridBagSizer* const sbGamecubeEXIDevSettings = new wxGridBagSizer(10, 10);
wxStaticBoxSizer* const sbGamecubeIPLSettings =
new wxStaticBoxSizer(wxVERTICAL, this, _("IPL Settings"));
sbGamecubeIPLSettings->Add(sGamecubeIPLSettings);
wxStaticBoxSizer* const sbGamecubeDeviceSettings =
new wxStaticBoxSizer(wxVERTICAL, this, _("Device Settings"));
wxGridBagSizer* const sbGamecubeEXIDevSettings = new wxGridBagSizer(10, 10);
for (int i = 0; i < 3; ++i)
{
sbGamecubeEXIDevSettings->Add(GCEXIDeviceText[i], wxGBPosition(i, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
sbGamecubeEXIDevSettings->Add(m_exi_devices[i], wxGBPosition(i, 1), wxGBSpan(1, (i < 2) ? 1 : 2), wxALIGN_CENTER_VERTICAL);
for (int i = 0; i < 3; ++i)
{
sbGamecubeEXIDevSettings->Add(GCEXIDeviceText[i], wxGBPosition(i, 0), wxDefaultSpan,
wxALIGN_CENTER_VERTICAL);
sbGamecubeEXIDevSettings->Add(m_exi_devices[i], wxGBPosition(i, 1),
wxGBSpan(1, (i < 2) ? 1 : 2), wxALIGN_CENTER_VERTICAL);
if (i < 2)
sbGamecubeEXIDevSettings->Add(m_memcard_path[i], wxGBPosition(i, 2), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
if (i < 2)
sbGamecubeEXIDevSettings->Add(m_memcard_path[i], wxGBPosition(i, 2), wxDefaultSpan,
wxALIGN_CENTER_VERTICAL);
if (NetPlay::IsNetPlayRunning())
m_exi_devices[i]->Disable();
}
sbGamecubeDeviceSettings->Add(sbGamecubeEXIDevSettings, 0, wxALL, 5);
if (NetPlay::IsNetPlayRunning())
m_exi_devices[i]->Disable();
}
sbGamecubeDeviceSettings->Add(sbGamecubeEXIDevSettings, 0, wxALL, 5);
wxBoxSizer* const main_sizer = new wxBoxSizer(wxVERTICAL);
main_sizer->Add(sbGamecubeIPLSettings, 0, wxEXPAND | wxALL, 5);
main_sizer->Add(sbGamecubeDeviceSettings, 0, wxEXPAND | wxALL, 5);
wxBoxSizer* const main_sizer = new wxBoxSizer(wxVERTICAL);
main_sizer->Add(sbGamecubeIPLSettings, 0, wxEXPAND | wxALL, 5);
main_sizer->Add(sbGamecubeDeviceSettings, 0, wxEXPAND | wxALL, 5);
SetSizer(main_sizer);
SetSizer(main_sizer);
}
void GameCubeConfigPane::LoadGUIValues()
{
const SConfig& startup_params = SConfig::GetInstance();
const SConfig& startup_params = SConfig::GetInstance();
m_system_lang_choice->SetSelection(startup_params.SelectedLanguage);
m_skip_bios_checkbox->SetValue(startup_params.bHLE_BS2);
m_override_lang_checkbox->SetValue(startup_params.bOverrideGCLanguage);
m_system_lang_choice->SetSelection(startup_params.SelectedLanguage);
m_skip_bios_checkbox->SetValue(startup_params.bHLE_BS2);
m_override_lang_checkbox->SetValue(startup_params.bOverrideGCLanguage);
wxArrayString slot_devices;
slot_devices.Add(_(DEV_NONE_STR));
slot_devices.Add(_(DEV_DUMMY_STR));
slot_devices.Add(_(EXIDEV_MEMCARD_STR));
slot_devices.Add(_(EXIDEV_MEMDIR_STR));
slot_devices.Add(_(EXIDEV_GECKO_STR));
slot_devices.Add(_(EXIDEV_AGP_STR));
wxArrayString slot_devices;
slot_devices.Add(_(DEV_NONE_STR));
slot_devices.Add(_(DEV_DUMMY_STR));
slot_devices.Add(_(EXIDEV_MEMCARD_STR));
slot_devices.Add(_(EXIDEV_MEMDIR_STR));
slot_devices.Add(_(EXIDEV_GECKO_STR));
slot_devices.Add(_(EXIDEV_AGP_STR));
#if HAVE_PORTAUDIO
slot_devices.Add(_(EXIDEV_MIC_STR));
slot_devices.Add(_(EXIDEV_MIC_STR));
#endif
wxArrayString sp1_devices;
sp1_devices.Add(_(DEV_NONE_STR));
sp1_devices.Add(_(DEV_DUMMY_STR));
sp1_devices.Add(_(EXIDEV_BBA_STR));
sp1_devices.Add(_(EXIDEV_AM_BB_STR));
wxArrayString sp1_devices;
sp1_devices.Add(_(DEV_NONE_STR));
sp1_devices.Add(_(DEV_DUMMY_STR));
sp1_devices.Add(_(EXIDEV_BBA_STR));
sp1_devices.Add(_(EXIDEV_AM_BB_STR));
for (int i = 0; i < 3; ++i)
{
bool isMemcard = false;
for (int i = 0; i < 3; ++i)
{
bool isMemcard = false;
// Add strings to the wxChoice list, the third wxChoice is the SP1 slot
if (i == 2)
m_exi_devices[i]->Append(sp1_devices);
else
m_exi_devices[i]->Append(slot_devices);
// Add strings to the wxChoice list, the third wxChoice is the SP1 slot
if (i == 2)
m_exi_devices[i]->Append(sp1_devices);
else
m_exi_devices[i]->Append(slot_devices);
switch (SConfig::GetInstance().m_EXIDevice[i])
{
case EXIDEVICE_NONE:
m_exi_devices[i]->SetStringSelection(slot_devices[0]);
break;
case EXIDEVICE_MEMORYCARD:
isMemcard = m_exi_devices[i]->SetStringSelection(slot_devices[2]);
break;
case EXIDEVICE_MEMORYCARDFOLDER:
m_exi_devices[i]->SetStringSelection(slot_devices[3]);
break;
case EXIDEVICE_GECKO:
m_exi_devices[i]->SetStringSelection(slot_devices[4]);
break;
case EXIDEVICE_AGP:
isMemcard = m_exi_devices[i]->SetStringSelection(slot_devices[5]);
break;
case EXIDEVICE_MIC:
m_exi_devices[i]->SetStringSelection(slot_devices[6]);
break;
case EXIDEVICE_ETH:
m_exi_devices[i]->SetStringSelection(sp1_devices[2]);
break;
case EXIDEVICE_AM_BASEBOARD:
m_exi_devices[i]->SetStringSelection(sp1_devices[3]);
break;
case EXIDEVICE_DUMMY:
default:
m_exi_devices[i]->SetStringSelection(slot_devices[1]);
break;
}
switch (SConfig::GetInstance().m_EXIDevice[i])
{
case EXIDEVICE_NONE:
m_exi_devices[i]->SetStringSelection(slot_devices[0]);
break;
case EXIDEVICE_MEMORYCARD:
isMemcard = m_exi_devices[i]->SetStringSelection(slot_devices[2]);
break;
case EXIDEVICE_MEMORYCARDFOLDER:
m_exi_devices[i]->SetStringSelection(slot_devices[3]);
break;
case EXIDEVICE_GECKO:
m_exi_devices[i]->SetStringSelection(slot_devices[4]);
break;
case EXIDEVICE_AGP:
isMemcard = m_exi_devices[i]->SetStringSelection(slot_devices[5]);
break;
case EXIDEVICE_MIC:
m_exi_devices[i]->SetStringSelection(slot_devices[6]);
break;
case EXIDEVICE_ETH:
m_exi_devices[i]->SetStringSelection(sp1_devices[2]);
break;
case EXIDEVICE_AM_BASEBOARD:
m_exi_devices[i]->SetStringSelection(sp1_devices[3]);
break;
case EXIDEVICE_DUMMY:
default:
m_exi_devices[i]->SetStringSelection(slot_devices[1]);
break;
}
if (!isMemcard && i < 2)
m_memcard_path[i]->Disable();
}
if (!isMemcard && i < 2)
m_memcard_path[i]->Disable();
}
}
void GameCubeConfigPane::RefreshGUI()
{
if (Core::IsRunning())
{
m_system_lang_choice->Disable();
m_override_lang_checkbox->Disable();
m_skip_bios_checkbox->Disable();
}
if (Core::IsRunning())
{
m_system_lang_choice->Disable();
m_override_lang_checkbox->Disable();
m_skip_bios_checkbox->Disable();
}
}
void GameCubeConfigPane::OnSystemLanguageChange(wxCommandEvent& event)
{
SConfig::GetInstance().SelectedLanguage = m_system_lang_choice->GetSelection();
SConfig::GetInstance().SelectedLanguage = m_system_lang_choice->GetSelection();
AddPendingEvent(wxCommandEvent(wxDOLPHIN_CFG_REFRESH_LIST));
AddPendingEvent(wxCommandEvent(wxDOLPHIN_CFG_REFRESH_LIST));
}
void GameCubeConfigPane::OnOverrideLanguageCheckBoxChanged(wxCommandEvent& event)
{
SConfig::GetInstance().bOverrideGCLanguage = m_override_lang_checkbox->IsChecked();
SConfig::GetInstance().bOverrideGCLanguage = m_override_lang_checkbox->IsChecked();
AddPendingEvent(wxCommandEvent(wxDOLPHIN_CFG_REFRESH_LIST));
AddPendingEvent(wxCommandEvent(wxDOLPHIN_CFG_REFRESH_LIST));
}
void GameCubeConfigPane::OnSkipBiosCheckBoxChanged(wxCommandEvent& event)
{
SConfig::GetInstance().bHLE_BS2 = m_skip_bios_checkbox->IsChecked();
SConfig::GetInstance().bHLE_BS2 = m_skip_bios_checkbox->IsChecked();
}
void GameCubeConfigPane::OnSlotAChanged(wxCommandEvent& event)
{
ChooseEXIDevice(event.GetString(), 0);
ChooseEXIDevice(event.GetString(), 0);
}
void GameCubeConfigPane::OnSlotBChanged(wxCommandEvent& event)
{
ChooseEXIDevice(event.GetString(), 1);
ChooseEXIDevice(event.GetString(), 1);
}
void GameCubeConfigPane::OnSP1Changed(wxCommandEvent& event)
{
ChooseEXIDevice(event.GetString(), 2);
ChooseEXIDevice(event.GetString(), 2);
}
void GameCubeConfigPane::OnSlotAButtonClick(wxCommandEvent& event)
{
ChooseSlotPath(true, SConfig::GetInstance().m_EXIDevice[0]);
ChooseSlotPath(true, SConfig::GetInstance().m_EXIDevice[0]);
}
void GameCubeConfigPane::OnSlotBButtonClick(wxCommandEvent& event)
{
ChooseSlotPath(false, SConfig::GetInstance().m_EXIDevice[1]);
ChooseSlotPath(false, SConfig::GetInstance().m_EXIDevice[1]);
}
void GameCubeConfigPane::ChooseEXIDevice(const wxString& deviceName, int deviceNum)
{
TEXIDevices tempType;
TEXIDevices tempType;
if (!deviceName.compare(_(EXIDEV_MEMCARD_STR)))
tempType = EXIDEVICE_MEMORYCARD;
else if (!deviceName.compare(_(EXIDEV_MEMDIR_STR)))
tempType = EXIDEVICE_MEMORYCARDFOLDER;
else if (!deviceName.compare(_(EXIDEV_MIC_STR)))
tempType = EXIDEVICE_MIC;
else if (!deviceName.compare(EXIDEV_BBA_STR))
tempType = EXIDEVICE_ETH;
else if (!deviceName.compare(EXIDEV_AGP_STR))
tempType = EXIDEVICE_AGP;
else if (!deviceName.compare(_(EXIDEV_AM_BB_STR)))
tempType = EXIDEVICE_AM_BASEBOARD;
else if (!deviceName.compare(EXIDEV_GECKO_STR))
tempType = EXIDEVICE_GECKO;
else if (!deviceName.compare(_(DEV_NONE_STR)))
tempType = EXIDEVICE_NONE;
else
tempType = EXIDEVICE_DUMMY;
if (!deviceName.compare(_(EXIDEV_MEMCARD_STR)))
tempType = EXIDEVICE_MEMORYCARD;
else if (!deviceName.compare(_(EXIDEV_MEMDIR_STR)))
tempType = EXIDEVICE_MEMORYCARDFOLDER;
else if (!deviceName.compare(_(EXIDEV_MIC_STR)))
tempType = EXIDEVICE_MIC;
else if (!deviceName.compare(EXIDEV_BBA_STR))
tempType = EXIDEVICE_ETH;
else if (!deviceName.compare(EXIDEV_AGP_STR))
tempType = EXIDEVICE_AGP;
else if (!deviceName.compare(_(EXIDEV_AM_BB_STR)))
tempType = EXIDEVICE_AM_BASEBOARD;
else if (!deviceName.compare(EXIDEV_GECKO_STR))
tempType = EXIDEVICE_GECKO;
else if (!deviceName.compare(_(DEV_NONE_STR)))
tempType = EXIDEVICE_NONE;
else
tempType = EXIDEVICE_DUMMY;
// Gray out the memcard path button if we're not on a memcard or AGP
if (tempType == EXIDEVICE_MEMORYCARD || tempType == EXIDEVICE_AGP)
m_memcard_path[deviceNum]->Enable();
else if (deviceNum == 0 || deviceNum == 1)
m_memcard_path[deviceNum]->Disable();
// Gray out the memcard path button if we're not on a memcard or AGP
if (tempType == EXIDEVICE_MEMORYCARD || tempType == EXIDEVICE_AGP)
m_memcard_path[deviceNum]->Enable();
else if (deviceNum == 0 || deviceNum == 1)
m_memcard_path[deviceNum]->Disable();
SConfig::GetInstance().m_EXIDevice[deviceNum] = tempType;
SConfig::GetInstance().m_EXIDevice[deviceNum] = tempType;
if (Core::IsRunning())
{
// Change plugged device! :D
ExpansionInterface::ChangeDevice(
(deviceNum == 1) ? 1 : 0, // SlotB is on channel 1, slotA and SP1 are on 0
tempType, // The device enum to change to
(deviceNum == 2) ? 2 : 0); // SP1 is device 2, slots are device 0
}
if (Core::IsRunning())
{
// Change plugged device! :D
ExpansionInterface::ChangeDevice(
(deviceNum == 1) ? 1 : 0, // SlotB is on channel 1, slotA and SP1 are on 0
tempType, // The device enum to change to
(deviceNum == 2) ? 2 : 0); // SP1 is device 2, slots are device 0
}
}
void GameCubeConfigPane::ChooseSlotPath(bool is_slot_a, TEXIDevices device_type)
{
bool memcard = (device_type == EXIDEVICE_MEMORYCARD);
std::string path;
std::string cardname;
std::string ext;
std::string pathA = SConfig::GetInstance().m_strMemoryCardA;
std::string pathB = SConfig::GetInstance().m_strMemoryCardB;
if (!memcard)
{
pathA = SConfig::GetInstance().m_strGbaCartA;
pathB = SConfig::GetInstance().m_strGbaCartB;
}
SplitPath(is_slot_a ? pathA : pathB, &path, &cardname, &ext);
std::string filename = WxStrToStr(wxFileSelector(
_("Choose a file to open"),
StrToWxStr(path),
StrToWxStr(cardname),
StrToWxStr(ext),
memcard ? _("GameCube Memory Cards (*.raw,*.gcp)") + "|*.raw;*.gcp" : _("Game Boy Advance Carts (*.gba)") + "|*.gba"));
bool memcard = (device_type == EXIDEVICE_MEMORYCARD);
std::string path;
std::string cardname;
std::string ext;
std::string pathA = SConfig::GetInstance().m_strMemoryCardA;
std::string pathB = SConfig::GetInstance().m_strMemoryCardB;
if (!memcard)
{
pathA = SConfig::GetInstance().m_strGbaCartA;
pathB = SConfig::GetInstance().m_strGbaCartB;
}
SplitPath(is_slot_a ? pathA : pathB, &path, &cardname, &ext);
std::string filename = WxStrToStr(wxFileSelector(
_("Choose a file to open"), StrToWxStr(path), StrToWxStr(cardname), StrToWxStr(ext),
memcard ? _("GameCube Memory Cards (*.raw,*.gcp)") + "|*.raw;*.gcp" :
_("Game Boy Advance Carts (*.gba)") + "|*.gba"));
if (!filename.empty())
{
if (File::Exists(filename))
{
if (memcard)
{
GCMemcard memorycard(filename);
if (!memorycard.IsValid())
{
WxUtils::ShowErrorDialog(wxString::Format(_("Cannot use that file as a memory card.\n%s\n" \
"is not a valid GameCube memory card file"), filename.c_str()));
return;
}
}
}
if (!filename.empty())
{
if (File::Exists(filename))
{
if (memcard)
{
GCMemcard memorycard(filename);
if (!memorycard.IsValid())
{
WxUtils::ShowErrorDialog(wxString::Format(_("Cannot use that file as a memory card.\n%s\n"
"is not a valid GameCube memory card file"),
filename.c_str()));
return;
}
}
}
wxFileName newFilename(filename);
newFilename.MakeAbsolute();
filename = newFilename.GetFullPath();
wxFileName newFilename(filename);
newFilename.MakeAbsolute();
filename = newFilename.GetFullPath();
#ifdef _WIN32
// If the Memory Card file is within the Exe dir, we can assume that the user wants it to be stored relative
// to the executable, so it stays set correctly when the probably portable Exe dir is moved.
// TODO: Replace this with a cleaner, non-wx solution once std::filesystem is standard
std::string exeDir = File::GetExeDirectory() + '\\';
if (wxString(filename).Lower().StartsWith(wxString(exeDir).Lower()))
filename.erase(0, exeDir.size());
// If the Memory Card file is within the Exe dir, we can assume that the user wants it to be
// stored relative
// to the executable, so it stays set correctly when the probably portable Exe dir is moved.
// TODO: Replace this with a cleaner, non-wx solution once std::filesystem is standard
std::string exeDir = File::GetExeDirectory() + '\\';
if (wxString(filename).Lower().StartsWith(wxString(exeDir).Lower()))
filename.erase(0, exeDir.size());
std::replace(filename.begin(), filename.end(), '\\', '/');
std::replace(filename.begin(), filename.end(), '\\', '/');
#endif
// also check that the path isn't used for the other memcard...
wxFileName otherFilename(is_slot_a ? pathB : pathA);
otherFilename.MakeAbsolute();
if (newFilename.GetFullPath().compare(otherFilename.GetFullPath()) != 0)
{
if (memcard)
{
if (is_slot_a)
SConfig::GetInstance().m_strMemoryCardA = filename;
else
SConfig::GetInstance().m_strMemoryCardB = filename;
}
else
{
if (is_slot_a)
SConfig::GetInstance().m_strGbaCartA = filename;
else
SConfig::GetInstance().m_strGbaCartB = filename;
}
// also check that the path isn't used for the other memcard...
wxFileName otherFilename(is_slot_a ? pathB : pathA);
otherFilename.MakeAbsolute();
if (newFilename.GetFullPath().compare(otherFilename.GetFullPath()) != 0)
{
if (memcard)
{
if (is_slot_a)
SConfig::GetInstance().m_strMemoryCardA = filename;
else
SConfig::GetInstance().m_strMemoryCardB = filename;
}
else
{
if (is_slot_a)
SConfig::GetInstance().m_strGbaCartA = filename;
else
SConfig::GetInstance().m_strGbaCartB = filename;
}
if (Core::IsRunning())
{
// Change memcard to the new file
ExpansionInterface::ChangeDevice(
is_slot_a ? 0 : 1, // SlotA: channel 0, SlotB channel 1
device_type,
0); // SP1 is device 2, slots are device 0
}
}
else
{
WxUtils::ShowErrorDialog(_("Are you trying to use the same file in both slots?"));
}
}
if (Core::IsRunning())
{
// Change memcard to the new file
ExpansionInterface::ChangeDevice(is_slot_a ? 0 : 1, // SlotA: channel 0, SlotB channel 1
device_type,
0); // SP1 is device 2, slots are device 0
}
}
else
{
WxUtils::ShowErrorDialog(_("Are you trying to use the same file in both slots?"));
}
}
}

View File

@ -15,30 +15,30 @@ class wxString;
class GameCubeConfigPane final : public wxPanel
{
public:
GameCubeConfigPane(wxWindow* parent, wxWindowID id);
GameCubeConfigPane(wxWindow* parent, wxWindowID id);
private:
void InitializeGUI();
void LoadGUIValues();
void RefreshGUI();
void InitializeGUI();
void LoadGUIValues();
void RefreshGUI();
void OnSystemLanguageChange(wxCommandEvent&);
void OnOverrideLanguageCheckBoxChanged(wxCommandEvent&);
void OnSkipBiosCheckBoxChanged(wxCommandEvent&);
void OnSlotAChanged(wxCommandEvent&);
void OnSlotBChanged(wxCommandEvent&);
void OnSP1Changed(wxCommandEvent&);
void OnSlotAButtonClick(wxCommandEvent&);
void OnSlotBButtonClick(wxCommandEvent&);
void OnSystemLanguageChange(wxCommandEvent&);
void OnOverrideLanguageCheckBoxChanged(wxCommandEvent&);
void OnSkipBiosCheckBoxChanged(wxCommandEvent&);
void OnSlotAChanged(wxCommandEvent&);
void OnSlotBChanged(wxCommandEvent&);
void OnSP1Changed(wxCommandEvent&);
void OnSlotAButtonClick(wxCommandEvent&);
void OnSlotBButtonClick(wxCommandEvent&);
void ChooseEXIDevice(const wxString& device_name, int device_id);
void ChooseSlotPath(bool is_slot_a, TEXIDevices device_type);
void ChooseEXIDevice(const wxString& device_name, int device_id);
void ChooseSlotPath(bool is_slot_a, TEXIDevices device_type);
wxArrayString m_ipl_language_strings;
wxArrayString m_ipl_language_strings;
wxChoice* m_system_lang_choice;
wxCheckBox* m_override_lang_checkbox;
wxCheckBox* m_skip_bios_checkbox;
wxChoice* m_exi_devices[3];
wxButton* m_memcard_path[2];
wxChoice* m_system_lang_choice;
wxCheckBox* m_override_lang_checkbox;
wxCheckBox* m_skip_bios_checkbox;
wxChoice* m_exi_devices[3];
wxButton* m_memcard_path[2];
};

View File

@ -16,183 +16,203 @@
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/PowerPC/PowerPC.h"
#include "DolphinWX/Frame.h"
#include "DolphinWX/Main.h"
#include "DolphinWX/Config/GeneralConfigPane.h"
#include "DolphinWX/Debugger/CodeWindow.h"
#include "DolphinWX/Frame.h"
#include "DolphinWX/Main.h"
GeneralConfigPane::GeneralConfigPane(wxWindow* parent, wxWindowID id)
: wxPanel(parent, id)
GeneralConfigPane::GeneralConfigPane(wxWindow* parent, wxWindowID id) : wxPanel(parent, id)
{
cpu_cores = {
{ PowerPC::CORE_INTERPRETER, _("Interpreter (slowest)") },
{ PowerPC::CORE_CACHEDINTERPRETER, _("Cached Interpreter (slower)") },
cpu_cores = {
{PowerPC::CORE_INTERPRETER, _("Interpreter (slowest)")},
{PowerPC::CORE_CACHEDINTERPRETER, _("Cached Interpreter (slower)")},
#ifdef _M_X86_64
{ PowerPC::CORE_JIT64, _("JIT Recompiler (recommended)") },
{ PowerPC::CORE_JITIL64, _("JITIL Recompiler (slow, experimental)") },
{PowerPC::CORE_JIT64, _("JIT Recompiler (recommended)")},
{PowerPC::CORE_JITIL64, _("JITIL Recompiler (slow, experimental)")},
#elif defined(_M_ARM_64)
{ PowerPC::CORE_JITARM64, _("JIT Arm64 (experimental)") },
{PowerPC::CORE_JITARM64, _("JIT Arm64 (experimental)")},
#endif
};
};
InitializeGUI();
LoadGUIValues();
RefreshGUI();
InitializeGUI();
LoadGUIValues();
RefreshGUI();
}
void GeneralConfigPane::InitializeGUI()
{
m_throttler_array_string.Add(_("Unlimited"));
for (int i = 10; i <= 200; i += 10) // from 10% to 200%
{
if (i == 100)
m_throttler_array_string.Add(wxString::Format(_("%i%% (Normal Speed)"), i));
else
m_throttler_array_string.Add(wxString::Format(_("%i%%"), i));
}
m_throttler_array_string.Add(_("Unlimited"));
for (int i = 10; i <= 200; i += 10) // from 10% to 200%
{
if (i == 100)
m_throttler_array_string.Add(wxString::Format(_("%i%% (Normal Speed)"), i));
else
m_throttler_array_string.Add(wxString::Format(_("%i%%"), i));
}
for (const CPUCore& cpu_core : cpu_cores)
m_cpu_engine_array_string.Add(cpu_core.name);
for (const CPUCore& cpu_core : cpu_cores)
m_cpu_engine_array_string.Add(cpu_core.name);
m_dual_core_checkbox = new wxCheckBox(this, wxID_ANY, _("Enable Dual Core (speedup)"));
m_idle_skip_checkbox = new wxCheckBox(this, wxID_ANY, _("Enable Idle Skipping (speedup)"));
m_cheats_checkbox = new wxCheckBox(this, wxID_ANY, _("Enable Cheats"));
m_force_ntscj_checkbox = new wxCheckBox(this, wxID_ANY, _("Force Console as NTSC-J"));
m_analytics_checkbox = new wxCheckBox(this, wxID_ANY, _("Enable Usage Statistics Reporting"));
m_dual_core_checkbox = new wxCheckBox(this, wxID_ANY, _("Enable Dual Core (speedup)"));
m_idle_skip_checkbox = new wxCheckBox(this, wxID_ANY, _("Enable Idle Skipping (speedup)"));
m_cheats_checkbox = new wxCheckBox(this, wxID_ANY, _("Enable Cheats"));
m_force_ntscj_checkbox = new wxCheckBox(this, wxID_ANY, _("Force Console as NTSC-J"));
m_analytics_checkbox = new wxCheckBox(this, wxID_ANY, _("Enable Usage Statistics Reporting"));
#ifdef __APPLE__
m_analytics_new_id = new wxButton(this, wxID_ANY, _("Generate a New Statistics Identity"), wxDefaultPosition, wxSize(350, 25));
m_analytics_new_id = new wxButton(this, wxID_ANY, _("Generate a New Statistics Identity"),
wxDefaultPosition, wxSize(350, 25));
#else
m_analytics_new_id = new wxButton(this, wxID_ANY, _("Generate a New Statistics Identity"));
m_analytics_new_id = new wxButton(this, wxID_ANY, _("Generate a New Statistics Identity"));
#endif
m_throttler_choice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_throttler_array_string);
m_cpu_engine_radiobox = new wxRadioBox(this, wxID_ANY, _("CPU Emulator Engine"), wxDefaultPosition, wxDefaultSize, m_cpu_engine_array_string, 0, wxRA_SPECIFY_ROWS);
m_throttler_choice =
new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_throttler_array_string);
m_cpu_engine_radiobox =
new wxRadioBox(this, wxID_ANY, _("CPU Emulator Engine"), wxDefaultPosition, wxDefaultSize,
m_cpu_engine_array_string, 0, wxRA_SPECIFY_ROWS);
m_dual_core_checkbox->SetToolTip(_("Splits the CPU and GPU threads so they can be run on separate cores.\nProvides major speed improvements on most modern PCs, but can cause occasional crashes/glitches."));
m_idle_skip_checkbox->SetToolTip(_("Attempt to detect and skip wait-loops.\nIf unsure, leave this checked."));
m_cheats_checkbox->SetToolTip(_("Enables the use of Action Replay and Gecko cheats."));
m_force_ntscj_checkbox->SetToolTip(_("Forces NTSC-J mode for using the Japanese ROM font.\nIf left unchecked, Dolphin defaults to NTSC-U and automatically enables this setting when playing Japanese games."));
m_analytics_checkbox->SetToolTip(_("Enables the collection and sharing of usage statistics data with the Dolphin development team. This data is used to improve the emulator and help us understand how our users interact with the system. No private data is ever collected."));
m_analytics_new_id->SetToolTip(_("Usage statistics reporting uses a unique random per-machine identifier to distinguish users from one another. This button generates a new random identifier for this machine which is dissociated from the previous one."));
m_throttler_choice->SetToolTip(_("Limits the emulation speed to the specified percentage.\nNote that raising or lowering the emulation speed will also raise or lower the audio pitch to prevent audio from stuttering."));
m_dual_core_checkbox->SetToolTip(
_("Splits the CPU and GPU threads so they can be run on separate cores.\nProvides major "
"speed improvements on most modern PCs, but can cause occasional crashes/glitches."));
m_idle_skip_checkbox->SetToolTip(
_("Attempt to detect and skip wait-loops.\nIf unsure, leave this checked."));
m_cheats_checkbox->SetToolTip(_("Enables the use of Action Replay and Gecko cheats."));
m_force_ntscj_checkbox->SetToolTip(
_("Forces NTSC-J mode for using the Japanese ROM font.\nIf left unchecked, Dolphin defaults "
"to NTSC-U and automatically enables this setting when playing Japanese games."));
m_analytics_checkbox->SetToolTip(
_("Enables the collection and sharing of usage statistics data with the Dolphin development "
"team. This data is used to improve the emulator and help us understand how our users "
"interact with the system. No private data is ever collected."));
m_analytics_new_id->SetToolTip(
_("Usage statistics reporting uses a unique random per-machine identifier to distinguish "
"users from one another. This button generates a new random identifier for this machine "
"which is dissociated from the previous one."));
m_throttler_choice->SetToolTip(_("Limits the emulation speed to the specified percentage.\nNote "
"that raising or lowering the emulation speed will also raise "
"or lower the audio pitch to prevent audio from stuttering."));
m_dual_core_checkbox->Bind(wxEVT_CHECKBOX, &GeneralConfigPane::OnDualCoreCheckBoxChanged, this);
m_idle_skip_checkbox->Bind(wxEVT_CHECKBOX, &GeneralConfigPane::OnIdleSkipCheckBoxChanged, this);
m_cheats_checkbox->Bind(wxEVT_CHECKBOX, &GeneralConfigPane::OnCheatCheckBoxChanged, this);
m_force_ntscj_checkbox->Bind(wxEVT_CHECKBOX, &GeneralConfigPane::OnForceNTSCJCheckBoxChanged, this);
m_analytics_checkbox->Bind(wxEVT_CHECKBOX, &GeneralConfigPane::OnAnalyticsCheckBoxChanged, this);
m_analytics_new_id->Bind(wxEVT_BUTTON, &GeneralConfigPane::OnAnalyticsNewIdButtonClick, this);
m_throttler_choice->Bind(wxEVT_CHOICE, &GeneralConfigPane::OnThrottlerChoiceChanged, this);
m_cpu_engine_radiobox->Bind(wxEVT_RADIOBOX, &GeneralConfigPane::OnCPUEngineRadioBoxChanged, this);
m_dual_core_checkbox->Bind(wxEVT_CHECKBOX, &GeneralConfigPane::OnDualCoreCheckBoxChanged, this);
m_idle_skip_checkbox->Bind(wxEVT_CHECKBOX, &GeneralConfigPane::OnIdleSkipCheckBoxChanged, this);
m_cheats_checkbox->Bind(wxEVT_CHECKBOX, &GeneralConfigPane::OnCheatCheckBoxChanged, this);
m_force_ntscj_checkbox->Bind(wxEVT_CHECKBOX, &GeneralConfigPane::OnForceNTSCJCheckBoxChanged,
this);
m_analytics_checkbox->Bind(wxEVT_CHECKBOX, &GeneralConfigPane::OnAnalyticsCheckBoxChanged, this);
m_analytics_new_id->Bind(wxEVT_BUTTON, &GeneralConfigPane::OnAnalyticsNewIdButtonClick, this);
m_throttler_choice->Bind(wxEVT_CHOICE, &GeneralConfigPane::OnThrottlerChoiceChanged, this);
m_cpu_engine_radiobox->Bind(wxEVT_RADIOBOX, &GeneralConfigPane::OnCPUEngineRadioBoxChanged, this);
wxBoxSizer* const throttler_sizer = new wxBoxSizer(wxHORIZONTAL);
throttler_sizer->Add(new wxStaticText(this, wxID_ANY, _("Speed Limit:")), 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM, 5);
throttler_sizer->Add(m_throttler_choice, 0, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
wxBoxSizer* const throttler_sizer = new wxBoxSizer(wxHORIZONTAL);
throttler_sizer->Add(new wxStaticText(this, wxID_ANY, _("Speed Limit:")), 0,
wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM, 5);
throttler_sizer->Add(m_throttler_choice, 0, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
wxStaticBoxSizer* const basic_settings_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Basic Settings"));
basic_settings_sizer->Add(m_dual_core_checkbox, 0, wxALL, 5);
basic_settings_sizer->Add(m_idle_skip_checkbox, 0, wxALL, 5);
basic_settings_sizer->Add(m_cheats_checkbox, 0, wxALL, 5);
basic_settings_sizer->Add(throttler_sizer);
wxStaticBoxSizer* const basic_settings_sizer =
new wxStaticBoxSizer(wxVERTICAL, this, _("Basic Settings"));
basic_settings_sizer->Add(m_dual_core_checkbox, 0, wxALL, 5);
basic_settings_sizer->Add(m_idle_skip_checkbox, 0, wxALL, 5);
basic_settings_sizer->Add(m_cheats_checkbox, 0, wxALL, 5);
basic_settings_sizer->Add(throttler_sizer);
wxStaticBoxSizer* const analytics_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Usage Statistics Reporting Settings"));
analytics_sizer->Add(m_analytics_checkbox, 0, wxALL, 5);
analytics_sizer->Add(m_analytics_new_id, 0, wxALL, 5);
wxStaticBoxSizer* const analytics_sizer =
new wxStaticBoxSizer(wxVERTICAL, this, _("Usage Statistics Reporting Settings"));
analytics_sizer->Add(m_analytics_checkbox, 0, wxALL, 5);
analytics_sizer->Add(m_analytics_new_id, 0, wxALL, 5);
wxStaticBoxSizer* const advanced_settings_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Advanced Settings"));
advanced_settings_sizer->Add(m_cpu_engine_radiobox, 0, wxALL, 5);
advanced_settings_sizer->Add(m_force_ntscj_checkbox, 0, wxALL, 5);
wxStaticBoxSizer* const advanced_settings_sizer =
new wxStaticBoxSizer(wxVERTICAL, this, _("Advanced Settings"));
advanced_settings_sizer->Add(m_cpu_engine_radiobox, 0, wxALL, 5);
advanced_settings_sizer->Add(m_force_ntscj_checkbox, 0, wxALL, 5);
wxBoxSizer* const main_sizer = new wxBoxSizer(wxVERTICAL);
main_sizer->Add(basic_settings_sizer, 0, wxEXPAND | wxALL, 5);
main_sizer->Add(analytics_sizer, 0, wxEXPAND | wxALL, 5);
main_sizer->Add(advanced_settings_sizer, 0, wxEXPAND | wxALL, 5);
wxBoxSizer* const main_sizer = new wxBoxSizer(wxVERTICAL);
main_sizer->Add(basic_settings_sizer, 0, wxEXPAND | wxALL, 5);
main_sizer->Add(analytics_sizer, 0, wxEXPAND | wxALL, 5);
main_sizer->Add(advanced_settings_sizer, 0, wxEXPAND | wxALL, 5);
SetSizer(main_sizer);
SetSizer(main_sizer);
}
void GeneralConfigPane::LoadGUIValues()
{
const SConfig& startup_params = SConfig::GetInstance();
const SConfig& startup_params = SConfig::GetInstance();
m_dual_core_checkbox->SetValue(startup_params.bCPUThread);
m_idle_skip_checkbox->SetValue(startup_params.bSkipIdle);
m_cheats_checkbox->SetValue(startup_params.bEnableCheats);
m_force_ntscj_checkbox->SetValue(startup_params.bForceNTSCJ);
m_analytics_checkbox->SetValue(startup_params.m_analytics_enabled);
u32 selection = std::lround(startup_params.m_EmulationSpeed * 10.0f);
if (selection < m_throttler_array_string.size())
m_throttler_choice->SetSelection(selection);
m_dual_core_checkbox->SetValue(startup_params.bCPUThread);
m_idle_skip_checkbox->SetValue(startup_params.bSkipIdle);
m_cheats_checkbox->SetValue(startup_params.bEnableCheats);
m_force_ntscj_checkbox->SetValue(startup_params.bForceNTSCJ);
m_analytics_checkbox->SetValue(startup_params.m_analytics_enabled);
u32 selection = std::lround(startup_params.m_EmulationSpeed * 10.0f);
if (selection < m_throttler_array_string.size())
m_throttler_choice->SetSelection(selection);
for (size_t i = 0; i < cpu_cores.size(); ++i)
{
if (cpu_cores[i].CPUid == startup_params.iCPUCore)
m_cpu_engine_radiobox->SetSelection(i);
}
for (size_t i = 0; i < cpu_cores.size(); ++i)
{
if (cpu_cores[i].CPUid == startup_params.iCPUCore)
m_cpu_engine_radiobox->SetSelection(i);
}
}
void GeneralConfigPane::RefreshGUI()
{
if (Core::IsRunning())
{
m_dual_core_checkbox->Disable();
m_idle_skip_checkbox->Disable();
m_cheats_checkbox->Disable();
m_force_ntscj_checkbox->Disable();
m_cpu_engine_radiobox->Disable();
}
if (Core::IsRunning())
{
m_dual_core_checkbox->Disable();
m_idle_skip_checkbox->Disable();
m_cheats_checkbox->Disable();
m_force_ntscj_checkbox->Disable();
m_cpu_engine_radiobox->Disable();
}
}
void GeneralConfigPane::OnDualCoreCheckBoxChanged(wxCommandEvent& event)
{
if (Core::IsRunning())
return;
if (Core::IsRunning())
return;
SConfig::GetInstance().bCPUThread = m_dual_core_checkbox->IsChecked();
SConfig::GetInstance().bCPUThread = m_dual_core_checkbox->IsChecked();
}
void GeneralConfigPane::OnIdleSkipCheckBoxChanged(wxCommandEvent& event)
{
SConfig::GetInstance().bSkipIdle = m_idle_skip_checkbox->IsChecked();
SConfig::GetInstance().bSkipIdle = m_idle_skip_checkbox->IsChecked();
}
void GeneralConfigPane::OnCheatCheckBoxChanged(wxCommandEvent& event)
{
SConfig::GetInstance().bEnableCheats = m_cheats_checkbox->IsChecked();
SConfig::GetInstance().bEnableCheats = m_cheats_checkbox->IsChecked();
}
void GeneralConfigPane::OnForceNTSCJCheckBoxChanged(wxCommandEvent& event)
{
SConfig::GetInstance().bForceNTSCJ = m_force_ntscj_checkbox->IsChecked();
SConfig::GetInstance().bForceNTSCJ = m_force_ntscj_checkbox->IsChecked();
}
void GeneralConfigPane::OnThrottlerChoiceChanged(wxCommandEvent& event)
{
if (m_throttler_choice->GetSelection() != wxNOT_FOUND)
SConfig::GetInstance().m_EmulationSpeed = m_throttler_choice->GetSelection() * 0.1f;
if (m_throttler_choice->GetSelection() != wxNOT_FOUND)
SConfig::GetInstance().m_EmulationSpeed = m_throttler_choice->GetSelection() * 0.1f;
}
void GeneralConfigPane::OnCPUEngineRadioBoxChanged(wxCommandEvent& event)
{
const int selection = m_cpu_engine_radiobox->GetSelection();
const int selection = m_cpu_engine_radiobox->GetSelection();
if (main_frame->g_pCodeWindow)
{
if (main_frame->g_pCodeWindow)
{
bool using_interp = (SConfig::GetInstance().iCPUCore == PowerPC::CORE_INTERPRETER);
main_frame->g_pCodeWindow->GetMenuBar()->Check(IDM_INTERPRETER, using_interp);
}
bool using_interp = (SConfig::GetInstance().iCPUCore == PowerPC::CORE_INTERPRETER);
main_frame->g_pCodeWindow->GetMenuBar()->Check(IDM_INTERPRETER, using_interp);
}
SConfig::GetInstance().iCPUCore = cpu_cores[selection].CPUid;
SConfig::GetInstance().iCPUCore = cpu_cores[selection].CPUid;
}
void GeneralConfigPane::OnAnalyticsCheckBoxChanged(wxCommandEvent& event)
{
SConfig::GetInstance().m_analytics_enabled = m_analytics_checkbox->IsChecked();
DolphinAnalytics::Instance()->ReloadConfig();
SConfig::GetInstance().m_analytics_enabled = m_analytics_checkbox->IsChecked();
DolphinAnalytics::Instance()->ReloadConfig();
}
void GeneralConfigPane::OnAnalyticsNewIdButtonClick(wxCommandEvent& event)
{
DolphinAnalytics::Instance()->GenerateNewIdentity();
wxMessageBox(_("New identity generated."), _("Identity generation"), wxICON_INFORMATION);
DolphinAnalytics::Instance()->GenerateNewIdentity();
wxMessageBox(_("New identity generated."), _("Identity generation"), wxICON_INFORMATION);
}

View File

@ -15,41 +15,40 @@ class wxRadioBox;
class GeneralConfigPane final : public wxPanel
{
public:
GeneralConfigPane(wxWindow* parent, wxWindowID id);
GeneralConfigPane(wxWindow* parent, wxWindowID id);
private:
struct CPUCore
{
int CPUid;
wxString name;
};
std::vector<CPUCore> cpu_cores;
void InitializeGUI();
void LoadGUIValues();
void RefreshGUI();
struct CPUCore
{
int CPUid;
wxString name;
};
std::vector<CPUCore> cpu_cores;
void InitializeGUI();
void LoadGUIValues();
void RefreshGUI();
void OnDualCoreCheckBoxChanged(wxCommandEvent&);
void OnIdleSkipCheckBoxChanged(wxCommandEvent&);
void OnCheatCheckBoxChanged(wxCommandEvent&);
void OnForceNTSCJCheckBoxChanged(wxCommandEvent&);
void OnThrottlerChoiceChanged(wxCommandEvent&);
void OnCPUEngineRadioBoxChanged(wxCommandEvent&);
void OnAnalyticsCheckBoxChanged(wxCommandEvent&);
void OnAnalyticsNewIdButtonClick(wxCommandEvent&);
void OnDualCoreCheckBoxChanged(wxCommandEvent&);
void OnIdleSkipCheckBoxChanged(wxCommandEvent&);
void OnCheatCheckBoxChanged(wxCommandEvent&);
void OnForceNTSCJCheckBoxChanged(wxCommandEvent&);
void OnThrottlerChoiceChanged(wxCommandEvent&);
void OnCPUEngineRadioBoxChanged(wxCommandEvent&);
void OnAnalyticsCheckBoxChanged(wxCommandEvent&);
void OnAnalyticsNewIdButtonClick(wxCommandEvent&);
wxArrayString m_throttler_array_string;
wxArrayString m_cpu_engine_array_string;
wxArrayString m_throttler_array_string;
wxArrayString m_cpu_engine_array_string;
wxCheckBox* m_dual_core_checkbox;
wxCheckBox* m_idle_skip_checkbox;
wxCheckBox* m_cheats_checkbox;
wxCheckBox* m_force_ntscj_checkbox;
wxCheckBox* m_dual_core_checkbox;
wxCheckBox* m_idle_skip_checkbox;
wxCheckBox* m_cheats_checkbox;
wxCheckBox* m_force_ntscj_checkbox;
wxCheckBox* m_analytics_checkbox;
wxButton* m_analytics_new_id;
wxCheckBox* m_analytics_checkbox;
wxButton* m_analytics_new_id;
wxChoice* m_throttler_choice;
wxChoice* m_throttler_choice;
wxRadioBox* m_cpu_engine_radiobox;
wxRadioBox* m_cpu_engine_radiobox;
};

View File

@ -17,208 +17,225 @@
#include "Common/FileUtil.h"
#include "Core/ConfigManager.h"
#include "Core/HotkeyManager.h"
#include "DolphinWX/Config/InterfaceConfigPane.h"
#include "DolphinWX/Frame.h"
#include "DolphinWX/InputConfigDiag.h"
#include "DolphinWX/Main.h"
#include "DolphinWX/WxUtils.h"
#include "DolphinWX/Config/InterfaceConfigPane.h"
#if defined(HAVE_XRANDR) && HAVE_XRANDR
#include "DolphinWX/X11Utils.h"
#endif
static const wxLanguage language_ids[] =
{
wxLANGUAGE_DEFAULT,
static const wxLanguage language_ids[] = {
wxLANGUAGE_DEFAULT,
wxLANGUAGE_MALAY,
wxLANGUAGE_CATALAN,
wxLANGUAGE_CZECH,
wxLANGUAGE_DANISH,
wxLANGUAGE_GERMAN,
wxLANGUAGE_ENGLISH,
wxLANGUAGE_SPANISH,
wxLANGUAGE_FRENCH,
wxLANGUAGE_CROATIAN,
wxLANGUAGE_ITALIAN,
wxLANGUAGE_HUNGARIAN,
wxLANGUAGE_DUTCH,
wxLANGUAGE_NORWEGIAN_BOKMAL,
wxLANGUAGE_POLISH,
wxLANGUAGE_PORTUGUESE,
wxLANGUAGE_PORTUGUESE_BRAZILIAN,
wxLANGUAGE_ROMANIAN,
wxLANGUAGE_SERBIAN,
wxLANGUAGE_SWEDISH,
wxLANGUAGE_TURKISH,
wxLANGUAGE_MALAY,
wxLANGUAGE_CATALAN,
wxLANGUAGE_CZECH,
wxLANGUAGE_DANISH,
wxLANGUAGE_GERMAN,
wxLANGUAGE_ENGLISH,
wxLANGUAGE_SPANISH,
wxLANGUAGE_FRENCH,
wxLANGUAGE_CROATIAN,
wxLANGUAGE_ITALIAN,
wxLANGUAGE_HUNGARIAN,
wxLANGUAGE_DUTCH,
wxLANGUAGE_NORWEGIAN_BOKMAL,
wxLANGUAGE_POLISH,
wxLANGUAGE_PORTUGUESE,
wxLANGUAGE_PORTUGUESE_BRAZILIAN,
wxLANGUAGE_ROMANIAN,
wxLANGUAGE_SERBIAN,
wxLANGUAGE_SWEDISH,
wxLANGUAGE_TURKISH,
wxLANGUAGE_GREEK,
wxLANGUAGE_RUSSIAN,
wxLANGUAGE_ARABIC,
wxLANGUAGE_FARSI,
wxLANGUAGE_KOREAN,
wxLANGUAGE_JAPANESE,
wxLANGUAGE_CHINESE_SIMPLIFIED,
wxLANGUAGE_CHINESE_TRADITIONAL,
wxLANGUAGE_GREEK,
wxLANGUAGE_RUSSIAN,
wxLANGUAGE_ARABIC,
wxLANGUAGE_FARSI,
wxLANGUAGE_KOREAN,
wxLANGUAGE_JAPANESE,
wxLANGUAGE_CHINESE_SIMPLIFIED,
wxLANGUAGE_CHINESE_TRADITIONAL,
};
InterfaceConfigPane::InterfaceConfigPane(wxWindow* parent, wxWindowID id)
: wxPanel(parent, id)
InterfaceConfigPane::InterfaceConfigPane(wxWindow* parent, wxWindowID id) : wxPanel(parent, id)
{
InitializeGUI();
LoadGUIValues();
InitializeGUI();
LoadGUIValues();
}
void InterfaceConfigPane::InitializeGUI()
{
// GUI language arrayStrings
// keep these in sync with the language_ids array at the beginning of this file
m_interface_lang_strings.Add(_("<System Language>"));
// GUI language arrayStrings
// keep these in sync with the language_ids array at the beginning of this file
m_interface_lang_strings.Add(_("<System Language>"));
m_interface_lang_strings.Add(L"Bahasa Melayu"); // Malay
m_interface_lang_strings.Add(L"Catal\u00E0"); // Catalan
m_interface_lang_strings.Add(L"\u010Ce\u0161tina"); // Czech
m_interface_lang_strings.Add(L"Dansk"); // Danish
m_interface_lang_strings.Add(L"Deutsch"); // German
m_interface_lang_strings.Add(L"English"); // English
m_interface_lang_strings.Add(L"Espa\u00F1ol"); // Spanish
m_interface_lang_strings.Add(L"Fran\u00E7ais"); // French
m_interface_lang_strings.Add(L"Hrvatski"); // Croatian
m_interface_lang_strings.Add(L"Italiano"); // Italian
m_interface_lang_strings.Add(L"Magyar"); // Hungarian
m_interface_lang_strings.Add(L"Nederlands"); // Dutch
m_interface_lang_strings.Add(L"Norsk bokm\u00E5l"); // Norwegian
m_interface_lang_strings.Add(L"Polski"); // Polish
m_interface_lang_strings.Add(L"Portugu\u00EAs"); // Portuguese
m_interface_lang_strings.Add(L"Portugu\u00EAs (Brasil)"); // Portuguese (Brazil)
m_interface_lang_strings.Add(L"Rom\u00E2n\u0103"); // Romanian
m_interface_lang_strings.Add(L"Srpski"); // Serbian
m_interface_lang_strings.Add(L"Svenska"); // Swedish
m_interface_lang_strings.Add(L"T\u00FCrk\u00E7e"); // Turkish
m_interface_lang_strings.Add(L"Bahasa Melayu"); // Malay
m_interface_lang_strings.Add(L"Catal\u00E0"); // Catalan
m_interface_lang_strings.Add(L"\u010Ce\u0161tina"); // Czech
m_interface_lang_strings.Add(L"Dansk"); // Danish
m_interface_lang_strings.Add(L"Deutsch"); // German
m_interface_lang_strings.Add(L"English"); // English
m_interface_lang_strings.Add(L"Espa\u00F1ol"); // Spanish
m_interface_lang_strings.Add(L"Fran\u00E7ais"); // French
m_interface_lang_strings.Add(L"Hrvatski"); // Croatian
m_interface_lang_strings.Add(L"Italiano"); // Italian
m_interface_lang_strings.Add(L"Magyar"); // Hungarian
m_interface_lang_strings.Add(L"Nederlands"); // Dutch
m_interface_lang_strings.Add(L"Norsk bokm\u00E5l"); // Norwegian
m_interface_lang_strings.Add(L"Polski"); // Polish
m_interface_lang_strings.Add(L"Portugu\u00EAs"); // Portuguese
m_interface_lang_strings.Add(L"Portugu\u00EAs (Brasil)"); // Portuguese (Brazil)
m_interface_lang_strings.Add(L"Rom\u00E2n\u0103"); // Romanian
m_interface_lang_strings.Add(L"Srpski"); // Serbian
m_interface_lang_strings.Add(L"Svenska"); // Swedish
m_interface_lang_strings.Add(L"T\u00FCrk\u00E7e"); // Turkish
m_interface_lang_strings.Add(L"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC"); // Greek
m_interface_lang_strings.Add(L"\u0420\u0443\u0441\u0441\u043A\u0438\u0439"); // Russian
m_interface_lang_strings.Add(L"\u0627\u0644\u0639\u0631\u0628\u064A\u0629"); // Arabic
m_interface_lang_strings.Add(L"\u0641\u0627\u0631\u0633\u06CC"); // Farsi
m_interface_lang_strings.Add(L"\uD55C\uAD6D\uC5B4"); // Korean
m_interface_lang_strings.Add(L"\u65E5\u672C\u8A9E"); // Japanese
m_interface_lang_strings.Add(L"\u7B80\u4F53\u4E2D\u6587"); // Simplified Chinese
m_interface_lang_strings.Add(L"\u7E41\u9AD4\u4E2D\u6587"); // Traditional Chinese
m_interface_lang_strings.Add(L"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC"); // Greek
m_interface_lang_strings.Add(L"\u0420\u0443\u0441\u0441\u043A\u0438\u0439"); // Russian
m_interface_lang_strings.Add(L"\u0627\u0644\u0639\u0631\u0628\u064A\u0629"); // Arabic
m_interface_lang_strings.Add(L"\u0641\u0627\u0631\u0633\u06CC"); // Farsi
m_interface_lang_strings.Add(L"\uD55C\uAD6D\uC5B4"); // Korean
m_interface_lang_strings.Add(L"\u65E5\u672C\u8A9E"); // Japanese
m_interface_lang_strings.Add(L"\u7B80\u4F53\u4E2D\u6587"); // Simplified Chinese
m_interface_lang_strings.Add(L"\u7E41\u9AD4\u4E2D\u6587"); // Traditional Chinese
m_confirm_stop_checkbox = new wxCheckBox(this, wxID_ANY, _("Confirm on Stop"));
m_panic_handlers_checkbox = new wxCheckBox(this, wxID_ANY, _("Use Panic Handlers"));
m_osd_messages_checkbox = new wxCheckBox(this, wxID_ANY, _("On-Screen Display Messages"));
m_pause_focus_lost_checkbox = new wxCheckBox(this, wxID_ANY, _("Pause on Focus Lost"));
m_interface_lang_choice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_interface_lang_strings);
m_theme_choice = new wxChoice(this, wxID_ANY);
m_confirm_stop_checkbox = new wxCheckBox(this, wxID_ANY, _("Confirm on Stop"));
m_panic_handlers_checkbox = new wxCheckBox(this, wxID_ANY, _("Use Panic Handlers"));
m_osd_messages_checkbox = new wxCheckBox(this, wxID_ANY, _("On-Screen Display Messages"));
m_pause_focus_lost_checkbox = new wxCheckBox(this, wxID_ANY, _("Pause on Focus Lost"));
m_interface_lang_choice =
new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_interface_lang_strings);
m_theme_choice = new wxChoice(this, wxID_ANY);
m_confirm_stop_checkbox->Bind(wxEVT_CHECKBOX, &InterfaceConfigPane::OnConfirmStopCheckBoxChanged, this);
m_panic_handlers_checkbox->Bind(wxEVT_CHECKBOX, &InterfaceConfigPane::OnPanicHandlersCheckBoxChanged, this);
m_osd_messages_checkbox->Bind(wxEVT_CHECKBOX, &InterfaceConfigPane::OnOSDMessagesCheckBoxChanged, this);
m_pause_focus_lost_checkbox->Bind(wxEVT_CHECKBOX, &InterfaceConfigPane::OnPauseOnFocusLostCheckBoxChanged, this);
m_interface_lang_choice->Bind(wxEVT_CHOICE, &InterfaceConfigPane::OnInterfaceLanguageChoiceChanged, this);
m_theme_choice->Bind(wxEVT_CHOICE, &InterfaceConfigPane::OnThemeSelected, this);
m_confirm_stop_checkbox->Bind(wxEVT_CHECKBOX, &InterfaceConfigPane::OnConfirmStopCheckBoxChanged,
this);
m_panic_handlers_checkbox->Bind(wxEVT_CHECKBOX,
&InterfaceConfigPane::OnPanicHandlersCheckBoxChanged, this);
m_osd_messages_checkbox->Bind(wxEVT_CHECKBOX, &InterfaceConfigPane::OnOSDMessagesCheckBoxChanged,
this);
m_pause_focus_lost_checkbox->Bind(wxEVT_CHECKBOX,
&InterfaceConfigPane::OnPauseOnFocusLostCheckBoxChanged, this);
m_interface_lang_choice->Bind(wxEVT_CHOICE,
&InterfaceConfigPane::OnInterfaceLanguageChoiceChanged, this);
m_theme_choice->Bind(wxEVT_CHOICE, &InterfaceConfigPane::OnThemeSelected, this);
m_confirm_stop_checkbox->SetToolTip(_("Show a confirmation box before stopping a game."));
m_panic_handlers_checkbox->SetToolTip(_("Show a message box when a potentially serious error has occurred.\nDisabling this may avoid annoying and non-fatal messages, but it may result in major crashes having no explanation at all."));
m_osd_messages_checkbox->SetToolTip(_("Display messages over the emulation screen area.\nThese messages include memory card writes, video backend and CPU information, and JIT cache clearing."));
m_pause_focus_lost_checkbox->SetToolTip(_("Pauses the emulator when focus is taken away from the emulation window."));
m_interface_lang_choice->SetToolTip(_("Change the language of the user interface.\nRequires restart."));
m_confirm_stop_checkbox->SetToolTip(_("Show a confirmation box before stopping a game."));
m_panic_handlers_checkbox->SetToolTip(
_("Show a message box when a potentially serious error has occurred.\nDisabling this may "
"avoid annoying and non-fatal messages, but it may result in major crashes having no "
"explanation at all."));
m_osd_messages_checkbox->SetToolTip(
_("Display messages over the emulation screen area.\nThese messages include memory card "
"writes, video backend and CPU information, and JIT cache clearing."));
m_pause_focus_lost_checkbox->SetToolTip(
_("Pauses the emulator when focus is taken away from the emulation window."));
m_interface_lang_choice->SetToolTip(
_("Change the language of the user interface.\nRequires restart."));
wxGridBagSizer* const language_and_theme_grid_sizer = new wxGridBagSizer();
language_and_theme_grid_sizer->Add(new wxStaticText(this, wxID_ANY, _("Language:")), wxGBPosition(0, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
language_and_theme_grid_sizer->Add(m_interface_lang_choice, wxGBPosition(0, 1), wxDefaultSpan, wxALL, 5);
language_and_theme_grid_sizer->Add(new wxStaticText(this, wxID_ANY, _("Theme:")), wxGBPosition(1, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
language_and_theme_grid_sizer->Add(m_theme_choice, wxGBPosition(1, 1), wxDefaultSpan, wxALL, 5);
wxGridBagSizer* const language_and_theme_grid_sizer = new wxGridBagSizer();
language_and_theme_grid_sizer->Add(new wxStaticText(this, wxID_ANY, _("Language:")),
wxGBPosition(0, 0), wxDefaultSpan,
wxALIGN_CENTER_VERTICAL | wxALL, 5);
language_and_theme_grid_sizer->Add(m_interface_lang_choice, wxGBPosition(0, 1), wxDefaultSpan,
wxALL, 5);
language_and_theme_grid_sizer->Add(new wxStaticText(this, wxID_ANY, _("Theme:")),
wxGBPosition(1, 0), wxDefaultSpan,
wxALIGN_CENTER_VERTICAL | wxALL, 5);
language_and_theme_grid_sizer->Add(m_theme_choice, wxGBPosition(1, 1), wxDefaultSpan, wxALL, 5);
wxStaticBoxSizer* const main_static_box_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Interface Settings"));
main_static_box_sizer->Add(m_confirm_stop_checkbox, 0, wxALL, 5);
main_static_box_sizer->Add(m_panic_handlers_checkbox, 0, wxALL, 5);
main_static_box_sizer->Add(m_osd_messages_checkbox, 0, wxALL, 5);
main_static_box_sizer->Add(m_pause_focus_lost_checkbox, 0, wxALL, 5);
main_static_box_sizer->Add(language_and_theme_grid_sizer, 0, wxEXPAND | wxALL, 0);
wxStaticBoxSizer* const main_static_box_sizer =
new wxStaticBoxSizer(wxVERTICAL, this, _("Interface Settings"));
main_static_box_sizer->Add(m_confirm_stop_checkbox, 0, wxALL, 5);
main_static_box_sizer->Add(m_panic_handlers_checkbox, 0, wxALL, 5);
main_static_box_sizer->Add(m_osd_messages_checkbox, 0, wxALL, 5);
main_static_box_sizer->Add(m_pause_focus_lost_checkbox, 0, wxALL, 5);
main_static_box_sizer->Add(language_and_theme_grid_sizer, 0, wxEXPAND | wxALL, 0);
wxBoxSizer* const main_box_sizer = new wxBoxSizer(wxVERTICAL);
main_box_sizer->Add(main_static_box_sizer, 0, wxEXPAND | wxALL, 5);
wxBoxSizer* const main_box_sizer = new wxBoxSizer(wxVERTICAL);
main_box_sizer->Add(main_static_box_sizer, 0, wxEXPAND | wxALL, 5);
SetSizer(main_box_sizer);
SetSizer(main_box_sizer);
}
void InterfaceConfigPane::LoadGUIValues()
{
const SConfig& startup_params = SConfig::GetInstance();
const SConfig& startup_params = SConfig::GetInstance();
m_confirm_stop_checkbox->SetValue(startup_params.bConfirmStop);
m_panic_handlers_checkbox->SetValue(startup_params.bUsePanicHandlers);
m_osd_messages_checkbox->SetValue(startup_params.bOnScreenDisplayMessages);
m_pause_focus_lost_checkbox->SetValue(SConfig::GetInstance().m_PauseOnFocusLost);
m_confirm_stop_checkbox->SetValue(startup_params.bConfirmStop);
m_panic_handlers_checkbox->SetValue(startup_params.bUsePanicHandlers);
m_osd_messages_checkbox->SetValue(startup_params.bOnScreenDisplayMessages);
m_pause_focus_lost_checkbox->SetValue(SConfig::GetInstance().m_PauseOnFocusLost);
for (size_t i = 0; i < sizeof(language_ids) / sizeof(wxLanguage); i++)
{
if (language_ids [i] == SConfig::GetInstance().m_InterfaceLanguage)
{
m_interface_lang_choice->SetSelection(i);
break;
}
}
for (size_t i = 0; i < sizeof(language_ids) / sizeof(wxLanguage); i++)
{
if (language_ids[i] == SConfig::GetInstance().m_InterfaceLanguage)
{
m_interface_lang_choice->SetSelection(i);
break;
}
}
LoadThemes();
LoadThemes();
}
void InterfaceConfigPane::LoadThemes()
{
auto sv = DoFileSearch({""}, {
File::GetUserPath(D_THEMES_IDX),
File::GetSysDirectory() + THEMES_DIR
}, /*recursive*/ false);
for (const std::string& filename : sv)
{
std::string name, ext;
SplitPath(filename, nullptr, &name, &ext);
auto sv =
DoFileSearch({""}, {File::GetUserPath(D_THEMES_IDX), File::GetSysDirectory() + THEMES_DIR},
/*recursive*/ false);
for (const std::string& filename : sv)
{
std::string name, ext;
SplitPath(filename, nullptr, &name, &ext);
name += ext;
const wxString wxname = StrToWxStr(name);
if (-1 == m_theme_choice->FindString(wxname))
m_theme_choice->Append(wxname);
}
name += ext;
const wxString wxname = StrToWxStr(name);
if (-1 == m_theme_choice->FindString(wxname))
m_theme_choice->Append(wxname);
}
m_theme_choice->SetStringSelection(StrToWxStr(SConfig::GetInstance().theme_name));
m_theme_choice->SetStringSelection(StrToWxStr(SConfig::GetInstance().theme_name));
}
void InterfaceConfigPane::OnConfirmStopCheckBoxChanged(wxCommandEvent& event)
{
SConfig::GetInstance().bConfirmStop = m_confirm_stop_checkbox->IsChecked();
SConfig::GetInstance().bConfirmStop = m_confirm_stop_checkbox->IsChecked();
}
void InterfaceConfigPane::OnPanicHandlersCheckBoxChanged(wxCommandEvent& event)
{
SConfig::GetInstance().bUsePanicHandlers = m_panic_handlers_checkbox->IsChecked();
SetEnableAlert(m_panic_handlers_checkbox->IsChecked());
SConfig::GetInstance().bUsePanicHandlers = m_panic_handlers_checkbox->IsChecked();
SetEnableAlert(m_panic_handlers_checkbox->IsChecked());
}
void InterfaceConfigPane::OnOSDMessagesCheckBoxChanged(wxCommandEvent& event)
{
SConfig::GetInstance().bOnScreenDisplayMessages = m_osd_messages_checkbox->IsChecked();
SConfig::GetInstance().bOnScreenDisplayMessages = m_osd_messages_checkbox->IsChecked();
}
void InterfaceConfigPane::OnInterfaceLanguageChoiceChanged(wxCommandEvent& event)
{
if (SConfig::GetInstance().m_InterfaceLanguage != language_ids[m_interface_lang_choice->GetSelection()])
SuccessAlertT("You must restart Dolphin in order for the change to take effect.");
if (SConfig::GetInstance().m_InterfaceLanguage !=
language_ids[m_interface_lang_choice->GetSelection()])
SuccessAlertT("You must restart Dolphin in order for the change to take effect.");
SConfig::GetInstance().m_InterfaceLanguage = language_ids[m_interface_lang_choice->GetSelection()];
SConfig::GetInstance().m_InterfaceLanguage =
language_ids[m_interface_lang_choice->GetSelection()];
}
void InterfaceConfigPane::OnPauseOnFocusLostCheckBoxChanged(wxCommandEvent& event)
{
SConfig::GetInstance().m_PauseOnFocusLost = m_pause_focus_lost_checkbox->IsChecked();
SConfig::GetInstance().m_PauseOnFocusLost = m_pause_focus_lost_checkbox->IsChecked();
}
void InterfaceConfigPane::OnThemeSelected(wxCommandEvent& event)
{
SConfig::GetInstance().theme_name = WxStrToStr(m_theme_choice->GetStringSelection());
SConfig::GetInstance().theme_name = WxStrToStr(m_theme_choice->GetStringSelection());
main_frame->InitBitmaps();
main_frame->UpdateGameList();
main_frame->InitBitmaps();
main_frame->UpdateGameList();
}

View File

@ -14,26 +14,26 @@ class wxChoice;
class InterfaceConfigPane final : public wxPanel
{
public:
InterfaceConfigPane(wxWindow* parent, wxWindowID id);
InterfaceConfigPane(wxWindow* parent, wxWindowID id);
private:
void InitializeGUI();
void LoadGUIValues();
void LoadThemes();
void InitializeGUI();
void LoadGUIValues();
void LoadThemes();
void OnConfirmStopCheckBoxChanged(wxCommandEvent&);
void OnPanicHandlersCheckBoxChanged(wxCommandEvent&);
void OnOSDMessagesCheckBoxChanged(wxCommandEvent&);
void OnInterfaceLanguageChoiceChanged(wxCommandEvent&);
void OnPauseOnFocusLostCheckBoxChanged(wxCommandEvent&);
void OnThemeSelected(wxCommandEvent&);
void OnConfirmStopCheckBoxChanged(wxCommandEvent&);
void OnPanicHandlersCheckBoxChanged(wxCommandEvent&);
void OnOSDMessagesCheckBoxChanged(wxCommandEvent&);
void OnInterfaceLanguageChoiceChanged(wxCommandEvent&);
void OnPauseOnFocusLostCheckBoxChanged(wxCommandEvent&);
void OnThemeSelected(wxCommandEvent&);
wxArrayString m_interface_lang_strings;
wxArrayString m_interface_lang_strings;
wxCheckBox* m_confirm_stop_checkbox;
wxCheckBox* m_panic_handlers_checkbox;
wxCheckBox* m_osd_messages_checkbox;
wxCheckBox* m_pause_focus_lost_checkbox;
wxChoice* m_interface_lang_choice;
wxChoice* m_theme_choice;
wxCheckBox* m_confirm_stop_checkbox;
wxCheckBox* m_panic_handlers_checkbox;
wxCheckBox* m_osd_messages_checkbox;
wxCheckBox* m_pause_focus_lost_checkbox;
wxChoice* m_interface_lang_choice;
wxChoice* m_theme_choice;
};

View File

@ -17,181 +17,193 @@
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "DiscIO/NANDContentLoader.h"
#include "DolphinWX/Config/ConfigMain.h"
#include "DolphinWX/Config/PathConfigPane.h"
#include "DolphinWX/Frame.h"
#include "DolphinWX/Main.h"
#include "DolphinWX/WxUtils.h"
#include "DolphinWX/Config/ConfigMain.h"
#include "DolphinWX/Config/PathConfigPane.h"
PathConfigPane::PathConfigPane(wxWindow* panel, wxWindowID id)
: wxPanel(panel, id)
PathConfigPane::PathConfigPane(wxWindow* panel, wxWindowID id) : wxPanel(panel, id)
{
InitializeGUI();
LoadGUIValues();
RefreshGUI();
InitializeGUI();
LoadGUIValues();
RefreshGUI();
}
void PathConfigPane::InitializeGUI()
{
m_iso_paths_listbox = new wxListBox(this, wxID_ANY);
m_recursive_iso_paths_checkbox = new wxCheckBox(this, wxID_ANY, _("Search Subfolders"));
m_add_iso_path_button = new wxButton(this, wxID_ANY, _("Add..."));
m_remove_iso_path_button = new wxButton(this, wxID_ANY, _("Remove"));
m_remove_iso_path_button->Disable();
m_iso_paths_listbox = new wxListBox(this, wxID_ANY);
m_recursive_iso_paths_checkbox = new wxCheckBox(this, wxID_ANY, _("Search Subfolders"));
m_add_iso_path_button = new wxButton(this, wxID_ANY, _("Add..."));
m_remove_iso_path_button = new wxButton(this, wxID_ANY, _("Remove"));
m_remove_iso_path_button->Disable();
m_default_iso_filepicker = new wxFilePickerCtrl(this, wxID_ANY, wxEmptyString, _("Choose a default ISO:"),
_("All GC/Wii files (elf, dol, gcm, iso, wbfs, ciso, gcz, wad)") + wxString::Format("|*.elf;*.dol;*.gcm;*.iso;*.wbfs;*.ciso;*.gcz;*.wad|%s", wxGetTranslation(wxALL_FILES)),
wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL | wxFLP_OPEN | wxFLP_SMALL);
m_dvd_root_dirpicker = new wxDirPickerCtrl(this, wxID_ANY, wxEmptyString, _("Choose a DVD root directory:"), wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL | wxDIRP_SMALL);
m_apploader_path_filepicker = new wxFilePickerCtrl(this, wxID_ANY, wxEmptyString, _("Choose file to use as apploader: (applies to discs constructed from directories only)"),
_("apploader (.img)") + wxString::Format("|*.img|%s", wxGetTranslation(wxALL_FILES)),
wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL | wxFLP_OPEN | wxFLP_SMALL);
m_nand_root_dirpicker = new wxDirPickerCtrl(this, wxID_ANY, wxEmptyString, _("Choose a NAND root directory:"), wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL | wxDIRP_SMALL);
m_default_iso_filepicker = new wxFilePickerCtrl(
this, wxID_ANY, wxEmptyString, _("Choose a default ISO:"),
_("All GC/Wii files (elf, dol, gcm, iso, wbfs, ciso, gcz, wad)") +
wxString::Format("|*.elf;*.dol;*.gcm;*.iso;*.wbfs;*.ciso;*.gcz;*.wad|%s",
wxGetTranslation(wxALL_FILES)),
wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL | wxFLP_OPEN | wxFLP_SMALL);
m_dvd_root_dirpicker =
new wxDirPickerCtrl(this, wxID_ANY, wxEmptyString, _("Choose a DVD root directory:"),
wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL | wxDIRP_SMALL);
m_apploader_path_filepicker = new wxFilePickerCtrl(
this, wxID_ANY, wxEmptyString,
_("Choose file to use as apploader: (applies to discs constructed from directories only)"),
_("apploader (.img)") + wxString::Format("|*.img|%s", wxGetTranslation(wxALL_FILES)),
wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL | wxFLP_OPEN | wxFLP_SMALL);
m_nand_root_dirpicker =
new wxDirPickerCtrl(this, wxID_ANY, wxEmptyString, _("Choose a NAND root directory:"),
wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL | wxDIRP_SMALL);
m_iso_paths_listbox->Bind(wxEVT_LISTBOX, &PathConfigPane::OnISOPathSelectionChanged, this);
m_recursive_iso_paths_checkbox->Bind(wxEVT_CHECKBOX, &PathConfigPane::OnRecursiveISOCheckBoxChanged, this);
m_add_iso_path_button->Bind(wxEVT_BUTTON, &PathConfigPane::OnAddISOPath, this);
m_remove_iso_path_button->Bind(wxEVT_BUTTON, &PathConfigPane::OnRemoveISOPath, this);
m_default_iso_filepicker->Bind(wxEVT_FILEPICKER_CHANGED, &PathConfigPane::OnDefaultISOChanged, this);
m_dvd_root_dirpicker->Bind(wxEVT_DIRPICKER_CHANGED, &PathConfigPane::OnDVDRootChanged, this);
m_apploader_path_filepicker->Bind(wxEVT_FILEPICKER_CHANGED, &PathConfigPane::OnApploaderPathChanged, this);
m_nand_root_dirpicker->Bind(wxEVT_DIRPICKER_CHANGED, &PathConfigPane::OnNANDRootChanged, this);
m_iso_paths_listbox->Bind(wxEVT_LISTBOX, &PathConfigPane::OnISOPathSelectionChanged, this);
m_recursive_iso_paths_checkbox->Bind(wxEVT_CHECKBOX,
&PathConfigPane::OnRecursiveISOCheckBoxChanged, this);
m_add_iso_path_button->Bind(wxEVT_BUTTON, &PathConfigPane::OnAddISOPath, this);
m_remove_iso_path_button->Bind(wxEVT_BUTTON, &PathConfigPane::OnRemoveISOPath, this);
m_default_iso_filepicker->Bind(wxEVT_FILEPICKER_CHANGED, &PathConfigPane::OnDefaultISOChanged,
this);
m_dvd_root_dirpicker->Bind(wxEVT_DIRPICKER_CHANGED, &PathConfigPane::OnDVDRootChanged, this);
m_apploader_path_filepicker->Bind(wxEVT_FILEPICKER_CHANGED,
&PathConfigPane::OnApploaderPathChanged, this);
m_nand_root_dirpicker->Bind(wxEVT_DIRPICKER_CHANGED, &PathConfigPane::OnNANDRootChanged, this);
wxBoxSizer* const iso_button_sizer = new wxBoxSizer(wxHORIZONTAL);
iso_button_sizer->Add(m_recursive_iso_paths_checkbox, 0, wxALL | wxALIGN_CENTER);
iso_button_sizer->AddStretchSpacer();
iso_button_sizer->Add(m_add_iso_path_button, 0, wxALL);
iso_button_sizer->Add(m_remove_iso_path_button, 0, wxALL);
wxBoxSizer* const iso_button_sizer = new wxBoxSizer(wxHORIZONTAL);
iso_button_sizer->Add(m_recursive_iso_paths_checkbox, 0, wxALL | wxALIGN_CENTER);
iso_button_sizer->AddStretchSpacer();
iso_button_sizer->Add(m_add_iso_path_button, 0, wxALL);
iso_button_sizer->Add(m_remove_iso_path_button, 0, wxALL);
wxStaticBoxSizer* const iso_listbox_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("ISO Directories"));
iso_listbox_sizer->Add(m_iso_paths_listbox, 1, wxEXPAND | wxALL, 0);
iso_listbox_sizer->Add(iso_button_sizer, 0, wxEXPAND | wxALL, 5);
wxStaticBoxSizer* const iso_listbox_sizer =
new wxStaticBoxSizer(wxVERTICAL, this, _("ISO Directories"));
iso_listbox_sizer->Add(m_iso_paths_listbox, 1, wxEXPAND | wxALL, 0);
iso_listbox_sizer->Add(iso_button_sizer, 0, wxEXPAND | wxALL, 5);
wxGridBagSizer* const picker_sizer = new wxGridBagSizer();
picker_sizer->Add(new wxStaticText(this, wxID_ANY, _("Default ISO:")),
wxGBPosition(0, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
picker_sizer->Add(m_default_iso_filepicker, wxGBPosition(0, 1), wxDefaultSpan, wxEXPAND | wxALL, 5);
picker_sizer->Add(new wxStaticText(this, wxID_ANY, _("DVD Root:")),
wxGBPosition(1, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
picker_sizer->Add(m_dvd_root_dirpicker, wxGBPosition(1, 1), wxDefaultSpan, wxEXPAND | wxALL, 5);
picker_sizer->Add(new wxStaticText(this, wxID_ANY, _("Apploader:")),
wxGBPosition(2, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
picker_sizer->Add(m_apploader_path_filepicker, wxGBPosition(2, 1), wxDefaultSpan, wxEXPAND | wxALL, 5);
picker_sizer->Add(new wxStaticText(this, wxID_ANY, _("Wii NAND Root:")),
wxGBPosition(3, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
picker_sizer->Add(m_nand_root_dirpicker, wxGBPosition(3, 1), wxDefaultSpan, wxEXPAND | wxALL, 5);
picker_sizer->AddGrowableCol(1);
wxGridBagSizer* const picker_sizer = new wxGridBagSizer();
picker_sizer->Add(new wxStaticText(this, wxID_ANY, _("Default ISO:")), wxGBPosition(0, 0),
wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
picker_sizer->Add(m_default_iso_filepicker, wxGBPosition(0, 1), wxDefaultSpan, wxEXPAND | wxALL,
5);
picker_sizer->Add(new wxStaticText(this, wxID_ANY, _("DVD Root:")), wxGBPosition(1, 0),
wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
picker_sizer->Add(m_dvd_root_dirpicker, wxGBPosition(1, 1), wxDefaultSpan, wxEXPAND | wxALL, 5);
picker_sizer->Add(new wxStaticText(this, wxID_ANY, _("Apploader:")), wxGBPosition(2, 0),
wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
picker_sizer->Add(m_apploader_path_filepicker, wxGBPosition(2, 1), wxDefaultSpan,
wxEXPAND | wxALL, 5);
picker_sizer->Add(new wxStaticText(this, wxID_ANY, _("Wii NAND Root:")), wxGBPosition(3, 0),
wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
picker_sizer->Add(m_nand_root_dirpicker, wxGBPosition(3, 1), wxDefaultSpan, wxEXPAND | wxALL, 5);
picker_sizer->AddGrowableCol(1);
// Populate the Paths page
wxBoxSizer* const main_sizer = new wxBoxSizer(wxVERTICAL);
main_sizer->Add(iso_listbox_sizer, 1, wxEXPAND | wxALL, 5);
main_sizer->Add(picker_sizer, 0, wxEXPAND | wxALL, 5);
// Populate the Paths page
wxBoxSizer* const main_sizer = new wxBoxSizer(wxVERTICAL);
main_sizer->Add(iso_listbox_sizer, 1, wxEXPAND | wxALL, 5);
main_sizer->Add(picker_sizer, 0, wxEXPAND | wxALL, 5);
SetSizer(main_sizer);
SetSizer(main_sizer);
}
void PathConfigPane::LoadGUIValues()
{
const SConfig& startup_params = SConfig::GetInstance();
const SConfig& startup_params = SConfig::GetInstance();
m_recursive_iso_paths_checkbox->SetValue(SConfig::GetInstance().m_RecursiveISOFolder);
m_default_iso_filepicker->SetPath(StrToWxStr(startup_params.m_strDefaultISO));
m_dvd_root_dirpicker->SetPath(StrToWxStr(startup_params.m_strDVDRoot));
m_apploader_path_filepicker->SetPath(StrToWxStr(startup_params.m_strApploader));
m_nand_root_dirpicker->SetPath(StrToWxStr(SConfig::GetInstance().m_NANDPath));
m_recursive_iso_paths_checkbox->SetValue(SConfig::GetInstance().m_RecursiveISOFolder);
m_default_iso_filepicker->SetPath(StrToWxStr(startup_params.m_strDefaultISO));
m_dvd_root_dirpicker->SetPath(StrToWxStr(startup_params.m_strDVDRoot));
m_apploader_path_filepicker->SetPath(StrToWxStr(startup_params.m_strApploader));
m_nand_root_dirpicker->SetPath(StrToWxStr(SConfig::GetInstance().m_NANDPath));
// Update selected ISO paths
for (const std::string& folder : SConfig::GetInstance().m_ISOFolder)
m_iso_paths_listbox->Append(StrToWxStr(folder));
// Update selected ISO paths
for (const std::string& folder : SConfig::GetInstance().m_ISOFolder)
m_iso_paths_listbox->Append(StrToWxStr(folder));
}
void PathConfigPane::RefreshGUI()
{
if (Core::IsRunning())
Disable();
if (Core::IsRunning())
Disable();
}
void PathConfigPane::OnISOPathSelectionChanged(wxCommandEvent& event)
{
m_remove_iso_path_button->Enable(m_iso_paths_listbox->GetSelection() != wxNOT_FOUND);
m_remove_iso_path_button->Enable(m_iso_paths_listbox->GetSelection() != wxNOT_FOUND);
}
void PathConfigPane::OnRecursiveISOCheckBoxChanged(wxCommandEvent& event)
{
SConfig::GetInstance().m_RecursiveISOFolder = m_recursive_iso_paths_checkbox->IsChecked();
SConfig::GetInstance().m_RecursiveISOFolder = m_recursive_iso_paths_checkbox->IsChecked();
AddPendingEvent(wxCommandEvent(wxDOLPHIN_CFG_REFRESH_LIST));
AddPendingEvent(wxCommandEvent(wxDOLPHIN_CFG_REFRESH_LIST));
}
void PathConfigPane::OnAddISOPath(wxCommandEvent& event)
{
wxDirDialog dialog(this, _("Choose a directory to add"), wxGetHomeDir(),
wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
wxDirDialog dialog(this, _("Choose a directory to add"), wxGetHomeDir(),
wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
if (dialog.ShowModal() == wxID_OK)
{
if (m_iso_paths_listbox->FindString(dialog.GetPath()) != wxNOT_FOUND)
{
WxUtils::ShowErrorDialog(_("The chosen directory is already in the list."));
}
else
{
AddPendingEvent(wxCommandEvent(wxDOLPHIN_CFG_REFRESH_LIST));
m_iso_paths_listbox->Append(dialog.GetPath());
}
}
if (dialog.ShowModal() == wxID_OK)
{
if (m_iso_paths_listbox->FindString(dialog.GetPath()) != wxNOT_FOUND)
{
WxUtils::ShowErrorDialog(_("The chosen directory is already in the list."));
}
else
{
AddPendingEvent(wxCommandEvent(wxDOLPHIN_CFG_REFRESH_LIST));
m_iso_paths_listbox->Append(dialog.GetPath());
}
}
SaveISOPathChanges();
SaveISOPathChanges();
}
void PathConfigPane::OnRemoveISOPath(wxCommandEvent& event)
{
AddPendingEvent(wxCommandEvent(wxDOLPHIN_CFG_REFRESH_LIST));
m_iso_paths_listbox->Delete(m_iso_paths_listbox->GetSelection());
AddPendingEvent(wxCommandEvent(wxDOLPHIN_CFG_REFRESH_LIST));
m_iso_paths_listbox->Delete(m_iso_paths_listbox->GetSelection());
// This seems to not be activated on Windows when it should be. wxw bug?
// This seems to not be activated on Windows when it should be. wxw bug?
#ifdef _WIN32
OnISOPathSelectionChanged(wxCommandEvent());
OnISOPathSelectionChanged(wxCommandEvent());
#endif
SaveISOPathChanges();
SaveISOPathChanges();
}
void PathConfigPane::OnDefaultISOChanged(wxCommandEvent& event)
{
SConfig::GetInstance().m_strDefaultISO = WxStrToStr(m_default_iso_filepicker->GetPath());
SConfig::GetInstance().m_strDefaultISO = WxStrToStr(m_default_iso_filepicker->GetPath());
}
void PathConfigPane::OnDVDRootChanged(wxCommandEvent& event)
{
SConfig::GetInstance().m_strDVDRoot = WxStrToStr(m_dvd_root_dirpicker->GetPath());
SConfig::GetInstance().m_strDVDRoot = WxStrToStr(m_dvd_root_dirpicker->GetPath());
}
void PathConfigPane::OnApploaderPathChanged(wxCommandEvent& event)
{
SConfig::GetInstance().m_strApploader = WxStrToStr(m_apploader_path_filepicker->GetPath());
SConfig::GetInstance().m_strApploader = WxStrToStr(m_apploader_path_filepicker->GetPath());
}
void PathConfigPane::OnNANDRootChanged(wxCommandEvent& event)
{
std::string nand_path =
SConfig::GetInstance().m_NANDPath =
WxStrToStr(m_nand_root_dirpicker->GetPath());
std::string nand_path = SConfig::GetInstance().m_NANDPath =
WxStrToStr(m_nand_root_dirpicker->GetPath());
File::SetUserPath(D_WIIROOT_IDX, nand_path);
m_nand_root_dirpicker->SetPath(StrToWxStr(nand_path));
File::SetUserPath(D_WIIROOT_IDX, nand_path);
m_nand_root_dirpicker->SetPath(StrToWxStr(nand_path));
SConfig::GetInstance().m_SYSCONF->UpdateLocation();
DiscIO::CNANDContentManager::Access().ClearCache();
SConfig::GetInstance().m_SYSCONF->UpdateLocation();
DiscIO::CNANDContentManager::Access().ClearCache();
main_frame->UpdateWiiMenuChoice();
main_frame->UpdateWiiMenuChoice();
}
void PathConfigPane::SaveISOPathChanges()
{
SConfig::GetInstance().m_ISOFolder.clear();
SConfig::GetInstance().m_ISOFolder.clear();
for (unsigned int i = 0; i < m_iso_paths_listbox->GetCount(); i++)
SConfig::GetInstance().m_ISOFolder.push_back(WxStrToStr(m_iso_paths_listbox->GetStrings()[i]));
for (unsigned int i = 0; i < m_iso_paths_listbox->GetCount(); i++)
SConfig::GetInstance().m_ISOFolder.push_back(WxStrToStr(m_iso_paths_listbox->GetStrings()[i]));
}

View File

@ -15,31 +15,31 @@ class wxFilePickerCtrl;
class PathConfigPane final : public wxPanel
{
public:
PathConfigPane(wxWindow* parent, wxWindowID id);
PathConfigPane(wxWindow* parent, wxWindowID id);
private:
void InitializeGUI();
void LoadGUIValues();
void RefreshGUI();
void InitializeGUI();
void LoadGUIValues();
void RefreshGUI();
void OnISOPathSelectionChanged(wxCommandEvent&);
void OnRecursiveISOCheckBoxChanged(wxCommandEvent&);
void OnAddISOPath(wxCommandEvent&);
void OnRemoveISOPath(wxCommandEvent&);
void OnDefaultISOChanged(wxCommandEvent&);
void OnDVDRootChanged(wxCommandEvent&);
void OnApploaderPathChanged(wxCommandEvent&);
void OnNANDRootChanged(wxCommandEvent&);
void OnISOPathSelectionChanged(wxCommandEvent&);
void OnRecursiveISOCheckBoxChanged(wxCommandEvent&);
void OnAddISOPath(wxCommandEvent&);
void OnRemoveISOPath(wxCommandEvent&);
void OnDefaultISOChanged(wxCommandEvent&);
void OnDVDRootChanged(wxCommandEvent&);
void OnApploaderPathChanged(wxCommandEvent&);
void OnNANDRootChanged(wxCommandEvent&);
void SaveISOPathChanges();
void SaveISOPathChanges();
wxListBox* m_iso_paths_listbox;
wxCheckBox* m_recursive_iso_paths_checkbox;
wxButton* m_add_iso_path_button;
wxButton* m_remove_iso_path_button;
wxListBox* m_iso_paths_listbox;
wxCheckBox* m_recursive_iso_paths_checkbox;
wxButton* m_add_iso_path_button;
wxButton* m_remove_iso_path_button;
wxDirPickerCtrl* m_dvd_root_dirpicker;
wxDirPickerCtrl* m_nand_root_dirpicker;
wxFilePickerCtrl* m_default_iso_filepicker;
wxFilePickerCtrl* m_apploader_path_filepicker;
wxDirPickerCtrl* m_dvd_root_dirpicker;
wxDirPickerCtrl* m_nand_root_dirpicker;
wxFilePickerCtrl* m_default_iso_filepicker;
wxFilePickerCtrl* m_apploader_path_filepicker;
};

View File

@ -12,163 +12,176 @@
#include "Core/Core.h"
#include "Core/IPC_HLE/WII_IPC_HLE.h"
#include "DiscIO/Volume.h"
#include "DolphinWX/WxUtils.h"
#include "DolphinWX/Config/WiiConfigPane.h"
#include "DolphinWX/WxUtils.h"
WiiConfigPane::WiiConfigPane(wxWindow* parent, wxWindowID id)
: wxPanel(parent, id)
WiiConfigPane::WiiConfigPane(wxWindow* parent, wxWindowID id) : wxPanel(parent, id)
{
InitializeGUI();
LoadGUIValues();
RefreshGUI();
InitializeGUI();
LoadGUIValues();
RefreshGUI();
}
void WiiConfigPane::InitializeGUI()
{
m_aspect_ratio_strings.Add("4:3");
m_aspect_ratio_strings.Add("16:9");
m_aspect_ratio_strings.Add("4:3");
m_aspect_ratio_strings.Add("16:9");
m_system_language_strings.Add(_("Japanese"));
m_system_language_strings.Add(_("English"));
m_system_language_strings.Add(_("German"));
m_system_language_strings.Add(_("French"));
m_system_language_strings.Add(_("Spanish"));
m_system_language_strings.Add(_("Italian"));
m_system_language_strings.Add(_("Dutch"));
m_system_language_strings.Add(_("Simplified Chinese"));
m_system_language_strings.Add(_("Traditional Chinese"));
m_system_language_strings.Add(_("Korean"));
m_system_language_strings.Add(_("Japanese"));
m_system_language_strings.Add(_("English"));
m_system_language_strings.Add(_("German"));
m_system_language_strings.Add(_("French"));
m_system_language_strings.Add(_("Spanish"));
m_system_language_strings.Add(_("Italian"));
m_system_language_strings.Add(_("Dutch"));
m_system_language_strings.Add(_("Simplified Chinese"));
m_system_language_strings.Add(_("Traditional Chinese"));
m_system_language_strings.Add(_("Korean"));
m_screensaver_checkbox = new wxCheckBox(this, wxID_ANY, _("Enable Screen Saver"));
m_pal60_mode_checkbox = new wxCheckBox(this, wxID_ANY, _("Use PAL60 Mode (EuRGB60)"));
m_aspect_ratio_choice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_aspect_ratio_strings);
m_system_language_choice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_system_language_strings);
m_sd_card_checkbox = new wxCheckBox(this, wxID_ANY, _("Insert SD Card"));
m_connect_keyboard_checkbox = new wxCheckBox(this, wxID_ANY, _("Connect USB Keyboard"));
m_screensaver_checkbox = new wxCheckBox(this, wxID_ANY, _("Enable Screen Saver"));
m_pal60_mode_checkbox = new wxCheckBox(this, wxID_ANY, _("Use PAL60 Mode (EuRGB60)"));
m_aspect_ratio_choice =
new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_aspect_ratio_strings);
m_system_language_choice =
new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_system_language_strings);
m_sd_card_checkbox = new wxCheckBox(this, wxID_ANY, _("Insert SD Card"));
m_connect_keyboard_checkbox = new wxCheckBox(this, wxID_ANY, _("Connect USB Keyboard"));
m_screensaver_checkbox->Bind(wxEVT_CHECKBOX, &WiiConfigPane::OnScreenSaverCheckBoxChanged, this);
m_pal60_mode_checkbox->Bind(wxEVT_CHECKBOX, &WiiConfigPane::OnPAL60CheckBoxChanged, this);
m_aspect_ratio_choice->Bind(wxEVT_CHOICE, &WiiConfigPane::OnAspectRatioChoiceChanged, this);
m_system_language_choice->Bind(wxEVT_CHOICE, &WiiConfigPane::OnSystemLanguageChoiceChanged, this);
m_sd_card_checkbox->Bind(wxEVT_CHECKBOX, &WiiConfigPane::OnSDCardCheckBoxChanged, this);
m_connect_keyboard_checkbox->Bind(wxEVT_CHECKBOX, &WiiConfigPane::OnConnectKeyboardCheckBoxChanged, this);
m_screensaver_checkbox->Bind(wxEVT_CHECKBOX, &WiiConfigPane::OnScreenSaverCheckBoxChanged, this);
m_pal60_mode_checkbox->Bind(wxEVT_CHECKBOX, &WiiConfigPane::OnPAL60CheckBoxChanged, this);
m_aspect_ratio_choice->Bind(wxEVT_CHOICE, &WiiConfigPane::OnAspectRatioChoiceChanged, this);
m_system_language_choice->Bind(wxEVT_CHOICE, &WiiConfigPane::OnSystemLanguageChoiceChanged, this);
m_sd_card_checkbox->Bind(wxEVT_CHECKBOX, &WiiConfigPane::OnSDCardCheckBoxChanged, this);
m_connect_keyboard_checkbox->Bind(wxEVT_CHECKBOX,
&WiiConfigPane::OnConnectKeyboardCheckBoxChanged, this);
m_screensaver_checkbox->SetToolTip(_("Dims the screen after five minutes of inactivity."));
m_pal60_mode_checkbox->SetToolTip(_("Sets the Wii display mode to 60Hz (480i) instead of 50Hz (576i) for PAL games.\nMay not work for all games."));
m_system_language_choice->SetToolTip(_("Sets the Wii system language."));
m_sd_card_checkbox->SetToolTip(_("Saved to /Wii/sd.raw (default size is 128mb)"));
m_connect_keyboard_checkbox->SetToolTip(_("May cause slow down in Wii Menu and some games."));
m_screensaver_checkbox->SetToolTip(_("Dims the screen after five minutes of inactivity."));
m_pal60_mode_checkbox->SetToolTip(_("Sets the Wii display mode to 60Hz (480i) instead of 50Hz "
"(576i) for PAL games.\nMay not work for all games."));
m_system_language_choice->SetToolTip(_("Sets the Wii system language."));
m_sd_card_checkbox->SetToolTip(_("Saved to /Wii/sd.raw (default size is 128mb)"));
m_connect_keyboard_checkbox->SetToolTip(_("May cause slow down in Wii Menu and some games."));
wxGridBagSizer* const misc_settings_grid_sizer = new wxGridBagSizer();
misc_settings_grid_sizer->Add(m_screensaver_checkbox, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5);
misc_settings_grid_sizer->Add(m_pal60_mode_checkbox, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
misc_settings_grid_sizer->Add(new wxStaticText(this, wxID_ANY, _("Aspect Ratio:")), wxGBPosition(2, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
misc_settings_grid_sizer->Add(m_aspect_ratio_choice, wxGBPosition(2, 1), wxDefaultSpan, wxALL, 5);
misc_settings_grid_sizer->Add(new wxStaticText(this, wxID_ANY, _("System Language:")), wxGBPosition(3, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL, 5);
misc_settings_grid_sizer->Add(m_system_language_choice, wxGBPosition(3, 1), wxDefaultSpan, wxALL, 5);
wxGridBagSizer* const misc_settings_grid_sizer = new wxGridBagSizer();
misc_settings_grid_sizer->Add(m_screensaver_checkbox, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL,
5);
misc_settings_grid_sizer->Add(m_pal60_mode_checkbox, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL,
5);
misc_settings_grid_sizer->Add(new wxStaticText(this, wxID_ANY, _("Aspect Ratio:")),
wxGBPosition(2, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL,
5);
misc_settings_grid_sizer->Add(m_aspect_ratio_choice, wxGBPosition(2, 1), wxDefaultSpan, wxALL, 5);
misc_settings_grid_sizer->Add(new wxStaticText(this, wxID_ANY, _("System Language:")),
wxGBPosition(3, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL,
5);
misc_settings_grid_sizer->Add(m_system_language_choice, wxGBPosition(3, 1), wxDefaultSpan, wxALL,
5);
wxStaticBoxSizer* const misc_settings_static_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Misc Settings"));
misc_settings_static_sizer->Add(misc_settings_grid_sizer);
wxStaticBoxSizer* const misc_settings_static_sizer =
new wxStaticBoxSizer(wxVERTICAL, this, _("Misc Settings"));
misc_settings_static_sizer->Add(misc_settings_grid_sizer);
wxStaticBoxSizer* const device_settings_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Device Settings"));
device_settings_sizer->Add(m_sd_card_checkbox, 0, wxALL, 5);
device_settings_sizer->Add(m_connect_keyboard_checkbox, 0, wxALL, 5);
wxStaticBoxSizer* const device_settings_sizer =
new wxStaticBoxSizer(wxVERTICAL, this, _("Device Settings"));
device_settings_sizer->Add(m_sd_card_checkbox, 0, wxALL, 5);
device_settings_sizer->Add(m_connect_keyboard_checkbox, 0, wxALL, 5);
wxBoxSizer* const main_sizer = new wxBoxSizer(wxVERTICAL);
main_sizer->Add(misc_settings_static_sizer, 0, wxEXPAND | wxALL, 5);
main_sizer->Add(device_settings_sizer, 0, wxEXPAND | wxALL, 5);
wxBoxSizer* const main_sizer = new wxBoxSizer(wxVERTICAL);
main_sizer->Add(misc_settings_static_sizer, 0, wxEXPAND | wxALL, 5);
main_sizer->Add(device_settings_sizer, 0, wxEXPAND | wxALL, 5);
SetSizer(main_sizer);
SetSizer(main_sizer);
}
void WiiConfigPane::LoadGUIValues()
{
m_screensaver_checkbox->SetValue(!!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.SSV"));
m_pal60_mode_checkbox->SetValue(SConfig::GetInstance().bPAL60);
m_aspect_ratio_choice->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.AR"));
m_system_language_choice->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG"));
m_screensaver_checkbox->SetValue(!!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.SSV"));
m_pal60_mode_checkbox->SetValue(SConfig::GetInstance().bPAL60);
m_aspect_ratio_choice->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.AR"));
m_system_language_choice->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG"));
m_sd_card_checkbox->SetValue(SConfig::GetInstance().m_WiiSDCard);
m_connect_keyboard_checkbox->SetValue(SConfig::GetInstance().m_WiiKeyboard);
m_sd_card_checkbox->SetValue(SConfig::GetInstance().m_WiiSDCard);
m_connect_keyboard_checkbox->SetValue(SConfig::GetInstance().m_WiiKeyboard);
}
void WiiConfigPane::RefreshGUI()
{
if (Core::IsRunning())
{
m_screensaver_checkbox->Disable();
m_pal60_mode_checkbox->Disable();
m_aspect_ratio_choice->Disable();
m_system_language_choice->Disable();
}
if (Core::IsRunning())
{
m_screensaver_checkbox->Disable();
m_pal60_mode_checkbox->Disable();
m_aspect_ratio_choice->Disable();
m_system_language_choice->Disable();
}
}
void WiiConfigPane::OnScreenSaverCheckBoxChanged(wxCommandEvent& event)
{
SConfig::GetInstance().m_SYSCONF->SetData("IPL.SSV", m_screensaver_checkbox->IsChecked());
SConfig::GetInstance().m_SYSCONF->SetData("IPL.SSV", m_screensaver_checkbox->IsChecked());
}
void WiiConfigPane::OnPAL60CheckBoxChanged(wxCommandEvent& event)
{
SConfig::GetInstance().bPAL60 = m_pal60_mode_checkbox->IsChecked();
SConfig::GetInstance().m_SYSCONF->SetData("IPL.E60", m_pal60_mode_checkbox->IsChecked());
SConfig::GetInstance().bPAL60 = m_pal60_mode_checkbox->IsChecked();
SConfig::GetInstance().m_SYSCONF->SetData("IPL.E60", m_pal60_mode_checkbox->IsChecked());
}
void WiiConfigPane::OnSDCardCheckBoxChanged(wxCommandEvent& event)
{
SConfig::GetInstance().m_WiiSDCard = m_sd_card_checkbox->IsChecked();
WII_IPC_HLE_Interface::SDIO_EventNotify();
SConfig::GetInstance().m_WiiSDCard = m_sd_card_checkbox->IsChecked();
WII_IPC_HLE_Interface::SDIO_EventNotify();
}
void WiiConfigPane::OnConnectKeyboardCheckBoxChanged(wxCommandEvent& event)
{
SConfig::GetInstance().m_WiiKeyboard = m_connect_keyboard_checkbox->IsChecked();
SConfig::GetInstance().m_WiiKeyboard = m_connect_keyboard_checkbox->IsChecked();
}
void WiiConfigPane::OnSystemLanguageChoiceChanged(wxCommandEvent& event)
{
DiscIO::IVolume::ELanguage wii_system_lang = (DiscIO::IVolume::ELanguage)m_system_language_choice->GetSelection();
SConfig::GetInstance().m_SYSCONF->SetData("IPL.LNG", wii_system_lang);
u8 country_code = GetSADRCountryCode(wii_system_lang);
DiscIO::IVolume::ELanguage wii_system_lang =
(DiscIO::IVolume::ELanguage)m_system_language_choice->GetSelection();
SConfig::GetInstance().m_SYSCONF->SetData("IPL.LNG", wii_system_lang);
u8 country_code = GetSADRCountryCode(wii_system_lang);
if (!SConfig::GetInstance().m_SYSCONF->SetArrayData("IPL.SADR", &country_code, 1))
WxUtils::ShowErrorDialog(_("Failed to update country code in SYSCONF"));
if (!SConfig::GetInstance().m_SYSCONF->SetArrayData("IPL.SADR", &country_code, 1))
WxUtils::ShowErrorDialog(_("Failed to update country code in SYSCONF"));
}
void WiiConfigPane::OnAspectRatioChoiceChanged(wxCommandEvent& event)
{
SConfig::GetInstance().m_SYSCONF->SetData("IPL.AR", m_aspect_ratio_choice->GetSelection());
SConfig::GetInstance().m_SYSCONF->SetData("IPL.AR", m_aspect_ratio_choice->GetSelection());
}
// Change from IPL.LNG value to IPL.SADR country code.
// http://wiibrew.org/wiki/Country_Codes
u8 WiiConfigPane::GetSADRCountryCode(DiscIO::IVolume::ELanguage language)
{
switch (language)
{
case DiscIO::IVolume::LANGUAGE_JAPANESE:
return 1; // Japan
case DiscIO::IVolume::LANGUAGE_ENGLISH:
return 49; // USA
case DiscIO::IVolume::LANGUAGE_GERMAN:
return 78; // Germany
case DiscIO::IVolume::LANGUAGE_FRENCH:
return 77; // France
case DiscIO::IVolume::LANGUAGE_SPANISH:
return 105; // Spain
case DiscIO::IVolume::LANGUAGE_ITALIAN:
return 83; // Italy
case DiscIO::IVolume::LANGUAGE_DUTCH:
return 94; // Netherlands
case DiscIO::IVolume::LANGUAGE_SIMPLIFIED_CHINESE:
case DiscIO::IVolume::LANGUAGE_TRADITIONAL_CHINESE:
return 157; // China
case DiscIO::IVolume::LANGUAGE_KOREAN:
return 136; // Korea
case DiscIO::IVolume::LANGUAGE_UNKNOWN:
break;
}
switch (language)
{
case DiscIO::IVolume::LANGUAGE_JAPANESE:
return 1; // Japan
case DiscIO::IVolume::LANGUAGE_ENGLISH:
return 49; // USA
case DiscIO::IVolume::LANGUAGE_GERMAN:
return 78; // Germany
case DiscIO::IVolume::LANGUAGE_FRENCH:
return 77; // France
case DiscIO::IVolume::LANGUAGE_SPANISH:
return 105; // Spain
case DiscIO::IVolume::LANGUAGE_ITALIAN:
return 83; // Italy
case DiscIO::IVolume::LANGUAGE_DUTCH:
return 94; // Netherlands
case DiscIO::IVolume::LANGUAGE_SIMPLIFIED_CHINESE:
case DiscIO::IVolume::LANGUAGE_TRADITIONAL_CHINESE:
return 157; // China
case DiscIO::IVolume::LANGUAGE_KOREAN:
return 136; // Korea
case DiscIO::IVolume::LANGUAGE_UNKNOWN:
break;
}
PanicAlert("Invalid language. Defaulting to Japanese.");
return 1;
PanicAlert("Invalid language. Defaulting to Japanese.");
return 1;
}

View File

@ -15,29 +15,29 @@ class wxChoice;
class WiiConfigPane final : public wxPanel
{
public:
WiiConfigPane(wxWindow* parent, wxWindowID id);
WiiConfigPane(wxWindow* parent, wxWindowID id);
private:
void InitializeGUI();
void LoadGUIValues();
void RefreshGUI();
void InitializeGUI();
void LoadGUIValues();
void RefreshGUI();
void OnScreenSaverCheckBoxChanged(wxCommandEvent&);
void OnPAL60CheckBoxChanged(wxCommandEvent&);
void OnSDCardCheckBoxChanged(wxCommandEvent&);
void OnConnectKeyboardCheckBoxChanged(wxCommandEvent&);
void OnSystemLanguageChoiceChanged(wxCommandEvent&);
void OnAspectRatioChoiceChanged(wxCommandEvent&);
void OnScreenSaverCheckBoxChanged(wxCommandEvent&);
void OnPAL60CheckBoxChanged(wxCommandEvent&);
void OnSDCardCheckBoxChanged(wxCommandEvent&);
void OnConnectKeyboardCheckBoxChanged(wxCommandEvent&);
void OnSystemLanguageChoiceChanged(wxCommandEvent&);
void OnAspectRatioChoiceChanged(wxCommandEvent&);
static u8 GetSADRCountryCode(DiscIO::IVolume::ELanguage language);
static u8 GetSADRCountryCode(DiscIO::IVolume::ELanguage language);
wxArrayString m_system_language_strings;
wxArrayString m_aspect_ratio_strings;
wxArrayString m_system_language_strings;
wxArrayString m_aspect_ratio_strings;
wxCheckBox* m_screensaver_checkbox;
wxCheckBox* m_pal60_mode_checkbox;
wxCheckBox* m_sd_card_checkbox;
wxCheckBox* m_connect_keyboard_checkbox;
wxChoice* m_system_language_choice;
wxChoice* m_aspect_ratio_choice;
wxCheckBox* m_screensaver_checkbox;
wxCheckBox* m_pal60_mode_checkbox;
wxCheckBox* m_sd_card_checkbox;
wxCheckBox* m_connect_keyboard_checkbox;
wxChoice* m_system_language_choice;
wxChoice* m_aspect_ratio_choice;
};