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-08-04 00:07:27 +00:00
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <wx/button.h>
|
|
|
|
#include <wx/checkbox.h>
|
|
|
|
#include <wx/combobox.h>
|
|
|
|
#include <wx/notebook.h>
|
|
|
|
#include <wx/panel.h>
|
2015-05-08 14:04:40 +00:00
|
|
|
#include <wx/sizer.h>
|
2014-08-04 00:07:27 +00:00
|
|
|
#include <wx/spinctrl.h>
|
|
|
|
#include <wx/stattext.h>
|
|
|
|
#include <wx/textctrl.h>
|
|
|
|
|
|
|
|
#include "Common/FileUtil.h"
|
2017-05-18 12:59:38 +00:00
|
|
|
#include "Core/Config/GraphicsSettings.h"
|
2014-08-04 00:07:27 +00:00
|
|
|
#include "Core/Core.h"
|
|
|
|
#include "DolphinWX/SoftwareVideoConfigDialog.h"
|
|
|
|
#include "DolphinWX/VideoConfigDiag.h"
|
|
|
|
#include "DolphinWX/WxUtils.h"
|
|
|
|
|
2017-05-18 12:59:38 +00:00
|
|
|
IntegerSetting::IntegerSetting(wxWindow* parent, const wxString& label,
|
|
|
|
const Config::ConfigInfo<int>& setting, int minVal, int maxVal,
|
|
|
|
long style)
|
2016-06-24 08:43:46 +00:00
|
|
|
: wxSpinCtrl(parent, wxID_ANY, label, wxDefaultPosition, wxDefaultSize, style),
|
|
|
|
m_setting(setting)
|
2014-08-04 00:07:27 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
SetRange(minVal, maxVal);
|
2017-05-18 12:59:38 +00:00
|
|
|
SetValue(Config::Get(m_setting));
|
2016-06-24 08:43:46 +00:00
|
|
|
Bind(wxEVT_SPINCTRL, &IntegerSetting::UpdateValue, this);
|
2014-08-04 00:07:27 +00:00
|
|
|
}
|
|
|
|
|
2016-06-26 06:06:23 +00:00
|
|
|
SoftwareVideoConfigDialog::SoftwareVideoConfigDialog(wxWindow* parent, const std::string& title)
|
2016-06-24 08:43:46 +00:00
|
|
|
: wxDialog(parent, wxID_ANY,
|
|
|
|
wxString(wxString::Format(_("Dolphin %s Graphics Configuration"), title)))
|
2014-08-04 00:07:27 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
wxNotebook* const notebook = new wxNotebook(this, wxID_ANY);
|
|
|
|
|
2016-08-02 06:22:58 +00:00
|
|
|
const int space5 = FromDIP(5);
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
// -- GENERAL --
|
|
|
|
{
|
|
|
|
wxPanel* const page_general = new wxPanel(notebook);
|
|
|
|
notebook->AddPage(page_general, _("General"));
|
|
|
|
wxBoxSizer* const szr_general = new wxBoxSizer(wxVERTICAL);
|
|
|
|
|
|
|
|
// - rendering
|
|
|
|
{
|
|
|
|
wxStaticBoxSizer* const group_rendering =
|
|
|
|
new wxStaticBoxSizer(wxVERTICAL, page_general, _("Rendering"));
|
2016-08-02 06:22:58 +00:00
|
|
|
szr_general->AddSpacer(space5);
|
|
|
|
szr_general->Add(group_rendering, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
|
|
|
|
wxGridSizer* const szr_rendering = new wxGridSizer(2, space5, space5);
|
|
|
|
group_rendering->Add(szr_rendering, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
|
|
|
|
group_rendering->AddSpacer(space5);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
// backend
|
|
|
|
wxStaticText* const label_backend = new wxStaticText(page_general, wxID_ANY, _("Backend:"));
|
|
|
|
wxChoice* const choice_backend = new wxChoice(page_general, wxID_ANY);
|
|
|
|
|
|
|
|
for (const auto& backend : g_available_video_backends)
|
|
|
|
{
|
|
|
|
choice_backend->AppendString(StrToWxStr(backend->GetDisplayName()));
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: How to get the translated plugin name?
|
|
|
|
choice_backend->SetStringSelection(StrToWxStr(g_video_backend->GetName()));
|
|
|
|
choice_backend->Bind(wxEVT_CHOICE, &SoftwareVideoConfigDialog::Event_Backend, this);
|
|
|
|
|
2016-08-02 06:22:58 +00:00
|
|
|
szr_rendering->Add(label_backend, 0, wxALIGN_CENTER_VERTICAL);
|
|
|
|
szr_rendering->Add(choice_backend, 0, wxALIGN_CENTER_VERTICAL);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-02-05 12:39:58 +00:00
|
|
|
if (Core::GetState() != Core::State::Uninitialized)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
|
|
|
label_backend->Disable();
|
|
|
|
choice_backend->Disable();
|
|
|
|
}
|
|
|
|
|
|
|
|
// xfb
|
|
|
|
szr_rendering->Add(
|
2017-05-18 12:59:38 +00:00
|
|
|
new SettingCheckBox(page_general, _("Bypass XFB"), "", Config::GFX_USE_XFB, true));
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - info
|
|
|
|
{
|
|
|
|
wxStaticBoxSizer* const group_info =
|
|
|
|
new wxStaticBoxSizer(wxVERTICAL, page_general, _("Overlay Information"));
|
2016-08-02 06:22:58 +00:00
|
|
|
szr_general->AddSpacer(space5);
|
|
|
|
szr_general->Add(group_info, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
|
|
|
|
wxGridSizer* const szr_info = new wxGridSizer(2, space5, space5);
|
|
|
|
group_info->Add(szr_info, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
|
|
|
|
group_info->AddSpacer(space5);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-05-18 12:59:38 +00:00
|
|
|
szr_info->Add(new SettingCheckBox(page_general, _("Various Statistics"), "",
|
|
|
|
Config::GFX_OVERLAY_STATS));
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - utility
|
|
|
|
{
|
|
|
|
wxStaticBoxSizer* const group_utility =
|
|
|
|
new wxStaticBoxSizer(wxVERTICAL, page_general, _("Utility"));
|
2016-08-02 06:22:58 +00:00
|
|
|
szr_general->AddSpacer(space5);
|
|
|
|
szr_general->Add(group_utility, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
|
|
|
|
wxGridSizer* const szr_utility = new wxGridSizer(2, space5, space5);
|
|
|
|
group_utility->Add(szr_utility, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
|
|
|
|
group_utility->AddSpacer(space5);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
szr_utility->Add(
|
2017-05-18 12:59:38 +00:00
|
|
|
new SettingCheckBox(page_general, _("Dump Textures"), "", Config::GFX_DUMP_TEXTURES));
|
2016-06-24 08:43:46 +00:00
|
|
|
szr_utility->Add(
|
2017-05-18 12:59:38 +00:00
|
|
|
new SettingCheckBox(page_general, _("Dump Objects"), "", Config::GFX_SW_DUMP_OBJECTS));
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
// - debug only
|
|
|
|
wxStaticBoxSizer* const group_debug_only_utility =
|
|
|
|
new wxStaticBoxSizer(wxHORIZONTAL, page_general, _("Debug Only"));
|
2016-08-02 06:22:58 +00:00
|
|
|
group_utility->Add(group_debug_only_utility, 0, wxEXPAND);
|
|
|
|
group_utility->AddSpacer(space5);
|
|
|
|
wxGridSizer* const szr_debug_only_utility = new wxGridSizer(2, space5, space5);
|
|
|
|
group_debug_only_utility->AddSpacer(space5);
|
|
|
|
group_debug_only_utility->Add(szr_debug_only_utility, 0, wxEXPAND | wxBOTTOM, space5);
|
|
|
|
group_debug_only_utility->AddSpacer(space5);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-05-18 12:59:38 +00:00
|
|
|
szr_debug_only_utility->Add(new SettingCheckBox(page_general, _("Dump TEV Stages"), "",
|
|
|
|
Config::GFX_SW_DUMP_TEV_STAGES));
|
2016-06-24 08:43:46 +00:00
|
|
|
szr_debug_only_utility->Add(new SettingCheckBox(page_general, _("Dump Texture Fetches"), "",
|
2017-05-18 12:59:38 +00:00
|
|
|
Config::GFX_SW_DUMP_TEV_TEX_FETCHES));
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - misc
|
|
|
|
{
|
|
|
|
wxStaticBoxSizer* const group_misc =
|
|
|
|
new wxStaticBoxSizer(wxVERTICAL, page_general, _("Drawn Object Range"));
|
2016-08-02 06:22:58 +00:00
|
|
|
szr_general->AddSpacer(space5);
|
|
|
|
szr_general->Add(group_misc, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
|
|
|
|
wxFlexGridSizer* const szr_misc = new wxFlexGridSizer(2, space5, space5);
|
|
|
|
group_misc->Add(szr_misc, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
|
|
|
|
group_misc->AddSpacer(space5);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
szr_misc->Add(
|
2017-05-18 12:59:38 +00:00
|
|
|
new IntegerSetting(page_general, _("Start"), Config::GFX_SW_DRAW_START, 0, 100000));
|
|
|
|
szr_misc->Add(new IntegerSetting(page_general, _("End"), Config::GFX_SW_DRAW_END, 0, 100000));
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
|
2016-08-02 06:22:58 +00:00
|
|
|
szr_general->AddSpacer(space5);
|
2016-06-24 08:43:46 +00:00
|
|
|
page_general->SetSizerAndFit(szr_general);
|
|
|
|
}
|
|
|
|
|
2016-08-02 06:22:58 +00:00
|
|
|
wxStdDialogButtonSizer* const btn_sizer = CreateStdDialogButtonSizer(wxOK | wxNO_DEFAULT);
|
|
|
|
btn_sizer->GetAffirmativeButton()->SetLabel(_("Close"));
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2016-08-02 06:22:58 +00:00
|
|
|
wxBoxSizer* const szr_main = new wxBoxSizer(wxVERTICAL);
|
|
|
|
szr_main->AddSpacer(space5);
|
|
|
|
szr_main->Add(notebook, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
|
|
|
|
szr_main->AddSpacer(space5);
|
|
|
|
szr_main->Add(btn_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
|
|
|
|
szr_main->AddSpacer(space5);
|
|
|
|
|
|
|
|
SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED);
|
|
|
|
SetLayoutAdaptationLevel(wxDIALOG_ADAPTATION_STANDARD_SIZER);
|
2016-06-24 08:43:46 +00:00
|
|
|
SetSizerAndFit(szr_main);
|
|
|
|
Center();
|
|
|
|
SetFocus();
|
2014-08-04 00:07:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SoftwareVideoConfigDialog::~SoftwareVideoConfigDialog()
|
|
|
|
{
|
2017-05-18 12:59:38 +00:00
|
|
|
Config::Save();
|
2014-08-04 00:07:27 +00:00
|
|
|
}
|