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"
|
|
|
|
#include "Core/Core.h"
|
|
|
|
#include "DolphinWX/SoftwareVideoConfigDialog.h"
|
|
|
|
#include "DolphinWX/VideoConfigDiag.h"
|
|
|
|
#include "DolphinWX/WxUtils.h"
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
IntegerSetting<T>::IntegerSetting(wxWindow* parent, const wxString& label, T& setting, int minVal, int maxVal, long style) :
|
2014-12-02 03:56:18 +00:00
|
|
|
wxSpinCtrl(parent, wxID_ANY, label, wxDefaultPosition, wxDefaultSize, style),
|
2014-08-04 00:07:27 +00:00
|
|
|
m_setting(setting)
|
|
|
|
{
|
|
|
|
SetRange(minVal, maxVal);
|
|
|
|
SetValue(m_setting);
|
2014-08-05 01:36:08 +00:00
|
|
|
Bind(wxEVT_SPINCTRL, &IntegerSetting::UpdateValue, this);
|
2014-08-04 00:07:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-10-09 18:50:36 +00:00
|
|
|
SoftwareVideoConfigDialog::SoftwareVideoConfigDialog(wxWindow* parent, const std::string& title, const std::string& ininame) :
|
2014-12-02 03:56:18 +00:00
|
|
|
wxDialog(parent, wxID_ANY,
|
2015-10-09 18:50:36 +00:00
|
|
|
wxString(wxString::Format(_("Dolphin %s Graphics Configuration"), title)))
|
2014-08-04 00:07:27 +00:00
|
|
|
{
|
2016-05-17 20:57:25 +00:00
|
|
|
VideoConfig& vconfig = g_Config;
|
2015-10-09 18:50:36 +00:00
|
|
|
|
|
|
|
if (File::Exists(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini"))
|
|
|
|
vconfig.Load(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini");
|
|
|
|
else
|
|
|
|
vconfig.Load(File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini");
|
2014-08-04 00:07:27 +00:00
|
|
|
|
2014-12-02 03:56:18 +00:00
|
|
|
wxNotebook* const notebook = new wxNotebook(this, wxID_ANY);
|
2014-08-04 00:07:27 +00:00
|
|
|
|
|
|
|
// -- GENERAL --
|
|
|
|
{
|
2014-12-02 03:56:18 +00:00
|
|
|
wxPanel* const page_general= new wxPanel(notebook);
|
2014-08-05 01:36:08 +00:00
|
|
|
notebook->AddPage(page_general, _("General"));
|
2014-08-04 00:07:27 +00:00
|
|
|
wxBoxSizer* const szr_general = new wxBoxSizer(wxVERTICAL);
|
|
|
|
|
|
|
|
// - rendering
|
|
|
|
{
|
2014-08-05 01:36:08 +00:00
|
|
|
wxStaticBoxSizer* const group_rendering = new wxStaticBoxSizer(wxVERTICAL, page_general, _("Rendering"));
|
2014-08-04 00:07:27 +00:00
|
|
|
szr_general->Add(group_rendering, 0, wxEXPAND | wxALL, 5);
|
|
|
|
wxGridSizer* const szr_rendering = new wxGridSizer(2, 5, 5);
|
|
|
|
group_rendering->Add(szr_rendering, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
|
|
|
|
|
|
|
|
// backend
|
|
|
|
wxStaticText* const label_backend = new wxStaticText(page_general, wxID_ANY, _("Backend:"));
|
2014-08-05 01:36:08 +00:00
|
|
|
wxChoice* const choice_backend = new wxChoice(page_general, wxID_ANY);
|
2014-08-04 00:07:27 +00:00
|
|
|
|
2016-02-16 02:29:24 +00:00
|
|
|
for (const auto& backend : g_available_video_backends)
|
2014-08-04 00:07:27 +00:00
|
|
|
{
|
|
|
|
choice_backend->AppendString(StrToWxStr(backend->GetDisplayName()));
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: How to get the translated plugin name?
|
|
|
|
choice_backend->SetStringSelection(StrToWxStr(g_video_backend->GetName()));
|
2014-08-05 01:36:08 +00:00
|
|
|
choice_backend->Bind(wxEVT_CHOICE, &SoftwareVideoConfigDialog::Event_Backend, this);
|
2014-08-04 00:07:27 +00:00
|
|
|
|
|
|
|
szr_rendering->Add(label_backend, 1, wxALIGN_CENTER_VERTICAL, 5);
|
|
|
|
szr_rendering->Add(choice_backend, 1, 0, 0);
|
|
|
|
|
|
|
|
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
|
|
|
{
|
|
|
|
label_backend->Disable();
|
|
|
|
choice_backend->Disable();
|
|
|
|
}
|
|
|
|
|
|
|
|
// xfb
|
2015-10-09 18:50:36 +00:00
|
|
|
szr_rendering->Add(new SettingCheckBox(page_general, _("Bypass XFB"), "", vconfig.bUseXFB, true));
|
2014-08-04 00:07:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - info
|
|
|
|
{
|
2014-08-05 01:36:08 +00:00
|
|
|
wxStaticBoxSizer* const group_info = new wxStaticBoxSizer(wxVERTICAL, page_general, _("Overlay Information"));
|
2014-08-04 00:07:27 +00:00
|
|
|
szr_general->Add(group_info, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
|
|
|
|
wxGridSizer* const szr_info = new wxGridSizer(2, 5, 5);
|
|
|
|
group_info->Add(szr_info, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
|
|
|
|
|
2015-10-09 18:50:36 +00:00
|
|
|
szr_info->Add(new SettingCheckBox(page_general, _("Various Statistics"), "", vconfig.bOverlayStats));
|
2014-08-04 00:07:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - utility
|
|
|
|
{
|
2014-08-05 01:36:08 +00:00
|
|
|
wxStaticBoxSizer* const group_utility = new wxStaticBoxSizer(wxVERTICAL, page_general, _("Utility"));
|
2014-08-04 00:07:27 +00:00
|
|
|
szr_general->Add(group_utility, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
|
|
|
|
wxGridSizer* const szr_utility = new wxGridSizer(2, 5, 5);
|
|
|
|
group_utility->Add(szr_utility, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
|
|
|
|
|
2014-08-05 01:36:08 +00:00
|
|
|
szr_utility->Add(new SettingCheckBox(page_general, _("Dump Textures"), "", vconfig.bDumpTextures));
|
|
|
|
szr_utility->Add(new SettingCheckBox(page_general, _("Dump Objects"), "", vconfig.bDumpObjects));
|
2014-08-04 00:07:27 +00:00
|
|
|
|
|
|
|
// - debug only
|
2014-08-05 01:36:08 +00:00
|
|
|
wxStaticBoxSizer* const group_debug_only_utility = new wxStaticBoxSizer(wxHORIZONTAL, page_general, _("Debug Only"));
|
2014-08-04 00:07:27 +00:00
|
|
|
group_utility->Add(group_debug_only_utility, 0, wxEXPAND | wxBOTTOM, 5);
|
|
|
|
wxGridSizer* const szr_debug_only_utility = new wxGridSizer(2, 5, 5);
|
|
|
|
group_debug_only_utility->Add(szr_debug_only_utility, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
|
|
|
|
|
2014-08-05 01:36:08 +00:00
|
|
|
szr_debug_only_utility->Add(new SettingCheckBox(page_general, _("Dump TEV Stages"), "", vconfig.bDumpTevStages));
|
|
|
|
szr_debug_only_utility->Add(new SettingCheckBox(page_general, _("Dump Texture Fetches"), "", vconfig.bDumpTevTextureFetches));
|
2014-08-04 00:07:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - misc
|
|
|
|
{
|
2014-08-05 01:36:08 +00:00
|
|
|
wxStaticBoxSizer* const group_misc = new wxStaticBoxSizer(wxVERTICAL, page_general, _("Drawn Object Range"));
|
2014-08-04 00:07:27 +00:00
|
|
|
szr_general->Add(group_misc, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
|
|
|
|
wxFlexGridSizer* const szr_misc = new wxFlexGridSizer(2, 5, 5);
|
|
|
|
group_misc->Add(szr_misc, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
|
|
|
|
|
2015-10-09 18:50:36 +00:00
|
|
|
szr_misc->Add(new IntegerSetting<int>(page_general, _("Start"), vconfig.drawStart, 0, 100000));
|
|
|
|
szr_misc->Add(new IntegerSetting<int>(page_general, _("End"), vconfig.drawEnd, 0, 100000));
|
2014-08-04 00:07:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
page_general->SetSizerAndFit(szr_general);
|
|
|
|
}
|
|
|
|
|
|
|
|
wxBoxSizer* const szr_main = new wxBoxSizer(wxVERTICAL);
|
|
|
|
szr_main->Add(notebook, 1, wxEXPAND | wxALL, 5);
|
2014-08-05 01:36:08 +00:00
|
|
|
szr_main->Add(new wxButton(this, wxID_OK, _("Close"), wxDefaultPosition),
|
2014-08-04 00:07:27 +00:00
|
|
|
0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 5);
|
|
|
|
|
|
|
|
SetSizerAndFit(szr_main);
|
|
|
|
Center();
|
|
|
|
SetFocus();
|
|
|
|
}
|
|
|
|
|
|
|
|
SoftwareVideoConfigDialog::~SoftwareVideoConfigDialog()
|
|
|
|
{
|
2016-05-17 20:57:25 +00:00
|
|
|
g_Config.Save((File::GetUserPath(D_CONFIG_IDX) + "GFX.ini").c_str());
|
2014-08-04 00:07:27 +00:00
|
|
|
}
|