ControlDialog::ControlDialog(GamepadPage* const parent, InputPlugin& plugin, ControllerInterface::ControlReference* const ref) : wxDialog(parent, -1, _("Configure Control"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) , control_reference(ref) , m_plugin(plugin) , m_parent(parent) { m_devq = m_parent->controller->default_device; // GetStrings() sounds slow :/ //device_cbox = new wxComboBox(this, -1, WXSTR_FROM_STR(ref->device_qualifier.ToString()), wxDefaultPosition, wxSize(256,-1), parent->device_cbox->GetStrings(), wxTE_PROCESS_ENTER); device_cbox = new wxComboBox(this, -1, WXSTR_FROM_STR(m_devq.ToString()), wxDefaultPosition, wxSize(256,-1), parent->device_cbox->GetStrings(), wxTE_PROCESS_ENTER); _connect_macro_(device_cbox, ControlDialog::SetDevice, wxEVT_COMMAND_COMBOBOX_SELECTED, this); _connect_macro_(device_cbox, ControlDialog::SetDevice, wxEVT_COMMAND_TEXT_ENTER, this); wxStaticBoxSizer* const control_chooser = CreateControlChooser(this, parent); wxStaticBoxSizer* const d_szr = new wxStaticBoxSizer(wxVERTICAL, this, _("Device")); d_szr->Add(device_cbox, 0, wxEXPAND|wxALL, 5); wxBoxSizer* const szr = new wxBoxSizer(wxVERTICAL); szr->Add(d_szr, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5); szr->Add(control_chooser, 1, wxEXPAND|wxALL, 5); SetSizerAndFit(szr); // needed UpdateGUI(); SetFocus(); }
SettingChoice::SettingChoice(wxWindow* parent, int &setting, const wxString& tooltip, int num, const wxString choices[], long style) : wxChoice(parent, -1, wxDefaultPosition, wxDefaultSize, num, choices) , m_setting(setting) { SetToolTip(tooltip); Select(m_setting); _connect_macro_(this, SettingChoice::UpdateValue, wxEVT_COMMAND_CHOICE_SELECTED, this); }
SettingRadioButton::BoolSetting(wxWindow* parent, const wxString& label, const wxString& tooltip, bool &setting, bool reverse, long style) : wxRadioButton(parent, -1, label, wxDefaultPosition, wxDefaultSize, style) , m_setting(setting) , m_reverse(reverse) { SetToolTip(tooltip); SetValue(m_setting ^ m_reverse); _connect_macro_(this, SettingRadioButton::UpdateValue, wxEVT_COMMAND_RADIOBUTTON_SELECTED, this); }
SettingCheckBox::BoolSetting(wxWindow* parent, const wxString& label, const wxString& tooltip, bool &setting, bool reverse, long style) : wxCheckBox(parent, -1, label, wxDefaultPosition, wxDefaultSize, style) , m_setting(setting) , m_reverse(reverse) { SetToolTip(tooltip); SetValue(m_setting ^ m_reverse); _connect_macro_(this, SettingCheckBox::UpdateValue, wxEVT_COMMAND_CHECKBOX_CLICKED, this); }
GamepadPage::GamepadPage(wxWindow* parent, InputPlugin& plugin, const unsigned int pad_num, InputConfigDialog* const config_dialog) : wxNotebookPage(parent, -1 , wxDefaultPosition, wxDefaultSize) ,controller(plugin.controllers[pad_num]) , m_config_dialog(config_dialog) , m_plugin(plugin) { wxBoxSizer* control_group_sizer = new ControlGroupsSizer(m_plugin.controllers[pad_num], this, this, &control_groups); wxStaticBoxSizer* profile_sbox = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Profile")); // device chooser wxStaticBoxSizer* const device_sbox = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Device")); device_cbox = new wxComboBox(this, -1, wxT(""), wxDefaultPosition, wxSize(64,-1)); device_cbox->ToggleWindowStyle(wxTE_PROCESS_ENTER); wxButton* refresh_button = new wxButton(this, -1, _("Refresh"), wxDefaultPosition, wxSize(60,-1)); _connect_macro_(device_cbox, GamepadPage::SetDevice, wxEVT_COMMAND_COMBOBOX_SELECTED, this); _connect_macro_(device_cbox, GamepadPage::SetDevice, wxEVT_COMMAND_TEXT_ENTER, this); _connect_macro_(refresh_button, GamepadPage::RefreshDevices, wxEVT_COMMAND_BUTTON_CLICKED, this); device_sbox->Add(device_cbox, 1, wxLEFT|wxRIGHT, 3); device_sbox->Add(refresh_button, 0, wxRIGHT|wxBOTTOM, 3); wxButton* const default_button = new wxButton(this, -1, _("Default"), wxDefaultPosition, wxSize(48,-1)); wxButton* const clearall_button = new wxButton(this, -1, _("Clear"), wxDefaultPosition, wxSize(58,-1)); wxStaticBoxSizer* const clear_sbox = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Reset")); clear_sbox->Add(default_button, 1, wxLEFT, 3); clear_sbox->Add(clearall_button, 1, wxRIGHT, 3); _connect_macro_(clearall_button, GamepadPage::ClearAll, wxEVT_COMMAND_BUTTON_CLICKED, this); _connect_macro_(default_button, GamepadPage::LoadDefaults, wxEVT_COMMAND_BUTTON_CLICKED, this); profile_cbox = new wxComboBox(this, -1, wxT(""), wxDefaultPosition, wxSize(64,-1)); wxButton* const pload_btn = new wxButton(this, -1, _("Load"), wxDefaultPosition, wxSize(48,-1)); wxButton* const psave_btn = new wxButton(this, -1, _("Save"), wxDefaultPosition, wxSize(48,-1)); wxButton* const pdelete_btn = new wxButton(this, -1, _("Delete"), wxDefaultPosition, wxSize(60,-1)); _connect_macro_(pload_btn, GamepadPage::LoadProfile, wxEVT_COMMAND_BUTTON_CLICKED, this); _connect_macro_(psave_btn, GamepadPage::SaveProfile, wxEVT_COMMAND_BUTTON_CLICKED, this); _connect_macro_(pdelete_btn, GamepadPage::DeleteProfile, wxEVT_COMMAND_BUTTON_CLICKED, this); profile_sbox->Add(profile_cbox, 1, wxLEFT, 3); profile_sbox->Add(pload_btn, 0, wxLEFT, 3); profile_sbox->Add(psave_btn, 0, 0, 3); profile_sbox->Add(pdelete_btn, 0, wxRIGHT|wxBOTTOM, 3); wxBoxSizer* const dio = new wxBoxSizer(wxHORIZONTAL); dio->Add(device_sbox, 1, wxEXPAND|wxRIGHT, 5); dio->Add(clear_sbox, 0, wxEXPAND|wxRIGHT, 5); dio->Add(profile_sbox, 1, wxEXPAND|wxRIGHT, 5); wxBoxSizer* const mapping = new wxBoxSizer(wxVERTICAL); mapping->Add(dio, 1, wxEXPAND|wxLEFT|wxTOP|wxBOTTOM, 5); mapping->Add(control_group_sizer, 0, wxLEFT|wxEXPAND, 5); UpdateGUI(); SetSizerAndFit(mapping); // needed Layout(); };
ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWindow* const parent, wxWindow* const eventsink) : wxBoxSizer(wxVERTICAL) , control_group(group) { static_bitmap = NULL; wxFont m_SmallFont(7, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); std::vector<ControllerEmu::ControlGroup::Control*>::iterator ci = group->controls.begin(), ce = group->controls.end(); for (; ci != ce; ++ci) { wxStaticText* const label = new wxStaticText(parent, -1, WXTSTR_FROM_CSTR((*ci)->name)); ControlButton* const control_button = new ControlButton(parent, (*ci)->control_ref, 80); control_button->SetFont(m_SmallFont); control_buttons.push_back(control_button); if ((*ci)->control_ref->is_input) { control_button->SetToolTip(_("Left-click to detect input.\nMiddle-click to clear.\nRight-click for more options.")); _connect_macro_(control_button, GamepadPage::DetectControl, wxEVT_COMMAND_BUTTON_CLICKED, eventsink); } else { control_button->SetToolTip(_("Left/Right-click for more options.\nMiddle-click to clear.")); _connect_macro_(control_button, GamepadPage::ConfigControl, wxEVT_COMMAND_BUTTON_CLICKED, eventsink); } _connect_macro_(control_button, GamepadPage::ClearControl, wxEVT_MIDDLE_DOWN, eventsink); _connect_macro_(control_button, GamepadPage::ConfigControl, wxEVT_RIGHT_UP, eventsink); wxBoxSizer* const control_sizer = new wxBoxSizer(wxHORIZONTAL); control_sizer->AddStretchSpacer(1); control_sizer->Add(label, 0, wxCENTER | wxRIGHT, 3); control_sizer->Add(control_button, 0, 0, 0); Add(control_sizer, 0, wxEXPAND|wxLEFT|wxRIGHT, 3); } wxMemoryDC dc; switch (group->type) { case GROUP_TYPE_STICK: case GROUP_TYPE_TILT: case GROUP_TYPE_CURSOR: case GROUP_TYPE_FORCE: { wxBitmap bitmap(64, 64); dc.SelectObject(bitmap); dc.Clear(); static_bitmap = new wxStaticBitmap(parent, -1, bitmap, wxDefaultPosition, wxDefaultSize, wxBITMAP_TYPE_BMP); std::vector< ControllerEmu::ControlGroup::Setting* >::const_iterator i = group->settings.begin(), e = group->settings.end(); wxBoxSizer* const szr = new wxBoxSizer(wxVERTICAL); for (; i!=e; ++i) { PadSettingSpin* setting = new PadSettingSpin(parent, *i); _connect_macro_(setting->wxcontrol, GamepadPage::AdjustSetting, wxEVT_COMMAND_SPINCTRL_UPDATED, eventsink); options.push_back(setting); szr->Add(new wxStaticText(parent, -1, WXTSTR_FROM_CSTR((*i)->name))); szr->Add(setting->wxcontrol, 0, wxLEFT, 0); } wxBoxSizer* const h_szr = new wxBoxSizer(wxHORIZONTAL); h_szr->Add(szr, 1, 0, 5); h_szr->Add(static_bitmap, 0, wxALL|wxCENTER, 3); Add(h_szr, 0, wxEXPAND|wxLEFT|wxCENTER|wxTOP, 3); } break; case GROUP_TYPE_BUTTONS: { wxBitmap bitmap(int(12*group->controls.size()+1), 12); dc.SelectObject(bitmap); dc.Clear(); static_bitmap = new wxStaticBitmap(parent, -1, bitmap, wxDefaultPosition, wxDefaultSize, wxBITMAP_TYPE_BMP); PadSettingSpin* const threshold_cbox = new PadSettingSpin(parent, group->settings[0]); _connect_macro_(threshold_cbox->wxcontrol, GamepadPage::AdjustSetting, wxEVT_COMMAND_SPINCTRL_UPDATED, eventsink); threshold_cbox->wxcontrol->SetToolTip(_("Adjust the analog control pressure required to activate buttons.")); options.push_back(threshold_cbox); wxBoxSizer* const szr = new wxBoxSizer(wxHORIZONTAL); szr->Add(new wxStaticText(parent, -1, WXTSTR_FROM_CSTR(group->settings[0]->name)), 0, wxCENTER|wxRIGHT, 3); szr->Add(threshold_cbox->wxcontrol, 0, wxRIGHT, 3); Add(szr, 0, wxALL|wxCENTER, 3); Add(static_bitmap, 0, wxALL|wxCENTER, 3); } break; case GROUP_TYPE_MIXED_TRIGGERS: case GROUP_TYPE_TRIGGERS: case GROUP_TYPE_SLIDER: { int height = (int)(12 * group->controls.size()); int width = 64; if (GROUP_TYPE_MIXED_TRIGGERS == group->type) width = 64+12+1; if (GROUP_TYPE_TRIGGERS != group->type) height /= 2; wxBitmap bitmap(width, height+1); dc.SelectObject(bitmap); dc.Clear(); static_bitmap = new wxStaticBitmap(parent, -1, bitmap, wxDefaultPosition, wxDefaultSize, wxBITMAP_TYPE_BMP); std::vector<ControllerEmu::ControlGroup::Setting*>::const_iterator i = group->settings.begin(), e = group->settings.end(); for (; i!=e; ++i) { PadSettingSpin* setting = new PadSettingSpin(parent, *i); _connect_macro_(setting->wxcontrol, GamepadPage::AdjustSetting, wxEVT_COMMAND_SPINCTRL_UPDATED, eventsink); options.push_back(setting); wxBoxSizer* const szr = new wxBoxSizer(wxHORIZONTAL); szr->Add(new wxStaticText(parent, -1, WXTSTR_FROM_CSTR((*i)->name)), 0, wxCENTER|wxRIGHT, 3); szr->Add(setting->wxcontrol, 0, wxRIGHT, 3); Add(szr, 0, wxALL|wxCENTER, 3); } Add(static_bitmap, 0, wxALL|wxCENTER, 3); } break; case GROUP_TYPE_EXTENSION: { PadSettingExtension* const attachments = new PadSettingExtension(parent, (ControllerEmu::Extension*)group); wxButton* const configure_btn = new ExtensionButton(parent, (ControllerEmu::Extension*)group); options.push_back(attachments); _connect_macro_(attachments->wxcontrol, GamepadPage::AdjustSetting, wxEVT_COMMAND_CHOICE_SELECTED, eventsink); _connect_macro_(configure_btn, GamepadPage::ConfigExtension, wxEVT_COMMAND_BUTTON_CLICKED, eventsink); Add(attachments->wxcontrol, 0, wxTOP|wxLEFT|wxRIGHT|wxEXPAND, 3); Add(configure_btn, 0, wxALL|wxEXPAND, 3); } break; case GROUP_TYPE_UDPWII: { wxButton* const btn = new UDPConfigButton(parent, (UDPWrapper*)group); _connect_macro_(btn, GamepadPage::ConfigUDPWii, wxEVT_COMMAND_BUTTON_CLICKED, eventsink); Add(btn, 0, wxALL|wxEXPAND, 3); } break; default: { //options std::vector<ControllerEmu::ControlGroup::Setting*>::const_iterator i = group->settings.begin(), e = group->settings.end(); for (; i!=e; ++i) { PadSettingCheckBox* setting_cbox = new PadSettingCheckBox(parent, (*i)->value, (*i)->name); _connect_macro_(setting_cbox->wxcontrol, GamepadPage::AdjustSetting, wxEVT_COMMAND_CHECKBOX_CLICKED, eventsink); options.push_back(setting_cbox); Add(setting_cbox->wxcontrol, 0, wxALL|wxLEFT, 5); } } break; } dc.SelectObject(wxNullBitmap); //AddStretchSpacer(0); }
wxStaticBoxSizer* ControlDialog::CreateControlChooser(wxWindow* const parent, wxWindow* const eventsink) { wxStaticBoxSizer* const main_szr = new wxStaticBoxSizer(wxVERTICAL, parent, control_reference->is_input ? _("Input") : _("Output")); textctrl = new wxTextCtrl(parent, -1, wxEmptyString, wxDefaultPosition, wxSize(-1, 48), wxTE_MULTILINE); wxButton* const detect_button = new wxButton(parent, -1, control_reference->is_input ? _("Detect") : _("Test")); wxButton* const clear_button = new wxButton(parent, -1, _("Clear")); wxButton* const set_button = new wxButton(parent, -1, _("Set")); wxButton* const select_button = new wxButton(parent, -1, _("Select")); _connect_macro_(select_button, ControlDialog::SetSelectedControl, wxEVT_COMMAND_BUTTON_CLICKED, parent); wxButton* const or_button = new wxButton(parent, -1, _("| OR"), wxDefaultPosition); _connect_macro_(or_button, ControlDialog::AppendControl, wxEVT_COMMAND_BUTTON_CLICKED, parent); control_lbox = new wxListBox(parent, -1, wxDefaultPosition, wxSize(-1, 64)); wxBoxSizer* const button_sizer = new wxBoxSizer(wxVERTICAL); button_sizer->Add(detect_button, 1, 0, 5); button_sizer->Add(select_button, 1, 0, 5); button_sizer->Add(or_button, 1, 0, 5); if (control_reference->is_input) { // TODO: check if && is good on other OS wxButton* const and_button = new wxButton(parent, -1, _("&& AND"), wxDefaultPosition); wxButton* const not_button = new wxButton(parent, -1, _("! NOT"), wxDefaultPosition); wxButton* const add_button = new wxButton(parent, -1, _("^ ADD"), wxDefaultPosition); _connect_macro_(and_button, ControlDialog::AppendControl, wxEVT_COMMAND_BUTTON_CLICKED, parent); _connect_macro_(not_button, ControlDialog::AppendControl, wxEVT_COMMAND_BUTTON_CLICKED, parent); _connect_macro_(add_button, ControlDialog::AppendControl, wxEVT_COMMAND_BUTTON_CLICKED, parent); button_sizer->Add(and_button, 1, 0, 5); button_sizer->Add(not_button, 1, 0, 5); button_sizer->Add(add_button, 1, 0, 5); } range_slider = new wxSlider(parent, -1, SLIDER_TICK_COUNT, 0, SLIDER_TICK_COUNT * 5, wxDefaultPosition, wxDefaultSize, wxSL_TOP | wxSL_LABELS /*| wxSL_AUTOTICKS*/); range_slider->SetValue((int)(control_reference->range * SLIDER_TICK_COUNT)); _connect_macro_(detect_button, ControlDialog::DetectControl, wxEVT_COMMAND_BUTTON_CLICKED, parent); _connect_macro_(clear_button, ControlDialog::ClearControl, wxEVT_COMMAND_BUTTON_CLICKED, parent); _connect_macro_(set_button, ControlDialog::SetControl, wxEVT_COMMAND_BUTTON_CLICKED, parent); _connect_macro_(range_slider, GamepadPage::AdjustControlOption, wxEVT_SCROLL_CHANGED, eventsink); wxStaticText* const range_label = new wxStaticText(parent, -1, _("Range")); m_bound_label = new wxStaticText(parent, -1, wxT("")); wxBoxSizer* const range_sizer = new wxBoxSizer(wxHORIZONTAL); range_sizer->Add(range_label, 0, wxCENTER|wxLEFT, 5); range_sizer->Add(range_slider, 1, wxEXPAND|wxLEFT, 5); wxBoxSizer* const ctrls_sizer = new wxBoxSizer(wxHORIZONTAL); ctrls_sizer->Add(control_lbox, 1, wxEXPAND, 0); ctrls_sizer->Add(button_sizer, 0, wxEXPAND, 0); wxSizer* const bottom_btns_sizer = CreateButtonSizer(wxOK); bottom_btns_sizer->Prepend(set_button, 0, wxRIGHT, 5); bottom_btns_sizer->Prepend(clear_button, 0, wxLEFT, 5); main_szr->Add(range_sizer, 0, wxEXPAND|wxLEFT|wxRIGHT, 5); main_szr->Add(ctrls_sizer, 0, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 5); main_szr->Add(textctrl, 1, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 5); main_szr->Add(bottom_btns_sizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5); main_szr->Add(m_bound_label, 0, wxCENTER, 0); UpdateListContents(); return main_szr; }
VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, const std::string& _ininame) : wxDialog(parent, -1, wxString::Format(_("Dolphin %s Graphics Configuration"), wxGetTranslation(wxString::From8BitData(title.c_str()))), wxDefaultPosition, wxDefaultSize) , vconfig(g_Config) , ininame(_ininame) { vconfig.Load((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str()); Connect(wxID_ANY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(VideoConfigDiag::OnUpdateUI), NULL, this); wxNotebook* const notebook = new wxNotebook(this, -1, wxDefaultPosition, wxDefaultSize); // -- GENERAL -- { wxPanel* const page_general = new wxPanel(notebook, -1, wxDefaultPosition); notebook->AddPage(page_general, _("General")); wxBoxSizer* const szr_general = new wxBoxSizer(wxVERTICAL); // - basic { wxFlexGridSizer* const szr_basic = new wxFlexGridSizer(2, 5, 5); // backend { wxStaticText* const label_backend = new wxStaticText(page_general, wxID_ANY, _("Backend:")); choice_backend = new wxChoice(page_general, wxID_ANY, wxDefaultPosition); RegisterControl(choice_backend, wxGetTranslation(backend_desc)); std::vector<VideoBackend*>::const_iterator it = g_available_video_backends.begin(), itend = g_available_video_backends.end(); for (; it != itend; ++it) choice_backend->AppendString(wxGetTranslation(wxString::FromAscii((*it)->GetName().c_str()))); choice_backend->SetStringSelection(wxGetTranslation(wxString::FromAscii(g_video_backend->GetName().c_str()))); _connect_macro_(choice_backend, VideoConfigDiag::Event_Backend, wxEVT_COMMAND_CHOICE_SELECTED, this); szr_basic->Add(label_backend, 1, wxALIGN_CENTER_VERTICAL, 5); szr_basic->Add(choice_backend, 1, 0, 0); if (Core::GetState() != Core::CORE_UNINITIALIZED) { label_backend->Disable(); choice_backend->Disable(); } } // adapter (D3D only) if (vconfig.backend_info.Adapters.size()) { wxChoice* const choice_adapter = CreateChoice(page_general, vconfig.iAdapter, wxGetTranslation(adapter_desc)); std::vector<std::string>::const_iterator it = vconfig.backend_info.Adapters.begin(), itend = vconfig.backend_info.Adapters.end(); for (; it != itend; ++it) choice_adapter->AppendString(wxString::FromAscii(it->c_str())); choice_adapter->Select(vconfig.iAdapter); szr_basic->Add(new wxStaticText(page_general, -1, _("Adapter:")), 1, wxALIGN_CENTER_VERTICAL, 5); szr_basic->Add(choice_adapter, 1, 0, 0); } // - display wxFlexGridSizer* const szr_display = new wxFlexGridSizer(2, 5, 5); { // display resolution { wxArrayString res_list = GetListOfResolutions(); if (res_list.empty()) res_list.Add(_("<No resolutions found>")); wxStaticText* const label_display_resolution = new wxStaticText(page_general, wxID_ANY, _("Fullscreen resolution:")); choice_display_resolution = new wxChoice(page_general, wxID_ANY, wxDefaultPosition, wxDefaultSize, res_list); RegisterControl(choice_display_resolution, wxGetTranslation(display_res_desc)); _connect_macro_(choice_display_resolution, VideoConfigDiag::Event_DisplayResolution, wxEVT_COMMAND_CHOICE_SELECTED, this); choice_display_resolution->SetStringSelection(wxString::FromAscii(SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution.c_str())); szr_display->Add(label_display_resolution, 1, wxALIGN_CENTER_VERTICAL, 0); szr_display->Add(choice_display_resolution); if (Core::GetState() != Core::CORE_UNINITIALIZED) { label_display_resolution->Disable(); choice_display_resolution->Disable(); } } // aspect-ratio { const wxString ar_choices[] = { _("Auto"), _("Force 16:9"), _("Force 4:3"), _("Stretch to Window") }; szr_display->Add(new wxStaticText(page_general, -1, _("Aspect Ratio:")), 1, wxALIGN_CENTER_VERTICAL, 0); wxChoice* const choice_aspect = CreateChoice(page_general, vconfig.iAspectRatio, wxGetTranslation(ar_desc), sizeof(ar_choices)/sizeof(*ar_choices), ar_choices); szr_display->Add(choice_aspect, 1, 0, 0); } // various other display options { szr_display->Add(CreateCheckBox(page_general, _("V-Sync"), wxGetTranslation(vsync_desc), vconfig.bVSync)); szr_display->Add(CreateCheckBox(page_general, _("Use Fullscreen"), wxGetTranslation(use_fullscreen_desc), SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen)); } } // - other wxFlexGridSizer* const szr_other = new wxFlexGridSizer(2, 5, 5); { SettingCheckBox* render_to_main_cb; szr_other->Add(CreateCheckBox(page_general, _("Show FPS"), wxGetTranslation(show_fps_desc), vconfig.bShowFPS)); szr_other->Add(CreateCheckBox(page_general, _("Auto adjust Window Size"), wxGetTranslation(auto_window_size_desc), SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderWindowAutoSize)); szr_other->Add(CreateCheckBox(page_general, _("Keep window on top"), wxGetTranslation(keep_window_on_top_desc), SConfig::GetInstance().m_LocalCoreStartupParameter.bKeepWindowOnTop)); szr_other->Add(CreateCheckBox(page_general, _("Hide Mouse Cursor"), wxGetTranslation(hide_mouse_cursor_desc), SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)); szr_other->Add(render_to_main_cb = CreateCheckBox(page_general, _("Render to Main Window"), wxGetTranslation(render_to_main_win_desc), SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)); if (Core::GetState() != Core::CORE_UNINITIALIZED) render_to_main_cb->Disable(); } wxStaticBoxSizer* const group_basic = new wxStaticBoxSizer(wxVERTICAL, page_general, _("Basic")); group_basic->Add(szr_basic, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); szr_general->Add(group_basic, 0, wxEXPAND | wxALL, 5); wxStaticBoxSizer* const group_display = new wxStaticBoxSizer(wxVERTICAL, page_general, _("Display")); group_display->Add(szr_display, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); szr_general->Add(group_display, 0, wxEXPAND | wxALL, 5); wxStaticBoxSizer* const group_other = new wxStaticBoxSizer(wxVERTICAL, page_general, _("Other")); group_other->Add(szr_other, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); szr_general->Add(group_other, 0, wxEXPAND | wxALL, 5); } szr_general->AddStretchSpacer(); CreateDescriptionArea(page_general, szr_general); page_general->SetSizerAndFit(szr_general); } // -- ENHANCEMENTS -- { wxPanel* const page_enh = new wxPanel(notebook, -1, wxDefaultPosition); notebook->AddPage(page_enh, _("Enhancements")); wxBoxSizer* const szr_enh_main = new wxBoxSizer(wxVERTICAL); // - enhancements wxFlexGridSizer* const szr_enh = new wxFlexGridSizer(2, 5, 5); // Internal resolution { const wxString efbscale_choices[] = { _("Auto (Window Size)"), _("Auto (Multiple of 640x528)"), wxT("1x Native (640x528)"), wxT("1.5x Native (960x792)"), wxT("2x Native (1280x1056)"), wxT("2.5x Native (1600x1320)"), wxT("3x Native (1920x1584)"), wxT("4x Native (2560x2112)") }; wxChoice *const choice_efbscale = CreateChoice(page_enh, vconfig.iEFBScale, wxGetTranslation(internal_res_desc), sizeof(efbscale_choices)/sizeof(*efbscale_choices), efbscale_choices); szr_enh->Add(new wxStaticText(page_enh, wxID_ANY, _("Internal Resolution:")), 1, wxALIGN_CENTER_VERTICAL, 0); szr_enh->Add(choice_efbscale); } // AA { text_aamode = new wxStaticText(page_enh, -1, _("Anti-Aliasing:")); choice_aamode = CreateChoice(page_enh, vconfig.iMultisampleMode, wxGetTranslation(aa_desc)); std::vector<std::string>::const_iterator it = vconfig.backend_info.AAModes.begin(), itend = vconfig.backend_info.AAModes.end(); for (; it != itend; ++it) choice_aamode->AppendString(wxGetTranslation(wxString::FromAscii(it->c_str()))); choice_aamode->Select(vconfig.iMultisampleMode); szr_enh->Add(text_aamode, 1, wxALIGN_CENTER_VERTICAL, 0); szr_enh->Add(choice_aamode); } // AF { const wxString af_choices[] = {wxT("1x"), wxT("2x"), wxT("4x"), wxT("8x"), wxT("16x")}; szr_enh->Add(new wxStaticText(page_enh, -1, _("Anisotropic Filtering:")), 1, wxALIGN_CENTER_VERTICAL, 0); szr_enh->Add(CreateChoice(page_enh, vconfig.iMaxAnisotropy, wxGetTranslation(af_desc), 5, af_choices)); } // postproc shader if (vconfig.backend_info.PPShaders.size()) { wxChoice *const choice_ppshader = new wxChoice(page_enh, -1, wxDefaultPosition); RegisterControl(choice_ppshader, wxGetTranslation(ppshader_desc)); choice_ppshader->AppendString(_("(off)")); std::vector<std::string>::const_iterator it = vconfig.backend_info.PPShaders.begin(), itend = vconfig.backend_info.PPShaders.end(); for (; it != itend; ++it) choice_ppshader->AppendString(wxString::FromAscii(it->c_str())); if (vconfig.sPostProcessingShader.empty()) choice_ppshader->Select(0); else choice_ppshader->SetStringSelection(wxString::FromAscii(vconfig.sPostProcessingShader.c_str())); _connect_macro_(choice_ppshader, VideoConfigDiag::Event_PPShader, wxEVT_COMMAND_CHOICE_SELECTED, this); szr_enh->Add(new wxStaticText(page_enh, -1, _("Post-Processing Effect:")), 1, wxALIGN_CENTER_VERTICAL, 0); szr_enh->Add(choice_ppshader); } // Scaled copy, PL, Bilinear filter, 3D Vision szr_enh->Add(CreateCheckBox(page_enh, _("Scaled EFB Copy"), wxGetTranslation(scaled_efb_copy_desc), vconfig.bCopyEFBScaled)); szr_enh->Add(pixel_lighting = CreateCheckBox(page_enh, _("Per-Pixel Lighting"), wxGetTranslation(pixel_lighting_desc), vconfig.bEnablePixelLighting)); szr_enh->Add(CreateCheckBox(page_enh, _("Force Texture Filtering"), wxGetTranslation(force_filtering_desc), vconfig.bForceFiltering)); // 3D Vision _3d_vision = CreateCheckBox(page_enh, _("3D Vision"), wxGetTranslation(_3d_vision_desc), vconfig.b3DVision); _3d_vision->Show(vconfig.backend_info.bSupports3DVision); szr_enh->Add(_3d_vision); // TODO: Add anaglyph 3d here wxStaticBoxSizer* const group_enh = new wxStaticBoxSizer(wxVERTICAL, page_enh, _("Enhancements")); group_enh->Add(szr_enh, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); szr_enh_main->Add(group_enh, 0, wxEXPAND | wxALL, 5); szr_enh_main->AddStretchSpacer(); CreateDescriptionArea(page_enh, szr_enh_main); page_enh->SetSizerAndFit(szr_enh_main); } // -- SPEED HACKS -- { wxPanel* const page_hacks = new wxPanel(notebook, -1, wxDefaultPosition); notebook->AddPage(page_hacks, _("Hacks")); wxBoxSizer* const szr_hacks = new wxBoxSizer(wxVERTICAL); // - EFB hacks wxStaticBoxSizer* const szr_efb = new wxStaticBoxSizer(wxVERTICAL, page_hacks, _("Embedded Frame Buffer")); // format change emulation emulate_efb_format_changes = CreateCheckBox(page_hacks, _("Ignore Format Changes"), wxGetTranslation(efb_emulate_format_changes_desc), vconfig.bEFBEmulateFormatChanges, true); // EFB copies wxStaticBoxSizer* const group_efbcopy = new wxStaticBoxSizer(wxHORIZONTAL, page_hacks, _("EFB Copies")); SettingCheckBox* efbcopy_disable = CreateCheckBox(page_hacks, _("Disable"), wxGetTranslation(efb_copy_desc), vconfig.bEFBCopyEnable, true); efbcopy_texture = CreateRadioButton(page_hacks, _("Texture"), wxGetTranslation(efb_copy_texture_desc), vconfig.bCopyEFBToTexture, false, wxRB_GROUP); efbcopy_ram = CreateRadioButton(page_hacks, _("RAM"), wxGetTranslation(efb_copy_ram_desc), vconfig.bCopyEFBToTexture, true); cache_efb_copies = CreateCheckBox(page_hacks, _("Enable Cache"), wxGetTranslation(cache_efb_copies_desc), vconfig.bEFBCopyCacheEnable); group_efbcopy->Add(efbcopy_disable, 0, wxLEFT | wxRIGHT | wxBOTTOM, 5); group_efbcopy->AddStretchSpacer(1); group_efbcopy->Add(efbcopy_texture, 0, wxRIGHT, 5); group_efbcopy->Add(efbcopy_ram, 0, wxRIGHT, 5); group_efbcopy->Add(cache_efb_copies, 0, wxRIGHT, 5); szr_efb->Add(CreateCheckBox(page_hacks, _("Skip EFB Access from CPU"), wxGetTranslation(efb_access_desc), vconfig.bEFBAccessEnable, true), 0, wxBOTTOM | wxLEFT, 5); szr_efb->Add(emulate_efb_format_changes, 0, wxBOTTOM | wxLEFT, 5); szr_efb->Add(group_efbcopy, 0, wxEXPAND | wxALL, 5); szr_hacks->Add(szr_efb, 0, wxEXPAND | wxALL, 5); // Texture cache { wxStaticBoxSizer* const szr_safetex = new wxStaticBoxSizer(wxHORIZONTAL, page_hacks, _("Texture Cache")); // TODO: Use wxSL_MIN_MAX_LABELS or wxSL_VALUE_LABEL with wx 2.9.1 wxSlider* const stc_slider = new wxSlider(page_hacks, wxID_ANY, 0, 0, 2, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_BOTTOM); _connect_macro_(stc_slider, VideoConfigDiag::Event_Stc, wxEVT_COMMAND_SLIDER_UPDATED, this); RegisterControl(stc_slider, wxGetTranslation(stc_desc)); if (vconfig.iSafeTextureCache_ColorSamples == 0) stc_slider->SetValue(0); else if (vconfig.iSafeTextureCache_ColorSamples == 512) stc_slider->SetValue(1); else if (vconfig.iSafeTextureCache_ColorSamples == 128) stc_slider->SetValue(2); else stc_slider->Disable(); // Using custom number of samples; TODO: Inform the user why this is disabled.. szr_safetex->Add(new wxStaticText(page_hacks, wxID_ANY, _("Accuracy:")), 0, wxALL, 5); szr_safetex->AddStretchSpacer(1); szr_safetex->Add(new wxStaticText(page_hacks, wxID_ANY, _("Safe")), 0, wxLEFT|wxTOP|wxBOTTOM, 5); szr_safetex->Add(stc_slider, 2, wxRIGHT, 0); szr_safetex->Add(new wxStaticText(page_hacks, wxID_ANY, _("Fast")), 0, wxRIGHT|wxTOP|wxBOTTOM, 5); szr_hacks->Add(szr_safetex, 0, wxEXPAND | wxALL, 5); } // - XFB { wxStaticBoxSizer* const group_xfb = new wxStaticBoxSizer(wxHORIZONTAL, page_hacks, _("External Frame Buffer")); SettingCheckBox* disable_xfb = CreateCheckBox(page_hacks, _("Disable"), wxGetTranslation(xfb_desc), vconfig.bUseXFB, true); virtual_xfb = CreateRadioButton(page_hacks, _("Virtual"), wxGetTranslation(xfb_virtual_desc), vconfig.bUseRealXFB, true, wxRB_GROUP); real_xfb = CreateRadioButton(page_hacks, _("Real"), wxGetTranslation(xfb_real_desc), vconfig.bUseRealXFB); group_xfb->Add(disable_xfb, 0, wxLEFT | wxRIGHT | wxBOTTOM, 5); group_xfb->AddStretchSpacer(1); group_xfb->Add(virtual_xfb, 0, wxRIGHT, 5); group_xfb->Add(real_xfb, 0, wxRIGHT, 5); szr_hacks->Add(group_xfb, 0, wxEXPAND | wxALL, 5); } // xfb // - other hacks { wxGridSizer* const szr_other = new wxGridSizer(2, 5, 5); szr_other->Add(CreateCheckBox(page_hacks, _("Fast Mipmaps"), wxGetTranslation(fast_mipmaps_desc), vconfig.bUseNativeMips, true)); szr_other->Add(CreateCheckBox(page_hacks, _("Cache Display Lists"), wxGetTranslation(dlc_desc), vconfig.bDlistCachingEnable)); szr_other->Add(CreateCheckBox(page_hacks, _("Disable Lighting"), wxGetTranslation(disable_lighting_desc), vconfig.bDisableLighting)); szr_other->Add(CreateCheckBox(page_hacks, _("Disable Fog"), wxGetTranslation(disable_fog_desc), vconfig.bDisableFog)); szr_other->Add(CreateCheckBox(page_hacks, _("Disable Per-Pixel Depth"), wxGetTranslation(pixel_depth_desc), vconfig.bEnablePerPixelDepth, true)); szr_other->Add(CreateCheckBox(page_hacks, _("Skip Dest. Alpha Pass"), wxGetTranslation(disable_alphapass_desc), vconfig.bDstAlphaPass)); szr_other->Add(CreateCheckBox(page_hacks, _("OpenCL Texture Decoder"), wxGetTranslation(opencl_desc), vconfig.bEnableOpenCL)); szr_other->Add(CreateCheckBox(page_hacks, _("OpenMP Texture Decoder"), wxGetTranslation(omp_desc), vconfig.bOMPDecoder)); wxStaticBoxSizer* const group_other = new wxStaticBoxSizer(wxVERTICAL, page_hacks, _("Other")); group_other->Add(szr_other, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); szr_hacks->Add(group_other, 0, wxEXPAND | wxALL, 5); } szr_hacks->AddStretchSpacer(); CreateDescriptionArea(page_hacks, szr_hacks); page_hacks->SetSizerAndFit(szr_hacks); } // -- ADVANCED -- { wxPanel* const page_advanced = new wxPanel(notebook, -1, wxDefaultPosition); notebook->AddPage(page_advanced, _("Advanced")); wxBoxSizer* const szr_advanced = new wxBoxSizer(wxVERTICAL); // - debug { wxGridSizer* const szr_debug = new wxGridSizer(2, 5, 5); szr_debug->Add(CreateCheckBox(page_advanced, _("Enable Wireframe"), wxGetTranslation(wireframe_desc), vconfig.bWireFrame)); szr_debug->Add(CreateCheckBox(page_advanced, _("Show EFB Copy Regions"), wxGetTranslation(efb_copy_regions_desc), vconfig.bShowEFBCopyRegions)); szr_debug->Add(CreateCheckBox(page_advanced, _("Show Statistics"), wxGetTranslation(show_stats_desc), vconfig.bOverlayStats)); szr_debug->Add(CreateCheckBox(page_advanced, _("Texture Format Overlay"), wxGetTranslation(texfmt_desc), vconfig.bTexFmtOverlayEnable)); szr_debug->Add(CreateCheckBox(page_advanced, _("Disable Textures"), wxGetTranslation(disable_textures_desc), vconfig.bDisableTexturing)); wxStaticBoxSizer* const group_debug = new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Debugging")); szr_advanced->Add(group_debug, 0, wxEXPAND | wxALL, 5); group_debug->Add(szr_debug, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); } // - utility { wxGridSizer* const szr_utility = new wxGridSizer(2, 5, 5); szr_utility->Add(CreateCheckBox(page_advanced, _("Dump Textures"), wxGetTranslation(dump_textures_desc), vconfig.bDumpTextures)); szr_utility->Add(CreateCheckBox(page_advanced, _("Load Custom Textures"), wxGetTranslation(load_hires_textures_desc), vconfig.bHiresTextures)); szr_utility->Add(CreateCheckBox(page_advanced, _("Dump EFB Target"), wxGetTranslation(dump_efb_desc), vconfig.bDumpEFBTarget)); szr_utility->Add(CreateCheckBox(page_advanced, _("Dump Frames"), wxGetTranslation(dump_frames_desc), vconfig.bDumpFrames)); szr_utility->Add(CreateCheckBox(page_advanced, _("Free Look"), wxGetTranslation(free_look_desc), vconfig.bFreeLook)); #if !defined WIN32 && defined HAVE_LIBAV szr_utility->Add(CreateCheckBox(page_advanced, _("Frame Dumps use FFV1"), wxGetTranslation(use_ffv1_desc), vconfig.bUseFFV1)); #endif wxStaticBoxSizer* const group_utility = new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Utility")); szr_advanced->Add(group_utility, 0, wxEXPAND | wxALL, 5); group_utility->Add(szr_utility, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); } // - misc { wxGridSizer* const szr_misc = new wxGridSizer(2, 5, 5); szr_misc->Add(CreateCheckBox(page_advanced, _("Show Input Display"), wxGetTranslation(show_input_display_desc), vconfig.bShowInputDisplay)); szr_misc->Add(CreateCheckBox(page_advanced, _("Crop"), wxGetTranslation(crop_desc), vconfig.bCrop)); szr_misc->Add(CreateCheckBox(page_advanced, _("Enable Hotkeys"), wxGetTranslation(hotkeys_desc), vconfig.bOSDHotKey)); szr_misc->Add(CreateCheckBox(page_advanced, _("Widescreen Hack"), wxGetTranslation(ws_hack_desc), vconfig.bWidescreenHack)); // Progressive Scan { wxCheckBox* const cb_prog_scan = new wxCheckBox(page_advanced, wxID_ANY, _("Enable Progressive Scan")); RegisterControl(cb_prog_scan, wxGetTranslation(prog_scan_desc)); _connect_macro_(cb_prog_scan, VideoConfigDiag::Event_ProgressiveScan, wxEVT_COMMAND_CHECKBOX_CLICKED, this); if (Core::GetState() != Core::CORE_UNINITIALIZED) cb_prog_scan->Disable(); cb_prog_scan->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressive); // A bit strange behavior, but this needs to stay in sync with the main progressive boolean; TODO: Is this still necessary? SConfig::GetInstance().m_SYSCONF->SetData("IPL.PGS", SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressive); szr_misc->Add(cb_prog_scan); } wxStaticBoxSizer* const group_misc = new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Misc")); szr_advanced->Add(group_misc, 0, wxEXPAND | wxALL, 5); group_misc->Add(szr_misc, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); } szr_advanced->AddStretchSpacer(); CreateDescriptionArea(page_advanced, szr_advanced); page_advanced->SetSizerAndFit(szr_advanced); } wxButton* const btn_close = new wxButton(this, wxID_OK, _("Close"), wxDefaultPosition); _connect_macro_(btn_close, VideoConfigDiag::Event_ClickClose, wxEVT_COMMAND_BUTTON_CLICKED, this); Connect(wxID_ANY, wxEVT_CLOSE_WINDOW, wxCloseEventHandler(VideoConfigDiag::Event_Close), (wxObject*)0, this); wxBoxSizer* const szr_main = new wxBoxSizer(wxVERTICAL); szr_main->Add(notebook, 1, wxEXPAND | wxALL, 5); szr_main->Add(btn_close, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 5); SetSizerAndFit(szr_main); Center(); SetFocus(); UpdateWindowUI(); }