2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2010 Dolphin Emulator Project
|
2015-05-17 23:08:10 +00:00
|
|
|
// Licensed under GPLv2+
|
2014-07-29 17:14:25 +00:00
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2014-02-10 18:54:46 +00:00
|
|
|
#pragma once
|
2010-11-15 09:54:07 +00:00
|
|
|
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <cstddef>
|
2011-04-29 23:11:18 +00:00
|
|
|
#include <map>
|
2014-02-17 10:18:15 +00:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2014-07-29 17:14:25 +00:00
|
|
|
#include <wx/button.h>
|
2010-11-15 09:54:07 +00:00
|
|
|
#include <wx/checkbox.h>
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <wx/choice.h>
|
|
|
|
#include <wx/dialog.h>
|
|
|
|
#include <wx/msgdlg.h>
|
|
|
|
#include <wx/radiobut.h>
|
2010-11-15 09:54:07 +00:00
|
|
|
#include <wx/spinctrl.h>
|
2014-02-19 01:56:29 +00:00
|
|
|
#include <wx/stattext.h>
|
2011-03-23 00:54:31 +00:00
|
|
|
|
2014-02-22 22:36:30 +00:00
|
|
|
#include "Common/CommonTypes.h"
|
|
|
|
#include "Common/SysConf.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "Core/ConfigManager.h"
|
2014-05-23 13:45:14 +00:00
|
|
|
#include "Core/Core.h"
|
2016-08-02 06:22:58 +00:00
|
|
|
#include "DolphinWX/DolphinSlider.h"
|
2014-07-29 17:14:25 +00:00
|
|
|
#include "DolphinWX/PostProcessingConfigDiag.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "DolphinWX/WxUtils.h"
|
2014-07-29 17:14:25 +00:00
|
|
|
#include "VideoCommon/PostProcessing.h"
|
2014-02-22 22:36:30 +00:00
|
|
|
#include "VideoCommon/VideoBackendBase.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "VideoCommon/VideoConfig.h"
|
2011-06-02 19:32:34 +00:00
|
|
|
|
2014-02-22 22:36:30 +00:00
|
|
|
class wxBoxSizer;
|
|
|
|
class wxControl;
|
|
|
|
class wxPanel;
|
|
|
|
|
2011-04-25 20:06:45 +00:00
|
|
|
template <typename W>
|
|
|
|
class BoolSetting : public W
|
2010-11-15 09:54:07 +00:00
|
|
|
{
|
2011-04-05 22:46:57 +00:00
|
|
|
public:
|
2016-06-24 08:43:46 +00:00
|
|
|
BoolSetting(wxWindow* parent, const wxString& label, const wxString& tooltip, bool& setting,
|
|
|
|
bool reverse = false, long style = 0);
|
|
|
|
|
|
|
|
void UpdateValue(wxCommandEvent& ev)
|
|
|
|
{
|
|
|
|
m_setting = (ev.GetInt() != 0) ^ m_reverse;
|
|
|
|
ev.Skip();
|
|
|
|
}
|
2011-03-27 22:23:44 +00:00
|
|
|
|
2010-11-15 09:54:07 +00:00
|
|
|
private:
|
2016-06-24 08:43:46 +00:00
|
|
|
bool& m_setting;
|
|
|
|
const bool m_reverse;
|
2010-11-15 09:54:07 +00:00
|
|
|
};
|
|
|
|
|
2011-04-25 20:06:45 +00:00
|
|
|
typedef BoolSetting<wxCheckBox> SettingCheckBox;
|
|
|
|
typedef BoolSetting<wxRadioButton> SettingRadioButton;
|
|
|
|
|
2011-02-12 09:10:11 +00:00
|
|
|
template <typename T>
|
|
|
|
class IntegerSetting : public wxSpinCtrl
|
|
|
|
{
|
|
|
|
public:
|
2016-06-24 08:43:46 +00:00
|
|
|
IntegerSetting(wxWindow* parent, const wxString& label, T& setting, int minVal, int maxVal,
|
|
|
|
long style = 0);
|
|
|
|
|
|
|
|
void UpdateValue(wxCommandEvent& ev)
|
|
|
|
{
|
|
|
|
m_setting = ev.GetInt();
|
|
|
|
ev.Skip();
|
|
|
|
}
|
2011-02-12 09:10:11 +00:00
|
|
|
|
|
|
|
private:
|
2016-06-24 08:43:46 +00:00
|
|
|
T& m_setting;
|
2011-02-12 09:10:11 +00:00
|
|
|
};
|
|
|
|
|
2011-04-25 20:06:45 +00:00
|
|
|
class SettingChoice : public wxChoice
|
|
|
|
{
|
|
|
|
public:
|
2016-06-24 08:43:46 +00:00
|
|
|
SettingChoice(wxWindow* parent, int& setting, const wxString& tooltip, int num = 0,
|
|
|
|
const wxString choices[] = nullptr, long style = 0);
|
|
|
|
void UpdateValue(wxCommandEvent& ev);
|
|
|
|
|
2011-04-25 20:06:45 +00:00
|
|
|
private:
|
2016-06-24 08:43:46 +00:00
|
|
|
int& m_setting;
|
2011-04-25 20:06:45 +00:00
|
|
|
};
|
2011-02-20 23:42:21 +00:00
|
|
|
|
2010-11-15 09:54:07 +00:00
|
|
|
class VideoConfigDiag : public wxDialog
|
|
|
|
{
|
|
|
|
public:
|
2016-06-26 06:06:23 +00:00
|
|
|
VideoConfigDiag(wxWindow* parent, const std::string& title);
|
2010-11-15 09:54:07 +00:00
|
|
|
|
2011-03-21 19:57:31 +00:00
|
|
|
protected:
|
2016-06-24 08:43:46 +00:00
|
|
|
void Event_Backend(wxCommandEvent& ev)
|
|
|
|
{
|
|
|
|
auto& new_backend = g_available_video_backends[ev.GetInt()];
|
|
|
|
|
|
|
|
if (g_video_backend != new_backend.get())
|
|
|
|
{
|
|
|
|
bool do_switch = !Core::IsRunning();
|
|
|
|
if (new_backend->GetName() == "Software Renderer")
|
|
|
|
{
|
|
|
|
do_switch =
|
|
|
|
(wxYES ==
|
|
|
|
wxMessageBox(_("Software rendering is an order of magnitude slower than using the "
|
|
|
|
"other backends.\nIt's only useful for debugging purposes.\nDo you "
|
|
|
|
"really want to enable software rendering? If unsure, select 'No'."),
|
2016-08-02 06:22:58 +00:00
|
|
|
_("Warning"), wxYES_NO | wxNO_DEFAULT | wxICON_EXCLAMATION, this));
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (do_switch)
|
|
|
|
{
|
|
|
|
// TODO: Only reopen the dialog if the software backend is
|
|
|
|
// selected (make sure to reinitialize backend info)
|
|
|
|
// reopen the dialog
|
|
|
|
Close();
|
|
|
|
|
|
|
|
g_video_backend = new_backend.get();
|
|
|
|
SConfig::GetInstance().m_strVideoBackend = g_video_backend->GetName();
|
|
|
|
|
|
|
|
g_video_backend->ShowConfig(GetParent());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Select current backend again
|
|
|
|
choice_backend->SetStringSelection(StrToWxStr(g_video_backend->GetName()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ev.Skip();
|
|
|
|
}
|
|
|
|
void Event_Adapter(wxCommandEvent& ev) { ev.Skip(); } // TODO
|
|
|
|
void Event_DisplayResolution(wxCommandEvent& ev);
|
|
|
|
|
|
|
|
void Event_ProgressiveScan(wxCommandEvent& ev)
|
|
|
|
{
|
|
|
|
SConfig::GetInstance().m_SYSCONF->SetData("IPL.PGS", ev.GetInt());
|
|
|
|
SConfig::GetInstance().bProgressive = ev.IsChecked();
|
|
|
|
|
|
|
|
ev.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Event_Stc(wxCommandEvent& ev)
|
|
|
|
{
|
|
|
|
int samples[] = {0, 512, 128};
|
|
|
|
vconfig.iSafeTextureCache_ColorSamples = samples[ev.GetInt()];
|
|
|
|
|
|
|
|
ev.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Event_PPShader(wxCommandEvent& ev)
|
|
|
|
{
|
|
|
|
const int sel = ev.GetInt();
|
|
|
|
if (sel)
|
|
|
|
vconfig.sPostProcessingShader = WxStrToStr(ev.GetString());
|
|
|
|
else
|
|
|
|
vconfig.sPostProcessingShader.clear();
|
|
|
|
|
|
|
|
// Should we enable the configuration button?
|
|
|
|
PostProcessingShaderConfiguration postprocessing_shader;
|
|
|
|
postprocessing_shader.LoadShader(vconfig.sPostProcessingShader);
|
|
|
|
button_config_pp->Enable(postprocessing_shader.HasOptions());
|
|
|
|
|
|
|
|
ev.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Event_ConfigurePPShader(wxCommandEvent& ev)
|
|
|
|
{
|
|
|
|
PostProcessingConfigDiag dialog(this, vconfig.sPostProcessingShader);
|
|
|
|
dialog.ShowModal();
|
|
|
|
|
|
|
|
ev.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Event_StereoDepth(wxCommandEvent& ev)
|
|
|
|
{
|
|
|
|
vconfig.iStereoDepth = ev.GetInt();
|
|
|
|
|
|
|
|
ev.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Event_StereoConvergence(wxCommandEvent& ev)
|
|
|
|
{
|
|
|
|
// Snap the slider
|
|
|
|
int value = ev.GetInt();
|
|
|
|
if (90 < value && value < 110)
|
|
|
|
conv_slider->SetValue(100);
|
|
|
|
|
|
|
|
vconfig.iStereoConvergencePercentage = conv_slider->GetValue();
|
|
|
|
|
|
|
|
ev.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Event_StereoMode(wxCommandEvent& ev)
|
|
|
|
{
|
|
|
|
if (vconfig.backend_info.bSupportsPostProcessing)
|
|
|
|
{
|
|
|
|
// Anaglyph overrides post-processing shaders
|
|
|
|
choice_ppshader->Clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
ev.Skip();
|
|
|
|
}
|
|
|
|
|
2016-08-02 06:22:58 +00:00
|
|
|
void Event_Close(wxCommandEvent&);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
// Enables/disables UI elements depending on current config
|
|
|
|
void OnUpdateUI(wxUpdateUIEvent& ev)
|
|
|
|
{
|
|
|
|
// Anti-aliasing
|
|
|
|
choice_aamode->Enable(vconfig.backend_info.AAModes.size() > 1);
|
|
|
|
text_aamode->Enable(vconfig.backend_info.AAModes.size() > 1);
|
|
|
|
|
|
|
|
// XFB
|
|
|
|
virtual_xfb->Enable(vconfig.bUseXFB);
|
|
|
|
real_xfb->Enable(vconfig.bUseXFB);
|
|
|
|
|
|
|
|
// custom textures
|
|
|
|
cache_hires_textures->Enable(vconfig.bHiresTextures);
|
|
|
|
|
|
|
|
// Repopulating the post-processing shaders can't be done from an event
|
|
|
|
if (choice_ppshader && choice_ppshader->IsEmpty())
|
|
|
|
PopulatePostProcessingShaders();
|
|
|
|
|
|
|
|
// Things which shouldn't be changed during emulation
|
|
|
|
if (Core::IsRunning())
|
|
|
|
{
|
|
|
|
choice_backend->Disable();
|
|
|
|
label_backend->Disable();
|
|
|
|
|
|
|
|
// D3D only
|
|
|
|
if (vconfig.backend_info.Adapters.size())
|
|
|
|
{
|
|
|
|
choice_adapter->Disable();
|
|
|
|
label_adapter->Disable();
|
|
|
|
}
|
2014-09-03 07:35:23 +00:00
|
|
|
|
2014-09-21 20:05:51 +00:00
|
|
|
#ifndef __APPLE__
|
2016-06-24 08:43:46 +00:00
|
|
|
// This isn't supported on OS X.
|
2014-09-03 07:35:23 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
choice_display_resolution->Disable();
|
|
|
|
label_display_resolution->Disable();
|
2014-09-03 07:35:23 +00:00
|
|
|
#endif
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
progressive_scan_checkbox->Disable();
|
|
|
|
render_to_main_checkbox->Disable();
|
|
|
|
}
|
|
|
|
ev.Skip();
|
|
|
|
}
|
2011-03-21 19:57:31 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
// Creates controls and connects their enter/leave window events to Evt_Enter/LeaveControl
|
|
|
|
SettingCheckBox* CreateCheckBox(wxWindow* parent, const wxString& label,
|
|
|
|
const wxString& description, bool& setting, bool reverse = false,
|
|
|
|
long style = 0);
|
|
|
|
SettingChoice* CreateChoice(wxWindow* parent, int& setting, const wxString& description,
|
|
|
|
int num = 0, const wxString choices[] = nullptr, long style = 0);
|
|
|
|
SettingRadioButton* CreateRadioButton(wxWindow* parent, const wxString& label,
|
|
|
|
const wxString& description, bool& setting,
|
|
|
|
bool reverse = false, long style = 0);
|
2011-04-29 23:11:18 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
// Same as above but only connects enter/leave window events
|
|
|
|
wxControl* RegisterControl(wxControl* const control, const wxString& description);
|
2011-04-29 23:11:18 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void Evt_EnterControl(wxMouseEvent& ev);
|
|
|
|
void Evt_LeaveControl(wxMouseEvent& ev);
|
|
|
|
void CreateDescriptionArea(wxPanel* const page, wxBoxSizer* const sizer);
|
|
|
|
void PopulatePostProcessingShaders();
|
|
|
|
void PopulateAAList();
|
|
|
|
void OnAAChanged(wxCommandEvent& ev);
|
2011-04-29 23:11:18 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
wxChoice* choice_backend;
|
|
|
|
wxChoice* choice_adapter;
|
|
|
|
wxChoice* choice_display_resolution;
|
2014-09-03 07:35:23 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
wxStaticText* label_backend;
|
|
|
|
wxStaticText* label_adapter;
|
2014-09-03 07:35:23 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
wxStaticText* text_aamode;
|
|
|
|
wxChoice* choice_aamode;
|
2016-08-02 06:22:58 +00:00
|
|
|
DolphinSlider* conv_slider;
|
2011-03-21 19:57:31 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
wxStaticText* label_display_resolution;
|
2014-09-03 07:35:23 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
wxButton* button_config_pp;
|
2014-07-29 17:14:25 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
SettingCheckBox* borderless_fullscreen;
|
|
|
|
SettingCheckBox* render_to_main_checkbox;
|
2011-03-21 19:57:31 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
SettingRadioButton* virtual_xfb;
|
|
|
|
SettingRadioButton* real_xfb;
|
2011-03-21 19:57:31 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
SettingCheckBox* cache_hires_textures;
|
2015-03-01 22:53:15 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
wxCheckBox* progressive_scan_checkbox;
|
2014-09-03 07:35:23 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
wxChoice* choice_ppshader;
|
2014-10-31 14:53:08 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
std::map<wxWindow*, wxString> ctrl_descs; // maps setting controls to their descriptions
|
|
|
|
std::map<wxWindow*, wxStaticText*> desc_texts; // maps dialog tabs (which are the parents of the
|
|
|
|
// setting controls) to their description text
|
|
|
|
// objects
|
2011-04-29 23:11:18 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
VideoConfig& vconfig;
|
2015-11-05 21:50:20 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
size_t m_msaa_modes;
|
2010-11-15 09:54:07 +00:00
|
|
|
};
|