2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-17 23:08:10 +00:00
|
|
|
// Licensed under GPLv2+
|
2013-04-18 03:43:35 +00:00
|
|
|
// Refer to the license.txt file included.
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2016-11-13 01:51:08 +00:00
|
|
|
#include "DolphinWX/ISOProperties/ISOProperties.h"
|
2016-11-06 00:53:40 +00:00
|
|
|
|
2017-06-29 09:20:38 +00:00
|
|
|
#include <algorithm>
|
2013-10-26 09:55:41 +00:00
|
|
|
#include <cinttypes>
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <cstddef>
|
|
|
|
#include <cstdio>
|
|
|
|
#include <cstring>
|
|
|
|
#include <fstream>
|
|
|
|
#include <string>
|
2014-02-17 10:18:15 +00:00
|
|
|
#include <type_traits>
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <vector>
|
2016-04-22 10:42:16 +00:00
|
|
|
#include <wx/app.h>
|
2016-07-23 01:05:22 +00:00
|
|
|
#include <wx/artprov.h>
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <wx/bitmap.h>
|
|
|
|
#include <wx/button.h>
|
|
|
|
#include <wx/checkbox.h>
|
|
|
|
#include <wx/checklst.h>
|
|
|
|
#include <wx/choice.h>
|
|
|
|
#include <wx/dialog.h>
|
|
|
|
#include <wx/filedlg.h>
|
|
|
|
#include <wx/image.h>
|
|
|
|
#include <wx/menu.h>
|
|
|
|
#include <wx/mimetype.h>
|
|
|
|
#include <wx/notebook.h>
|
|
|
|
#include <wx/panel.h>
|
|
|
|
#include <wx/sizer.h>
|
2015-01-02 17:49:10 +00:00
|
|
|
#include <wx/spinctrl.h>
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <wx/statbmp.h>
|
|
|
|
#include <wx/stattext.h>
|
|
|
|
#include <wx/textctrl.h>
|
|
|
|
#include <wx/thread.h>
|
|
|
|
#include <wx/utils.h>
|
2013-09-07 21:02:49 +00:00
|
|
|
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "Common/CommonPaths.h"
|
2014-09-08 01:06:58 +00:00
|
|
|
#include "Common/CommonTypes.h"
|
2014-02-22 22:36:30 +00:00
|
|
|
#include "Common/FileUtil.h"
|
|
|
|
#include "Common/IniFile.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "Common/StringUtil.h"
|
2017-07-11 11:10:11 +00:00
|
|
|
#include "Core/ConfigLoaders/GameConfigLoader.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "Core/ConfigManager.h"
|
2016-07-23 01:05:22 +00:00
|
|
|
#include "Core/Core.h"
|
2014-02-22 22:36:30 +00:00
|
|
|
#include "Core/GeckoCodeConfig.h"
|
|
|
|
#include "Core/PatchEngine.h"
|
2015-09-16 19:06:54 +00:00
|
|
|
#include "DiscIO/Blob.h"
|
2016-07-06 18:33:05 +00:00
|
|
|
#include "DiscIO/Enums.h"
|
2014-02-22 22:36:30 +00:00
|
|
|
#include "DiscIO/Volume.h"
|
2016-07-23 01:05:04 +00:00
|
|
|
#include "DolphinWX/Cheats/ActionReplayCodesPanel.h"
|
2016-06-24 08:43:46 +00:00
|
|
|
#include "DolphinWX/Cheats/GeckoCodeDiag.h"
|
2016-11-06 00:53:40 +00:00
|
|
|
#include "DolphinWX/Config/ConfigMain.h"
|
2016-08-03 11:14:52 +00:00
|
|
|
#include "DolphinWX/DolphinSlider.h"
|
2016-07-23 01:05:22 +00:00
|
|
|
#include "DolphinWX/Frame.h"
|
2016-04-22 10:42:16 +00:00
|
|
|
#include "DolphinWX/Globals.h"
|
2016-12-04 07:04:35 +00:00
|
|
|
#include "DolphinWX/ISOProperties/FilesystemPanel.h"
|
2016-11-13 01:51:08 +00:00
|
|
|
#include "DolphinWX/ISOProperties/InfoPanel.h"
|
2016-07-23 01:05:22 +00:00
|
|
|
#include "DolphinWX/Main.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "DolphinWX/PatchAddEdit.h"
|
|
|
|
#include "DolphinWX/WxUtils.h"
|
2017-12-31 19:33:36 +00:00
|
|
|
#include "UICommon/GameFile.h"
|
2009-09-13 22:03:18 +00:00
|
|
|
|
2016-07-23 01:05:22 +00:00
|
|
|
// A warning message displayed on the ARCodes and GeckoCodes pages when cheats are
|
|
|
|
// disabled globally to explain why turning cheats on does not work.
|
|
|
|
// Also displays a different warning when the game is currently running to explain
|
|
|
|
// that toggling codes has no effect while the game is already running.
|
|
|
|
class CheatWarningMessage final : public wxPanel
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CheatWarningMessage(wxWindow* parent, std::string game_id)
|
|
|
|
: wxPanel(parent), m_game_id(std::move(game_id))
|
|
|
|
{
|
|
|
|
SetExtraStyle(GetExtraStyle() | wxWS_EX_BLOCK_EVENTS);
|
|
|
|
CreateGUI();
|
|
|
|
wxTheApp->Bind(wxEVT_IDLE, &CheatWarningMessage::OnAppIdle, this);
|
|
|
|
Hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
void UpdateState()
|
|
|
|
{
|
|
|
|
// If cheats are disabled then show the notification about that.
|
|
|
|
// If cheats are enabled and the game is currently running then display that warning.
|
|
|
|
State new_state = State::Hidden;
|
|
|
|
if (!SConfig::GetInstance().bEnableCheats)
|
|
|
|
new_state = State::DisabledCheats;
|
2016-10-29 12:42:43 +00:00
|
|
|
else if (Core::IsRunning() && SConfig::GetInstance().GetGameID() == m_game_id)
|
2016-07-23 01:05:22 +00:00
|
|
|
new_state = State::GameRunning;
|
|
|
|
ApplyState(new_state);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
enum class State
|
|
|
|
{
|
|
|
|
Inactive,
|
|
|
|
Hidden,
|
|
|
|
DisabledCheats,
|
|
|
|
GameRunning
|
|
|
|
};
|
|
|
|
|
|
|
|
void CreateGUI()
|
|
|
|
{
|
2016-08-03 11:14:52 +00:00
|
|
|
int space10 = FromDIP(10);
|
|
|
|
int space15 = FromDIP(15);
|
|
|
|
|
2016-07-23 01:05:22 +00:00
|
|
|
wxStaticBitmap* icon =
|
|
|
|
new wxStaticBitmap(this, wxID_ANY, wxArtProvider::GetMessageBoxIcon(wxICON_WARNING));
|
|
|
|
m_message = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
|
|
|
|
wxST_NO_AUTORESIZE);
|
|
|
|
m_btn_configure = new wxButton(this, wxID_ANY, _("Configure Dolphin"));
|
|
|
|
|
|
|
|
m_btn_configure->Bind(wxEVT_BUTTON, &CheatWarningMessage::OnConfigureClicked, this);
|
|
|
|
|
|
|
|
wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
|
2016-08-03 11:14:52 +00:00
|
|
|
sizer->Add(icon, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, space15);
|
|
|
|
sizer->Add(m_message, 1, wxALIGN_CENTER_VERTICAL | wxLEFT, space15);
|
|
|
|
sizer->Add(m_btn_configure, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, space10);
|
|
|
|
sizer->AddSpacer(space10);
|
2016-07-23 01:05:22 +00:00
|
|
|
|
|
|
|
SetSizer(sizer);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnConfigureClicked(wxCommandEvent&)
|
|
|
|
{
|
2016-11-06 00:53:40 +00:00
|
|
|
main_frame->OpenGeneralConfiguration(CConfigMain::ID_GENERALPAGE);
|
2016-07-23 01:05:22 +00:00
|
|
|
UpdateState();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnAppIdle(wxIdleEvent& ev)
|
|
|
|
{
|
|
|
|
ev.Skip();
|
|
|
|
// Only respond to setting changes if we've been triggered once already.
|
|
|
|
if (m_state != State::Inactive)
|
|
|
|
UpdateState();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ApplyState(State new_state)
|
|
|
|
{
|
|
|
|
// The purpose of this function is to prevent unnecessary UI updates which cause flickering.
|
|
|
|
if (new_state == m_state || (m_state == State::Inactive && new_state == State::Hidden))
|
|
|
|
return;
|
|
|
|
|
|
|
|
bool visible = true;
|
|
|
|
switch (new_state)
|
|
|
|
{
|
|
|
|
case State::Inactive:
|
|
|
|
case State::Hidden:
|
|
|
|
visible = false;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case State::DisabledCheats:
|
|
|
|
m_btn_configure->Show();
|
|
|
|
m_message->SetLabelText(_("Dolphin's cheat system is currently disabled."));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case State::GameRunning:
|
|
|
|
m_btn_configure->Hide();
|
|
|
|
m_message->SetLabelText(
|
|
|
|
_("Changing cheats will only take effect when the game is restarted."));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
m_state = new_state;
|
|
|
|
Show(visible);
|
|
|
|
GetParent()->Layout();
|
|
|
|
if (visible)
|
|
|
|
{
|
|
|
|
m_message->Wrap(m_message->GetSize().GetWidth());
|
|
|
|
m_message->InvalidateBestSize();
|
|
|
|
GetParent()->Layout();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string m_game_id;
|
|
|
|
wxStaticText* m_message = nullptr;
|
|
|
|
wxButton* m_btn_configure = nullptr;
|
|
|
|
State m_state = State::Inactive;
|
|
|
|
};
|
|
|
|
|
2016-11-13 01:51:08 +00:00
|
|
|
wxDEFINE_EVENT(DOLPHIN_EVT_CHANGE_ISO_PROPERTIES_TITLE, wxCommandEvent);
|
|
|
|
|
2008-12-08 05:30:24 +00:00
|
|
|
BEGIN_EVENT_TABLE(CISOProperties, wxDialog)
|
2016-06-24 08:43:46 +00:00
|
|
|
EVT_CLOSE(CISOProperties::OnClose)
|
|
|
|
EVT_BUTTON(wxID_OK, CISOProperties::OnCloseClick)
|
|
|
|
EVT_BUTTON(ID_EDITCONFIG, CISOProperties::OnEditConfig)
|
|
|
|
EVT_BUTTON(ID_SHOWDEFAULTCONFIG, CISOProperties::OnShowDefaultConfig)
|
2016-07-23 01:05:04 +00:00
|
|
|
EVT_LISTBOX(ID_PATCHES_LIST, CISOProperties::PatchListSelectionChanged)
|
2016-06-24 08:43:46 +00:00
|
|
|
EVT_BUTTON(ID_EDITPATCH, CISOProperties::PatchButtonClicked)
|
|
|
|
EVT_BUTTON(ID_ADDPATCH, CISOProperties::PatchButtonClicked)
|
|
|
|
EVT_BUTTON(ID_REMOVEPATCH, CISOProperties::PatchButtonClicked)
|
2008-12-08 05:30:24 +00:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
2017-12-31 19:33:36 +00:00
|
|
|
CISOProperties::CISOProperties(const UICommon::GameFile& game_list_item, wxWindow* parent,
|
|
|
|
wxWindowID id, const wxString& title, const wxPoint& position,
|
|
|
|
const wxSize& size, long style)
|
2017-09-20 22:37:25 +00:00
|
|
|
: wxDialog(parent, id, title, position, size, style), m_open_gamelist_item(game_list_item)
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2016-11-13 01:51:08 +00:00
|
|
|
Bind(DOLPHIN_EVT_CHANGE_ISO_PROPERTIES_TITLE, &CISOProperties::OnChangeTitle, this);
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
// Load ISO data
|
2017-12-31 19:33:36 +00:00
|
|
|
m_open_iso = DiscIO::CreateVolumeFromFilename(m_open_gamelist_item.GetFilePath());
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-09-20 22:37:25 +00:00
|
|
|
m_game_id = m_open_iso->GetGameID();
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
// Load game INIs
|
2017-09-20 22:37:25 +00:00
|
|
|
m_gameini_file_local = File::GetUserPath(D_GAMESETTINGS_IDX) + m_game_id + ".ini";
|
|
|
|
m_gameini_default = SConfig::LoadDefaultGameIni(m_game_id, m_open_iso->GetRevision());
|
|
|
|
m_gameini_local = SConfig::LoadLocalGameIni(m_game_id, m_open_iso->GetRevision());
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
// Setup GUI
|
|
|
|
CreateGUIControls();
|
|
|
|
LoadGameConfig();
|
|
|
|
|
|
|
|
wxTheApp->Bind(DOLPHIN_EVT_LOCAL_INI_CHANGED, &CISOProperties::OnLocalIniModified, this);
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CISOProperties::~CISOProperties()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-09-07 21:02:49 +00:00
|
|
|
long CISOProperties::GetElementStyle(const char* section, const char* key)
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
// Disable 3rd state if default gameini overrides the setting
|
2017-09-20 22:37:25 +00:00
|
|
|
if (m_gameini_default.Exists(section, key))
|
2016-06-24 08:43:46 +00:00
|
|
|
return 0;
|
2013-09-07 21:02:49 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
return wxCHK_3STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER;
|
2013-09-07 21:02:49 +00:00
|
|
|
}
|
|
|
|
|
2015-04-09 15:44:53 +00:00
|
|
|
void CISOProperties::CreateGUIControls()
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2016-08-03 11:14:52 +00:00
|
|
|
const int space5 = FromDIP(5);
|
|
|
|
|
2018-01-11 13:31:01 +00:00
|
|
|
wxButton* const edit_config = new wxButton(this, ID_EDITCONFIG, _("Edit User Config"));
|
|
|
|
edit_config->SetToolTip(
|
|
|
|
_("Allows manual editing of the user configuration INI file for this "
|
|
|
|
"game. Settings in the user config INI override default config INI settings."));
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-09-20 22:37:25 +00:00
|
|
|
wxButton* const edit_default_config =
|
2018-01-11 13:31:01 +00:00
|
|
|
new wxButton(this, ID_SHOWDEFAULTCONFIG, _("View Default Config"));
|
2017-09-20 22:37:25 +00:00
|
|
|
edit_default_config->SetToolTip(
|
2018-01-11 13:31:01 +00:00
|
|
|
_("Displays the default configuration INI file(s) for this game. These defaults are "
|
|
|
|
"recommended settings from the developers to avoid known issues. Changes should be made to "
|
|
|
|
"the user config INI files only, not to default config INI files."));
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
// Notebook
|
2017-09-20 22:37:25 +00:00
|
|
|
wxNotebook* const notebook = new wxNotebook(this, ID_NOTEBOOK);
|
|
|
|
wxPanel* const m_GameConfig = new wxPanel(notebook, ID_GAMECONFIG);
|
|
|
|
notebook->AddPage(m_GameConfig, _("GameConfig"));
|
|
|
|
wxPanel* const m_PatchPage = new wxPanel(notebook, ID_PATCH_PAGE);
|
|
|
|
notebook->AddPage(m_PatchPage, _("Patches"));
|
|
|
|
wxPanel* const m_CheatPage = new wxPanel(notebook, ID_ARCODE_PAGE);
|
|
|
|
notebook->AddPage(m_CheatPage, _("AR Codes"));
|
|
|
|
wxPanel* const gecko_cheat_page = new wxPanel(notebook);
|
|
|
|
notebook->AddPage(gecko_cheat_page, _("Gecko Codes"));
|
|
|
|
notebook->AddPage(new InfoPanel(notebook, ID_INFORMATION, m_open_gamelist_item, m_open_iso),
|
|
|
|
_("Info"));
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
// GameConfig editing - Overrides and emulation state
|
2018-04-12 12:18:04 +00:00
|
|
|
wxStaticText* const OverrideText =
|
|
|
|
new wxStaticText(m_GameConfig, wxID_ANY,
|
|
|
|
_("These settings override core Dolphin settings.\nUndetermined "
|
|
|
|
"means the game uses Dolphin's setting."));
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
// Core
|
2017-09-20 22:37:25 +00:00
|
|
|
m_cpu_thread =
|
|
|
|
new wxCheckBox(m_GameConfig, ID_USEDUALCORE, _("Enable Dual Core"), wxDefaultPosition,
|
|
|
|
wxDefaultSize, GetElementStyle("Core", "CPUThread"));
|
|
|
|
m_mmu = new wxCheckBox(m_GameConfig, ID_MMU, _("Enable MMU"), wxDefaultPosition, wxDefaultSize,
|
|
|
|
GetElementStyle("Core", "MMU"));
|
|
|
|
m_mmu->SetToolTip(_(
|
2016-06-24 08:43:46 +00:00
|
|
|
"Enables the Memory Management Unit, needed for some games. (ON = Compatible, OFF = Fast)"));
|
2017-09-20 22:37:25 +00:00
|
|
|
m_dcbz_off = new wxCheckBox(m_GameConfig, ID_DCBZOFF, _("Skip DCBZ clearing"), wxDefaultPosition,
|
|
|
|
wxDefaultSize, GetElementStyle("Core", "DCBZ"));
|
|
|
|
m_dcbz_off->SetToolTip(_("Bypass the clearing of the data cache by the DCBZ instruction. Usually "
|
|
|
|
"leave this option disabled."));
|
|
|
|
m_fprf = new wxCheckBox(m_GameConfig, ID_FPRF, _("Enable FPRF"), wxDefaultPosition, wxDefaultSize,
|
|
|
|
GetElementStyle("Core", "FPRF"));
|
|
|
|
m_fprf->SetToolTip(
|
|
|
|
_("Enables Floating Point Result Flag calculation, needed for a few games. (ON "
|
|
|
|
"= Compatible, OFF = Fast)"));
|
|
|
|
m_sync_gpu = new wxCheckBox(m_GameConfig, ID_SYNCGPU, _("Synchronize GPU thread"),
|
|
|
|
wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "SyncGPU"));
|
|
|
|
m_sync_gpu->SetToolTip(_("Synchronizes the GPU and CPU threads to help prevent random freezes in "
|
|
|
|
"Dual Core mode. (ON = Compatible, OFF = Fast)"));
|
|
|
|
m_fast_disc_speed =
|
2016-06-24 08:43:46 +00:00
|
|
|
new wxCheckBox(m_GameConfig, ID_DISCSPEED, _("Speed up Disc Transfer Rate"),
|
|
|
|
wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "FastDiscSpeed"));
|
2017-09-20 22:37:25 +00:00
|
|
|
m_fast_disc_speed->SetToolTip(
|
|
|
|
_("Enable fast disc access. This can cause crashes and other problems "
|
|
|
|
"in some games. (ON = Fast, OFF = Compatible)"));
|
2017-11-02 13:32:16 +00:00
|
|
|
m_dps_hle = new wxCheckBox(m_GameConfig, ID_AUDIO_DSP_HLE, _("DSP HLE Emulation (fast)"),
|
2017-09-20 22:37:25 +00:00
|
|
|
wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "DSPHLE"));
|
|
|
|
|
|
|
|
wxBoxSizer* const gpu_determinism_sizer = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
wxStaticText* const gpu_determinism_text =
|
2018-03-19 17:52:46 +00:00
|
|
|
new wxStaticText(m_GameConfig, wxID_ANY, _("Deterministic dual core:"));
|
2017-09-20 22:37:25 +00:00
|
|
|
m_gpu_determinism_string.Add(_("Not Set"));
|
|
|
|
m_gpu_determinism_string.Add(_("auto"));
|
|
|
|
m_gpu_determinism_string.Add(_("none"));
|
|
|
|
m_gpu_determinism_string.Add(_("fake-completion"));
|
|
|
|
m_gpu_determinism = new wxChoice(m_GameConfig, ID_GPUDETERMINISM, wxDefaultPosition,
|
|
|
|
wxDefaultSize, m_gpu_determinism_string);
|
|
|
|
gpu_determinism_sizer->Add(gpu_determinism_text, 0, wxALIGN_CENTER_VERTICAL);
|
|
|
|
gpu_determinism_sizer->Add(m_gpu_determinism, 0, wxALIGN_CENTER_VERTICAL);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
// Wii Console
|
2017-09-20 22:37:25 +00:00
|
|
|
m_enable_widescreen =
|
2016-06-24 08:43:46 +00:00
|
|
|
new wxCheckBox(m_GameConfig, ID_ENABLEWIDESCREEN, _("Enable WideScreen"), wxDefaultPosition,
|
|
|
|
wxDefaultSize, GetElementStyle("Wii", "Widescreen"));
|
|
|
|
|
|
|
|
// Stereoscopy
|
2017-09-20 22:37:25 +00:00
|
|
|
wxBoxSizer* const depth_percentage = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
wxStaticText* const depth_percentage_text =
|
2018-03-19 17:52:46 +00:00
|
|
|
new wxStaticText(m_GameConfig, wxID_ANY, _("Depth Percentage:"));
|
2017-09-20 22:37:25 +00:00
|
|
|
m_depth_percentage = new DolphinSlider(m_GameConfig, ID_DEPTHPERCENTAGE, 100, 0, 200);
|
|
|
|
m_depth_percentage->SetToolTip(
|
2016-06-24 08:43:46 +00:00
|
|
|
_("This value is multiplied with the depth set in the graphics configuration."));
|
2017-09-20 22:37:25 +00:00
|
|
|
depth_percentage->Add(depth_percentage_text);
|
|
|
|
depth_percentage->Add(m_depth_percentage);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-09-20 22:37:25 +00:00
|
|
|
wxBoxSizer* const convergence_sizer = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
wxStaticText* const convergence_text =
|
2018-03-19 17:52:46 +00:00
|
|
|
new wxStaticText(m_GameConfig, wxID_ANY, _("Convergence:"));
|
2017-09-20 22:37:25 +00:00
|
|
|
m_convergence = new wxSpinCtrl(m_GameConfig, ID_CONVERGENCE);
|
|
|
|
m_convergence->SetRange(0, INT32_MAX);
|
|
|
|
m_convergence->SetToolTip(
|
2016-06-24 08:43:46 +00:00
|
|
|
_("This value is added to the convergence value set in the graphics configuration."));
|
2017-09-20 22:37:25 +00:00
|
|
|
convergence_sizer->Add(convergence_text);
|
|
|
|
convergence_sizer->Add(m_convergence);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-09-20 22:37:25 +00:00
|
|
|
m_mono_depth =
|
2016-06-24 08:43:46 +00:00
|
|
|
new wxCheckBox(m_GameConfig, ID_MONODEPTH, _("Monoscopic Shadows"), wxDefaultPosition,
|
|
|
|
wxDefaultSize, GetElementStyle("Video_Stereoscopy", "StereoEFBMonoDepth"));
|
2017-09-20 22:37:25 +00:00
|
|
|
m_mono_depth->SetToolTip(_("Use a single depth buffer for both eyes. Needed for a few games."));
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-09-20 22:37:25 +00:00
|
|
|
wxStaticBoxSizer* const core_overrides_sizer =
|
2016-06-24 08:43:46 +00:00
|
|
|
new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Core"));
|
2017-09-20 22:37:25 +00:00
|
|
|
core_overrides_sizer->Add(m_cpu_thread, 0, wxLEFT | wxRIGHT, space5);
|
|
|
|
core_overrides_sizer->Add(m_mmu, 0, wxLEFT | wxRIGHT, space5);
|
|
|
|
core_overrides_sizer->Add(m_dcbz_off, 0, wxLEFT | wxRIGHT, space5);
|
|
|
|
core_overrides_sizer->Add(m_fprf, 0, wxLEFT | wxRIGHT, space5);
|
|
|
|
core_overrides_sizer->Add(m_sync_gpu, 0, wxLEFT | wxRIGHT, space5);
|
|
|
|
core_overrides_sizer->Add(m_fast_disc_speed, 0, wxLEFT | wxRIGHT, space5);
|
|
|
|
core_overrides_sizer->Add(m_dps_hle, 0, wxLEFT | wxRIGHT, space5);
|
|
|
|
core_overrides_sizer->AddSpacer(space5);
|
|
|
|
core_overrides_sizer->Add(gpu_determinism_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
|
|
|
|
core_overrides_sizer->AddSpacer(space5);
|
|
|
|
|
|
|
|
wxStaticBoxSizer* const wii_overrides_sizer =
|
2016-06-24 08:43:46 +00:00
|
|
|
new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Wii Console"));
|
2018-03-31 12:04:13 +00:00
|
|
|
if (m_open_iso->GetVolumeType() == DiscIO::Platform::GameCubeDisc)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2017-09-20 22:37:25 +00:00
|
|
|
wii_overrides_sizer->ShowItems(false);
|
|
|
|
m_enable_widescreen->Hide();
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2017-09-20 22:37:25 +00:00
|
|
|
wii_overrides_sizer->Add(m_enable_widescreen, 0, wxLEFT, space5);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-09-20 22:37:25 +00:00
|
|
|
wxStaticBoxSizer* const stereo_overrides_sizer =
|
2016-06-24 08:43:46 +00:00
|
|
|
new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Stereoscopy"));
|
2017-09-20 22:37:25 +00:00
|
|
|
stereo_overrides_sizer->Add(depth_percentage);
|
|
|
|
stereo_overrides_sizer->Add(convergence_sizer);
|
|
|
|
stereo_overrides_sizer->Add(m_mono_depth);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-09-20 22:37:25 +00:00
|
|
|
wxStaticBoxSizer* const game_config_sizer =
|
2016-06-24 08:43:46 +00:00
|
|
|
new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Game-Specific Settings"));
|
2017-09-20 22:37:25 +00:00
|
|
|
game_config_sizer->AddSpacer(space5);
|
|
|
|
game_config_sizer->Add(OverrideText, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
|
|
|
|
game_config_sizer->AddSpacer(space5);
|
|
|
|
game_config_sizer->Add(core_overrides_sizer, 0, wxEXPAND);
|
|
|
|
game_config_sizer->Add(wii_overrides_sizer, 0, wxEXPAND);
|
|
|
|
game_config_sizer->Add(stereo_overrides_sizer, 0, wxEXPAND);
|
|
|
|
|
|
|
|
wxBoxSizer* const config_page_sizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
config_page_sizer->AddSpacer(space5);
|
|
|
|
config_page_sizer->Add(game_config_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
|
|
|
|
config_page_sizer->AddSpacer(space5);
|
|
|
|
m_GameConfig->SetSizer(config_page_sizer);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
// Patches
|
2017-09-20 22:37:25 +00:00
|
|
|
wxBoxSizer* const patches_sizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
m_patches = new wxCheckListBox(m_PatchPage, ID_PATCHES_LIST, wxDefaultPosition, wxDefaultSize, 0,
|
|
|
|
nullptr, wxLB_HSCROLL);
|
2016-06-24 08:43:46 +00:00
|
|
|
wxBoxSizer* const sPatchButtons = new wxBoxSizer(wxHORIZONTAL);
|
2017-09-20 22:37:25 +00:00
|
|
|
m_edit_patch = new wxButton(m_PatchPage, ID_EDITPATCH, _("Edit..."));
|
2016-06-24 08:43:46 +00:00
|
|
|
wxButton* const AddPatch = new wxButton(m_PatchPage, ID_ADDPATCH, _("Add..."));
|
2017-09-20 22:37:25 +00:00
|
|
|
m_remove_patch = new wxButton(m_PatchPage, ID_REMOVEPATCH, _("Remove"));
|
|
|
|
m_edit_patch->Disable();
|
|
|
|
m_remove_patch->Disable();
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-09-20 22:37:25 +00:00
|
|
|
wxBoxSizer* patch_page_sizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
patches_sizer->Add(m_patches, 1, wxEXPAND);
|
|
|
|
sPatchButtons->Add(m_edit_patch, 0, wxEXPAND);
|
2016-06-24 08:43:46 +00:00
|
|
|
sPatchButtons->AddStretchSpacer();
|
2016-08-03 11:14:52 +00:00
|
|
|
sPatchButtons->Add(AddPatch, 0, wxEXPAND);
|
2017-09-20 22:37:25 +00:00
|
|
|
sPatchButtons->Add(m_remove_patch, 0, wxEXPAND);
|
|
|
|
patches_sizer->Add(sPatchButtons, 0, wxEXPAND);
|
|
|
|
patch_page_sizer->AddSpacer(space5);
|
|
|
|
patch_page_sizer->Add(patches_sizer, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
|
|
|
|
patch_page_sizer->AddSpacer(space5);
|
|
|
|
m_PatchPage->SetSizer(patch_page_sizer);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
// Action Replay Cheats
|
2016-07-23 01:05:04 +00:00
|
|
|
m_ar_code_panel =
|
|
|
|
new ActionReplayCodesPanel(m_CheatPage, ActionReplayCodesPanel::STYLE_MODIFY_BUTTONS);
|
2017-09-20 22:37:25 +00:00
|
|
|
m_cheats_disabled_ar = new CheatWarningMessage(m_CheatPage, m_game_id);
|
2016-07-23 01:05:22 +00:00
|
|
|
|
|
|
|
m_ar_code_panel->Bind(DOLPHIN_EVT_ARCODE_TOGGLED, &CISOProperties::OnCheatCodeToggled, this);
|
2016-07-23 01:05:04 +00:00
|
|
|
|
2017-09-20 22:37:25 +00:00
|
|
|
wxBoxSizer* const cheat_page_sizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
cheat_page_sizer->Add(m_cheats_disabled_ar, 0, wxEXPAND | wxTOP, space5);
|
|
|
|
cheat_page_sizer->Add(m_ar_code_panel, 1, wxEXPAND | wxALL, space5);
|
|
|
|
m_CheatPage->SetSizer(cheat_page_sizer);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2016-07-23 01:05:22 +00:00
|
|
|
// Gecko Cheats
|
|
|
|
m_geckocode_panel = new Gecko::CodeConfigPanel(gecko_cheat_page);
|
2017-09-20 22:37:25 +00:00
|
|
|
m_cheats_disabled_gecko = new CheatWarningMessage(gecko_cheat_page, m_game_id);
|
2016-07-23 01:05:22 +00:00
|
|
|
|
|
|
|
m_geckocode_panel->Bind(DOLPHIN_EVT_GECKOCODE_TOGGLED, &CISOProperties::OnCheatCodeToggled, this);
|
|
|
|
|
|
|
|
wxBoxSizer* gecko_layout = new wxBoxSizer(wxVERTICAL);
|
2016-08-03 11:14:52 +00:00
|
|
|
gecko_layout->Add(m_cheats_disabled_gecko, 0, wxEXPAND | wxTOP, space5);
|
2016-07-23 01:05:22 +00:00
|
|
|
gecko_layout->Add(m_geckocode_panel, 1, wxEXPAND);
|
|
|
|
gecko_cheat_page->SetSizer(gecko_layout);
|
|
|
|
|
2017-06-17 10:26:32 +00:00
|
|
|
if (DiscIO::IsDisc(m_open_iso->GetVolumeType()))
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2017-09-20 22:37:25 +00:00
|
|
|
notebook->AddPage(new FilesystemPanel(notebook, ID_FILESYSTEM, m_open_iso), _("Filesystem"));
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
|
2017-09-20 22:37:25 +00:00
|
|
|
wxStdDialogButtonSizer* buttons_sizer = CreateStdDialogButtonSizer(wxOK | wxNO_DEFAULT);
|
|
|
|
buttons_sizer->Prepend(edit_default_config);
|
|
|
|
buttons_sizer->Prepend(edit_config);
|
|
|
|
buttons_sizer->GetAffirmativeButton()->SetLabel(_("Close"));
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
// If there is no default gameini, disable the button.
|
2017-06-29 09:20:38 +00:00
|
|
|
const std::vector<std::string> ini_names =
|
2017-09-20 22:37:25 +00:00
|
|
|
ConfigLoaders::GetGameIniFilenames(m_game_id, m_open_iso->GetRevision());
|
2017-06-29 09:20:38 +00:00
|
|
|
const bool game_ini_exists =
|
|
|
|
std::any_of(ini_names.cbegin(), ini_names.cend(), [](const std::string& name) {
|
|
|
|
return File::Exists(File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + name);
|
|
|
|
});
|
2016-06-24 08:43:46 +00:00
|
|
|
if (!game_ini_exists)
|
2017-09-20 22:37:25 +00:00
|
|
|
edit_default_config->Disable();
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
// Add notebook and buttons to the dialog
|
2017-09-20 22:37:25 +00:00
|
|
|
wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
main_sizer->AddSpacer(space5);
|
|
|
|
main_sizer->Add(notebook, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
|
|
|
|
main_sizer->AddSpacer(space5);
|
|
|
|
main_sizer->Add(buttons_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
|
|
|
|
main_sizer->AddSpacer(space5);
|
|
|
|
main_sizer->SetMinSize(FromDIP(wxSize(500, -1)));
|
2016-08-03 11:14:52 +00:00
|
|
|
|
|
|
|
SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED);
|
|
|
|
SetLayoutAdaptationLevel(wxDIALOG_ADAPTATION_STANDARD_SIZER);
|
2017-09-20 22:37:25 +00:00
|
|
|
SetSizerAndFit(main_sizer);
|
2016-06-24 08:43:46 +00:00
|
|
|
Center();
|
|
|
|
SetFocus();
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CISOProperties::OnClose(wxCloseEvent& WXUNUSED(event))
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
if (!SaveGameConfig())
|
2017-09-20 22:37:25 +00:00
|
|
|
WxUtils::ShowErrorDialog(
|
|
|
|
wxString::Format(_("Could not save %s."), m_gameini_file_local.c_str()));
|
2016-06-24 08:43:46 +00:00
|
|
|
Destroy();
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CISOProperties::OnCloseClick(wxCommandEvent& WXUNUSED(event))
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
Close();
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CISOProperties::SetCheckboxValueFromGameini(const char* section, const char* key,
|
|
|
|
wxCheckBox* checkbox)
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
// Prefer local gameini value over default gameini value.
|
|
|
|
bool value;
|
2017-09-20 22:37:25 +00:00
|
|
|
if (m_gameini_local.GetOrCreateSection(section)->Get(key, &value))
|
2016-06-24 08:43:46 +00:00
|
|
|
checkbox->Set3StateValue((wxCheckBoxState)value);
|
2017-09-20 22:37:25 +00:00
|
|
|
else if (m_gameini_default.GetOrCreateSection(section)->Get(key, &value))
|
2016-06-24 08:43:46 +00:00
|
|
|
checkbox->Set3StateValue((wxCheckBoxState)value);
|
|
|
|
else
|
|
|
|
checkbox->Set3StateValue(wxCHK_UNDETERMINED);
|
2013-09-07 21:02:49 +00:00
|
|
|
}
|
2011-01-29 21:13:56 +00:00
|
|
|
|
2013-09-07 21:02:49 +00:00
|
|
|
void CISOProperties::LoadGameConfig()
|
|
|
|
{
|
2017-09-20 22:37:25 +00:00
|
|
|
SetCheckboxValueFromGameini("Core", "CPUThread", m_cpu_thread);
|
|
|
|
SetCheckboxValueFromGameini("Core", "MMU", m_mmu);
|
|
|
|
SetCheckboxValueFromGameini("Core", "DCBZ", m_dcbz_off);
|
|
|
|
SetCheckboxValueFromGameini("Core", "FPRF", m_fprf);
|
|
|
|
SetCheckboxValueFromGameini("Core", "SyncGPU", m_sync_gpu);
|
|
|
|
SetCheckboxValueFromGameini("Core", "FastDiscSpeed", m_fast_disc_speed);
|
|
|
|
SetCheckboxValueFromGameini("Core", "DSPHLE", m_dps_hle);
|
|
|
|
SetCheckboxValueFromGameini("Wii", "Widescreen", m_enable_widescreen);
|
|
|
|
SetCheckboxValueFromGameini("Video_Stereoscopy", "StereoEFBMonoDepth", m_mono_depth);
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
std::string sTemp;
|
2017-09-20 22:37:25 +00:00
|
|
|
if (!m_gameini_local.GetIfExists("Core", "GPUDeterminismMode", &sTemp))
|
|
|
|
m_gameini_default.GetIfExists("Core", "GPUDeterminismMode", &sTemp);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
if (sTemp == "")
|
2017-09-20 22:37:25 +00:00
|
|
|
m_gpu_determinism->SetSelection(0);
|
2016-06-24 08:43:46 +00:00
|
|
|
else if (sTemp == "auto")
|
2017-09-20 22:37:25 +00:00
|
|
|
m_gpu_determinism->SetSelection(1);
|
2016-06-24 08:43:46 +00:00
|
|
|
else if (sTemp == "none")
|
2017-09-20 22:37:25 +00:00
|
|
|
m_gpu_determinism->SetSelection(2);
|
2016-06-24 08:43:46 +00:00
|
|
|
else if (sTemp == "fake-completion")
|
2017-09-20 22:37:25 +00:00
|
|
|
m_gpu_determinism->SetSelection(3);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2018-04-01 19:27:06 +00:00
|
|
|
int iTemp;
|
2017-09-20 22:37:25 +00:00
|
|
|
IniFile::Section* default_stereoscopy = m_gameini_default.GetOrCreateSection("Video_Stereoscopy");
|
2016-06-24 08:43:46 +00:00
|
|
|
default_stereoscopy->Get("StereoDepthPercentage", &iTemp, 100);
|
2017-09-20 22:37:25 +00:00
|
|
|
m_gameini_local.GetIfExists("Video_Stereoscopy", "StereoDepthPercentage", &iTemp);
|
|
|
|
m_depth_percentage->SetValue(iTemp);
|
2016-06-24 08:43:46 +00:00
|
|
|
default_stereoscopy->Get("StereoConvergence", &iTemp, 0);
|
2017-09-20 22:37:25 +00:00
|
|
|
m_gameini_local.GetIfExists("Video_Stereoscopy", "StereoConvergence", &iTemp);
|
|
|
|
m_convergence->SetValue(iTemp);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
PatchList_Load();
|
2017-09-20 22:37:25 +00:00
|
|
|
m_ar_code_panel->LoadCodes(m_gameini_default, m_gameini_local);
|
|
|
|
m_geckocode_panel->LoadCodes(m_gameini_default, m_gameini_local, m_open_iso->GetGameID());
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CISOProperties::SaveGameIniValueFrom3StateCheckbox(const char* section, const char* key,
|
|
|
|
wxCheckBox* checkbox)
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
// Delete any existing entries from the local gameini if checkbox is undetermined.
|
|
|
|
// Otherwise, write the current value to the local gameini if the value differs from the default
|
|
|
|
// gameini values.
|
|
|
|
// Delete any existing entry from the local gameini if the value does not differ from the default
|
|
|
|
// gameini value.
|
|
|
|
bool checkbox_val = (checkbox->Get3StateValue() == wxCHK_CHECKED);
|
|
|
|
|
|
|
|
if (checkbox->Get3StateValue() == wxCHK_UNDETERMINED)
|
2017-09-20 22:37:25 +00:00
|
|
|
m_gameini_local.DeleteKey(section, key);
|
|
|
|
else if (!m_gameini_default.Exists(section, key))
|
|
|
|
m_gameini_local.GetOrCreateSection(section)->Set(key, checkbox_val);
|
2016-06-24 08:43:46 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
bool default_value;
|
2017-09-20 22:37:25 +00:00
|
|
|
m_gameini_default.GetOrCreateSection(section)->Get(key, &default_value);
|
2016-06-24 08:43:46 +00:00
|
|
|
if (default_value != checkbox_val)
|
2017-09-20 22:37:25 +00:00
|
|
|
m_gameini_local.GetOrCreateSection(section)->Set(key, checkbox_val);
|
2016-06-24 08:43:46 +00:00
|
|
|
else
|
2017-09-20 22:37:25 +00:00
|
|
|
m_gameini_local.DeleteKey(section, key);
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2013-09-07 21:02:49 +00:00
|
|
|
}
|
2013-01-25 18:00:53 +00:00
|
|
|
|
2013-09-07 21:02:49 +00:00
|
|
|
bool CISOProperties::SaveGameConfig()
|
|
|
|
{
|
2017-09-20 22:37:25 +00:00
|
|
|
SaveGameIniValueFrom3StateCheckbox("Core", "CPUThread", m_cpu_thread);
|
|
|
|
SaveGameIniValueFrom3StateCheckbox("Core", "MMU", m_mmu);
|
|
|
|
SaveGameIniValueFrom3StateCheckbox("Core", "DCBZ", m_dcbz_off);
|
|
|
|
SaveGameIniValueFrom3StateCheckbox("Core", "FPRF", m_fprf);
|
|
|
|
SaveGameIniValueFrom3StateCheckbox("Core", "SyncGPU", m_sync_gpu);
|
|
|
|
SaveGameIniValueFrom3StateCheckbox("Core", "FastDiscSpeed", m_fast_disc_speed);
|
|
|
|
SaveGameIniValueFrom3StateCheckbox("Core", "DSPHLE", m_dps_hle);
|
|
|
|
SaveGameIniValueFrom3StateCheckbox("Wii", "Widescreen", m_enable_widescreen);
|
|
|
|
SaveGameIniValueFrom3StateCheckbox("Video_Stereoscopy", "StereoEFBMonoDepth", m_mono_depth);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
#define SAVE_IF_NOT_DEFAULT(section, key, val, def) \
|
|
|
|
do \
|
|
|
|
{ \
|
2017-09-20 22:37:25 +00:00
|
|
|
if (m_gameini_default.Exists((section), (key))) \
|
2016-06-24 08:43:46 +00:00
|
|
|
{ \
|
|
|
|
std::remove_reference<decltype((val))>::type tmp__; \
|
2017-09-20 22:37:25 +00:00
|
|
|
m_gameini_default.GetOrCreateSection((section))->Get((key), &tmp__); \
|
2016-06-24 08:43:46 +00:00
|
|
|
if ((val) != tmp__) \
|
2017-09-20 22:37:25 +00:00
|
|
|
m_gameini_local.GetOrCreateSection((section))->Set((key), (val)); \
|
2016-06-24 08:43:46 +00:00
|
|
|
else \
|
2017-09-20 22:37:25 +00:00
|
|
|
m_gameini_local.DeleteKey((section), (key)); \
|
2016-06-24 08:43:46 +00:00
|
|
|
} \
|
|
|
|
else if ((val) != (def)) \
|
2017-09-20 22:37:25 +00:00
|
|
|
m_gameini_local.GetOrCreateSection((section))->Set((key), (val)); \
|
2016-06-24 08:43:46 +00:00
|
|
|
else \
|
2017-09-20 22:37:25 +00:00
|
|
|
m_gameini_local.DeleteKey((section), (key)); \
|
2016-06-24 08:43:46 +00:00
|
|
|
} while (0)
|
|
|
|
|
|
|
|
std::string tmp;
|
2017-09-20 22:37:25 +00:00
|
|
|
if (m_gpu_determinism->GetSelection() == 0)
|
2016-06-24 08:43:46 +00:00
|
|
|
tmp = "Not Set";
|
2017-09-20 22:37:25 +00:00
|
|
|
else if (m_gpu_determinism->GetSelection() == 1)
|
2016-06-24 08:43:46 +00:00
|
|
|
tmp = "auto";
|
2017-09-20 22:37:25 +00:00
|
|
|
else if (m_gpu_determinism->GetSelection() == 2)
|
2016-06-24 08:43:46 +00:00
|
|
|
tmp = "none";
|
2017-09-20 22:37:25 +00:00
|
|
|
else if (m_gpu_determinism->GetSelection() == 3)
|
2016-06-24 08:43:46 +00:00
|
|
|
tmp = "fake-completion";
|
|
|
|
|
|
|
|
SAVE_IF_NOT_DEFAULT("Core", "GPUDeterminismMode", tmp, "Not Set");
|
|
|
|
|
2017-09-20 22:37:25 +00:00
|
|
|
int depth = m_depth_percentage->GetValue() > 0 ? m_depth_percentage->GetValue() : 100;
|
2016-06-24 08:43:46 +00:00
|
|
|
SAVE_IF_NOT_DEFAULT("Video_Stereoscopy", "StereoDepthPercentage", depth, 100);
|
2017-09-20 22:37:25 +00:00
|
|
|
SAVE_IF_NOT_DEFAULT("Video_Stereoscopy", "StereoConvergence", m_convergence->GetValue(), 0);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
PatchList_Save();
|
2017-09-20 22:37:25 +00:00
|
|
|
m_ar_code_panel->SaveCodes(&m_gameini_local);
|
|
|
|
Gecko::SaveCodes(m_gameini_local, m_geckocode_panel->GetCodes());
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-09-20 22:37:25 +00:00
|
|
|
bool success = m_gameini_local.Save(m_gameini_file_local);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
// If the resulting file is empty, delete it. Kind of a hack, but meh.
|
2017-09-20 22:37:25 +00:00
|
|
|
if (success && File::GetSize(m_gameini_file_local) == 0)
|
|
|
|
File::Delete(m_gameini_file_local);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
if (success)
|
|
|
|
GenerateLocalIniModified();
|
|
|
|
|
|
|
|
return success;
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
2015-04-25 20:15:48 +00:00
|
|
|
void CISOProperties::LaunchExternalEditor(const std::string& filename, bool wait_until_closed)
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2011-01-30 14:20:20 +00:00
|
|
|
#ifdef __APPLE__
|
2016-09-19 00:22:39 +00:00
|
|
|
// GetOpenCommand does not work for wxCocoa
|
|
|
|
const char* OpenCommandConst[] = {"open", "-a", "TextEdit", filename.c_str(), NULL};
|
|
|
|
char** OpenCommand = const_cast<char**>(OpenCommandConst);
|
2011-01-30 14:20:20 +00:00
|
|
|
#else
|
2017-09-20 22:37:25 +00:00
|
|
|
wxFileType* file_type = wxTheMimeTypesManager->GetFileTypeFromExtension("ini");
|
|
|
|
if (file_type == nullptr) // From extension failed, trying with MIME type now
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2017-09-20 22:37:25 +00:00
|
|
|
file_type = wxTheMimeTypesManager->GetFileTypeFromMimeType("text/plain");
|
|
|
|
if (file_type == nullptr) // MIME type failed, aborting mission
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
|
|
|
WxUtils::ShowErrorDialog(_("Filetype 'ini' is unknown! Will not open!"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-20 22:37:25 +00:00
|
|
|
wxString OpenCommand = file_type->GetOpenCommand(StrToWxStr(filename));
|
2016-06-24 08:43:46 +00:00
|
|
|
if (OpenCommand.IsEmpty())
|
|
|
|
{
|
|
|
|
WxUtils::ShowErrorDialog(_("Couldn't find open command for extension 'ini'!"));
|
|
|
|
return;
|
|
|
|
}
|
2016-09-19 00:22:39 +00:00
|
|
|
#endif
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
long result;
|
|
|
|
|
|
|
|
if (wait_until_closed)
|
|
|
|
result = wxExecute(OpenCommand, wxEXEC_SYNC);
|
|
|
|
else
|
|
|
|
result = wxExecute(OpenCommand);
|
|
|
|
|
|
|
|
if (result == -1)
|
|
|
|
{
|
|
|
|
WxUtils::ShowErrorDialog(_("wxExecute returned -1 on application run!"));
|
|
|
|
return;
|
|
|
|
}
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
2016-04-22 10:42:16 +00:00
|
|
|
void CISOProperties::GenerateLocalIniModified()
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
wxCommandEvent event_update(DOLPHIN_EVT_LOCAL_INI_CHANGED);
|
2017-09-20 22:37:25 +00:00
|
|
|
event_update.SetString(StrToWxStr(m_game_id));
|
|
|
|
event_update.SetInt(m_open_gamelist_item.GetRevision());
|
2016-06-24 08:43:46 +00:00
|
|
|
wxTheApp->ProcessEvent(event_update);
|
2016-04-22 10:42:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CISOProperties::OnLocalIniModified(wxCommandEvent& ev)
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
ev.Skip();
|
2017-09-20 22:37:25 +00:00
|
|
|
if (WxStrToStr(ev.GetString()) != m_game_id)
|
2016-06-24 08:43:46 +00:00
|
|
|
return;
|
2016-04-22 10:42:16 +00:00
|
|
|
|
2017-09-20 22:37:25 +00:00
|
|
|
m_gameini_local.Load(m_gameini_file_local);
|
2016-06-24 08:43:46 +00:00
|
|
|
LoadGameConfig();
|
2016-04-22 10:42:16 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CISOProperties::OnEditConfig(wxCommandEvent& WXUNUSED(event))
|
2013-09-07 21:02:49 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
SaveGameConfig();
|
|
|
|
// Create blank file to prevent editor from prompting to create it.
|
2017-09-20 22:37:25 +00:00
|
|
|
if (!File::Exists(m_gameini_file_local))
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2017-09-20 22:37:25 +00:00
|
|
|
std::fstream blank_file(m_gameini_file_local, std::ios::out);
|
|
|
|
blank_file.close();
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2017-09-20 22:37:25 +00:00
|
|
|
LaunchExternalEditor(m_gameini_file_local, true);
|
2016-06-24 08:43:46 +00:00
|
|
|
GenerateLocalIniModified();
|
2013-09-07 21:02:49 +00:00
|
|
|
}
|
|
|
|
|
2016-07-23 01:05:22 +00:00
|
|
|
void CISOProperties::OnCheatCodeToggled(wxCommandEvent&)
|
|
|
|
{
|
|
|
|
m_cheats_disabled_ar->UpdateState();
|
|
|
|
m_cheats_disabled_gecko->UpdateState();
|
|
|
|
}
|
|
|
|
|
2016-11-13 01:51:08 +00:00
|
|
|
void CISOProperties::OnChangeTitle(wxCommandEvent& event)
|
2014-04-12 10:50:12 +00:00
|
|
|
{
|
2016-11-13 01:51:08 +00:00
|
|
|
SetTitle(event.GetString());
|
2014-04-12 10:50:12 +00:00
|
|
|
}
|
|
|
|
|
2015-02-24 19:04:19 +00:00
|
|
|
// Opens all pre-defined INIs for the game. If there are multiple ones,
|
|
|
|
// they will all be opened, but there is usually only one
|
2016-06-24 08:43:46 +00:00
|
|
|
void CISOProperties::OnShowDefaultConfig(wxCommandEvent& WXUNUSED(event))
|
2013-09-07 21:02:49 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
for (const std::string& filename :
|
2017-09-20 22:37:25 +00:00
|
|
|
ConfigLoaders::GetGameIniFilenames(m_game_id, m_open_iso->GetRevision()))
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
|
|
|
std::string path = File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + filename;
|
|
|
|
if (File::Exists(path))
|
|
|
|
LaunchExternalEditor(path, false);
|
|
|
|
}
|
2013-09-07 21:02:49 +00:00
|
|
|
}
|
|
|
|
|
2016-07-23 01:05:04 +00:00
|
|
|
void CISOProperties::PatchListSelectionChanged(wxCommandEvent& event)
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2017-09-20 22:37:25 +00:00
|
|
|
if (m_patches->GetSelection() == wxNOT_FOUND ||
|
|
|
|
m_default_patches.find(m_patches->GetString(m_patches->GetSelection()).ToStdString()) !=
|
|
|
|
m_default_patches.end())
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2017-09-20 22:37:25 +00:00
|
|
|
m_edit_patch->Disable();
|
|
|
|
m_remove_patch->Disable();
|
2016-07-23 01:05:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-09-20 22:37:25 +00:00
|
|
|
m_edit_patch->Enable();
|
|
|
|
m_remove_patch->Enable();
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2016-04-19 21:19:31 +00:00
|
|
|
}
|
|
|
|
|
2008-12-08 05:30:24 +00:00
|
|
|
void CISOProperties::PatchList_Load()
|
|
|
|
{
|
2017-09-20 22:37:25 +00:00
|
|
|
m_on_frame.clear();
|
|
|
|
m_patches->Clear();
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-09-20 22:37:25 +00:00
|
|
|
PatchEngine::LoadPatchSection("OnFrame", m_on_frame, m_gameini_default, m_gameini_local);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
u32 index = 0;
|
2017-09-20 22:37:25 +00:00
|
|
|
for (PatchEngine::Patch& p : m_on_frame)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2017-09-20 22:37:25 +00:00
|
|
|
m_patches->Append(StrToWxStr(p.name));
|
|
|
|
m_patches->Check(index, p.active);
|
2016-06-24 08:43:46 +00:00
|
|
|
if (!p.user_defined)
|
2017-09-20 22:37:25 +00:00
|
|
|
m_default_patches.insert(p.name);
|
2016-06-24 08:43:46 +00:00
|
|
|
++index;
|
|
|
|
}
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CISOProperties::PatchList_Save()
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
std::vector<std::string> lines;
|
2017-09-20 22:37:25 +00:00
|
|
|
std::vector<std::string> enabled_lines;
|
2016-06-24 08:43:46 +00:00
|
|
|
u32 index = 0;
|
2017-09-20 22:37:25 +00:00
|
|
|
for (PatchEngine::Patch& p : m_on_frame)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2017-09-20 22:37:25 +00:00
|
|
|
if (m_patches->IsChecked(index))
|
|
|
|
enabled_lines.push_back("$" + p.name);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
// Do not save default patches.
|
2017-09-20 22:37:25 +00:00
|
|
|
if (m_default_patches.find(p.name) == m_default_patches.end())
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
|
|
|
lines.push_back("$" + p.name);
|
|
|
|
for (const PatchEngine::PatchEntry& entry : p.entries)
|
|
|
|
{
|
2018-05-13 18:10:58 +00:00
|
|
|
std::string temp =
|
|
|
|
StringFromFormat("0x%08X:%s:0x%08X", entry.address,
|
|
|
|
PatchEngine::PatchTypeAsString(entry.type), entry.value);
|
|
|
|
lines.push_back(std::move(temp));
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
++index;
|
|
|
|
}
|
2017-09-20 22:37:25 +00:00
|
|
|
m_gameini_local.SetLines("OnFrame_Enabled", enabled_lines);
|
|
|
|
m_gameini_local.SetLines("OnFrame", lines);
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CISOProperties::PatchButtonClicked(wxCommandEvent& event)
|
|
|
|
{
|
2017-09-20 22:37:25 +00:00
|
|
|
int selection = m_patches->GetSelection();
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
switch (event.GetId())
|
|
|
|
{
|
|
|
|
case ID_EDITPATCH:
|
|
|
|
{
|
2017-09-20 22:37:25 +00:00
|
|
|
CPatchAddEdit dlg(selection, &m_on_frame, this);
|
2016-06-24 08:43:46 +00:00
|
|
|
dlg.ShowModal();
|
|
|
|
Raise();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ID_ADDPATCH:
|
|
|
|
{
|
2017-09-20 22:37:25 +00:00
|
|
|
CPatchAddEdit dlg(-1, &m_on_frame, this, 1, _("Add Patch"));
|
2016-06-24 08:43:46 +00:00
|
|
|
int res = dlg.ShowModal();
|
|
|
|
Raise();
|
|
|
|
if (res == wxID_OK)
|
|
|
|
{
|
2017-09-20 22:37:25 +00:00
|
|
|
m_patches->Append(StrToWxStr(m_on_frame.back().name));
|
|
|
|
m_patches->Check((unsigned int)(m_on_frame.size() - 1), m_on_frame.back().active);
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ID_REMOVEPATCH:
|
2017-09-20 22:37:25 +00:00
|
|
|
m_on_frame.erase(m_on_frame.begin() + m_patches->GetSelection());
|
|
|
|
m_patches->Delete(m_patches->GetSelection());
|
2016-06-24 08:43:46 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
PatchList_Save();
|
2017-09-20 22:37:25 +00:00
|
|
|
m_patches->Clear();
|
2016-06-24 08:43:46 +00:00
|
|
|
PatchList_Load();
|
|
|
|
|
2017-09-20 22:37:25 +00:00
|
|
|
m_edit_patch->Disable();
|
|
|
|
m_remove_patch->Disable();
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|