Removed the hackery that was being done with the plugin configuration dialogs on...
[dolphin.git] / Source / Core / DolphinWX / Src / ConfigMain.cpp
blob4080c191423010a6650dcf45eea819f88dd67d0c
1 // Copyright (C) 2003 Dolphin Project.
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, version 2.0.
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU General Public License 2.0 for more details.
12 // A copy of the GPL 2.0 should have been included with the program.
13 // If not, see http://www.gnu.org/licenses/
15 // Official SVN repository and contact information can be found at
16 // http://code.google.com/p/dolphin-emu/
18 #include <string> // System
19 #include <vector>
21 #include "Common.h"
22 #include "CommonPaths.h"
24 #include "Core.h" // Core
25 #include "HW/EXI.h"
26 #include "HW/SI.h"
28 #include "Globals.h" // Local
29 #include "ConfigMain.h"
30 #include "PluginManager.h"
31 #include "ConfigManager.h"
32 #include "SysConf.h"
33 #include "Frame.h"
34 #include "HotkeyDlg.h"
36 #include "../../Common/Src/OpenCL.h"
38 #ifdef __APPLE__
39 #include <Cocoa/Cocoa.h>
40 #endif
42 extern CFrame* main_frame;
44 // Strings for Device Selections
45 #define DEV_NONE_STR "<Nothing>"
46 #define DEV_DUMMY_STR "Dummy"
48 #define SIDEV_STDCONT_STR "Standard Controller"
49 #define SIDEV_GBA_STR "GBA"
50 #define SIDEV_AM_BB_STR "AM-Baseboard"
52 #define EXIDEV_MEMCARD_STR "Memory Card"
53 #define EXIDEV_MIC_STR "Mic"
54 #define EXIDEV_BBA_STR "BBA"
55 #define EXIDEV_AM_BB_STR "AM-Baseboard"
57 BEGIN_EVENT_TABLE(CConfigMain, wxDialog)
59 EVT_CLOSE(CConfigMain::OnClose)
60 EVT_BUTTON(wxID_OK, CConfigMain::OnOk)
63 EVT_CHECKBOX(ID_CPUTHREAD, CConfigMain::CoreSettingsChanged)
64 EVT_CHECKBOX(ID_IDLESKIP, CConfigMain::CoreSettingsChanged)
65 EVT_CHECKBOX(ID_ENABLECHEATS, CConfigMain::CoreSettingsChanged)
66 EVT_CHOICE(ID_FRAMELIMIT, CConfigMain::CoreSettingsChanged)
67 EVT_CHECKBOX(ID_FRAMELIMIT_USEFPSFORLIMITING, CConfigMain::CoreSettingsChanged)
69 EVT_CHECKBOX(ID_ALWAYS_HLE_BS2, CConfigMain::CoreSettingsChanged)
70 #if defined(HAVE_OPENCL) && HAVE_OPENCL
71 EVT_CHECKBOX(ID_ENABLE_OPENCL, CConfigMain::CoreSettingsChanged)
72 #endif
73 EVT_RADIOBOX(ID_CPUENGINE, CConfigMain::CoreSettingsChanged)
74 EVT_CHECKBOX(ID_LOCKTHREADS, CConfigMain::CoreSettingsChanged)
75 EVT_CHECKBOX(ID_DSPTHREAD, CConfigMain::CoreSettingsChanged)
78 EVT_CHOICE(ID_DISPLAY_FULLSCREENRES, CConfigMain::DisplaySettingsChanged)
79 EVT_TEXT(ID_DISPLAY_WINDOWWIDTH, CConfigMain::DisplaySettingsChanged)
80 EVT_TEXT(ID_DISPLAY_WINDOWHEIGHT, CConfigMain::DisplaySettingsChanged)
81 EVT_CHECKBOX(ID_DISPLAY_FULLSCREEN, CConfigMain::DisplaySettingsChanged)
82 EVT_CHECKBOX(ID_DISPLAY_HIDECURSOR, CConfigMain::DisplaySettingsChanged)
83 EVT_CHECKBOX(ID_DISPLAY_RENDERTOMAIN, CConfigMain::DisplaySettingsChanged)
85 EVT_CHECKBOX(ID_INTERFACE_CONFIRMSTOP, CConfigMain::DisplaySettingsChanged)
86 EVT_CHECKBOX(ID_INTERFACE_USEPANICHANDLERS, CConfigMain::DisplaySettingsChanged)
87 EVT_RADIOBOX(ID_INTERFACE_THEME, CConfigMain::DisplaySettingsChanged)
88 EVT_CHOICE(ID_INTERFACE_LANG, CConfigMain::DisplaySettingsChanged)
89 EVT_BUTTON(ID_HOTKEY_CONFIG, CConfigMain::DisplaySettingsChanged)
92 EVT_CHOICE(ID_GC_SRAM_LNG, CConfigMain::GCSettingsChanged)
94 EVT_CHOICE(ID_GC_EXIDEVICE_SLOTA, CConfigMain::GCSettingsChanged)
95 EVT_BUTTON(ID_GC_EXIDEVICE_SLOTA_PATH, CConfigMain::GCSettingsChanged)
96 EVT_CHOICE(ID_GC_EXIDEVICE_SLOTB, CConfigMain::GCSettingsChanged)
97 EVT_BUTTON(ID_GC_EXIDEVICE_SLOTB_PATH, CConfigMain::GCSettingsChanged)
98 EVT_CHOICE(ID_GC_EXIDEVICE_SP1, CConfigMain::GCSettingsChanged)
99 EVT_CHOICE(ID_GC_SIDEVICE0, CConfigMain::GCSettingsChanged)
100 EVT_CHOICE(ID_GC_SIDEVICE1, CConfigMain::GCSettingsChanged)
101 EVT_CHOICE(ID_GC_SIDEVICE2, CConfigMain::GCSettingsChanged)
102 EVT_CHOICE(ID_GC_SIDEVICE3, CConfigMain::GCSettingsChanged)
105 EVT_CHOICE(ID_WII_BT_BAR, CConfigMain::WiiSettingsChanged)
107 EVT_CHECKBOX(ID_WII_IPL_SSV, CConfigMain::WiiSettingsChanged)
108 EVT_CHECKBOX(ID_WII_IPL_PGS, CConfigMain::WiiSettingsChanged)
109 EVT_CHECKBOX(ID_WII_IPL_E60, CConfigMain::WiiSettingsChanged)
110 EVT_CHOICE(ID_WII_IPL_AR, CConfigMain::WiiSettingsChanged)
111 EVT_CHOICE(ID_WII_IPL_LNG, CConfigMain::WiiSettingsChanged)
113 EVT_CHECKBOX(ID_WII_SD_CARD, CConfigMain::WiiSettingsChanged)
114 EVT_CHECKBOX(ID_WII_KEYBOARD, CConfigMain::WiiSettingsChanged)
117 EVT_LISTBOX(ID_ISOPATHS, CConfigMain::ISOPathsSelectionChanged)
118 EVT_CHECKBOX(ID_RECURSIVEISOPATH, CConfigMain::RecursiveDirectoryChanged)
119 EVT_BUTTON(ID_ADDISOPATH, CConfigMain::AddRemoveISOPaths)
120 EVT_BUTTON(ID_REMOVEISOPATH, CConfigMain::AddRemoveISOPaths)
122 EVT_FILEPICKER_CHANGED(ID_DEFAULTISO, CConfigMain::DefaultISOChanged)
123 EVT_DIRPICKER_CHANGED(ID_DVDROOT, CConfigMain::DVDRootChanged)
124 EVT_FILEPICKER_CHANGED(ID_APPLOADERPATH, CConfigMain::ApploaderPathChanged)
127 EVT_CHOICE(ID_GRAPHIC_CB, CConfigMain::OnSelectionChanged)
128 EVT_BUTTON(ID_GRAPHIC_CONFIG, CConfigMain::OnConfig)
130 EVT_CHOICE(ID_DSP_CB, CConfigMain::OnSelectionChanged)
131 EVT_BUTTON(ID_DSP_CONFIG, CConfigMain::OnConfig)
133 EVT_CHOICE(ID_WIIMOTE_CB, CConfigMain::OnSelectionChanged)
134 EVT_BUTTON(ID_WIIMOTE_CONFIG, CConfigMain::OnConfig)
136 END_EVENT_TABLE()
138 CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
139 : wxDialog(parent, id, title, position, size, style)
141 // Control refreshing of the ISOs list
142 bRefreshList = false;
144 AddResolutions();
145 CreateGUIControls();
147 // Update selected ISO paths
148 for(u32 i = 0; i < SConfig::GetInstance().m_ISOFolder.size(); i++)
150 ISOPaths->Append(wxString(SConfig::GetInstance().m_ISOFolder[i].c_str(), *wxConvCurrent));
154 CConfigMain::~CConfigMain()
158 // Used to restrict changing of some options while emulator is running
159 void CConfigMain::UpdateGUI()
161 if(Core::GetState() != Core::CORE_UNINITIALIZED)
163 // Disable the Core stuff on GeneralPage
164 CPUThread->Disable();
165 SkipIdle->Disable();
166 EnableCheats->Disable();
168 AlwaysHLE_BS2->Disable();
169 #if defined(HAVE_OPENCL) && HAVE_OPENCL
170 EnableOpenCL->Disable();
171 #endif
172 CPUEngine->Disable();
173 LockThreads->Disable();
174 DSPThread->Disable();
177 // Disable stuff on DisplayPage
178 FullscreenResolution->Disable();
179 RenderToMain->Disable();
182 // Disable stuff on GamecubePage
183 GCSystemLang->Disable();
186 // Disable stuff on WiiPage
187 WiiSensBarPos->Disable();
188 WiiScreenSaver->Disable();
189 WiiProgressiveScan->Disable();
190 WiiEuRGB60->Disable();
191 WiiAspectRatio->Disable();
192 WiiSystemLang->Disable();
195 // Disable stuff on PathsPage
196 PathsPage->Disable();
199 // Disable stuff on PluginsPage
200 GraphicSelection->Disable();
201 DSPSelection->Disable();
202 WiimoteSelection->Disable();
206 void CConfigMain::InitializeGUILists()
208 // General page
209 // Framelimit
210 arrayStringFor_Framelimit.Add(wxT("Off"));
211 arrayStringFor_Framelimit.Add(wxT("Auto"));
212 for (int i = 10; i <= 120; i += 5) // from 10 to 120
213 arrayStringFor_Framelimit.Add(wxString::Format(wxT("%i"), i));
215 // Emulator Engine
216 arrayStringFor_CPUEngine.Add(wxT("Interpreter (VERY slow)"));
217 arrayStringFor_CPUEngine.Add(wxT("JIT Recompiler (recommended)"));
218 arrayStringFor_CPUEngine.Add(wxT("JITIL experimental recompiler"));
221 // Display page
222 // Resolutions
223 if (arrayStringFor_FullscreenResolution.empty())
224 arrayStringFor_FullscreenResolution.Add(wxT("<No resolutions found>"));
226 // Themes
227 arrayStringFor_Themes.Add(wxT("Boomy"));
228 arrayStringFor_Themes.Add(wxT("Vista"));
229 arrayStringFor_Themes.Add(wxT("X-Plastik"));
230 arrayStringFor_Themes.Add(wxT("KDE"));
232 // GUI language arrayStrings
233 arrayStringFor_InterfaceLang.Add(wxT("English"));
234 arrayStringFor_InterfaceLang.Add(wxT("German"));
235 arrayStringFor_InterfaceLang.Add(wxT("French"));
236 arrayStringFor_InterfaceLang.Add(wxT("Spanish"));
237 arrayStringFor_InterfaceLang.Add(wxT("Italian"));
238 arrayStringFor_InterfaceLang.Add(wxT("Dutch"));
241 // Gamecube page
242 // GC Language arrayStrings
243 arrayStringFor_GCSystemLang = arrayStringFor_InterfaceLang;
246 // Wii page
247 // Sensorbar Position
248 arrayStringFor_WiiSensBarPos.Add(wxT("Bottom"));
249 arrayStringFor_WiiSensBarPos.Add(wxT("Top"));
251 // Aspect ratio
252 arrayStringFor_WiiAspectRatio.Add(wxT("4:3"));
253 arrayStringFor_WiiAspectRatio.Add(wxT("16:9"));
255 // Wii Language arrayStrings
256 arrayStringFor_WiiSystemLang = arrayStringFor_InterfaceLang;
257 arrayStringFor_WiiSystemLang.Insert(wxT("Japanese"), 0);
258 arrayStringFor_WiiSystemLang.Add(wxT("Simplified Chinese"));
259 arrayStringFor_WiiSystemLang.Add(wxT("Traditional Chinese"));
260 arrayStringFor_WiiSystemLang.Add(wxT("Korean"));
264 void CConfigMain::InitializeGUIValues()
266 // General - Basic
267 CPUThread->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread);
268 SkipIdle->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle);
269 EnableCheats->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats);
270 Framelimit->SetSelection(SConfig::GetInstance().m_Framelimit);
271 UseFPSForLimiting->SetValue(SConfig::GetInstance().b_UseFPS);
273 // General - Advanced
274 AlwaysHLE_BS2->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bHLE_BS2);
275 #if defined(HAVE_OPENCL) && HAVE_OPENCL
276 EnableOpenCL->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableOpenCL);
277 #endif
278 CPUEngine->SetSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore);
279 LockThreads->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bLockThreads);
280 DSPThread->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPThread);
283 // Display - Display
284 FullscreenResolution->SetStringSelection(wxString::FromAscii(SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution.c_str()));
285 WindowWidth->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth);
286 WindowHeight->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight);
287 Fullscreen->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen);
288 HideCursor->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor);
289 RenderToMain->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain);
291 // Display - Interface
292 ConfirmStop->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop);
293 UsePanicHandlers->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bUsePanicHandlers);
294 Theme->SetSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.iTheme);
295 // need redesign
296 InterfaceLang->SetSelection(SConfig::GetInstance().m_InterfaceLanguage);
299 // Gamecube - IPL
300 GCSystemLang->SetSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage);
302 // Gamecube - Devices
303 // Not here. They use some locals over in CreateGUIControls for initialization,
304 // which is why they are still there.
307 // Wii - Wiimote
308 WiiSensBarPos->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("BT.BAR"));
310 // Wii - Misc
311 WiiScreenSaver->SetValue(!!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.SSV"));
312 WiiProgressiveScan->SetValue(!!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.PGS"));
313 WiiEuRGB60->SetValue(!!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.E60"));
314 WiiAspectRatio->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.AR"));
315 WiiSystemLang->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG"));
317 // Wii - Devices
318 WiiSDCard->SetValue(SConfig::GetInstance().m_WiiSDCard);
319 WiiKeyboard->SetValue(SConfig::GetInstance().m_WiiKeyboard);
322 // Paths
323 RecursiveISOPath->SetValue(SConfig::GetInstance().m_RecursiveISOFolder);
324 DefaultISO->SetPath(wxString(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM.c_str(), *wxConvCurrent));
325 DVDRoot->SetPath(wxString(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDVDRoot.c_str(), *wxConvCurrent));
326 ApploaderPath->SetPath(wxString(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strApploader.c_str(), *wxConvCurrent));
329 // Plugins
330 FillChoiceBox(GraphicSelection, PLUGIN_TYPE_VIDEO, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
331 FillChoiceBox(DSPSelection, PLUGIN_TYPE_DSP, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
332 FillChoiceBox(WiimoteSelection, PLUGIN_TYPE_WIIMOTE, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin);
335 void CConfigMain::InitializeGUITooltips()
337 // General - Basic
338 CPUThread->SetToolTip(wxT("This splits the Video and CPU threads, so they can be run on separate cores.")
339 wxT("\nCauses major speed improvements on PCs with more than one core,")
340 wxT("\nbut can also cause occasional crashes/glitches."));
341 Framelimit->SetToolTip(wxT("If you set Framelimit higher than game full speed (NTSC:60, PAL:50),\nyou also have to disable Audio Throttle in DSP to make it effective."));
343 // General - Advanced
344 DSPThread->SetToolTip(wxT("Run DSPLLE on a dedicated thread (not recommended)."));
345 #if defined(HAVE_OPENCL) && HAVE_OPENCL
346 EnableOpenCL->SetToolTip(wxT("Allow videocard to accelerate texture decoding."));
347 #endif
349 // Display - Display
350 FullscreenResolution->SetToolTip(wxT("Select resolution for fullscreen mode"));
351 WindowWidth->SetToolTip(wxT("Window width for windowed mode"));
352 WindowHeight->SetToolTip(wxT("Window height for windowed mode"));
353 Fullscreen->SetToolTip(wxT("Start the rendering window in fullscreen mode."));
354 HideCursor->SetToolTip(wxT("Hide the cursor when it is over the rendering window")
355 wxT("\n and the rendering window has focus."));
356 RenderToMain->SetToolTip(wxT("Render to main window."));
358 // Display - Interface
359 ConfirmStop->SetToolTip(wxT("Show a confirmation box before stopping a game."));
360 UsePanicHandlers->SetToolTip(wxT("Show a message box when a potentially serious error has occured.")
361 wxT(" Disabling this may avoid annoying and non-fatal messages, but it may also mean that Dolphin")
362 wxT(" suddenly crashes without any explanation at all."));
364 // Display - Themes: Copyright notice
365 Theme->SetItemToolTip(0, wxT("Created by Milosz Wlazlo [miloszwl@miloszwl.com, miloszwl.deviantart.com]"));
366 Theme->SetItemToolTip(1, wxT("Created by VistaIcons.com"));
367 Theme->SetItemToolTip(2, wxT("Created by black_rider and published on ForumW.org > Web Developments"));
368 Theme->SetItemToolTip(3, wxT("Created by KDE-Look.org"));
370 InterfaceLang->SetToolTip(wxT("For the time being this will only change the text shown in")
371 wxT("\nthe game list of PAL GC games."));
374 // Gamecube - Devices
375 GCEXIDevice[2]->SetToolTip(wxT("Serial Port 1 - This is the port which devices such as the net adapter use"));
378 // Wii - Devices
379 WiiKeyboard->SetToolTip(wxT("This could cause slow down in Wii Menu and some games."));
382 void CConfigMain::CreateGUIControls()
384 InitializeGUILists();
386 // Create the notebook and pages
387 Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
388 GeneralPage = new wxPanel(Notebook, ID_GENERALPAGE, wxDefaultPosition, wxDefaultSize);
389 DisplayPage = new wxPanel(Notebook, ID_DISPLAYPAGE, wxDefaultPosition, wxDefaultSize);
390 GamecubePage = new wxPanel(Notebook, ID_GAMECUBEPAGE, wxDefaultPosition, wxDefaultSize);
391 WiiPage = new wxPanel(Notebook, ID_WIIPAGE, wxDefaultPosition, wxDefaultSize);
392 PathsPage = new wxPanel(Notebook, ID_PATHSPAGE, wxDefaultPosition, wxDefaultSize);
393 PluginsPage = new wxPanel(Notebook, ID_PLUGINPAGE, wxDefaultPosition, wxDefaultSize);
395 Notebook->AddPage(GeneralPage, wxT("General"));
396 Notebook->AddPage(DisplayPage, wxT("Display"));
397 Notebook->AddPage(GamecubePage, wxT("Gamecube"));
398 Notebook->AddPage(WiiPage, wxT("Wii"));
399 Notebook->AddPage(PathsPage, wxT("Paths"));
400 Notebook->AddPage(PluginsPage, wxT("Plugins"));
402 // General page
403 // Core Settings - Basic
404 sbBasic = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Basic Settings"));
405 CPUThread = new wxCheckBox(GeneralPage, ID_CPUTHREAD, wxT("Enable Dual Core (speedup)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
406 SkipIdle = new wxCheckBox(GeneralPage, ID_IDLESKIP, wxT("Enable Idle Skipping (speedup)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
407 EnableCheats = new wxCheckBox(GeneralPage, ID_ENABLECHEATS, wxT("Enable Cheats"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
408 // Framelimit
409 wxStaticText* FramelimitText = new wxStaticText(GeneralPage, ID_FRAMELIMIT_TEXT, wxT("Framelimit :"), wxDefaultPosition, wxDefaultSize);
410 Framelimit = new wxChoice(GeneralPage, ID_FRAMELIMIT, wxDefaultPosition, wxDefaultSize, arrayStringFor_Framelimit, 0, wxDefaultValidator);
411 UseFPSForLimiting = new wxCheckBox(GeneralPage, ID_FRAMELIMIT_USEFPSFORLIMITING, wxT("Use FPS For Limiting"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
413 // Core Settings - Advanced
414 sbAdvanced = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Advanced Settings"));
415 AlwaysHLE_BS2 = new wxCheckBox(GeneralPage, ID_ALWAYS_HLE_BS2, wxT("HLE the IPL (recommended)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
416 #if defined(HAVE_OPENCL) && HAVE_OPENCL
417 EnableOpenCL = new wxCheckBox(GeneralPage, ID_ENABLE_OPENCL, wxT("Enable OpenCL"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
418 #endif
419 CPUEngine = new wxRadioBox(GeneralPage, ID_CPUENGINE, wxT("CPU Emulator Engine"), wxDefaultPosition, wxDefaultSize, arrayStringFor_CPUEngine, 0, wxRA_SPECIFY_ROWS);
420 LockThreads = new wxCheckBox(GeneralPage, ID_LOCKTHREADS, wxT("Lock threads to cores"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
421 DSPThread = new wxCheckBox(GeneralPage, ID_DSPTHREAD, wxT("DSPLLE on thread"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
423 // Populate the settings
424 sbBasic->Add(CPUThread, 0, wxALL, 5);
425 sbBasic->Add(SkipIdle, 0, wxALL, 5);
426 sbBasic->Add(EnableCheats, 0, wxALL, 5);
427 wxBoxSizer* sFramelimit = new wxBoxSizer(wxHORIZONTAL);
428 sFramelimit->Add(FramelimitText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
429 sFramelimit->Add(Framelimit, 0, wxALL | wxEXPAND, 5);
430 sFramelimit->Add(UseFPSForLimiting, 0, wxALL | wxEXPAND, 5);
431 sbBasic->Add(sFramelimit, 0, wxALL | wxEXPAND, 5);
433 sbAdvanced->Add(AlwaysHLE_BS2, 0, wxALL, 5);
434 #if defined(HAVE_OPENCL) && HAVE_OPENCL
435 sbAdvanced->Add(EnableOpenCL, 0, wxALL, 5);
436 #endif
437 sbAdvanced->Add(CPUEngine, 0, wxALL, 5);
438 sbAdvanced->Add(LockThreads, 0, wxALL, 5);
439 sbAdvanced->Add(DSPThread, 0, wxALL, 5);
441 // Populate the General page
442 sGeneralPage = new wxBoxSizer(wxVERTICAL);
443 sGeneralPage->Add(sbBasic, 0, wxEXPAND | wxALL, 5);
444 sGeneralPage->Add(sbAdvanced, 0, wxEXPAND | wxALL, 5);
446 GeneralPage->SetSizer(sGeneralPage);
447 sGeneralPage->Layout();
451 // Display page
452 // General display settings
453 sbDisplay = new wxStaticBoxSizer(wxVERTICAL, DisplayPage, wxT("Emulator Display Settings"));
454 wxStaticText* FullscreenResolutionText = new wxStaticText(DisplayPage, wxID_ANY, wxT("Fullscreen Display Resolution:"), wxDefaultPosition, wxDefaultSize, 0);
455 FullscreenResolution = new wxChoice(DisplayPage, ID_DISPLAY_FULLSCREENRES, wxDefaultPosition, wxDefaultSize, arrayStringFor_FullscreenResolution, 0, wxDefaultValidator, arrayStringFor_FullscreenResolution[0]);
456 wxStaticText *WindowSizeText = new wxStaticText(DisplayPage, wxID_ANY, wxT("Window Size:"), wxDefaultPosition, wxDefaultSize, 0);
457 WindowWidth = new wxSpinCtrl(DisplayPage, ID_DISPLAY_WINDOWWIDTH, wxEmptyString, wxDefaultPosition, wxSize(70, -1));
458 WindowWidth->SetRange(0,3280);
459 wxStaticText *WindowXText = new wxStaticText(DisplayPage, wxID_ANY, wxT("x"), wxDefaultPosition, wxDefaultSize, 0);
460 WindowHeight = new wxSpinCtrl(DisplayPage, ID_DISPLAY_WINDOWHEIGHT, wxEmptyString, wxDefaultPosition, wxSize(70, -1));
461 WindowHeight->SetRange(0,2048);
462 Fullscreen = new wxCheckBox(DisplayPage, ID_DISPLAY_FULLSCREEN, wxT("Start Renderer in Fullscreen"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
463 HideCursor = new wxCheckBox(DisplayPage, ID_DISPLAY_HIDECURSOR, wxT("Hide Mouse Cursor"));
464 RenderToMain = new wxCheckBox(DisplayPage, ID_DISPLAY_RENDERTOMAIN, wxT("Render to Main Window"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
466 // Interface settings
467 sbInterface = new wxStaticBoxSizer(wxVERTICAL, DisplayPage, wxT("Interface Settings"));
468 ConfirmStop = new wxCheckBox(DisplayPage, ID_INTERFACE_CONFIRMSTOP, wxT("Confirm On Stop"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
469 UsePanicHandlers = new wxCheckBox(DisplayPage, ID_INTERFACE_USEPANICHANDLERS, wxT("Use Panic Handlers"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
471 // Themes - this should really be a wxChoice...
472 Theme = new wxRadioBox(DisplayPage, ID_INTERFACE_THEME, wxT("Theme"), wxDefaultPosition, wxDefaultSize, arrayStringFor_Themes, 1, wxRA_SPECIFY_ROWS);
474 // Interface Language
475 // At the moment this only changes the language displayed in m_gamelistctrl
476 // If someone wants to control the whole GUI's language, it should be set here too
477 wxStaticText* InterfaceLangText = new wxStaticText(DisplayPage, ID_INTERFACE_LANG_TEXT, wxT("Game List Language:"), wxDefaultPosition, wxDefaultSize);
478 InterfaceLang = new wxChoice(DisplayPage, ID_INTERFACE_LANG, wxDefaultPosition, wxDefaultSize, arrayStringFor_InterfaceLang, 0, wxDefaultValidator);
480 // Hotkey configuration
481 HotkeyConfig = new wxButton(DisplayPage, ID_HOTKEY_CONFIG, wxT("Hotkeys"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
483 // Populate the settings
484 wxBoxSizer* sDisplayRes = new wxBoxSizer(wxHORIZONTAL);
485 sDisplayRes->Add(FullscreenResolutionText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
486 sDisplayRes->Add(FullscreenResolution, 0, wxEXPAND | wxALL, 5);
487 sbDisplay->Add(sDisplayRes, 0, wxALL, 5);
488 wxBoxSizer* sDisplaySize = new wxBoxSizer(wxHORIZONTAL);
489 sDisplaySize->Add(WindowSizeText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
490 sDisplaySize->Add(WindowWidth, 0, wxEXPAND | wxALL, 5);
491 sDisplaySize->Add(WindowXText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
492 sDisplaySize->Add(WindowHeight, 0, wxEXPAND | wxALL, 5);
493 sbDisplay->Add(sDisplaySize, 0, wxALL, 5);
494 sbDisplay->Add(Fullscreen, 0, wxEXPAND | wxALL, 5);
495 sbDisplay->Add(HideCursor, 0, wxALL, 5);
496 sbDisplay->Add(RenderToMain, 0, wxEXPAND | wxALL, 5);
498 sbInterface->Add(ConfirmStop, 0, wxALL, 5);
499 sbInterface->Add(UsePanicHandlers, 0, wxALL, 5);
500 sbInterface->Add(Theme, 0, wxEXPAND | wxALL, 5);
501 wxBoxSizer* sInterface = new wxBoxSizer(wxHORIZONTAL);
502 sInterface->Add(InterfaceLangText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
503 sInterface->Add(InterfaceLang, 0, wxEXPAND | wxALL, 5);
504 sInterface->AddStretchSpacer();
505 sInterface->Add(HotkeyConfig, 0, wxALIGN_RIGHT | wxALL, 5);
506 sbInterface->Add(sInterface, 0, wxEXPAND | wxALL, 5);
508 // Populate the Display page
509 sDisplayPage = new wxBoxSizer(wxVERTICAL);
510 sDisplayPage->Add(sbDisplay, 0, wxEXPAND | wxALL, 5);
511 sDisplayPage->Add(sbInterface, 0, wxEXPAND | wxALL, 5);
513 DisplayPage->SetSizer(sDisplayPage);
514 sDisplayPage->Layout();
518 // Gamecube page
519 // IPL settings
520 sbGamecubeIPLSettings = new wxStaticBoxSizer(wxVERTICAL, GamecubePage, wxT("IPL Settings"));
521 wxStaticText* GCSystemLangText = new wxStaticText(GamecubePage, ID_GC_SRAM_LNG_TEXT, wxT("System Language:"), wxDefaultPosition, wxDefaultSize);
522 GCSystemLang = new wxChoice(GamecubePage, ID_GC_SRAM_LNG, wxDefaultPosition, wxDefaultSize, arrayStringFor_GCSystemLang, 0, wxDefaultValidator);
523 // Device settings
524 // EXI Devices
525 wxStaticBoxSizer *sbGamecubeDeviceSettings = new wxStaticBoxSizer(wxVERTICAL, GamecubePage, wxT("Device Settings"));
526 wxStaticText* GCEXIDeviceText[3];
527 GCEXIDeviceText[0] = new wxStaticText(GamecubePage, ID_GC_EXIDEVICE_SLOTA_TEXT, wxT("Slot A"), wxDefaultPosition, wxDefaultSize);
528 GCEXIDeviceText[1] = new wxStaticText(GamecubePage, ID_GC_EXIDEVICE_SLOTB_TEXT, wxT("Slot B"), wxDefaultPosition, wxDefaultSize);
529 GCEXIDeviceText[2] = new wxStaticText(GamecubePage, ID_GC_EXIDEVICE_SP1_TEXT, wxT("SP1 "), wxDefaultPosition, wxDefaultSize);
530 const wxString SlotDevices[] = {wxT(DEV_NONE_STR), wxT(DEV_DUMMY_STR), wxT(EXIDEV_MEMCARD_STR)
531 #if HAVE_PORTAUDIO
532 , wxT(EXIDEV_MIC_STR)
533 #endif
535 static const int numSlotDevices = sizeof(SlotDevices)/sizeof(wxString);
536 const wxString SP1Devices[] = { wxT(DEV_NONE_STR), wxT(DEV_DUMMY_STR), wxT(EXIDEV_BBA_STR), wxT(EXIDEV_AM_BB_STR) };
537 static const int numSP1Devices = sizeof(SP1Devices)/sizeof(wxString);
538 GCEXIDevice[0] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SLOTA, wxDefaultPosition, wxDefaultSize, numSlotDevices, SlotDevices, 0, wxDefaultValidator);
539 GCEXIDevice[1] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SLOTB, wxDefaultPosition, wxDefaultSize, numSlotDevices, SlotDevices, 0, wxDefaultValidator);
540 GCEXIDevice[2] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SP1, wxDefaultPosition, wxDefaultSize, numSP1Devices, SP1Devices, 0, wxDefaultValidator);
541 GCMemcardPath[0] = new wxButton(GamecubePage, ID_GC_EXIDEVICE_SLOTA_PATH, wxT("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
542 GCMemcardPath[1] = new wxButton(GamecubePage, ID_GC_EXIDEVICE_SLOTB_PATH, wxT("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
543 // Can't move this one without making the 4 const's etc. above class members/fields,
544 for (int i = 0; i < 3; ++i)
546 bool isMemcard = false;
547 switch (SConfig::GetInstance().m_EXIDevice[i])
549 case EXIDEVICE_NONE:
550 GCEXIDevice[i]->SetStringSelection(SlotDevices[0]);
551 break;
552 case EXIDEVICE_MEMORYCARD_A:
553 case EXIDEVICE_MEMORYCARD_B:
554 isMemcard = GCEXIDevice[i]->SetStringSelection(SlotDevices[2]);
555 break;
556 case EXIDEVICE_MIC:
557 GCEXIDevice[i]->SetStringSelection(SlotDevices[3]);
558 break;
559 case EXIDEVICE_ETH:
560 GCEXIDevice[i]->SetStringSelection(SP1Devices[2]);
561 break;
562 case EXIDEVICE_AM_BASEBOARD:
563 GCEXIDevice[i]->SetStringSelection(SP1Devices[3]);
564 break;
565 case EXIDEVICE_DUMMY:
566 default:
567 GCEXIDevice[i]->SetStringSelection(SlotDevices[1]);
568 break;
570 if (!isMemcard && i < 2)
571 GCMemcardPath[i]->Disable();
573 //SI Devices
574 wxStaticText* GCSIDeviceText[4];
575 GCSIDeviceText[0] = new wxStaticText(GamecubePage, ID_GC_SIDEVICE_TEXT, wxT("Port 1"), wxDefaultPosition, wxDefaultSize);
576 GCSIDeviceText[1] = new wxStaticText(GamecubePage, ID_GC_SIDEVICE_TEXT, wxT("Port 2"), wxDefaultPosition, wxDefaultSize);
577 GCSIDeviceText[2] = new wxStaticText(GamecubePage, ID_GC_SIDEVICE_TEXT, wxT("Port 3"), wxDefaultPosition, wxDefaultSize);
578 GCSIDeviceText[3] = new wxStaticText(GamecubePage, ID_GC_SIDEVICE_TEXT, wxT("Port 4"), wxDefaultPosition, wxDefaultSize);
579 const wxString SIPort1Devices[] = {wxT(DEV_NONE_STR),wxT(SIDEV_STDCONT_STR),wxT(SIDEV_GBA_STR),wxT(SIDEV_AM_BB_STR)};
580 static const int numSIPort1Devices = sizeof(SIPort1Devices)/sizeof(wxString);
581 const wxString SIDevices[] = {wxT(DEV_NONE_STR),wxT(SIDEV_STDCONT_STR),wxT(SIDEV_GBA_STR)};
582 static const int numSIDevices = sizeof(SIDevices)/sizeof(wxString);
583 GCSIDevice[0] = new wxChoice(GamecubePage, ID_GC_SIDEVICE0, wxDefaultPosition, wxDefaultSize, numSIPort1Devices, SIPort1Devices, 0, wxDefaultValidator);
584 GCSIDevice[1] = new wxChoice(GamecubePage, ID_GC_SIDEVICE1, wxDefaultPosition, wxDefaultSize, numSIDevices, SIDevices, 0, wxDefaultValidator);
585 GCSIDevice[2] = new wxChoice(GamecubePage, ID_GC_SIDEVICE2, wxDefaultPosition, wxDefaultSize, numSIDevices, SIDevices, 0, wxDefaultValidator);
586 GCSIDevice[3] = new wxChoice(GamecubePage, ID_GC_SIDEVICE3, wxDefaultPosition, wxDefaultSize, numSIDevices, SIDevices, 0, wxDefaultValidator);
587 // Can't move this one without making the 2 const's etc. above class members/fields.
588 for (int i = 0; i < 4; ++i)
590 switch (SConfig::GetInstance().m_SIDevice[i])
592 case SI_GC_CONTROLLER:
593 GCSIDevice[i]->SetStringSelection(SIDevices[1]);
594 break;
595 case SI_GBA:
596 GCSIDevice[i]->SetStringSelection(SIDevices[2]);
597 break;
598 case SI_AM_BASEBOARD:
599 GCSIDevice[i]->SetStringSelection(SIDevices[3]);
600 break;
601 default:
602 GCSIDevice[i]->SetStringSelection(SIDevices[0]);
603 break;
607 // Populate the settings
608 sGamecubeIPLSettings = new wxGridBagSizer();
609 sGamecubeIPLSettings->Add(GCSystemLangText, wxGBPosition(0, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5);
610 sGamecubeIPLSettings->Add(GCSystemLang, wxGBPosition(0, 1), wxDefaultSpan, wxALL, 5);
611 sbGamecubeIPLSettings->Add(sGamecubeIPLSettings);
612 wxBoxSizer *sEXIDevices[4], *sSIDevices[4];
613 for (int i = 0; i < 3; ++i)
615 sEXIDevices[i] = new wxBoxSizer(wxHORIZONTAL);
616 sEXIDevices[i]->Add(GCEXIDeviceText[i], 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
617 sEXIDevices[i]->Add(GCEXIDevice[i], 0, wxALL, 5);
618 if (i < 2)
619 sEXIDevices[i]->Add(GCMemcardPath[i], 0, wxALL, 5);
620 sbGamecubeDeviceSettings->Add(sEXIDevices[i]);
622 for (int i = 0; i < 4; ++i)
624 sSIDevices[i] = new wxBoxSizer(wxHORIZONTAL);
625 sSIDevices[i]->Add(GCSIDeviceText[i], 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
626 sSIDevices[i]->Add(GCSIDevice[i], 0, wxALL, 5);
627 sbGamecubeDeviceSettings->Add(sSIDevices[i]);
630 // Populate the Gamecube page
631 sGamecubePage = new wxBoxSizer(wxVERTICAL);
632 sGamecubePage->Add(sbGamecubeIPLSettings, 0, wxEXPAND|wxALL, 5);
633 sGamecubePage->Add(sbGamecubeDeviceSettings, 0, wxEXPAND|wxALL, 5);
635 GamecubePage->SetSizer(sGamecubePage);
636 sGamecubePage->Layout();
640 // Wii page
641 // Wiimote Settings
642 sbWiimoteSettings = new wxStaticBoxSizer(wxHORIZONTAL, WiiPage, wxT("Wiimote Settings"));
643 wxStaticText* WiiSensBarPosText = new wxStaticText(WiiPage, ID_WII_BT_BAR_TEXT, wxT("Sensor Bar Position:"), wxDefaultPosition, wxDefaultSize);
644 WiiSensBarPos = new wxChoice(WiiPage, ID_WII_BT_BAR, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiSensBarPos, 0, wxDefaultValidator);
646 // Misc Settings
647 sbWiiIPLSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("Misc Settings"));
648 WiiScreenSaver = new wxCheckBox(WiiPage, ID_WII_IPL_SSV, wxT("Enable Screen Saver (burn-in reduction)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
649 WiiProgressiveScan = new wxCheckBox(WiiPage, ID_WII_IPL_PGS, wxT("Enable Progressive Scan"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
650 WiiEuRGB60 = new wxCheckBox(WiiPage, ID_WII_IPL_E60, wxT("Use EuRGB60 Mode (PAL60)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
651 wxStaticText* WiiAspectRatioText = new wxStaticText(WiiPage, ID_WII_IPL_AR_TEXT, wxT("Aspect Ratio:"), wxDefaultPosition, wxDefaultSize);
652 WiiAspectRatio = new wxChoice(WiiPage, ID_WII_IPL_AR, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiAspectRatio, 0, wxDefaultValidator);
653 wxStaticText* WiiSystemLangText = new wxStaticText(WiiPage, ID_WII_IPL_LNG_TEXT, wxT("System Language:"), wxDefaultPosition, wxDefaultSize);
654 WiiSystemLang = new wxChoice(WiiPage, ID_WII_IPL_LNG, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiSystemLang, 0, wxDefaultValidator);
656 // Device Settings
657 sbWiiDeviceSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("Device Settings"));
658 WiiSDCard = new wxCheckBox(WiiPage, ID_WII_SD_CARD, wxT("Insert SD Card"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
659 WiiKeyboard = new wxCheckBox(WiiPage, ID_WII_KEYBOARD, wxT("Connect USB Keyboard"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
661 // Populate the settings
662 sWiimoteSettings = new wxGridBagSizer();
663 sWiimoteSettings->Add(WiiSensBarPosText, wxGBPosition(0, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5);
664 sWiimoteSettings->Add(WiiSensBarPos, wxGBPosition(0, 1), wxDefaultSpan, wxALL, 5);
665 sbWiimoteSettings->Add(sWiimoteSettings);
667 sWiiIPLSettings = new wxGridBagSizer();
668 sWiiIPLSettings->Add(WiiScreenSaver, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5);
669 sWiiIPLSettings->Add(WiiProgressiveScan, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
670 sWiiIPLSettings->Add(WiiEuRGB60, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5);
671 sWiiIPLSettings->Add(WiiAspectRatioText, wxGBPosition(3, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5);
672 sWiiIPLSettings->Add(WiiAspectRatio, wxGBPosition(3, 1), wxDefaultSpan, wxALL, 5);
673 sWiiIPLSettings->Add(WiiSystemLangText, wxGBPosition(4, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5);
674 sWiiIPLSettings->Add(WiiSystemLang, wxGBPosition(4, 1), wxDefaultSpan, wxALL, 5);
675 sbWiiIPLSettings->Add(sWiiIPLSettings);
677 sbWiiDeviceSettings->Add(WiiSDCard, 0, wxALL, 5);
678 sbWiiDeviceSettings->Add(WiiKeyboard, 0, wxALL, 5);
680 // Populate the Wii page
681 sWiiPage = new wxBoxSizer(wxVERTICAL);
682 sWiiPage->Add(sbWiimoteSettings, 0, wxEXPAND|wxALL, 5);
683 sWiiPage->Add(sbWiiIPLSettings, 0, wxEXPAND|wxALL, 5);
684 sWiiPage->Add(sbWiiDeviceSettings, 0, wxEXPAND|wxALL, 5);
686 WiiPage->SetSizer(sWiiPage);
687 sWiiPage->Layout();
691 // Paths page
692 sbISOPaths = new wxStaticBoxSizer(wxVERTICAL, PathsPage, wxT("ISO Directories"));
693 ISOPaths = new wxListBox(PathsPage, ID_ISOPATHS, wxDefaultPosition, wxDefaultSize, arrayStringFor_ISOPaths, wxLB_SINGLE, wxDefaultValidator);
694 RecursiveISOPath = new wxCheckBox(PathsPage, ID_RECURSIVEISOPATH, wxT("Search Subfolders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
695 AddISOPath = new wxButton(PathsPage, ID_ADDISOPATH, wxT("Add..."), wxDefaultPosition, wxDefaultSize, 0);
696 RemoveISOPath = new wxButton(PathsPage, ID_REMOVEISOPATH, wxT("Remove"), wxDefaultPosition, wxDefaultSize, 0);
697 RemoveISOPath->Enable(false);
699 wxStaticText* DefaultISOText = new wxStaticText(PathsPage, ID_DEFAULTISO_TEXT, wxT("Default ISO:"), wxDefaultPosition, wxDefaultSize);
700 DefaultISO = new wxFilePickerCtrl(PathsPage, ID_DEFAULTISO, wxEmptyString, wxT("Choose a default ISO:"),
701 wxString::Format(wxT("All GC/Wii images (gcm, iso, gcz)|*.gcm;*.iso;*.gcz|All files (%s)|%s"), wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr),
702 wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_OPEN);
703 wxStaticText* DVDRootText = new wxStaticText(PathsPage, ID_DVDROOT_TEXT, wxT("DVD Root:"), wxDefaultPosition, wxDefaultSize);
704 DVDRoot = new wxDirPickerCtrl(PathsPage, ID_DVDROOT, wxEmptyString, wxT("Choose a DVD root directory:"), wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL);
705 wxStaticText* ApploaderPathText = new wxStaticText(PathsPage, ID_APPLOADERPATH_TEXT, wxT("Apploader:"), wxDefaultPosition, wxDefaultSize);
706 ApploaderPath = new wxFilePickerCtrl(PathsPage, ID_APPLOADERPATH, wxEmptyString, wxT("Choose file to use as apploader: (applies to discs constructed from directories only)"),
707 wxString::Format(wxT("apploader (.img)|*.img|All files (%s)|%s"), wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr),
708 wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_OPEN);
710 // Populate the settings
711 sbISOPaths->Add(ISOPaths, 1, wxEXPAND|wxALL, 0);
712 wxBoxSizer* sISOButtons = new wxBoxSizer(wxHORIZONTAL);
713 sISOButtons->Add(RecursiveISOPath, 0, wxALL|wxALIGN_CENTER, 0);
714 sISOButtons->AddStretchSpacer();
715 sISOButtons->Add(AddISOPath, 0, wxALL, 0);
716 sISOButtons->Add(RemoveISOPath, 0, wxALL, 0);
717 sbISOPaths->Add(sISOButtons, 0, wxEXPAND|wxALL, 5);
719 sOtherPaths = new wxGridBagSizer();
720 sOtherPaths->Add(DefaultISOText, wxGBPosition(0, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5);
721 sOtherPaths->Add(DefaultISO, wxGBPosition(0, 1), wxDefaultSpan, wxEXPAND|wxALL, 5);
722 sOtherPaths->Add(DVDRootText, wxGBPosition(1, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5);
723 sOtherPaths->Add(DVDRoot, wxGBPosition(1, 1), wxDefaultSpan, wxEXPAND|wxALL, 5);
724 sOtherPaths->Add(ApploaderPathText, wxGBPosition(2, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5);
725 sOtherPaths->Add(ApploaderPath, wxGBPosition(2, 1), wxDefaultSpan, wxEXPAND|wxALL, 5);
726 sOtherPaths->AddGrowableCol(1);
728 // Populate the Paths page
729 sPathsPage = new wxBoxSizer(wxVERTICAL);
730 sPathsPage->Add(sbISOPaths, 1, wxEXPAND|wxALL, 5);
731 sPathsPage->Add(sOtherPaths, 0, wxEXPAND|wxALL, 5);
733 PathsPage->SetSizer(sPathsPage);
734 sPathsPage->Layout();
738 // Plugins page
739 sbGraphicsPlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginsPage, wxT("Graphics"));
740 GraphicSelection = new wxChoice(PluginsPage, ID_GRAPHIC_CB, wxDefaultPosition, wxDefaultSize, 0, NULL, 0, wxDefaultValidator);
741 GraphicConfig = new wxButton(PluginsPage, ID_GRAPHIC_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
743 sbDSPPlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginsPage, wxT("DSP"));
744 DSPSelection = new wxChoice(PluginsPage, ID_DSP_CB, wxDefaultPosition, wxDefaultSize, 0, NULL, 0, wxDefaultValidator);
745 DSPConfig = new wxButton(PluginsPage, ID_DSP_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
747 sbWiimotePlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginsPage, wxT("Wiimote"));
748 WiimoteSelection = new wxChoice(PluginsPage, ID_WIIMOTE_CB, wxDefaultPosition, wxDefaultSize, 0, NULL, 0, wxDefaultValidator);
749 WiimoteConfig = new wxButton(PluginsPage, ID_WIIMOTE_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
751 // Populate the settings
752 sbGraphicsPlugin->Add(GraphicSelection, 1, wxEXPAND|wxALL, 5);
753 sbGraphicsPlugin->Add(GraphicConfig, 0, wxALL, 5);
755 sbDSPPlugin->Add(DSPSelection, 1, wxEXPAND|wxALL, 5);
756 sbDSPPlugin->Add(DSPConfig, 0, wxALL, 5);
758 sbWiimotePlugin->Add(WiimoteSelection, 1, wxEXPAND|wxALL, 5);
759 sbWiimotePlugin->Add(WiimoteConfig, 0, wxALL, 5);
761 // Populate the Plugins page
762 sPluginsPage = new wxBoxSizer(wxVERTICAL);
763 sPluginsPage->Add(sbGraphicsPlugin, 0, wxEXPAND|wxALL, 5);
764 sPluginsPage->Add(sbDSPPlugin, 0, wxEXPAND|wxALL, 5);
765 sPluginsPage->Add(sbWiimotePlugin, 0, wxEXPAND|wxALL, 5);
767 PluginsPage->SetSizer(sPluginsPage);
768 sPluginsPage->Layout();
770 m_Ok = new wxButton(this, wxID_OK);
772 wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL);
773 sButtons->Add(0, 0, 1, wxEXPAND, 5);
774 sButtons->Add(m_Ok, 0, wxALL, 5);
776 wxBoxSizer* sMain = new wxBoxSizer(wxVERTICAL);
777 sMain->Add(Notebook, 1, wxEXPAND|wxALL, 5);
778 sMain->Add(sButtons, 0, wxEXPAND, 5);
780 InitializeGUIValues();
781 InitializeGUITooltips();
783 UpdateGUI();
785 SetSizer(sMain);
786 Layout();
788 Fit();
789 Center();
792 void CConfigMain::OnClose(wxCloseEvent& WXUNUSED (event))
794 EndModal((bRefreshList) ? wxID_OK : wxID_CLOSE);
797 void CConfigMain::OnOk(wxCommandEvent& WXUNUSED (event))
799 Close();
800 // Sysconf saves when it gets deleted
801 //delete SConfig::GetInstance().m_SYSCONF;
803 // Save the config. Dolphin crashes to often to save the settings on closing only
804 SConfig::GetInstance().SaveSettings();
807 // Core settings
808 void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
810 switch (event.GetId())
812 // Core - Basic
813 case ID_CPUTHREAD:
814 SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread = CPUThread->IsChecked();
815 break;
816 case ID_IDLESKIP:
817 SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle = SkipIdle->IsChecked();
818 break;
819 case ID_ENABLECHEATS:
820 SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats = EnableCheats->IsChecked();
821 break;
822 case ID_FRAMELIMIT:
823 SConfig::GetInstance().m_Framelimit = Framelimit->GetSelection();
824 break;
825 case ID_FRAMELIMIT_USEFPSFORLIMITING:
826 SConfig::GetInstance().b_UseFPS = UseFPSForLimiting->IsChecked();
827 break;
828 // Core - Advanced
829 case ID_ALWAYS_HLE_BS2:
830 SConfig::GetInstance().m_LocalCoreStartupParameter.bHLE_BS2 = AlwaysHLE_BS2->IsChecked();
831 break;
832 #if defined(HAVE_OPENCL) && HAVE_OPENCL
833 case ID_ENABLE_OPENCL:
834 SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableOpenCL = EnableOpenCL->IsChecked();
835 break;
836 #endif
837 case ID_CPUENGINE:
838 SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore = CPUEngine->GetSelection();
839 if (main_frame->g_pCodeWindow)
840 main_frame->g_pCodeWindow->GetMenuBar()->Check(IDM_INTERPRETER,
841 SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore?false:true);
842 break;
843 case ID_DSPTHREAD:
844 SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPThread = DSPThread->IsChecked();
845 break;
846 case ID_LOCKTHREADS:
847 SConfig::GetInstance().m_LocalCoreStartupParameter.bLockThreads = LockThreads->IsChecked();
848 break;
852 // Display and Interface settings
853 void CConfigMain::DisplaySettingsChanged(wxCommandEvent& event)
855 switch (event.GetId())
857 // Display - Display
858 case ID_DISPLAY_FULLSCREENRES:
859 SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution =
860 FullscreenResolution->GetStringSelection().mb_str();
861 #if defined(HAVE_XRANDR) && HAVE_XRANDR
862 main_frame->m_XRRConfig->Update();
863 #endif
864 break;
865 case ID_DISPLAY_WINDOWWIDTH:
866 SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth = WindowWidth->GetValue();
867 break;
868 case ID_DISPLAY_WINDOWHEIGHT:
869 SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight = WindowHeight->GetValue();
870 break;
871 case ID_DISPLAY_FULLSCREEN:
872 SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen = Fullscreen->IsChecked();
873 break;
874 case ID_DISPLAY_HIDECURSOR:
875 SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor = HideCursor->IsChecked();
876 break;
877 case ID_DISPLAY_RENDERTOMAIN:
878 SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain = RenderToMain->IsChecked();
879 break;
880 // Display - Interface
881 case ID_INTERFACE_CONFIRMSTOP:
882 SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop = ConfirmStop->IsChecked();
883 break;
884 case ID_INTERFACE_USEPANICHANDLERS:
885 SConfig::GetInstance().m_LocalCoreStartupParameter.bUsePanicHandlers = UsePanicHandlers->IsChecked();
886 SetEnableAlert(UsePanicHandlers->IsChecked());
887 break;
888 case ID_INTERFACE_THEME:
889 SConfig::GetInstance().m_LocalCoreStartupParameter.iTheme = Theme->GetSelection();
890 main_frame->InitBitmaps();
891 break;
892 case ID_INTERFACE_LANG:
893 SConfig::GetInstance().m_InterfaceLanguage = (INTERFACE_LANGUAGE)InterfaceLang->GetSelection();
894 bRefreshList = true;
895 break;
896 case ID_HOTKEY_CONFIG:
898 HotkeyConfigDialog *m_HotkeyDialog = new HotkeyConfigDialog(this);
899 m_HotkeyDialog->ShowModal();
900 m_HotkeyDialog->Destroy();
901 // Update the GUI in case menu accelerators were changed
902 main_frame->UpdateGUI();
904 break;
909 // GC settings
910 // -----------------------
911 void CConfigMain::GCSettingsChanged(wxCommandEvent& event)
913 int sidevice = 0;
914 int exidevice = 0;
915 switch (event.GetId())
917 // Gamecube - IPL
918 case ID_GC_SRAM_LNG:
919 SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage = GCSystemLang->GetSelection();
920 break;
921 // Gamecube - Devices
922 case ID_GC_EXIDEVICE_SP1:
923 exidevice++;
924 case ID_GC_EXIDEVICE_SLOTB:
925 exidevice++;
926 case ID_GC_EXIDEVICE_SLOTA:
927 ChooseEXIDevice(std::string(event.GetString().mb_str()), exidevice);
928 break;
929 case ID_GC_EXIDEVICE_SLOTA_PATH:
930 ChooseMemcardPath(SConfig::GetInstance().m_strMemoryCardA, true);
931 break;
932 case ID_GC_EXIDEVICE_SLOTB_PATH:
933 ChooseMemcardPath(SConfig::GetInstance().m_strMemoryCardB, false);
934 break;
935 case ID_GC_SIDEVICE3:
936 sidevice++;
937 case ID_GC_SIDEVICE2:
938 sidevice++;
939 case ID_GC_SIDEVICE1:
940 sidevice++;
941 case ID_GC_SIDEVICE0:
942 ChooseSIDevice(std::string(event.GetString().mb_str()), sidevice);
943 break;
947 void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA)
949 std::string filename = std::string(wxFileSelector(
950 wxT("Choose a file to open"),
951 wxString::From8BitData(File::GetUserPath(D_GCUSER_IDX)),
952 isSlotA ? wxT(GC_MEMCARDA) : wxT(GC_MEMCARDB),
953 wxEmptyString,
954 wxT("Gamecube Memory Cards (*.raw,*.gcp)|*.raw;*.gcp")).mb_str());
956 if (!filename.empty())
958 // also check that the path isn't used for the other memcard...
959 if (filename.compare(isSlotA ? SConfig::GetInstance().m_strMemoryCardB
960 : SConfig::GetInstance().m_strMemoryCardA) != 0)
962 strMemcard = filename;
964 if (Core::GetState() != Core::CORE_UNINITIALIZED)
966 // Change memcard to the new file
967 ExpansionInterface::ChangeDevice(
968 isSlotA ? 0 : 1, // SlotA: channel 0, SlotB channel 1
969 isSlotA ? EXIDEVICE_MEMORYCARD_A : EXIDEVICE_MEMORYCARD_B,
970 0); // SP1 is device 2, slots are device 0
973 else
975 PanicAlert("Cannot use that file as a memory card.\n"
976 "Are you trying to use the same file in both slots?");
981 void CConfigMain::ChooseSIDevice(std::string deviceName, int deviceNum)
983 TSIDevices tempType;
984 if (!deviceName.compare(SIDEV_STDCONT_STR))
985 tempType = SI_GC_CONTROLLER;
986 else if (!deviceName.compare(SIDEV_GBA_STR))
987 tempType = SI_GBA;
988 else if (!deviceName.compare(SIDEV_AM_BB_STR))
989 tempType = SI_AM_BASEBOARD;
990 else
991 tempType = SI_NONE;
993 SConfig::GetInstance().m_SIDevice[deviceNum] = tempType;
995 if (Core::GetState() != Core::CORE_UNINITIALIZED)
997 // Change plugged device! :D
998 SerialInterface::ChangeDevice(tempType, deviceNum);
1002 void CConfigMain::ChooseEXIDevice(std::string deviceName, int deviceNum)
1004 TEXIDevices tempType;
1006 if (!deviceName.compare(EXIDEV_MEMCARD_STR))
1007 tempType = deviceNum ? EXIDEVICE_MEMORYCARD_B : EXIDEVICE_MEMORYCARD_A;
1008 else if (!deviceName.compare(EXIDEV_MIC_STR))
1009 tempType = EXIDEVICE_MIC;
1010 else if (!deviceName.compare(EXIDEV_BBA_STR))
1011 tempType = EXIDEVICE_ETH;
1012 else if (!deviceName.compare(EXIDEV_AM_BB_STR))
1013 tempType = EXIDEVICE_AM_BASEBOARD;
1014 else if (!deviceName.compare(DEV_NONE_STR))
1015 tempType = EXIDEVICE_NONE;
1016 else
1017 tempType = EXIDEVICE_DUMMY;
1019 // Gray out the memcard path button if we're not on a memcard
1020 if (tempType == EXIDEVICE_MEMORYCARD_A || tempType == EXIDEVICE_MEMORYCARD_B)
1021 GCMemcardPath[deviceNum]->Enable();
1022 else if (deviceNum == 0 || deviceNum == 1)
1023 GCMemcardPath[deviceNum]->Disable();
1025 SConfig::GetInstance().m_EXIDevice[deviceNum] = tempType;
1027 if (Core::GetState() != Core::CORE_UNINITIALIZED)
1029 // Change plugged device! :D
1030 ExpansionInterface::ChangeDevice(
1031 (deviceNum == 1) ? 1 : 0, // SlotB is on channel 1, slotA and SP1 are on 0
1032 tempType, // The device enum to change to
1033 (deviceNum == 2) ? 2 : 0); // SP1 is device 2, slots are device 0
1040 // Wii settings
1041 // -------------------
1042 void CConfigMain::WiiSettingsChanged(wxCommandEvent& event)
1044 switch (event.GetId())
1046 // Wii - Wiimote settings
1047 case ID_WII_BT_BAR:
1048 SConfig::GetInstance().m_SYSCONF->SetData("BT.BAR", WiiSensBarPos->GetSelection());
1049 break;
1050 // SYSCONF settings
1051 case ID_WII_IPL_SSV:
1052 SConfig::GetInstance().m_SYSCONF->SetData("IPL.SSV", WiiScreenSaver->IsChecked());
1053 break;
1054 case ID_WII_IPL_PGS:
1055 SConfig::GetInstance().m_SYSCONF->SetData("IPL.PGS", WiiProgressiveScan->IsChecked());
1056 break;
1057 case ID_WII_IPL_E60:
1058 SConfig::GetInstance().m_SYSCONF->SetData("IPL.E60", WiiEuRGB60->IsChecked());
1059 break;
1060 case ID_WII_IPL_AR:
1061 SConfig::GetInstance().m_SYSCONF->SetData("IPL.AR", WiiAspectRatio->GetSelection());
1062 break;
1063 case ID_WII_IPL_LNG:
1064 SConfig::GetInstance().m_SYSCONF->SetData("IPL.LNG", WiiSystemLang->GetSelection());
1065 break;
1066 // Wii - Devices
1067 case ID_WII_SD_CARD:
1068 SConfig::GetInstance().m_WiiSDCard = WiiSDCard->IsChecked();
1069 break;
1070 case ID_WII_KEYBOARD:
1071 SConfig::GetInstance().m_WiiKeyboard = WiiKeyboard->IsChecked();
1072 break;
1080 // Paths settings
1081 // -------------------
1082 void CConfigMain::ISOPathsSelectionChanged(wxCommandEvent& WXUNUSED (event))
1084 if (!ISOPaths->GetStringSelection().empty())
1086 RemoveISOPath->Enable(true);
1088 else
1090 RemoveISOPath->Enable(false);
1094 void CConfigMain::AddRemoveISOPaths(wxCommandEvent& event)
1096 if (event.GetId() == ID_ADDISOPATH)
1098 wxString dirHome;
1099 wxGetHomeDir(&dirHome);
1101 wxDirDialog dialog(this, _T("Choose a directory to add"), dirHome, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
1103 if (dialog.ShowModal() == wxID_OK)
1105 if (ISOPaths->FindString(dialog.GetPath()) != -1)
1107 wxMessageBox(_("The chosen directory is already in the list"), _("Error"), wxOK);
1109 else
1111 bRefreshList = true;
1112 ISOPaths->Append(dialog.GetPath());
1116 else
1118 bRefreshList = true;
1119 ISOPaths->Delete(ISOPaths->GetSelection());
1122 // Save changes right away
1123 SConfig::GetInstance().m_ISOFolder.clear();
1125 for (unsigned int i = 0; i < ISOPaths->GetCount(); i++)
1126 SConfig::GetInstance().m_ISOFolder.push_back(std::string(ISOPaths->GetStrings()[i].mb_str()));
1129 void CConfigMain::RecursiveDirectoryChanged(wxCommandEvent& WXUNUSED (event))
1131 SConfig::GetInstance().m_RecursiveISOFolder = RecursiveISOPath->IsChecked();
1132 bRefreshList = true;
1135 void CConfigMain::DefaultISOChanged(wxFileDirPickerEvent& WXUNUSED (event))
1137 SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM = DefaultISO->GetPath().mb_str();
1140 void CConfigMain::DVDRootChanged(wxFileDirPickerEvent& WXUNUSED (event))
1142 SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDVDRoot = DVDRoot->GetPath().mb_str();
1145 void CConfigMain::ApploaderPathChanged(wxFileDirPickerEvent& WXUNUSED (event))
1147 SConfig::GetInstance().m_LocalCoreStartupParameter.m_strApploader = ApploaderPath->GetPath().mb_str();
1151 // Plugin settings
1152 void CConfigMain::OnSelectionChanged(wxCommandEvent& WXUNUSED (event))
1154 // Update plugin filenames
1155 GetFilename(GraphicSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
1156 GetFilename(DSPSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
1157 GetFilename(WiimoteSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin);
1160 void CConfigMain::OnConfig(wxCommandEvent& event)
1162 switch (event.GetId())
1164 case ID_GRAPHIC_CONFIG:
1165 CallConfig(GraphicSelection);
1166 break;
1167 case ID_DSP_CONFIG:
1168 CallConfig(DSPSelection);
1169 break;
1170 case ID_WIIMOTE_CONFIG:
1171 CallConfig(WiimoteSelection);
1172 break;
1176 void CConfigMain::CallConfig(wxChoice* _pChoice)
1178 int Index = _pChoice->GetSelection();
1179 INFO_LOG(CONSOLE, "CallConfig: %i\n", Index);
1180 if (Index >= 0)
1182 const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
1183 if (pInfo != NULL)
1185 #ifdef _WIN32
1186 // Make sure only one dialog can be opened at a time in Windows,
1187 // but is unnecessary and looks bad in linux.
1188 Disable();
1189 #endif
1190 CPluginManager::GetInstance().OpenConfig(this,
1191 pInfo->GetFilename().c_str(), pInfo->GetPluginInfo().Type);
1192 #ifdef _WIN32
1193 Enable();
1194 Raise();
1195 #endif
1200 void CConfigMain::FillChoiceBox(wxChoice* _pChoice, int _PluginType, const std::string& _SelectFilename)
1202 _pChoice->Clear();
1204 int Index = -1;
1205 const CPluginInfos& rInfos = CPluginManager::GetInstance().GetPluginInfos();
1207 for (size_t i = 0; i < rInfos.size(); i++)
1209 const PLUGIN_INFO& rPluginInfo = rInfos[i].GetPluginInfo();
1211 if (rPluginInfo.Type == _PluginType)
1213 wxString temp;
1214 temp = wxString::FromAscii(rInfos[i].GetPluginInfo().Name);
1215 int NewIndex = _pChoice->Append(temp, (void*)&rInfos[i]);
1217 if (rInfos[i].GetFilename() == _SelectFilename)
1219 Index = NewIndex;
1224 _pChoice->Select(Index);
1227 bool CConfigMain::GetFilename(wxChoice* _pChoice, std::string& _rFilename)
1229 _rFilename.clear();
1230 int Index = _pChoice->GetSelection();
1231 if (Index >= 0)
1233 const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
1234 _rFilename = pInfo->GetFilename();
1235 INFO_LOG(CONSOLE, "GetFilename: %i %s\n", Index, _rFilename.c_str());
1236 return(true);
1239 return(false);
1242 // Search for avaliable resolutions
1243 void CConfigMain::AddResolutions()
1245 #ifdef _WIN32
1246 DWORD iModeNum = 0;
1247 DEVMODE dmi;
1248 ZeroMemory(&dmi, sizeof(dmi));
1249 dmi.dmSize = sizeof(dmi);
1250 std::vector<std::string> resos;
1252 while (EnumDisplaySettings(NULL, iModeNum++, &dmi) != 0)
1254 char res[100];
1255 sprintf(res, "%dx%d", dmi.dmPelsWidth, dmi.dmPelsHeight);
1256 std::string strRes(res);
1257 // Only add unique resolutions
1258 if (std::find(resos.begin(), resos.end(), strRes) == resos.end())
1260 resos.push_back(strRes);
1261 arrayStringFor_FullscreenResolution.Add(wxString::FromAscii(res));
1263 ZeroMemory(&dmi, sizeof(dmi));
1265 #elif defined(HAVE_XRANDR) && HAVE_XRANDR
1266 main_frame->m_XRRConfig->AddResolutions(arrayStringFor_FullscreenResolution);
1267 #elif defined(__APPLE__)
1268 CFDictionaryRef mode;
1269 CFArrayRef array;
1270 CFIndex n, i;
1271 int w, h;
1272 std::vector<std::string> resos;
1274 array = CGDisplayAvailableModes(CGMainDisplayID());
1275 n = CFArrayGetCount(array);
1277 for (i = 0; i < n; i++)
1279 mode = (CFDictionaryRef)CFArrayGetValueAtIndex(array, i);
1281 CFNumberRef anWidth = (CFNumberRef)CFDictionaryGetValue(mode,
1282 kCGDisplayWidth);
1283 if (NULL == anWidth ||
1284 !CFNumberGetValue(anWidth, kCFNumberIntType, &w))
1285 continue;
1287 CFNumberRef anHeight =
1288 (CFNumberRef)CFDictionaryGetValue(mode,
1289 kCGDisplayHeight);
1290 if (NULL == anHeight ||
1291 !CFNumberGetValue(anHeight, kCFNumberIntType, &h))
1292 continue;
1294 char res[32];
1295 sprintf(res,"%dx%d", w, h);
1296 std::string strRes(res);
1298 // Only add unique resolutions
1299 if (std::find(resos.begin(), resos.end(), strRes) ==
1300 resos.end())
1302 resos.push_back(strRes);
1303 arrayStringFor_FullscreenResolution.Add(strRes);
1306 #endif