Cleanup var naming in ISOProperties

This commit is contained in:
Anthony 2017-09-20 15:37:25 -07:00
parent 5585ac47bf
commit 56d0cb8d61
2 changed files with 311 additions and 307 deletions

View file

@ -193,19 +193,19 @@ END_EVENT_TABLE()
CISOProperties::CISOProperties(const GameListItem& game_list_item, wxWindow* parent, wxWindowID id, CISOProperties::CISOProperties(const GameListItem& game_list_item, wxWindow* parent, wxWindowID id,
const wxString& title, const wxPoint& position, const wxSize& size, const wxString& title, const wxPoint& position, const wxSize& size,
long style) long style)
: wxDialog(parent, id, title, position, size, style), OpenGameListItem(game_list_item) : wxDialog(parent, id, title, position, size, style), m_open_gamelist_item(game_list_item)
{ {
Bind(DOLPHIN_EVT_CHANGE_ISO_PROPERTIES_TITLE, &CISOProperties::OnChangeTitle, this); Bind(DOLPHIN_EVT_CHANGE_ISO_PROPERTIES_TITLE, &CISOProperties::OnChangeTitle, this);
// Load ISO data // Load ISO data
m_open_iso = DiscIO::CreateVolumeFromFilename(OpenGameListItem.GetFileName()); m_open_iso = DiscIO::CreateVolumeFromFilename(m_open_gamelist_item.GetFileName());
game_id = m_open_iso->GetGameID(); m_game_id = m_open_iso->GetGameID();
// Load game INIs // Load game INIs
GameIniFileLocal = File::GetUserPath(D_GAMESETTINGS_IDX) + game_id + ".ini"; m_gameini_file_local = File::GetUserPath(D_GAMESETTINGS_IDX) + m_game_id + ".ini";
GameIniDefault = SConfig::LoadDefaultGameIni(game_id, m_open_iso->GetRevision()); m_gameini_default = SConfig::LoadDefaultGameIni(m_game_id, m_open_iso->GetRevision());
GameIniLocal = SConfig::LoadLocalGameIni(game_id, m_open_iso->GetRevision()); m_gameini_local = SConfig::LoadLocalGameIni(m_game_id, m_open_iso->GetRevision());
// Setup GUI // Setup GUI
CreateGUIControls(); CreateGUIControls();
@ -221,7 +221,7 @@ CISOProperties::~CISOProperties()
long CISOProperties::GetElementStyle(const char* section, const char* key) long CISOProperties::GetElementStyle(const char* section, const char* key)
{ {
// Disable 3rd state if default gameini overrides the setting // Disable 3rd state if default gameini overrides the setting
if (GameIniDefault.Exists(section, key)) if (m_gameini_default.Exists(section, key))
return 0; return 0;
return wxCHK_3STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER; return wxCHK_3STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER;
@ -231,25 +231,26 @@ void CISOProperties::CreateGUIControls()
{ {
const int space5 = FromDIP(5); const int space5 = FromDIP(5);
wxButton* const EditConfig = new wxButton(this, ID_EDITCONFIG, _("Edit Config")); wxButton* const edit_config = new wxButton(this, ID_EDITCONFIG, _("Edit Config"));
EditConfig->SetToolTip(_("This will let you manually edit the INI config file.")); edit_config->SetToolTip(_("This will let you manually edit the INI config file."));
wxButton* const EditConfigDefault = new wxButton(this, ID_SHOWDEFAULTCONFIG, _("Show Defaults")); wxButton* const edit_default_config =
EditConfigDefault->SetToolTip( new wxButton(this, ID_SHOWDEFAULTCONFIG, _("Show Defaults"));
edit_default_config->SetToolTip(
_("Opens the default (read-only) configuration for this game in an external text editor.")); _("Opens the default (read-only) configuration for this game in an external text editor."));
// Notebook // Notebook
wxNotebook* const m_Notebook = new wxNotebook(this, ID_NOTEBOOK); wxNotebook* const notebook = new wxNotebook(this, ID_NOTEBOOK);
wxPanel* const m_GameConfig = new wxPanel(m_Notebook, ID_GAMECONFIG); wxPanel* const m_GameConfig = new wxPanel(notebook, ID_GAMECONFIG);
m_Notebook->AddPage(m_GameConfig, _("GameConfig")); notebook->AddPage(m_GameConfig, _("GameConfig"));
wxPanel* const m_PatchPage = new wxPanel(m_Notebook, ID_PATCH_PAGE); wxPanel* const m_PatchPage = new wxPanel(notebook, ID_PATCH_PAGE);
m_Notebook->AddPage(m_PatchPage, _("Patches")); notebook->AddPage(m_PatchPage, _("Patches"));
wxPanel* const m_CheatPage = new wxPanel(m_Notebook, ID_ARCODE_PAGE); wxPanel* const m_CheatPage = new wxPanel(notebook, ID_ARCODE_PAGE);
m_Notebook->AddPage(m_CheatPage, _("AR Codes")); notebook->AddPage(m_CheatPage, _("AR Codes"));
wxPanel* const gecko_cheat_page = new wxPanel(m_Notebook); wxPanel* const gecko_cheat_page = new wxPanel(notebook);
m_Notebook->AddPage(gecko_cheat_page, _("Gecko Codes")); notebook->AddPage(gecko_cheat_page, _("Gecko Codes"));
m_Notebook->AddPage(new InfoPanel(m_Notebook, ID_INFORMATION, OpenGameListItem, m_open_iso), notebook->AddPage(new InfoPanel(notebook, ID_INFORMATION, m_open_gamelist_item, m_open_iso),
_("Info")); _("Info"));
// GameConfig editing - Overrides and emulation state // GameConfig editing - Overrides and emulation state
wxStaticText* const OverrideText = new wxStaticText( wxStaticText* const OverrideText = new wxStaticText(
@ -257,173 +258,176 @@ void CISOProperties::CreateGUIControls()
"means the game uses Dolphin's setting.")); "means the game uses Dolphin's setting."));
// Core // Core
CPUThread = new wxCheckBox(m_GameConfig, ID_USEDUALCORE, _("Enable Dual Core"), wxDefaultPosition, m_cpu_thread =
wxDefaultSize, GetElementStyle("Core", "CPUThread")); new wxCheckBox(m_GameConfig, ID_USEDUALCORE, _("Enable Dual Core"), wxDefaultPosition,
MMU = new wxCheckBox(m_GameConfig, ID_MMU, _("Enable MMU"), wxDefaultPosition, wxDefaultSize, wxDefaultSize, GetElementStyle("Core", "CPUThread"));
GetElementStyle("Core", "MMU")); m_mmu = new wxCheckBox(m_GameConfig, ID_MMU, _("Enable MMU"), wxDefaultPosition, wxDefaultSize,
MMU->SetToolTip(_( GetElementStyle("Core", "MMU"));
m_mmu->SetToolTip(_(
"Enables the Memory Management Unit, needed for some games. (ON = Compatible, OFF = Fast)")); "Enables the Memory Management Unit, needed for some games. (ON = Compatible, OFF = Fast)"));
DCBZOFF = new wxCheckBox(m_GameConfig, ID_DCBZOFF, _("Skip DCBZ clearing"), wxDefaultPosition, m_dcbz_off = new wxCheckBox(m_GameConfig, ID_DCBZOFF, _("Skip DCBZ clearing"), wxDefaultPosition,
wxDefaultSize, GetElementStyle("Core", "DCBZ")); wxDefaultSize, GetElementStyle("Core", "DCBZ"));
DCBZOFF->SetToolTip(_("Bypass the clearing of the data cache by the DCBZ instruction. Usually " m_dcbz_off->SetToolTip(_("Bypass the clearing of the data cache by the DCBZ instruction. Usually "
"leave this option disabled.")); "leave this option disabled."));
FPRF = new wxCheckBox(m_GameConfig, ID_FPRF, _("Enable FPRF"), wxDefaultPosition, wxDefaultSize, m_fprf = new wxCheckBox(m_GameConfig, ID_FPRF, _("Enable FPRF"), wxDefaultPosition, wxDefaultSize,
GetElementStyle("Core", "FPRF")); GetElementStyle("Core", "FPRF"));
FPRF->SetToolTip(_("Enables Floating Point Result Flag calculation, needed for a few games. (ON " m_fprf->SetToolTip(
"= Compatible, OFF = Fast)")); _("Enables Floating Point Result Flag calculation, needed for a few games. (ON "
SyncGPU = new wxCheckBox(m_GameConfig, ID_SYNCGPU, _("Synchronize GPU thread"), wxDefaultPosition, "= Compatible, OFF = Fast)"));
wxDefaultSize, GetElementStyle("Core", "SyncGPU")); m_sync_gpu = new wxCheckBox(m_GameConfig, ID_SYNCGPU, _("Synchronize GPU thread"),
SyncGPU->SetToolTip(_("Synchronizes the GPU and CPU threads to help prevent random freezes in " wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "SyncGPU"));
"Dual Core mode. (ON = Compatible, OFF = Fast)")); m_sync_gpu->SetToolTip(_("Synchronizes the GPU and CPU threads to help prevent random freezes in "
FastDiscSpeed = "Dual Core mode. (ON = Compatible, OFF = Fast)"));
m_fast_disc_speed =
new wxCheckBox(m_GameConfig, ID_DISCSPEED, _("Speed up Disc Transfer Rate"), new wxCheckBox(m_GameConfig, ID_DISCSPEED, _("Speed up Disc Transfer Rate"),
wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "FastDiscSpeed")); wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "FastDiscSpeed"));
FastDiscSpeed->SetToolTip(_("Enable fast disc access. This can cause crashes and other problems " m_fast_disc_speed->SetToolTip(
"in some games. (ON = Fast, OFF = Compatible)")); _("Enable fast disc access. This can cause crashes and other problems "
DSPHLE = new wxCheckBox(m_GameConfig, ID_AUDIO_DSP_HLE, _("DSP HLE emulation (fast)"), "in some games. (ON = Fast, OFF = Compatible)"));
wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "DSPHLE")); m_dps_hle = new wxCheckBox(m_GameConfig, ID_AUDIO_DSP_HLE, _("DSP HLE emulation (fast)"),
wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "DSPHLE"));
wxBoxSizer* const sGPUDeterminism = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* const gpu_determinism_sizer = new wxBoxSizer(wxHORIZONTAL);
wxStaticText* const GPUDeterminismText = wxStaticText* const gpu_determinism_text =
new wxStaticText(m_GameConfig, wxID_ANY, _("Deterministic dual core: ")); new wxStaticText(m_GameConfig, wxID_ANY, _("Deterministic dual core: "));
arrayStringFor_GPUDeterminism.Add(_("Not Set")); m_gpu_determinism_string.Add(_("Not Set"));
arrayStringFor_GPUDeterminism.Add(_("auto")); m_gpu_determinism_string.Add(_("auto"));
arrayStringFor_GPUDeterminism.Add(_("none")); m_gpu_determinism_string.Add(_("none"));
arrayStringFor_GPUDeterminism.Add(_("fake-completion")); m_gpu_determinism_string.Add(_("fake-completion"));
GPUDeterminism = new wxChoice(m_GameConfig, ID_GPUDETERMINISM, wxDefaultPosition, wxDefaultSize, m_gpu_determinism = new wxChoice(m_GameConfig, ID_GPUDETERMINISM, wxDefaultPosition,
arrayStringFor_GPUDeterminism); wxDefaultSize, m_gpu_determinism_string);
sGPUDeterminism->Add(GPUDeterminismText, 0, wxALIGN_CENTER_VERTICAL); gpu_determinism_sizer->Add(gpu_determinism_text, 0, wxALIGN_CENTER_VERTICAL);
sGPUDeterminism->Add(GPUDeterminism, 0, wxALIGN_CENTER_VERTICAL); gpu_determinism_sizer->Add(m_gpu_determinism, 0, wxALIGN_CENTER_VERTICAL);
// Wii Console // Wii Console
EnableWideScreen = m_enable_widescreen =
new wxCheckBox(m_GameConfig, ID_ENABLEWIDESCREEN, _("Enable WideScreen"), wxDefaultPosition, new wxCheckBox(m_GameConfig, ID_ENABLEWIDESCREEN, _("Enable WideScreen"), wxDefaultPosition,
wxDefaultSize, GetElementStyle("Wii", "Widescreen")); wxDefaultSize, GetElementStyle("Wii", "Widescreen"));
// Stereoscopy // Stereoscopy
wxBoxSizer* const sDepthPercentage = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* const depth_percentage = new wxBoxSizer(wxHORIZONTAL);
wxStaticText* const DepthPercentageText = wxStaticText* const depth_percentage_text =
new wxStaticText(m_GameConfig, wxID_ANY, _("Depth Percentage: ")); new wxStaticText(m_GameConfig, wxID_ANY, _("Depth Percentage: "));
DepthPercentage = new DolphinSlider(m_GameConfig, ID_DEPTHPERCENTAGE, 100, 0, 200); m_depth_percentage = new DolphinSlider(m_GameConfig, ID_DEPTHPERCENTAGE, 100, 0, 200);
DepthPercentage->SetToolTip( m_depth_percentage->SetToolTip(
_("This value is multiplied with the depth set in the graphics configuration.")); _("This value is multiplied with the depth set in the graphics configuration."));
sDepthPercentage->Add(DepthPercentageText); depth_percentage->Add(depth_percentage_text);
sDepthPercentage->Add(DepthPercentage); depth_percentage->Add(m_depth_percentage);
wxBoxSizer* const sConvergence = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* const convergence_sizer = new wxBoxSizer(wxHORIZONTAL);
wxStaticText* const ConvergenceText = wxStaticText* const convergence_text =
new wxStaticText(m_GameConfig, wxID_ANY, _("Convergence: ")); new wxStaticText(m_GameConfig, wxID_ANY, _("Convergence: "));
Convergence = new wxSpinCtrl(m_GameConfig, ID_CONVERGENCE); m_convergence = new wxSpinCtrl(m_GameConfig, ID_CONVERGENCE);
Convergence->SetRange(0, INT32_MAX); m_convergence->SetRange(0, INT32_MAX);
Convergence->SetToolTip( m_convergence->SetToolTip(
_("This value is added to the convergence value set in the graphics configuration.")); _("This value is added to the convergence value set in the graphics configuration."));
sConvergence->Add(ConvergenceText); convergence_sizer->Add(convergence_text);
sConvergence->Add(Convergence); convergence_sizer->Add(m_convergence);
MonoDepth = m_mono_depth =
new wxCheckBox(m_GameConfig, ID_MONODEPTH, _("Monoscopic Shadows"), wxDefaultPosition, new wxCheckBox(m_GameConfig, ID_MONODEPTH, _("Monoscopic Shadows"), wxDefaultPosition,
wxDefaultSize, GetElementStyle("Video_Stereoscopy", "StereoEFBMonoDepth")); wxDefaultSize, GetElementStyle("Video_Stereoscopy", "StereoEFBMonoDepth"));
MonoDepth->SetToolTip(_("Use a single depth buffer for both eyes. Needed for a few games.")); m_mono_depth->SetToolTip(_("Use a single depth buffer for both eyes. Needed for a few games."));
wxBoxSizer* const sEmuState = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* const emustate_sizer = new wxBoxSizer(wxHORIZONTAL);
wxStaticText* const EmuStateText = wxStaticText* const emustate_text =
new wxStaticText(m_GameConfig, wxID_ANY, _("Emulation State: ")); new wxStaticText(m_GameConfig, wxID_ANY, _("Emulation State: "));
arrayStringFor_EmuState.Add(_("Not Set")); m_emustate_string.Add(_("Not Set"));
arrayStringFor_EmuState.Add(_("Broken")); m_emustate_string.Add(_("Broken"));
arrayStringFor_EmuState.Add(_("Intro")); m_emustate_string.Add(_("Intro"));
arrayStringFor_EmuState.Add(_("In Game")); m_emustate_string.Add(_("In Game"));
arrayStringFor_EmuState.Add(_("Playable")); m_emustate_string.Add(_("Playable"));
arrayStringFor_EmuState.Add(_("Perfect")); m_emustate_string.Add(_("Perfect"));
EmuState = new wxChoice(m_GameConfig, ID_EMUSTATE, wxDefaultPosition, wxDefaultSize, m_emustate_choice =
arrayStringFor_EmuState); new wxChoice(m_GameConfig, ID_EMUSTATE, wxDefaultPosition, wxDefaultSize, m_emustate_string);
EmuIssues = new wxTextCtrl(m_GameConfig, ID_EMU_ISSUES, wxEmptyString); m_emu_issues = new wxTextCtrl(m_GameConfig, ID_EMU_ISSUES, wxEmptyString);
sEmuState->Add(EmuStateText, 0, wxALIGN_CENTER_VERTICAL); emustate_sizer->Add(emustate_text, 0, wxALIGN_CENTER_VERTICAL);
sEmuState->Add(EmuState, 0, wxALIGN_CENTER_VERTICAL); emustate_sizer->Add(m_emustate_choice, 0, wxALIGN_CENTER_VERTICAL);
sEmuState->Add(EmuIssues, 1, wxEXPAND); emustate_sizer->Add(m_emu_issues, 1, wxEXPAND);
wxStaticBoxSizer* const sbCoreOverrides = wxStaticBoxSizer* const core_overrides_sizer =
new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Core")); new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Core"));
sbCoreOverrides->Add(CPUThread, 0, wxLEFT | wxRIGHT, space5); core_overrides_sizer->Add(m_cpu_thread, 0, wxLEFT | wxRIGHT, space5);
sbCoreOverrides->Add(MMU, 0, wxLEFT | wxRIGHT, space5); core_overrides_sizer->Add(m_mmu, 0, wxLEFT | wxRIGHT, space5);
sbCoreOverrides->Add(DCBZOFF, 0, wxLEFT | wxRIGHT, space5); core_overrides_sizer->Add(m_dcbz_off, 0, wxLEFT | wxRIGHT, space5);
sbCoreOverrides->Add(FPRF, 0, wxLEFT | wxRIGHT, space5); core_overrides_sizer->Add(m_fprf, 0, wxLEFT | wxRIGHT, space5);
sbCoreOverrides->Add(SyncGPU, 0, wxLEFT | wxRIGHT, space5); core_overrides_sizer->Add(m_sync_gpu, 0, wxLEFT | wxRIGHT, space5);
sbCoreOverrides->Add(FastDiscSpeed, 0, wxLEFT | wxRIGHT, space5); core_overrides_sizer->Add(m_fast_disc_speed, 0, wxLEFT | wxRIGHT, space5);
sbCoreOverrides->Add(DSPHLE, 0, wxLEFT | wxRIGHT, space5); core_overrides_sizer->Add(m_dps_hle, 0, wxLEFT | wxRIGHT, space5);
sbCoreOverrides->AddSpacer(space5); core_overrides_sizer->AddSpacer(space5);
sbCoreOverrides->Add(sGPUDeterminism, 0, wxEXPAND | wxLEFT | wxRIGHT, space5); core_overrides_sizer->Add(gpu_determinism_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
sbCoreOverrides->AddSpacer(space5); core_overrides_sizer->AddSpacer(space5);
wxStaticBoxSizer* const sbWiiOverrides = wxStaticBoxSizer* const wii_overrides_sizer =
new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Wii Console")); new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Wii Console"));
if (m_open_iso->GetVolumeType() == DiscIO::Platform::GAMECUBE_DISC) if (m_open_iso->GetVolumeType() == DiscIO::Platform::GAMECUBE_DISC)
{ {
sbWiiOverrides->ShowItems(false); wii_overrides_sizer->ShowItems(false);
EnableWideScreen->Hide(); m_enable_widescreen->Hide();
} }
sbWiiOverrides->Add(EnableWideScreen, 0, wxLEFT, space5); wii_overrides_sizer->Add(m_enable_widescreen, 0, wxLEFT, space5);
wxStaticBoxSizer* const sbStereoOverrides = wxStaticBoxSizer* const stereo_overrides_sizer =
new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Stereoscopy")); new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Stereoscopy"));
sbStereoOverrides->Add(sDepthPercentage); stereo_overrides_sizer->Add(depth_percentage);
sbStereoOverrides->Add(sConvergence); stereo_overrides_sizer->Add(convergence_sizer);
sbStereoOverrides->Add(MonoDepth); stereo_overrides_sizer->Add(m_mono_depth);
wxStaticBoxSizer* const sbGameConfig = wxStaticBoxSizer* const game_config_sizer =
new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Game-Specific Settings")); new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Game-Specific Settings"));
sbGameConfig->AddSpacer(space5); game_config_sizer->AddSpacer(space5);
sbGameConfig->Add(OverrideText, 0, wxEXPAND | wxLEFT | wxRIGHT, space5); game_config_sizer->Add(OverrideText, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
sbGameConfig->AddSpacer(space5); game_config_sizer->AddSpacer(space5);
sbGameConfig->Add(sbCoreOverrides, 0, wxEXPAND); game_config_sizer->Add(core_overrides_sizer, 0, wxEXPAND);
sbGameConfig->Add(sbWiiOverrides, 0, wxEXPAND); game_config_sizer->Add(wii_overrides_sizer, 0, wxEXPAND);
sbGameConfig->Add(sbStereoOverrides, 0, wxEXPAND); game_config_sizer->Add(stereo_overrides_sizer, 0, wxEXPAND);
wxBoxSizer* const sConfigPage = new wxBoxSizer(wxVERTICAL); wxBoxSizer* const config_page_sizer = new wxBoxSizer(wxVERTICAL);
sConfigPage->AddSpacer(space5); config_page_sizer->AddSpacer(space5);
sConfigPage->Add(sbGameConfig, 0, wxEXPAND | wxLEFT | wxRIGHT, space5); config_page_sizer->Add(game_config_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
sConfigPage->AddSpacer(space5); config_page_sizer->AddSpacer(space5);
sConfigPage->Add(sEmuState, 0, wxEXPAND | wxLEFT | wxRIGHT, space5); config_page_sizer->Add(emustate_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
sConfigPage->AddSpacer(space5); config_page_sizer->AddSpacer(space5);
m_GameConfig->SetSizer(sConfigPage); m_GameConfig->SetSizer(config_page_sizer);
// Patches // Patches
wxBoxSizer* const sPatches = new wxBoxSizer(wxVERTICAL); wxBoxSizer* const patches_sizer = new wxBoxSizer(wxVERTICAL);
Patches = new wxCheckListBox(m_PatchPage, ID_PATCHES_LIST, wxDefaultPosition, wxDefaultSize, 0, m_patches = new wxCheckListBox(m_PatchPage, ID_PATCHES_LIST, wxDefaultPosition, wxDefaultSize, 0,
nullptr, wxLB_HSCROLL); nullptr, wxLB_HSCROLL);
wxBoxSizer* const sPatchButtons = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* const sPatchButtons = new wxBoxSizer(wxHORIZONTAL);
EditPatch = new wxButton(m_PatchPage, ID_EDITPATCH, _("Edit...")); m_edit_patch = new wxButton(m_PatchPage, ID_EDITPATCH, _("Edit..."));
wxButton* const AddPatch = new wxButton(m_PatchPage, ID_ADDPATCH, _("Add...")); wxButton* const AddPatch = new wxButton(m_PatchPage, ID_ADDPATCH, _("Add..."));
RemovePatch = new wxButton(m_PatchPage, ID_REMOVEPATCH, _("Remove")); m_remove_patch = new wxButton(m_PatchPage, ID_REMOVEPATCH, _("Remove"));
EditPatch->Disable(); m_edit_patch->Disable();
RemovePatch->Disable(); m_remove_patch->Disable();
wxBoxSizer* sPatchPage = new wxBoxSizer(wxVERTICAL); wxBoxSizer* patch_page_sizer = new wxBoxSizer(wxVERTICAL);
sPatches->Add(Patches, 1, wxEXPAND); patches_sizer->Add(m_patches, 1, wxEXPAND);
sPatchButtons->Add(EditPatch, 0, wxEXPAND); sPatchButtons->Add(m_edit_patch, 0, wxEXPAND);
sPatchButtons->AddStretchSpacer(); sPatchButtons->AddStretchSpacer();
sPatchButtons->Add(AddPatch, 0, wxEXPAND); sPatchButtons->Add(AddPatch, 0, wxEXPAND);
sPatchButtons->Add(RemovePatch, 0, wxEXPAND); sPatchButtons->Add(m_remove_patch, 0, wxEXPAND);
sPatches->Add(sPatchButtons, 0, wxEXPAND); patches_sizer->Add(sPatchButtons, 0, wxEXPAND);
sPatchPage->AddSpacer(space5); patch_page_sizer->AddSpacer(space5);
sPatchPage->Add(sPatches, 1, wxEXPAND | wxLEFT | wxRIGHT, space5); patch_page_sizer->Add(patches_sizer, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
sPatchPage->AddSpacer(space5); patch_page_sizer->AddSpacer(space5);
m_PatchPage->SetSizer(sPatchPage); m_PatchPage->SetSizer(patch_page_sizer);
// Action Replay Cheats // Action Replay Cheats
m_ar_code_panel = m_ar_code_panel =
new ActionReplayCodesPanel(m_CheatPage, ActionReplayCodesPanel::STYLE_MODIFY_BUTTONS); new ActionReplayCodesPanel(m_CheatPage, ActionReplayCodesPanel::STYLE_MODIFY_BUTTONS);
m_cheats_disabled_ar = new CheatWarningMessage(m_CheatPage, game_id); m_cheats_disabled_ar = new CheatWarningMessage(m_CheatPage, m_game_id);
m_ar_code_panel->Bind(DOLPHIN_EVT_ARCODE_TOGGLED, &CISOProperties::OnCheatCodeToggled, this); m_ar_code_panel->Bind(DOLPHIN_EVT_ARCODE_TOGGLED, &CISOProperties::OnCheatCodeToggled, this);
wxBoxSizer* const sCheatPage = new wxBoxSizer(wxVERTICAL); wxBoxSizer* const cheat_page_sizer = new wxBoxSizer(wxVERTICAL);
sCheatPage->Add(m_cheats_disabled_ar, 0, wxEXPAND | wxTOP, space5); cheat_page_sizer->Add(m_cheats_disabled_ar, 0, wxEXPAND | wxTOP, space5);
sCheatPage->Add(m_ar_code_panel, 1, wxEXPAND | wxALL, space5); cheat_page_sizer->Add(m_ar_code_panel, 1, wxEXPAND | wxALL, space5);
m_CheatPage->SetSizer(sCheatPage); m_CheatPage->SetSizer(cheat_page_sizer);
// Gecko Cheats // Gecko Cheats
m_geckocode_panel = new Gecko::CodeConfigPanel(gecko_cheat_page); m_geckocode_panel = new Gecko::CodeConfigPanel(gecko_cheat_page);
m_cheats_disabled_gecko = new CheatWarningMessage(gecko_cheat_page, game_id); m_cheats_disabled_gecko = new CheatWarningMessage(gecko_cheat_page, m_game_id);
m_geckocode_panel->Bind(DOLPHIN_EVT_GECKOCODE_TOGGLED, &CISOProperties::OnCheatCodeToggled, this); m_geckocode_panel->Bind(DOLPHIN_EVT_GECKOCODE_TOGGLED, &CISOProperties::OnCheatCodeToggled, this);
@ -434,37 +438,36 @@ void CISOProperties::CreateGUIControls()
if (DiscIO::IsDisc(m_open_iso->GetVolumeType())) if (DiscIO::IsDisc(m_open_iso->GetVolumeType()))
{ {
m_Notebook->AddPage(new FilesystemPanel(m_Notebook, ID_FILESYSTEM, m_open_iso), notebook->AddPage(new FilesystemPanel(notebook, ID_FILESYSTEM, m_open_iso), _("Filesystem"));
_("Filesystem"));
} }
wxStdDialogButtonSizer* sButtons = CreateStdDialogButtonSizer(wxOK | wxNO_DEFAULT); wxStdDialogButtonSizer* buttons_sizer = CreateStdDialogButtonSizer(wxOK | wxNO_DEFAULT);
sButtons->Prepend(EditConfigDefault); buttons_sizer->Prepend(edit_default_config);
sButtons->Prepend(EditConfig); buttons_sizer->Prepend(edit_config);
sButtons->GetAffirmativeButton()->SetLabel(_("Close")); buttons_sizer->GetAffirmativeButton()->SetLabel(_("Close"));
// If there is no default gameini, disable the button. // If there is no default gameini, disable the button.
const std::vector<std::string> ini_names = const std::vector<std::string> ini_names =
ConfigLoaders::GetGameIniFilenames(game_id, m_open_iso->GetRevision()); ConfigLoaders::GetGameIniFilenames(m_game_id, m_open_iso->GetRevision());
const bool game_ini_exists = const bool game_ini_exists =
std::any_of(ini_names.cbegin(), ini_names.cend(), [](const std::string& name) { std::any_of(ini_names.cbegin(), ini_names.cend(), [](const std::string& name) {
return File::Exists(File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + name); return File::Exists(File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + name);
}); });
if (!game_ini_exists) if (!game_ini_exists)
EditConfigDefault->Disable(); edit_default_config->Disable();
// Add notebook and buttons to the dialog // Add notebook and buttons to the dialog
wxBoxSizer* sMain = new wxBoxSizer(wxVERTICAL); wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
sMain->AddSpacer(space5); main_sizer->AddSpacer(space5);
sMain->Add(m_Notebook, 1, wxEXPAND | wxLEFT | wxRIGHT, space5); main_sizer->Add(notebook, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
sMain->AddSpacer(space5); main_sizer->AddSpacer(space5);
sMain->Add(sButtons, 0, wxEXPAND | wxLEFT | wxRIGHT, space5); main_sizer->Add(buttons_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
sMain->AddSpacer(space5); main_sizer->AddSpacer(space5);
sMain->SetMinSize(FromDIP(wxSize(500, -1))); main_sizer->SetMinSize(FromDIP(wxSize(500, -1)));
SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED); SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED);
SetLayoutAdaptationLevel(wxDIALOG_ADAPTATION_STANDARD_SIZER); SetLayoutAdaptationLevel(wxDIALOG_ADAPTATION_STANDARD_SIZER);
SetSizerAndFit(sMain); SetSizerAndFit(main_sizer);
Center(); Center();
SetFocus(); SetFocus();
} }
@ -472,7 +475,8 @@ void CISOProperties::CreateGUIControls()
void CISOProperties::OnClose(wxCloseEvent& WXUNUSED(event)) void CISOProperties::OnClose(wxCloseEvent& WXUNUSED(event))
{ {
if (!SaveGameConfig()) if (!SaveGameConfig())
WxUtils::ShowErrorDialog(wxString::Format(_("Could not save %s."), GameIniFileLocal.c_str())); WxUtils::ShowErrorDialog(
wxString::Format(_("Could not save %s."), m_gameini_file_local.c_str()));
Destroy(); Destroy();
} }
@ -483,7 +487,7 @@ void CISOProperties::OnCloseClick(wxCommandEvent& WXUNUSED(event))
void CISOProperties::OnEmustateChanged(wxCommandEvent& event) void CISOProperties::OnEmustateChanged(wxCommandEvent& event)
{ {
EmuIssues->Enable(event.GetSelection() != 0); m_emu_issues->Enable(event.GetSelection() != 0);
} }
void CISOProperties::SetCheckboxValueFromGameini(const char* section, const char* key, void CISOProperties::SetCheckboxValueFromGameini(const char* section, const char* key,
@ -491,9 +495,9 @@ void CISOProperties::SetCheckboxValueFromGameini(const char* section, const char
{ {
// Prefer local gameini value over default gameini value. // Prefer local gameini value over default gameini value.
bool value; bool value;
if (GameIniLocal.GetOrCreateSection(section)->Get(key, &value)) if (m_gameini_local.GetOrCreateSection(section)->Get(key, &value))
checkbox->Set3StateValue((wxCheckBoxState)value); checkbox->Set3StateValue((wxCheckBoxState)value);
else if (GameIniDefault.GetOrCreateSection(section)->Get(key, &value)) else if (m_gameini_default.GetOrCreateSection(section)->Get(key, &value))
checkbox->Set3StateValue((wxCheckBoxState)value); checkbox->Set3StateValue((wxCheckBoxState)value);
else else
checkbox->Set3StateValue(wxCHK_UNDETERMINED); checkbox->Set3StateValue(wxCHK_UNDETERMINED);
@ -501,73 +505,73 @@ void CISOProperties::SetCheckboxValueFromGameini(const char* section, const char
void CISOProperties::LoadGameConfig() void CISOProperties::LoadGameConfig()
{ {
SetCheckboxValueFromGameini("Core", "CPUThread", CPUThread); SetCheckboxValueFromGameini("Core", "CPUThread", m_cpu_thread);
SetCheckboxValueFromGameini("Core", "MMU", MMU); SetCheckboxValueFromGameini("Core", "MMU", m_mmu);
SetCheckboxValueFromGameini("Core", "DCBZ", DCBZOFF); SetCheckboxValueFromGameini("Core", "DCBZ", m_dcbz_off);
SetCheckboxValueFromGameini("Core", "FPRF", FPRF); SetCheckboxValueFromGameini("Core", "FPRF", m_fprf);
SetCheckboxValueFromGameini("Core", "SyncGPU", SyncGPU); SetCheckboxValueFromGameini("Core", "SyncGPU", m_sync_gpu);
SetCheckboxValueFromGameini("Core", "FastDiscSpeed", FastDiscSpeed); SetCheckboxValueFromGameini("Core", "FastDiscSpeed", m_fast_disc_speed);
SetCheckboxValueFromGameini("Core", "DSPHLE", DSPHLE); SetCheckboxValueFromGameini("Core", "DSPHLE", m_dps_hle);
SetCheckboxValueFromGameini("Wii", "Widescreen", EnableWideScreen); SetCheckboxValueFromGameini("Wii", "Widescreen", m_enable_widescreen);
SetCheckboxValueFromGameini("Video_Stereoscopy", "StereoEFBMonoDepth", MonoDepth); SetCheckboxValueFromGameini("Video_Stereoscopy", "StereoEFBMonoDepth", m_mono_depth);
IniFile::Section* default_video = GameIniDefault.GetOrCreateSection("Video"); IniFile::Section* default_video = m_gameini_default.GetOrCreateSection("Video");
int iTemp; int iTemp;
default_video->Get("ProjectionHack", &iTemp); default_video->Get("ProjectionHack", &iTemp);
default_video->Get("PH_SZNear", &m_PHack_Data.PHackSZNear); default_video->Get("PH_SZNear", &m_phack_data.PHackSZNear);
if (GameIniLocal.GetIfExists("Video", "PH_SZNear", &iTemp)) if (m_gameini_local.GetIfExists("Video", "PH_SZNear", &iTemp))
m_PHack_Data.PHackSZNear = !!iTemp; m_phack_data.PHackSZNear = !!iTemp;
default_video->Get("PH_SZFar", &m_PHack_Data.PHackSZFar); default_video->Get("PH_SZFar", &m_phack_data.PHackSZFar);
if (GameIniLocal.GetIfExists("Video", "PH_SZFar", &iTemp)) if (m_gameini_local.GetIfExists("Video", "PH_SZFar", &iTemp))
m_PHack_Data.PHackSZFar = !!iTemp; m_phack_data.PHackSZFar = !!iTemp;
std::string sTemp; std::string sTemp;
default_video->Get("PH_ZNear", &m_PHack_Data.PHZNear); default_video->Get("PH_ZNear", &m_phack_data.PHZNear);
if (GameIniLocal.GetIfExists("Video", "PH_ZNear", &sTemp)) if (m_gameini_local.GetIfExists("Video", "PH_ZNear", &sTemp))
m_PHack_Data.PHZNear = sTemp; m_phack_data.PHZNear = sTemp;
default_video->Get("PH_ZFar", &m_PHack_Data.PHZFar); default_video->Get("PH_ZFar", &m_phack_data.PHZFar);
if (GameIniLocal.GetIfExists("Video", "PH_ZFar", &sTemp)) if (m_gameini_local.GetIfExists("Video", "PH_ZFar", &sTemp))
m_PHack_Data.PHZFar = sTemp; m_phack_data.PHZFar = sTemp;
IniFile::Section* default_emustate = GameIniDefault.GetOrCreateSection("EmuState"); IniFile::Section* default_emustate = m_gameini_default.GetOrCreateSection("EmuState");
default_emustate->Get("EmulationStateId", &iTemp, 0 /*Not Set*/); default_emustate->Get("EmulationStateId", &iTemp, 0 /*Not Set*/);
EmuState->SetSelection(iTemp); m_emustate_choice->SetSelection(iTemp);
if (GameIniLocal.GetIfExists("EmuState", "EmulationStateId", &iTemp)) if (m_gameini_local.GetIfExists("EmuState", "EmulationStateId", &iTemp))
EmuState->SetSelection(iTemp); m_emustate_choice->SetSelection(iTemp);
default_emustate->Get("EmulationIssues", &sTemp); default_emustate->Get("EmulationIssues", &sTemp);
if (!sTemp.empty()) if (!sTemp.empty())
EmuIssues->SetValue(StrToWxStr(sTemp)); m_emu_issues->SetValue(StrToWxStr(sTemp));
if (GameIniLocal.GetIfExists("EmuState", "EmulationIssues", &sTemp)) if (m_gameini_local.GetIfExists("EmuState", "EmulationIssues", &sTemp))
EmuIssues->SetValue(StrToWxStr(sTemp)); m_emu_issues->SetValue(StrToWxStr(sTemp));
EmuIssues->Enable(EmuState->GetSelection() != 0); m_emu_issues->Enable(m_emustate_choice->GetSelection() != 0);
sTemp = ""; sTemp = "";
if (!GameIniLocal.GetIfExists("Core", "GPUDeterminismMode", &sTemp)) if (!m_gameini_local.GetIfExists("Core", "GPUDeterminismMode", &sTemp))
GameIniDefault.GetIfExists("Core", "GPUDeterminismMode", &sTemp); m_gameini_default.GetIfExists("Core", "GPUDeterminismMode", &sTemp);
if (sTemp == "") if (sTemp == "")
GPUDeterminism->SetSelection(0); m_gpu_determinism->SetSelection(0);
else if (sTemp == "auto") else if (sTemp == "auto")
GPUDeterminism->SetSelection(1); m_gpu_determinism->SetSelection(1);
else if (sTemp == "none") else if (sTemp == "none")
GPUDeterminism->SetSelection(2); m_gpu_determinism->SetSelection(2);
else if (sTemp == "fake-completion") else if (sTemp == "fake-completion")
GPUDeterminism->SetSelection(3); m_gpu_determinism->SetSelection(3);
IniFile::Section* default_stereoscopy = GameIniDefault.GetOrCreateSection("Video_Stereoscopy"); IniFile::Section* default_stereoscopy = m_gameini_default.GetOrCreateSection("Video_Stereoscopy");
default_stereoscopy->Get("StereoDepthPercentage", &iTemp, 100); default_stereoscopy->Get("StereoDepthPercentage", &iTemp, 100);
GameIniLocal.GetIfExists("Video_Stereoscopy", "StereoDepthPercentage", &iTemp); m_gameini_local.GetIfExists("Video_Stereoscopy", "StereoDepthPercentage", &iTemp);
DepthPercentage->SetValue(iTemp); m_depth_percentage->SetValue(iTemp);
default_stereoscopy->Get("StereoConvergence", &iTemp, 0); default_stereoscopy->Get("StereoConvergence", &iTemp, 0);
GameIniLocal.GetIfExists("Video_Stereoscopy", "StereoConvergence", &iTemp); m_gameini_local.GetIfExists("Video_Stereoscopy", "StereoConvergence", &iTemp);
Convergence->SetValue(iTemp); m_convergence->SetValue(iTemp);
PatchList_Load(); PatchList_Load();
m_ar_code_panel->LoadCodes(GameIniDefault, GameIniLocal); m_ar_code_panel->LoadCodes(m_gameini_default, m_gameini_local);
m_geckocode_panel->LoadCodes(GameIniDefault, GameIniLocal, m_open_iso->GetGameID()); m_geckocode_panel->LoadCodes(m_gameini_default, m_gameini_local, m_open_iso->GetGameID());
} }
void CISOProperties::SaveGameIniValueFrom3StateCheckbox(const char* section, const char* key, void CISOProperties::SaveGameIniValueFrom3StateCheckbox(const char* section, const char* key,
@ -581,84 +585,84 @@ void CISOProperties::SaveGameIniValueFrom3StateCheckbox(const char* section, con
bool checkbox_val = (checkbox->Get3StateValue() == wxCHK_CHECKED); bool checkbox_val = (checkbox->Get3StateValue() == wxCHK_CHECKED);
if (checkbox->Get3StateValue() == wxCHK_UNDETERMINED) if (checkbox->Get3StateValue() == wxCHK_UNDETERMINED)
GameIniLocal.DeleteKey(section, key); m_gameini_local.DeleteKey(section, key);
else if (!GameIniDefault.Exists(section, key)) else if (!m_gameini_default.Exists(section, key))
GameIniLocal.GetOrCreateSection(section)->Set(key, checkbox_val); m_gameini_local.GetOrCreateSection(section)->Set(key, checkbox_val);
else else
{ {
bool default_value; bool default_value;
GameIniDefault.GetOrCreateSection(section)->Get(key, &default_value); m_gameini_default.GetOrCreateSection(section)->Get(key, &default_value);
if (default_value != checkbox_val) if (default_value != checkbox_val)
GameIniLocal.GetOrCreateSection(section)->Set(key, checkbox_val); m_gameini_local.GetOrCreateSection(section)->Set(key, checkbox_val);
else else
GameIniLocal.DeleteKey(section, key); m_gameini_local.DeleteKey(section, key);
} }
} }
bool CISOProperties::SaveGameConfig() bool CISOProperties::SaveGameConfig()
{ {
SaveGameIniValueFrom3StateCheckbox("Core", "CPUThread", CPUThread); SaveGameIniValueFrom3StateCheckbox("Core", "CPUThread", m_cpu_thread);
SaveGameIniValueFrom3StateCheckbox("Core", "MMU", MMU); SaveGameIniValueFrom3StateCheckbox("Core", "MMU", m_mmu);
SaveGameIniValueFrom3StateCheckbox("Core", "DCBZ", DCBZOFF); SaveGameIniValueFrom3StateCheckbox("Core", "DCBZ", m_dcbz_off);
SaveGameIniValueFrom3StateCheckbox("Core", "FPRF", FPRF); SaveGameIniValueFrom3StateCheckbox("Core", "FPRF", m_fprf);
SaveGameIniValueFrom3StateCheckbox("Core", "SyncGPU", SyncGPU); SaveGameIniValueFrom3StateCheckbox("Core", "SyncGPU", m_sync_gpu);
SaveGameIniValueFrom3StateCheckbox("Core", "FastDiscSpeed", FastDiscSpeed); SaveGameIniValueFrom3StateCheckbox("Core", "FastDiscSpeed", m_fast_disc_speed);
SaveGameIniValueFrom3StateCheckbox("Core", "DSPHLE", DSPHLE); SaveGameIniValueFrom3StateCheckbox("Core", "DSPHLE", m_dps_hle);
SaveGameIniValueFrom3StateCheckbox("Wii", "Widescreen", EnableWideScreen); SaveGameIniValueFrom3StateCheckbox("Wii", "Widescreen", m_enable_widescreen);
SaveGameIniValueFrom3StateCheckbox("Video_Stereoscopy", "StereoEFBMonoDepth", MonoDepth); SaveGameIniValueFrom3StateCheckbox("Video_Stereoscopy", "StereoEFBMonoDepth", m_mono_depth);
#define SAVE_IF_NOT_DEFAULT(section, key, val, def) \ #define SAVE_IF_NOT_DEFAULT(section, key, val, def) \
do \ do \
{ \ { \
if (GameIniDefault.Exists((section), (key))) \ if (m_gameini_default.Exists((section), (key))) \
{ \ { \
std::remove_reference<decltype((val))>::type tmp__; \ std::remove_reference<decltype((val))>::type tmp__; \
GameIniDefault.GetOrCreateSection((section))->Get((key), &tmp__); \ m_gameini_default.GetOrCreateSection((section))->Get((key), &tmp__); \
if ((val) != tmp__) \ if ((val) != tmp__) \
GameIniLocal.GetOrCreateSection((section))->Set((key), (val)); \ m_gameini_local.GetOrCreateSection((section))->Set((key), (val)); \
else \ else \
GameIniLocal.DeleteKey((section), (key)); \ m_gameini_local.DeleteKey((section), (key)); \
} \ } \
else if ((val) != (def)) \ else if ((val) != (def)) \
GameIniLocal.GetOrCreateSection((section))->Set((key), (val)); \ m_gameini_local.GetOrCreateSection((section))->Set((key), (val)); \
else \ else \
GameIniLocal.DeleteKey((section), (key)); \ m_gameini_local.DeleteKey((section), (key)); \
} while (0) } while (0)
SAVE_IF_NOT_DEFAULT("Video", "PH_SZNear", (m_PHack_Data.PHackSZNear ? 1 : 0), 0); SAVE_IF_NOT_DEFAULT("Video", "PH_SZNear", (m_phack_data.PHackSZNear ? 1 : 0), 0);
SAVE_IF_NOT_DEFAULT("Video", "PH_SZFar", (m_PHack_Data.PHackSZFar ? 1 : 0), 0); SAVE_IF_NOT_DEFAULT("Video", "PH_SZFar", (m_phack_data.PHackSZFar ? 1 : 0), 0);
SAVE_IF_NOT_DEFAULT("Video", "PH_ZNear", m_PHack_Data.PHZNear, ""); SAVE_IF_NOT_DEFAULT("Video", "PH_ZNear", m_phack_data.PHZNear, "");
SAVE_IF_NOT_DEFAULT("Video", "PH_ZFar", m_PHack_Data.PHZFar, ""); SAVE_IF_NOT_DEFAULT("Video", "PH_ZFar", m_phack_data.PHZFar, "");
SAVE_IF_NOT_DEFAULT("EmuState", "EmulationStateId", EmuState->GetSelection(), 0); SAVE_IF_NOT_DEFAULT("EmuState", "EmulationStateId", m_emustate_choice->GetSelection(), 0);
std::string emu_issues = EmuIssues->GetValue().ToStdString(); std::string emu_issues = m_emu_issues->GetValue().ToStdString();
SAVE_IF_NOT_DEFAULT("EmuState", "EmulationIssues", emu_issues, ""); SAVE_IF_NOT_DEFAULT("EmuState", "EmulationIssues", emu_issues, "");
std::string tmp; std::string tmp;
if (GPUDeterminism->GetSelection() == 0) if (m_gpu_determinism->GetSelection() == 0)
tmp = "Not Set"; tmp = "Not Set";
else if (GPUDeterminism->GetSelection() == 1) else if (m_gpu_determinism->GetSelection() == 1)
tmp = "auto"; tmp = "auto";
else if (GPUDeterminism->GetSelection() == 2) else if (m_gpu_determinism->GetSelection() == 2)
tmp = "none"; tmp = "none";
else if (GPUDeterminism->GetSelection() == 3) else if (m_gpu_determinism->GetSelection() == 3)
tmp = "fake-completion"; tmp = "fake-completion";
SAVE_IF_NOT_DEFAULT("Core", "GPUDeterminismMode", tmp, "Not Set"); SAVE_IF_NOT_DEFAULT("Core", "GPUDeterminismMode", tmp, "Not Set");
int depth = DepthPercentage->GetValue() > 0 ? DepthPercentage->GetValue() : 100; int depth = m_depth_percentage->GetValue() > 0 ? m_depth_percentage->GetValue() : 100;
SAVE_IF_NOT_DEFAULT("Video_Stereoscopy", "StereoDepthPercentage", depth, 100); SAVE_IF_NOT_DEFAULT("Video_Stereoscopy", "StereoDepthPercentage", depth, 100);
SAVE_IF_NOT_DEFAULT("Video_Stereoscopy", "StereoConvergence", Convergence->GetValue(), 0); SAVE_IF_NOT_DEFAULT("Video_Stereoscopy", "StereoConvergence", m_convergence->GetValue(), 0);
PatchList_Save(); PatchList_Save();
m_ar_code_panel->SaveCodes(&GameIniLocal); m_ar_code_panel->SaveCodes(&m_gameini_local);
Gecko::SaveCodes(GameIniLocal, m_geckocode_panel->GetCodes()); Gecko::SaveCodes(m_gameini_local, m_geckocode_panel->GetCodes());
bool success = GameIniLocal.Save(GameIniFileLocal); bool success = m_gameini_local.Save(m_gameini_file_local);
// If the resulting file is empty, delete it. Kind of a hack, but meh. // If the resulting file is empty, delete it. Kind of a hack, but meh.
if (success && File::GetSize(GameIniFileLocal) == 0) if (success && File::GetSize(m_gameini_file_local) == 0)
File::Delete(GameIniFileLocal); File::Delete(m_gameini_file_local);
if (success) if (success)
GenerateLocalIniModified(); GenerateLocalIniModified();
@ -673,18 +677,18 @@ void CISOProperties::LaunchExternalEditor(const std::string& filename, bool wait
const char* OpenCommandConst[] = {"open", "-a", "TextEdit", filename.c_str(), NULL}; const char* OpenCommandConst[] = {"open", "-a", "TextEdit", filename.c_str(), NULL};
char** OpenCommand = const_cast<char**>(OpenCommandConst); char** OpenCommand = const_cast<char**>(OpenCommandConst);
#else #else
wxFileType* filetype = wxTheMimeTypesManager->GetFileTypeFromExtension("ini"); wxFileType* file_type = wxTheMimeTypesManager->GetFileTypeFromExtension("ini");
if (filetype == nullptr) // From extension failed, trying with MIME type now if (file_type == nullptr) // From extension failed, trying with MIME type now
{ {
filetype = wxTheMimeTypesManager->GetFileTypeFromMimeType("text/plain"); file_type = wxTheMimeTypesManager->GetFileTypeFromMimeType("text/plain");
if (filetype == nullptr) // MIME type failed, aborting mission if (file_type == nullptr) // MIME type failed, aborting mission
{ {
WxUtils::ShowErrorDialog(_("Filetype 'ini' is unknown! Will not open!")); WxUtils::ShowErrorDialog(_("Filetype 'ini' is unknown! Will not open!"));
return; return;
} }
} }
wxString OpenCommand = filetype->GetOpenCommand(StrToWxStr(filename)); wxString OpenCommand = file_type->GetOpenCommand(StrToWxStr(filename));
if (OpenCommand.IsEmpty()) if (OpenCommand.IsEmpty())
{ {
WxUtils::ShowErrorDialog(_("Couldn't find open command for extension 'ini'!")); WxUtils::ShowErrorDialog(_("Couldn't find open command for extension 'ini'!"));
@ -709,18 +713,18 @@ void CISOProperties::LaunchExternalEditor(const std::string& filename, bool wait
void CISOProperties::GenerateLocalIniModified() void CISOProperties::GenerateLocalIniModified()
{ {
wxCommandEvent event_update(DOLPHIN_EVT_LOCAL_INI_CHANGED); wxCommandEvent event_update(DOLPHIN_EVT_LOCAL_INI_CHANGED);
event_update.SetString(StrToWxStr(game_id)); event_update.SetString(StrToWxStr(m_game_id));
event_update.SetInt(OpenGameListItem.GetRevision()); event_update.SetInt(m_open_gamelist_item.GetRevision());
wxTheApp->ProcessEvent(event_update); wxTheApp->ProcessEvent(event_update);
} }
void CISOProperties::OnLocalIniModified(wxCommandEvent& ev) void CISOProperties::OnLocalIniModified(wxCommandEvent& ev)
{ {
ev.Skip(); ev.Skip();
if (WxStrToStr(ev.GetString()) != game_id) if (WxStrToStr(ev.GetString()) != m_game_id)
return; return;
GameIniLocal.Load(GameIniFileLocal); m_gameini_local.Load(m_gameini_file_local);
LoadGameConfig(); LoadGameConfig();
} }
@ -728,12 +732,12 @@ void CISOProperties::OnEditConfig(wxCommandEvent& WXUNUSED(event))
{ {
SaveGameConfig(); SaveGameConfig();
// Create blank file to prevent editor from prompting to create it. // Create blank file to prevent editor from prompting to create it.
if (!File::Exists(GameIniFileLocal)) if (!File::Exists(m_gameini_file_local))
{ {
std::fstream blankFile(GameIniFileLocal, std::ios::out); std::fstream blank_file(m_gameini_file_local, std::ios::out);
blankFile.close(); blank_file.close();
} }
LaunchExternalEditor(GameIniFileLocal, true); LaunchExternalEditor(m_gameini_file_local, true);
GenerateLocalIniModified(); GenerateLocalIniModified();
} }
@ -753,7 +757,7 @@ void CISOProperties::OnChangeTitle(wxCommandEvent& event)
void CISOProperties::OnShowDefaultConfig(wxCommandEvent& WXUNUSED(event)) void CISOProperties::OnShowDefaultConfig(wxCommandEvent& WXUNUSED(event))
{ {
for (const std::string& filename : for (const std::string& filename :
ConfigLoaders::GetGameIniFilenames(game_id, m_open_iso->GetRevision())) ConfigLoaders::GetGameIniFilenames(m_game_id, m_open_iso->GetRevision()))
{ {
std::string path = File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + filename; std::string path = File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + filename;
if (File::Exists(path)) if (File::Exists(path))
@ -763,34 +767,34 @@ void CISOProperties::OnShowDefaultConfig(wxCommandEvent& WXUNUSED(event))
void CISOProperties::PatchListSelectionChanged(wxCommandEvent& event) void CISOProperties::PatchListSelectionChanged(wxCommandEvent& event)
{ {
if (Patches->GetSelection() == wxNOT_FOUND || if (m_patches->GetSelection() == wxNOT_FOUND ||
DefaultPatches.find(Patches->GetString(Patches->GetSelection()).ToStdString()) != m_default_patches.find(m_patches->GetString(m_patches->GetSelection()).ToStdString()) !=
DefaultPatches.end()) m_default_patches.end())
{ {
EditPatch->Disable(); m_edit_patch->Disable();
RemovePatch->Disable(); m_remove_patch->Disable();
} }
else else
{ {
EditPatch->Enable(); m_edit_patch->Enable();
RemovePatch->Enable(); m_remove_patch->Enable();
} }
} }
void CISOProperties::PatchList_Load() void CISOProperties::PatchList_Load()
{ {
onFrame.clear(); m_on_frame.clear();
Patches->Clear(); m_patches->Clear();
PatchEngine::LoadPatchSection("OnFrame", onFrame, GameIniDefault, GameIniLocal); PatchEngine::LoadPatchSection("OnFrame", m_on_frame, m_gameini_default, m_gameini_local);
u32 index = 0; u32 index = 0;
for (PatchEngine::Patch& p : onFrame) for (PatchEngine::Patch& p : m_on_frame)
{ {
Patches->Append(StrToWxStr(p.name)); m_patches->Append(StrToWxStr(p.name));
Patches->Check(index, p.active); m_patches->Check(index, p.active);
if (!p.user_defined) if (!p.user_defined)
DefaultPatches.insert(p.name); m_default_patches.insert(p.name);
++index; ++index;
} }
} }
@ -798,15 +802,15 @@ void CISOProperties::PatchList_Load()
void CISOProperties::PatchList_Save() void CISOProperties::PatchList_Save()
{ {
std::vector<std::string> lines; std::vector<std::string> lines;
std::vector<std::string> enabledLines; std::vector<std::string> enabled_lines;
u32 index = 0; u32 index = 0;
for (PatchEngine::Patch& p : onFrame) for (PatchEngine::Patch& p : m_on_frame)
{ {
if (Patches->IsChecked(index)) if (m_patches->IsChecked(index))
enabledLines.push_back("$" + p.name); enabled_lines.push_back("$" + p.name);
// Do not save default patches. // Do not save default patches.
if (DefaultPatches.find(p.name) == DefaultPatches.end()) if (m_default_patches.find(p.name) == m_default_patches.end())
{ {
lines.push_back("$" + p.name); lines.push_back("$" + p.name);
for (const PatchEngine::PatchEntry& entry : p.entries) for (const PatchEngine::PatchEntry& entry : p.entries)
@ -818,45 +822,45 @@ void CISOProperties::PatchList_Save()
} }
++index; ++index;
} }
GameIniLocal.SetLines("OnFrame_Enabled", enabledLines); m_gameini_local.SetLines("OnFrame_Enabled", enabled_lines);
GameIniLocal.SetLines("OnFrame", lines); m_gameini_local.SetLines("OnFrame", lines);
} }
void CISOProperties::PatchButtonClicked(wxCommandEvent& event) void CISOProperties::PatchButtonClicked(wxCommandEvent& event)
{ {
int selection = Patches->GetSelection(); int selection = m_patches->GetSelection();
switch (event.GetId()) switch (event.GetId())
{ {
case ID_EDITPATCH: case ID_EDITPATCH:
{ {
CPatchAddEdit dlg(selection, &onFrame, this); CPatchAddEdit dlg(selection, &m_on_frame, this);
dlg.ShowModal(); dlg.ShowModal();
Raise(); Raise();
} }
break; break;
case ID_ADDPATCH: case ID_ADDPATCH:
{ {
CPatchAddEdit dlg(-1, &onFrame, this, 1, _("Add Patch")); CPatchAddEdit dlg(-1, &m_on_frame, this, 1, _("Add Patch"));
int res = dlg.ShowModal(); int res = dlg.ShowModal();
Raise(); Raise();
if (res == wxID_OK) if (res == wxID_OK)
{ {
Patches->Append(StrToWxStr(onFrame.back().name)); m_patches->Append(StrToWxStr(m_on_frame.back().name));
Patches->Check((unsigned int)(onFrame.size() - 1), onFrame.back().active); m_patches->Check((unsigned int)(m_on_frame.size() - 1), m_on_frame.back().active);
} }
} }
break; break;
case ID_REMOVEPATCH: case ID_REMOVEPATCH:
onFrame.erase(onFrame.begin() + Patches->GetSelection()); m_on_frame.erase(m_on_frame.begin() + m_patches->GetSelection());
Patches->Delete(Patches->GetSelection()); m_patches->Delete(m_patches->GetSelection());
break; break;
} }
PatchList_Save(); PatchList_Save();
Patches->Clear(); m_patches->Clear();
PatchList_Load(); PatchList_Load();
EditPatch->Disable(); m_edit_patch->Disable();
RemovePatch->Disable(); m_remove_patch->Disable();
} }

View file

@ -63,30 +63,30 @@ private:
std::unique_ptr<DiscIO::Volume> m_open_iso; std::unique_ptr<DiscIO::Volume> m_open_iso;
std::vector<PatchEngine::Patch> onFrame; std::vector<PatchEngine::Patch> m_on_frame;
PHackData m_PHack_Data; PHackData m_phack_data;
// Core // Core
wxCheckBox *CPUThread, *MMU, *DCBZOFF, *FPRF; wxCheckBox *m_cpu_thread, *m_mmu, *m_dcbz_off, *m_fprf;
wxCheckBox *SyncGPU, *FastDiscSpeed, *DSPHLE; wxCheckBox *m_sync_gpu, *m_fast_disc_speed, *m_dps_hle;
wxArrayString arrayStringFor_GPUDeterminism; wxArrayString m_gpu_determinism_string;
wxChoice* GPUDeterminism; wxChoice* m_gpu_determinism;
// Wii // Wii
wxCheckBox* EnableWideScreen; wxCheckBox* m_enable_widescreen;
// Stereoscopy // Stereoscopy
DolphinSlider* DepthPercentage; DolphinSlider* m_depth_percentage;
wxSpinCtrl* Convergence; wxSpinCtrl* m_convergence;
wxCheckBox* MonoDepth; wxCheckBox* m_mono_depth;
wxArrayString arrayStringFor_EmuState; wxArrayString m_emustate_string;
wxChoice* EmuState; wxChoice* m_emustate_choice;
wxTextCtrl* EmuIssues; wxTextCtrl* m_emu_issues;
wxCheckListBox* Patches; wxCheckListBox* m_patches;
wxButton* EditPatch; wxButton* m_edit_patch;
wxButton* RemovePatch; wxButton* m_remove_patch;
ActionReplayCodesPanel* m_ar_code_panel; ActionReplayCodesPanel* m_ar_code_panel;
Gecko::CodeConfigPanel* m_geckocode_panel; Gecko::CodeConfigPanel* m_geckocode_panel;
@ -141,14 +141,14 @@ private:
void OnCheatCodeToggled(wxCommandEvent& event); void OnCheatCodeToggled(wxCommandEvent& event);
void OnChangeTitle(wxCommandEvent& event); void OnChangeTitle(wxCommandEvent& event);
const GameListItem OpenGameListItem; const GameListItem m_open_gamelist_item;
IniFile GameIniDefault; IniFile m_gameini_default;
IniFile GameIniLocal; IniFile m_gameini_local;
std::string GameIniFileLocal; std::string m_gameini_file_local;
std::string game_id; std::string m_game_id;
std::set<std::string> DefaultPatches; std::set<std::string> m_default_patches;
void LoadGameConfig(); void LoadGameConfig();
bool SaveGameConfig(); bool SaveGameConfig();