Move fullscreen display resolution control to the GUI with the rest of the fullscreen...
[dolphin.git] / Source / Core / DolphinWX / Src / ConfigMain.cpp
blobde2d69704467011f877a13a99a456ec45f55a800
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 "Core.h" // Core
22 #include "HW/EXI.h"
23 #include "HW/SI.h"
25 #include "Globals.h" // Local
26 #include "ConfigMain.h"
27 #include "PluginManager.h"
28 #include "ConfigManager.h"
29 #include "SysConf.h"
30 #include "Frame.h"
31 #include "HotkeyDlg.h"
33 extern CFrame* main_frame;
35 // Strings for Device Selections
36 #define DEV_NONE_STR "<Nothing>"
37 #define DEV_DUMMY_STR "Dummy"
39 #define SIDEV_STDCONT_STR "Standard Controller"
40 #define SIDEV_GBA_STR "GBA"
41 #define SIDEV_AM_BB_STR "AM-Baseboard"
43 #define EXIDEV_MEMCARD_STR "Memory Card"
44 #define EXIDEV_MIC_STR "Mic"
45 #define EXIDEV_BBA_STR "BBA"
46 #define EXIDEV_AM_BB_STR "AM-Baseboard"
48 BEGIN_EVENT_TABLE(CConfigMain, wxDialog)
50 EVT_CLOSE(CConfigMain::OnClose)
51 EVT_BUTTON(wxID_CLOSE, CConfigMain::CloseClick)
53 EVT_CHECKBOX(ID_INTERFACE_CONFIRMSTOP, CConfigMain::CoreSettingsChanged)
54 EVT_CHECKBOX(ID_INTERFACE_USEPANICHANDLERS, CConfigMain::CoreSettingsChanged)
55 EVT_CHECKBOX(ID_FRAMELIMIT_USEFPSFORLIMITING, CConfigMain::CoreSettingsChanged)
56 EVT_CHOICE(ID_DISPLAY_FULLSCREENRES, CConfigMain::CoreSettingsChanged)
57 EVT_CHECKBOX(ID_DISPLAY_FULLSCREEN, CConfigMain::CoreSettingsChanged)
58 EVT_TEXT(ID_DISPLAY_WINDOWWIDTH, CConfigMain::CoreSettingsChanged)
59 EVT_TEXT(ID_DISPLAY_WINDOWHEIGHT, CConfigMain::CoreSettingsChanged)
60 EVT_CHECKBOX(ID_DISPLAY_HIDECURSOR, CConfigMain::CoreSettingsChanged)
61 EVT_CHECKBOX(ID_DISPLAY_RENDERTOMAIN, CConfigMain::CoreSettingsChanged)
62 EVT_RADIOBOX(ID_INTERFACE_THEME, CConfigMain::CoreSettingsChanged)
63 EVT_CHOICE(ID_INTERFACE_LANG, CConfigMain::CoreSettingsChanged)
64 EVT_BUTTON(ID_HOTKEY_CONFIG, CConfigMain::CoreSettingsChanged)
66 EVT_CHECKBOX(ID_ALWAYS_HLE_BS2, CConfigMain::CoreSettingsChanged)
67 EVT_RADIOBUTTON(ID_RADIOJIT, CConfigMain::CoreSettingsChanged)
68 EVT_RADIOBUTTON(ID_RADIOJITIL, CConfigMain::CoreSettingsChanged)
69 EVT_RADIOBUTTON(ID_RADIOINT, CConfigMain::CoreSettingsChanged)
70 EVT_CHECKBOX(ID_CPUTHREAD, CConfigMain::CoreSettingsChanged)
71 EVT_CHECKBOX(ID_DSPTHREAD, CConfigMain::CoreSettingsChanged)
72 EVT_CHECKBOX(ID_LOCKTHREADS, CConfigMain::CoreSettingsChanged)
73 EVT_CHECKBOX(ID_IDLESKIP, CConfigMain::CoreSettingsChanged)
74 EVT_CHECKBOX(ID_ENABLECHEATS, CConfigMain::CoreSettingsChanged)
75 EVT_CHOICE(ID_FRAMELIMIT, CConfigMain::CoreSettingsChanged)
77 EVT_CHOICE(ID_GC_SRAM_LNG, CConfigMain::GCSettingsChanged)
78 EVT_CHOICE(ID_GC_EXIDEVICE_SLOTA, CConfigMain::GCSettingsChanged)
79 EVT_BUTTON(ID_GC_EXIDEVICE_SLOTA_PATH, CConfigMain::GCSettingsChanged)
80 EVT_CHOICE(ID_GC_EXIDEVICE_SLOTB, CConfigMain::GCSettingsChanged)
81 EVT_BUTTON(ID_GC_EXIDEVICE_SLOTB_PATH, CConfigMain::GCSettingsChanged)
82 EVT_CHOICE(ID_GC_EXIDEVICE_SP1, CConfigMain::GCSettingsChanged)
83 EVT_CHOICE(ID_GC_SIDEVICE0, CConfigMain::GCSettingsChanged)
84 EVT_CHOICE(ID_GC_SIDEVICE1, CConfigMain::GCSettingsChanged)
85 EVT_CHOICE(ID_GC_SIDEVICE2, CConfigMain::GCSettingsChanged)
86 EVT_CHOICE(ID_GC_SIDEVICE3, CConfigMain::GCSettingsChanged)
88 EVT_CHOICE(ID_WII_BT_BAR, CConfigMain::WiiSettingsChanged)
89 EVT_CHECKBOX(ID_WII_IPL_SSV, CConfigMain::WiiSettingsChanged)
90 EVT_CHECKBOX(ID_WII_IPL_PGS, CConfigMain::WiiSettingsChanged)
91 EVT_CHECKBOX(ID_WII_IPL_E60, CConfigMain::WiiSettingsChanged)
92 EVT_CHOICE(ID_WII_IPL_AR, CConfigMain::WiiSettingsChanged)
93 EVT_CHOICE(ID_WII_IPL_LNG, CConfigMain::WiiSettingsChanged)
94 EVT_CHECKBOX(ID_WII_SD_CARD, CConfigMain::WiiSettingsChanged)
95 EVT_CHECKBOX(ID_WII_KEYBOARD, CConfigMain::WiiSettingsChanged)
97 EVT_LISTBOX(ID_ISOPATHS, CConfigMain::ISOPathsSelectionChanged)
98 EVT_BUTTON(ID_ADDISOPATH, CConfigMain::AddRemoveISOPaths)
99 EVT_BUTTON(ID_REMOVEISOPATH, CConfigMain::AddRemoveISOPaths)
100 EVT_CHECKBOX(ID_RECERSIVEISOPATH, CConfigMain::RecursiveDirectoryChanged)
101 EVT_FILEPICKER_CHANGED(ID_DEFAULTISO, CConfigMain::DefaultISOChanged)
102 EVT_DIRPICKER_CHANGED(ID_DVDROOT, CConfigMain::DVDRootChanged)
103 EVT_FILEPICKER_CHANGED(ID_APPLOADERPATH, CConfigMain::ApploaderPathChanged)
105 EVT_CHOICE(ID_GRAPHIC_CB, CConfigMain::OnSelectionChanged)
106 EVT_BUTTON(ID_GRAPHIC_CONFIG, CConfigMain::OnConfig)
107 EVT_CHOICE(ID_DSP_CB, CConfigMain::OnSelectionChanged)
108 EVT_BUTTON(ID_DSP_CONFIG, CConfigMain::OnConfig)
109 EVT_CHOICE(ID_PAD_CB, CConfigMain::OnSelectionChanged)
110 EVT_BUTTON(ID_PAD_CONFIG, CConfigMain::OnConfig)
111 EVT_CHOICE(ID_WIIMOTE_CB, CConfigMain::OnSelectionChanged)
112 EVT_BUTTON(ID_WIIMOTE_CONFIG, CConfigMain::OnConfig)
114 END_EVENT_TABLE()
116 CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
117 : wxDialog(parent, id, title, position, size, style)
119 // Control refreshing of the ISOs list
120 bRefreshList = false;
122 AddResolutions();
123 CreateGUIControls();
125 // Update selected ISO paths
126 for(u32 i = 0; i < SConfig::GetInstance().m_ISOFolder.size(); i++)
128 ISOPaths->Append(wxString(SConfig::GetInstance().m_ISOFolder[i].c_str(), *wxConvCurrent));
132 CConfigMain::~CConfigMain()
136 // Used to restrict changing of some options while emulator is running
137 void CConfigMain::UpdateGUI()
139 if(Core::GetState() != Core::CORE_UNINITIALIZED)
141 // Disable the Core stuff on GeneralPage
142 AlwaysHLE_BS2->Disable();
143 m_RadioJIT->Disable();
144 m_RadioJITIL->Disable();
145 m_RadioInt->Disable();
146 CPUThread->Disable();
147 DSPThread->Disable();
148 LockThreads->Disable();
149 SkipIdle->Disable();
150 EnableCheats->Disable();
151 RenderToMain->Disable();
152 FullscreenResolution->Disable();
154 GCSystemLang->Disable();
156 WiiSensBarPos->Disable();
157 WiiScreenSaver->Disable();
158 WiiProgressiveScan->Disable();
159 WiiEuRGB60->Disable();
160 WiiAspectRatio->Disable();
161 WiiSystemLang->Disable();
163 PathsPage->Disable();
165 GraphicSelection->Disable();
166 DSPSelection->Disable();
167 PADSelection->Disable();
168 WiimoteSelection->Disable();
172 void CConfigMain::InitializeGUILists()
174 // Deal with all the language arrayStrings here
175 // GC
176 arrayStringFor_GCSystemLang.Add(wxT("English"));
177 arrayStringFor_GCSystemLang.Add(wxT("German"));
178 arrayStringFor_GCSystemLang.Add(wxT("French"));
179 arrayStringFor_GCSystemLang.Add(wxT("Spanish"));
180 arrayStringFor_GCSystemLang.Add(wxT("Italian"));
181 arrayStringFor_GCSystemLang.Add(wxT("Dutch"));
182 // Wii
183 arrayStringFor_WiiSystemLang = arrayStringFor_GCSystemLang;
184 arrayStringFor_WiiSystemLang.Insert(wxT("Japanese"), 0);
185 arrayStringFor_WiiSystemLang.Add(wxT("Simplified Chinese"));
186 arrayStringFor_WiiSystemLang.Add(wxT("Traditional Chinese"));
187 arrayStringFor_WiiSystemLang.Add(wxT("Korean"));
188 // GUI
189 arrayStringFor_InterfaceLang = arrayStringFor_GCSystemLang;
191 // Resolutions
192 if (arrayStringFor_FullscreenResolution.empty())
193 arrayStringFor_FullscreenResolution.Add(wxT("<No resolutions found>"));
195 // Framelimit
196 arrayStringFor_Framelimit.Add(wxT("Off"));
197 arrayStringFor_Framelimit.Add(wxT("Auto"));
198 for (int i = 10; i <= 120; i += 5) // from 10 to 120
199 arrayStringFor_Framelimit.Add(wxString::Format(wxT("%i"), i));
201 // Themes
202 arrayStringFor_Themes.Add(wxT("Boomy"));
203 arrayStringFor_Themes.Add(wxT("Vista"));
204 arrayStringFor_Themes.Add(wxT("X-Plastik"));
205 arrayStringFor_Themes.Add(wxT("KDE"));
207 // Wii
208 // Sensorbar Position
209 arrayStringFor_WiiSensBarPos.Add(wxT("Bottom"));
210 arrayStringFor_WiiSensBarPos.Add(wxT("Top"));
211 // Aspect ratio
212 arrayStringFor_WiiAspectRatio.Add(wxT("4:3"));
213 arrayStringFor_WiiAspectRatio.Add(wxT("16:9"));
216 void CConfigMain::InitializeGUIValues()
218 // General - Basic
219 CPUThread->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread);
220 SkipIdle->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle);
221 EnableCheats->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats);
222 Framelimit->SetSelection(SConfig::GetInstance().m_Framelimit);
223 UseFPSForLimiting->SetValue(SConfig::GetInstance().b_UseFPS);
225 // General - Advanced
226 AlwaysHLE_BS2->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bHLE_BS2);
227 switch (SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore)
229 case 0: m_RadioInt->SetValue(true); break;
230 case 1: m_RadioJIT->SetValue(true); break;
231 case 2: m_RadioJITIL->SetValue(true); break;
233 LockThreads->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bLockThreads);
234 DSPThread->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPThread);
236 // General - Interface
237 ConfirmStop->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop);
238 UsePanicHandlers->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bUsePanicHandlers);
239 Theme->SetSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.iTheme);
240 // need redesign
241 InterfaceLang->SetSelection(SConfig::GetInstance().m_InterfaceLanguage);
243 // General - Display
244 int num = 0;
245 num = FullscreenResolution->FindString(wxString::FromAscii(SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution.c_str()));
246 FullscreenResolution->SetSelection(num);
247 WindowWidth->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth);
248 WindowHeight->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight);
249 Fullscreen->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen);
250 HideCursor->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor);
251 RenderToMain->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain);
253 // Gamecube - IPL
254 GCSystemLang->SetSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage);
256 // Gamecube - Devices
257 // Not here. They use some locals over in CreateGUIControls for initialization,
258 // which is why they are still there.
260 // Wii
261 WiiSensBarPos->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("BT.BAR"));
263 WiiScreenSaver->SetValue(!!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.SSV"));
264 WiiProgressiveScan->SetValue(!!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.PGS"));
265 WiiEuRGB60->SetValue(!!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.E60"));
266 WiiAspectRatio->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.AR"));
267 WiiSystemLang->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG"));
269 WiiSDCard->SetValue(SConfig::GetInstance().m_WiiSDCard);
270 WiiKeyboard->SetValue(SConfig::GetInstance().m_WiiKeyboard);
272 // Paths
273 RecersiveISOPath->SetValue(SConfig::GetInstance().m_RecursiveISOFolder);
274 DefaultISO->SetPath(wxString(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM.c_str(), *wxConvCurrent));
275 DVDRoot->SetPath(wxString(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDVDRoot.c_str(), *wxConvCurrent));
276 ApploaderPath->SetPath(wxString(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strApploader.c_str(), *wxConvCurrent));
278 // Plugins
279 FillChoiceBox(GraphicSelection, PLUGIN_TYPE_VIDEO, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
280 FillChoiceBox(DSPSelection, PLUGIN_TYPE_DSP, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
281 for (int i = 0; i < MAXPADS; i++)
282 FillChoiceBox(PADSelection, PLUGIN_TYPE_PAD, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[i]);
283 for (int i=0; i < MAXWIIMOTES; i++)
284 FillChoiceBox(WiimoteSelection, PLUGIN_TYPE_WIIMOTE, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[i]);
286 void CConfigMain::InitializeGUITooltips()
288 // General - Basic
289 CPUThread->SetToolTip(wxT("This splits the Video and CPU threads, so they can be run on separate cores.")
290 wxT("\nCauses major speed improvements on PCs with more than one core,")
291 wxT("\nbut can also cause occasional crashes/glitches."));
292 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."));
294 // General - Advanced
295 DSPThread->SetToolTip(wxT("Run DSPLLE on a dedicated thread (not recommended)."));
297 // General - Interface
298 ConfirmStop->SetToolTip(wxT("Show a confirmation box before stopping a game."));
299 UsePanicHandlers->SetToolTip(wxT("Show a message box when a potentially serious error has occured.")
300 wxT(" Disabling this may avoid annoying and non-fatal messages, but it may also mean that Dolphin")
301 wxT(" suddenly crashes without any explanation at all."));
302 InterfaceLang->SetToolTip(wxT("For the time being this will only change the text shown in")
303 wxT("\nthe game list of PAL GC games."));
305 // Themes: Copyright notice
306 Theme->SetItemToolTip(0, wxT("Created by Milosz Wlazlo [miloszwl@miloszwl.com, miloszwl.deviantart.com]"));
307 Theme->SetItemToolTip(1, wxT("Created by VistaIcons.com"));
308 Theme->SetItemToolTip(2, wxT("Created by black_rider and published on ForumW.org > Web Developments"));
309 Theme->SetItemToolTip(3, wxT("Created by KDE-Look.org"));
311 // General - Display
312 FullscreenResolution->SetToolTip(wxT("Select resolution for fullscreen mode"));
313 WindowWidth->SetToolTip(wxT("Window width for windowed mode"));
314 WindowHeight->SetToolTip(wxT("Window height for windowed mode"));
315 Fullscreen->SetToolTip(wxT("Start the rendering window in fullscreen mode."));
316 HideCursor->SetToolTip(wxT("Hide the cursor when it is over the rendering window")
317 wxT("\n and the rendering window has focus."));
318 RenderToMain->SetToolTip(wxT("Render to main window."));
320 // Wii
321 WiiKeyboard->SetToolTip(wxT("This could cause slow down in Wii Menu and some games."));
324 void CConfigMain::CreateGUIControls()
326 InitializeGUILists();
328 // Create the notebook and pages
329 Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
330 GeneralPage = new wxPanel(Notebook, ID_GENERALPAGE, wxDefaultPosition, wxDefaultSize);
331 GamecubePage = new wxPanel(Notebook, ID_GAMECUBEPAGE, wxDefaultPosition, wxDefaultSize);
332 WiiPage = new wxPanel(Notebook, ID_WIIPAGE, wxDefaultPosition, wxDefaultSize);
333 PathsPage = new wxPanel(Notebook, ID_PATHSPAGE, wxDefaultPosition, wxDefaultSize);
334 PluginPage = new wxPanel(Notebook, ID_PLUGINPAGE, wxDefaultPosition, wxDefaultSize);
336 Notebook->AddPage(GeneralPage, wxT("General"));
337 Notebook->AddPage(GamecubePage, wxT("Gamecube"));
338 Notebook->AddPage(WiiPage, wxT("Wii"));
339 Notebook->AddPage(PathsPage, wxT("Paths"));
340 Notebook->AddPage(PluginPage, wxT("Plugins"));
342 // General page
343 sbBasic = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Basic Settings"));
344 sbAdvanced = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Advanced Settings"));
345 sbInterface = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Interface Settings"));
346 sbDisplay = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Emulator Display Settings"));
347 // Core Settings - Basic
348 CPUThread = new wxCheckBox(GeneralPage, ID_CPUTHREAD, wxT("Enable Dual Core (speedup)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
349 SkipIdle = new wxCheckBox(GeneralPage, ID_IDLESKIP, wxT("Enable Idle Skipping (speedup)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
350 EnableCheats = new wxCheckBox(GeneralPage, ID_ENABLECHEATS, wxT("Enable Cheats"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
352 // Framelimit
353 wxStaticText *FramelimitText = new wxStaticText(GeneralPage, ID_FRAMELIMIT_TEXT, wxT("Framelimit :"), wxDefaultPosition, wxDefaultSize);
354 Framelimit = new wxChoice(GeneralPage, ID_FRAMELIMIT, wxDefaultPosition, wxDefaultSize, arrayStringFor_Framelimit, 0, wxDefaultValidator);
355 UseFPSForLimiting = new wxCheckBox(GeneralPage, ID_FRAMELIMIT_USEFPSFORLIMITING, wxT("Use FPS For Limiting"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
357 // Core Settings - Advanced
358 wxStaticBoxSizer* sizerCoreType = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("CPU Emulator Engine"));
359 AlwaysHLE_BS2 = new wxCheckBox(GeneralPage, ID_ALWAYS_HLE_BS2, wxT("HLE the IPL (recommended)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
360 m_RadioJIT = new wxRadioButton(GeneralPage, ID_RADIOJIT, wxT("JIT recompiler (recommended)"));
361 m_RadioJITIL = new wxRadioButton(GeneralPage, ID_RADIOJITIL, wxT("JitIL experimental recompiler"));
362 m_RadioInt = new wxRadioButton(GeneralPage, ID_RADIOINT, wxT("Interpreter (VERY slow)"));
363 LockThreads = new wxCheckBox(GeneralPage, ID_LOCKTHREADS, wxT("Lock threads to cores"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
364 DSPThread = new wxCheckBox(GeneralPage, ID_DSPTHREAD, wxT("DSPLLE on thread"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
366 // Interface settings
367 ConfirmStop = new wxCheckBox(GeneralPage, ID_INTERFACE_CONFIRMSTOP, wxT("Confirm On Stop"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
368 UsePanicHandlers = new wxCheckBox(GeneralPage, ID_INTERFACE_USEPANICHANDLERS, wxT("Use Panic Handlers"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
371 // Interface Language
372 // At the moment this only changes the language displayed in m_gamelistctrl
373 // If someone wants to control the whole GUI's language, it should be set here too
374 wxStaticText *InterfaceLangText = new wxStaticText(GeneralPage, ID_INTERFACE_LANG_TEXT, wxT("Game List Language:"), wxDefaultPosition, wxDefaultSize);
375 InterfaceLang = new wxChoice(GeneralPage, ID_INTERFACE_LANG, wxDefaultPosition, wxDefaultSize, arrayStringFor_InterfaceLang, 0, wxDefaultValidator);
377 // Hotkey configuration
378 HotkeyConfig = new wxButton(GeneralPage, ID_HOTKEY_CONFIG, wxT("Hotkeys"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
380 // Themes - this should really be a wxChoice...
381 Theme = new wxRadioBox(GeneralPage, ID_INTERFACE_THEME, wxT("Theme"),wxDefaultPosition, wxDefaultSize, arrayStringFor_Themes, 1, wxRA_SPECIFY_ROWS);
383 // General display settings
384 wxStaticText *FullscreenResolutionText = new wxStaticText(GeneralPage, wxID_ANY, wxT("Fullscreen Display Resolution:"), wxDefaultPosition, wxDefaultSize, 0);
385 FullscreenResolution = new wxChoice(GeneralPage, ID_DISPLAY_FULLSCREENRES, wxDefaultPosition, wxDefaultSize, arrayStringFor_FullscreenResolution, 0, wxDefaultValidator, arrayStringFor_FullscreenResolution[0]);
386 wxStaticText *WindowSizeText = new wxStaticText(GeneralPage, wxID_ANY, wxT("Window Size:"), wxDefaultPosition, wxDefaultSize, 0);
387 WindowWidth = new wxSpinCtrl(GeneralPage, ID_DISPLAY_WINDOWWIDTH, wxEmptyString, wxDefaultPosition, wxDefaultSize);
388 wxStaticText *WindowXText = new wxStaticText(GeneralPage, wxID_ANY, wxT("x"), wxDefaultPosition, wxDefaultSize, 0);
389 WindowWidth->SetRange(0,3280);
390 WindowHeight = new wxSpinCtrl(GeneralPage, ID_DISPLAY_WINDOWHEIGHT, wxEmptyString, wxDefaultPosition, wxDefaultSize);
391 WindowHeight->SetRange(0,2048);
392 Fullscreen = new wxCheckBox(GeneralPage, ID_DISPLAY_FULLSCREEN, wxT("Start Renderer in Fullscreen"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
393 HideCursor = new wxCheckBox(GeneralPage, ID_DISPLAY_HIDECURSOR, wxT("Hide Mouse Cursor"));
394 RenderToMain = new wxCheckBox(GeneralPage, ID_DISPLAY_RENDERTOMAIN, wxT("Render to Main Window"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
396 // Populate the settings
397 sCore = new wxBoxSizer(wxHORIZONTAL);
398 sbBasic->Add(CPUThread, 0, wxALL, 5);
399 sbBasic->Add(SkipIdle, 0, wxALL, 5);
400 sbBasic->Add(EnableCheats, 0, wxALL, 5);
401 wxBoxSizer *sFramelimit = new wxBoxSizer(wxHORIZONTAL);
402 sFramelimit->Add(FramelimitText, 0, wxALL | wxALIGN_CENTER, 1);
403 sFramelimit->Add(Framelimit, 0, wxALL | wxEXPAND, 5);
404 sFramelimit->Add(UseFPSForLimiting, 0, wxALL | wxEXPAND, 5);
405 sbBasic->Add(sFramelimit, 0, wxALL | wxEXPAND, 5);
407 sbAdvanced->Add(AlwaysHLE_BS2, 0, wxALL, 5);
408 sizerCoreType->Add(m_RadioJIT, 0, wxALL | wxEXPAND, 5);
409 sizerCoreType->Add(m_RadioJITIL, 0, wxALL | wxEXPAND, 5);
410 sizerCoreType->Add(m_RadioInt, 0, wxALL | wxEXPAND, 5);
411 sbAdvanced->Add(sizerCoreType, 0, wxALL, 5);
412 sbAdvanced->Add(LockThreads, 0, wxALL, 5);
413 sbAdvanced->Add(DSPThread, 0, wxALL, 5);
414 sCore->Add(sbBasic, 0, wxEXPAND);
415 sCore->AddStretchSpacer();
416 sCore->Add(sbAdvanced, 0, wxEXPAND);
418 sbInterface->Add(ConfirmStop, 0, wxALL, 5);
419 sbInterface->Add(UsePanicHandlers, 0, wxALL, 5);
420 sbInterface->Add(Theme, 0, wxEXPAND | wxALL, 5);
421 wxBoxSizer *sInterface = new wxBoxSizer(wxHORIZONTAL);
422 sInterface->Add(InterfaceLangText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
423 sInterface->Add(InterfaceLang, 0, wxEXPAND | wxALL, 5);
424 sInterface->AddStretchSpacer();
425 sInterface->Add(HotkeyConfig, 0, wxALIGN_RIGHT | wxALL, 5);
426 sbInterface->Add(sInterface, 0, wxEXPAND | wxALL, 5);
428 wxBoxSizer *sDisplayRes = new wxBoxSizer(wxHORIZONTAL);
429 sDisplayRes->Add(FullscreenResolutionText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
430 sDisplayRes->Add(FullscreenResolution, 0, wxEXPAND | wxALL, 5);
431 sbDisplay->Add(sDisplayRes, 0, wxALL, 5);
432 wxBoxSizer *sDisplaySize = new wxBoxSizer(wxHORIZONTAL);
433 sDisplaySize->Add(WindowSizeText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
434 sDisplaySize->Add(WindowWidth, 0, wxEXPAND | wxALL, 5);
435 sDisplaySize->Add(WindowXText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
436 sDisplaySize->Add(WindowHeight, 0, wxEXPAND | wxALL, 5);
437 sbDisplay->Add(sDisplaySize, 0, wxALL, 5);
438 sbDisplay->Add(Fullscreen, 0, wxEXPAND | wxALL, 5);
439 sbDisplay->Add(HideCursor, 0, wxALL, 5);
440 sbDisplay->Add(RenderToMain, 0, wxEXPAND | wxALL, 5);
442 // Populate the entire page
443 sGeneralPage = new wxBoxSizer(wxVERTICAL);
444 sGeneralPage->Add(sCore, 0, wxEXPAND | wxALL, 5);
445 sGeneralPage->Add(sbInterface, 0, wxEXPAND | wxALL, 5);
446 sGeneralPage->Add(sbDisplay, 0, wxEXPAND | wxALL, 5);
448 GeneralPage->SetSizer(sGeneralPage);
449 sGeneralPage->Layout();
453 // Gamecube page
454 sbGamecubeIPLSettings = new wxStaticBoxSizer(wxVERTICAL, GamecubePage, wxT("IPL Settings"));
455 // IPL settings
456 GCSystemLangText = new wxStaticText(GamecubePage, ID_GC_SRAM_LNG_TEXT, wxT("System Language:"), wxDefaultPosition, wxDefaultSize);
457 GCSystemLang = new wxChoice(GamecubePage, ID_GC_SRAM_LNG, wxDefaultPosition, wxDefaultSize, arrayStringFor_GCSystemLang, 0, wxDefaultValidator);
458 // Devices
459 wxStaticBoxSizer *sbGamecubeDeviceSettings = new wxStaticBoxSizer(wxVERTICAL, GamecubePage, wxT("Device Settings"));
460 // EXI Devices
461 wxStaticText *GCEXIDeviceText[3];
462 GCEXIDeviceText[0] = new wxStaticText(GamecubePage, ID_GC_EXIDEVICE_SLOTA_TEXT, wxT("Slot A"), wxDefaultPosition, wxDefaultSize);
463 GCEXIDeviceText[1] = new wxStaticText(GamecubePage, ID_GC_EXIDEVICE_SLOTB_TEXT, wxT("Slot B"), wxDefaultPosition, wxDefaultSize);
464 GCEXIDeviceText[2] = new wxStaticText(GamecubePage, ID_GC_EXIDEVICE_SP1_TEXT, wxT("SP1 "), wxDefaultPosition, wxDefaultSize);
465 GCEXIDeviceText[2]->SetToolTip(wxT("Serial Port 1 - This is the port which devices such as the net adapter use"));
466 const wxString SlotDevices[] = {wxT(DEV_NONE_STR),wxT(DEV_DUMMY_STR),wxT(EXIDEV_MEMCARD_STR)
467 #if HAVE_PORTAUDIO
468 , wxT(EXIDEV_MIC_STR)
469 #endif
471 static const int numSlotDevices = sizeof(SlotDevices)/sizeof(wxString);
472 const wxString SP1Devices[] = {wxT(DEV_NONE_STR),wxT(DEV_DUMMY_STR),wxT(EXIDEV_BBA_STR),wxT(EXIDEV_AM_BB_STR)};
473 static const int numSP1Devices = sizeof(SP1Devices)/sizeof(wxString);
474 GCEXIDevice[0] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SLOTA, wxDefaultPosition, wxDefaultSize, numSlotDevices, SlotDevices, 0, wxDefaultValidator);
475 GCEXIDevice[1] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SLOTB, wxDefaultPosition, wxDefaultSize, numSlotDevices, SlotDevices, 0, wxDefaultValidator);
476 GCEXIDevice[2] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SP1, wxDefaultPosition, wxDefaultSize, numSP1Devices, SP1Devices, 0, wxDefaultValidator);
477 GCMemcardPath[0] = new wxButton(GamecubePage, ID_GC_EXIDEVICE_SLOTA_PATH, wxT("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
478 GCMemcardPath[1] = new wxButton(GamecubePage, ID_GC_EXIDEVICE_SLOTB_PATH, wxT("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
479 // Can't move this one without making the 4 const's etc. above class members/fields,
480 for (int i = 0; i < 3; ++i)
482 bool isMemcard = false;
483 switch (SConfig::GetInstance().m_EXIDevice[i])
485 case EXIDEVICE_NONE:
486 GCEXIDevice[i]->SetStringSelection(SlotDevices[0]);
487 break;
488 case EXIDEVICE_MEMORYCARD_A:
489 case EXIDEVICE_MEMORYCARD_B:
490 isMemcard = GCEXIDevice[i]->SetStringSelection(SlotDevices[2]);
491 break;
492 case EXIDEVICE_MIC:
493 GCEXIDevice[i]->SetStringSelection(SlotDevices[3]);
494 break;
495 case EXIDEVICE_ETH:
496 GCEXIDevice[i]->SetStringSelection(SP1Devices[2]);
497 break;
498 case EXIDEVICE_AM_BASEBOARD:
499 GCEXIDevice[i]->SetStringSelection(SP1Devices[3]);
500 break;
501 case EXIDEVICE_DUMMY:
502 default:
503 GCEXIDevice[i]->SetStringSelection(SlotDevices[1]);
504 break;
506 if (!isMemcard && i < 2)
507 GCMemcardPath[i]->Disable();
509 //SI Devices
510 wxStaticText *GCSIDeviceText[4];
511 GCSIDeviceText[0] = new wxStaticText(GamecubePage, ID_GC_SIDEVICE_TEXT, wxT("Port 1"), wxDefaultPosition, wxDefaultSize);
512 GCSIDeviceText[1] = new wxStaticText(GamecubePage, ID_GC_SIDEVICE_TEXT, wxT("Port 2"), wxDefaultPosition, wxDefaultSize);
513 GCSIDeviceText[2] = new wxStaticText(GamecubePage, ID_GC_SIDEVICE_TEXT, wxT("Port 3"), wxDefaultPosition, wxDefaultSize);
514 GCSIDeviceText[3] = new wxStaticText(GamecubePage, ID_GC_SIDEVICE_TEXT, wxT("Port 4"), wxDefaultPosition, wxDefaultSize);
515 const wxString SIPort1Devices[] = {wxT(DEV_NONE_STR),wxT(SIDEV_STDCONT_STR),wxT(SIDEV_GBA_STR),wxT(SIDEV_AM_BB_STR)};
516 static const int numSIPort1Devices = sizeof(SIPort1Devices)/sizeof(wxString);
517 const wxString SIDevices[] = {wxT(DEV_NONE_STR),wxT(SIDEV_STDCONT_STR),wxT(SIDEV_GBA_STR)};
518 static const int numSIDevices = sizeof(SIDevices)/sizeof(wxString);
519 GCSIDevice[0] = new wxChoice(GamecubePage, ID_GC_SIDEVICE0, wxDefaultPosition, wxDefaultSize, numSIPort1Devices, SIPort1Devices, 0, wxDefaultValidator);
520 GCSIDevice[1] = new wxChoice(GamecubePage, ID_GC_SIDEVICE1, wxDefaultPosition, wxDefaultSize, numSIDevices, SIDevices, 0, wxDefaultValidator);
521 GCSIDevice[2] = new wxChoice(GamecubePage, ID_GC_SIDEVICE2, wxDefaultPosition, wxDefaultSize, numSIDevices, SIDevices, 0, wxDefaultValidator);
522 GCSIDevice[3] = new wxChoice(GamecubePage, ID_GC_SIDEVICE3, wxDefaultPosition, wxDefaultSize, numSIDevices, SIDevices, 0, wxDefaultValidator);
523 // Can't move this one without making the 2 const's etc. above class members/fields.
524 for (int i = 0; i < 4; ++i)
526 switch (SConfig::GetInstance().m_SIDevice[i])
528 case SI_GC_CONTROLLER:
529 GCSIDevice[i]->SetStringSelection(SIDevices[1]);
530 break;
531 case SI_GBA:
532 GCSIDevice[i]->SetStringSelection(SIDevices[2]);
533 break;
534 case SI_AM_BASEBOARD:
535 GCSIDevice[i]->SetStringSelection(SIDevices[3]);
536 break;
537 default:
538 GCSIDevice[i]->SetStringSelection(SIDevices[0]);
539 break;
542 sGamecube = new wxBoxSizer(wxVERTICAL);
543 sGamecubeIPLSettings = new wxGridBagSizer(0, 0);
544 sGamecubeIPLSettings->Add(GCSystemLangText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
545 sGamecubeIPLSettings->Add(GCSystemLang, wxGBPosition(0, 1), wxGBSpan(1, 1), wxALL, 5);
546 sbGamecubeIPLSettings->Add(sGamecubeIPLSettings);
547 sGamecube->Add(sbGamecubeIPLSettings, 0, wxEXPAND|wxALL, 5);
548 wxBoxSizer *sEXIDevices[4];
549 wxBoxSizer *sSIDevices[4];
550 for (int i = 0; i < 3; ++i)
552 sEXIDevices[i] = new wxBoxSizer(wxHORIZONTAL);
553 sEXIDevices[i]->Add(GCEXIDeviceText[i], 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
554 sEXIDevices[i]->Add(GCEXIDevice[i], 0, wxALL, 5);
555 if (i < 2)
556 sEXIDevices[i]->Add(GCMemcardPath[i], 0, wxALL, 5);
557 sbGamecubeDeviceSettings->Add(sEXIDevices[i]);
559 for (int i = 0; i < 4; ++i)
561 sSIDevices[i] = new wxBoxSizer(wxHORIZONTAL);
562 sSIDevices[i]->Add(GCSIDeviceText[i], 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
563 sSIDevices[i]->Add(GCSIDevice[i], 0, wxALL, 5);
564 sbGamecubeDeviceSettings->Add(sSIDevices[i]);
566 sGamecube->Add(sbGamecubeDeviceSettings, 0, wxEXPAND|wxALL, 5);
567 GamecubePage->SetSizer(sGamecube);
568 sGamecube->Layout();
570 // Wii page
571 sbWiimoteSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("Wiimote Settings"));
572 WiiSensBarPosText = new wxStaticText(WiiPage, ID_WII_BT_BAR_TEXT, wxT("Sensor Bar Position:"), wxDefaultPosition, wxDefaultSize);
573 WiiSensBarPos = new wxChoice(WiiPage, ID_WII_BT_BAR, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiSensBarPos, 0, wxDefaultValidator);
575 sbWiiIPLSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("Misc Settings"));
576 WiiScreenSaver = new wxCheckBox(WiiPage, ID_WII_IPL_SSV, wxT("Enable Screen Saver (burn-in reduction)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
577 WiiProgressiveScan = new wxCheckBox(WiiPage, ID_WII_IPL_PGS, wxT("Enable Progressive Scan"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
578 WiiEuRGB60 = new wxCheckBox(WiiPage, ID_WII_IPL_E60, wxT("Use EuRGB60 Mode (PAL60)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
579 WiiAspectRatioText = new wxStaticText(WiiPage, ID_WII_IPL_AR_TEXT, wxT("Aspect Ratio:"), wxDefaultPosition, wxDefaultSize);
580 WiiAspectRatio = new wxChoice(WiiPage, ID_WII_IPL_AR, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiAspectRatio, 0, wxDefaultValidator);
581 WiiSystemLangText = new wxStaticText(WiiPage, ID_WII_IPL_LNG_TEXT, wxT("System Language:"), wxDefaultPosition, wxDefaultSize);
582 WiiSystemLang = new wxChoice(WiiPage, ID_WII_IPL_LNG, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiSystemLang, 0, wxDefaultValidator);
584 // Devices
585 sbWiiDeviceSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("Device Settings"));
587 WiiSDCard = new wxCheckBox(WiiPage, ID_WII_SD_CARD, wxT("Insert SD Card"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
588 WiiKeyboard = new wxCheckBox(WiiPage, ID_WII_KEYBOARD, wxT("Connect USB Keyboard"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
590 // Populate sbWiimoteSettings
591 sWii = new wxBoxSizer(wxVERTICAL);
592 sWiimoteSettings = new wxGridBagSizer(0, 0);
593 sWiimoteSettings->Add(WiiSensBarPosText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
594 sWiimoteSettings->Add(WiiSensBarPos, wxGBPosition(0, 1), wxGBSpan(1, 1), wxALL, 5);
595 sbWiimoteSettings->Add(sWiimoteSettings);
596 sWii->Add(sbWiimoteSettings, 0, wxEXPAND|wxALL, 5);
598 sWiiIPLSettings = new wxGridBagSizer(0, 0);
599 sWiiIPLSettings->Add(WiiScreenSaver, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5);
600 sWiiIPLSettings->Add(WiiProgressiveScan, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
601 sWiiIPLSettings->Add(WiiEuRGB60, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5);
602 sWiiIPLSettings->Add(WiiAspectRatioText, wxGBPosition(3, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
603 sWiiIPLSettings->Add(WiiAspectRatio, wxGBPosition(3, 1), wxGBSpan(1, 1), wxALL, 5);
604 sWiiIPLSettings->Add(WiiSystemLangText, wxGBPosition(4, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
605 sWiiIPLSettings->Add(WiiSystemLang, wxGBPosition(4, 1), wxGBSpan(1, 1), wxALL, 5);
606 sbWiiIPLSettings->Add(sWiiIPLSettings);
607 sWii->Add(sbWiiIPLSettings, 0, wxEXPAND|wxALL, 5);
609 sbWiiDeviceSettings->Add(WiiSDCard, 0, wxALL, 5);
610 sbWiiDeviceSettings->Add(WiiKeyboard, 0, wxALL, 5);
611 sWii->Add(sbWiiDeviceSettings, 0, wxEXPAND|wxALL, 5);
612 WiiPage->SetSizer(sWii);
613 sWii->Layout();
617 // Paths page
618 sbISOPaths = new wxStaticBoxSizer(wxVERTICAL, PathsPage, wxT("ISO Directories"));
619 ISOPaths = new wxListBox(PathsPage, ID_ISOPATHS, wxDefaultPosition, wxDefaultSize, arrayStringFor_ISOPaths, wxLB_SINGLE, wxDefaultValidator);
620 AddISOPath = new wxButton(PathsPage, ID_ADDISOPATH, wxT("Add..."), wxDefaultPosition, wxDefaultSize, 0);
621 RemoveISOPath = new wxButton(PathsPage, ID_REMOVEISOPATH, wxT("Remove"), wxDefaultPosition, wxDefaultSize, 0);
622 RemoveISOPath->Enable(false);
623 RecersiveISOPath = new wxCheckBox(PathsPage, ID_RECERSIVEISOPATH, wxT("Search Subfolders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
624 DefaultISOText = new wxStaticText(PathsPage, ID_DEFAULTISO_TEXT, wxT("Default ISO:"), wxDefaultPosition, wxDefaultSize);
625 DefaultISO = new wxFilePickerCtrl(PathsPage, ID_DEFAULTISO, wxEmptyString, wxT("Choose a default ISO:"),
626 wxString::Format(wxT("All GC/Wii images (gcm, iso, gcz)|*.gcm;*.iso;*.gcz|All files (%s)|%s"), wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr),
627 wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_OPEN);
629 DVDRootText = new wxStaticText(PathsPage, ID_DVDROOT_TEXT, wxT("DVD Root:"), wxDefaultPosition, wxDefaultSize);
630 DVDRoot = new wxDirPickerCtrl(PathsPage, ID_DVDROOT, wxEmptyString, wxT("Choose a DVD root directory:"), wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL);
631 ApploaderPathText = new wxStaticText(PathsPage, ID_APPLOADERPATH_TEXT, wxT("Apploader:"), wxDefaultPosition, wxDefaultSize);
632 ApploaderPath = new wxFilePickerCtrl(PathsPage, ID_APPLOADERPATH, wxEmptyString, wxT("Choose file to use as apploader: (applies to discs constructed from directories only)"),
633 wxString::Format(wxT("apploader (.img)|*.img|All files (%s)|%s"), wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr),
634 wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_OPEN);
636 sPaths = new wxBoxSizer(wxVERTICAL);
638 sbISOPaths->Add(ISOPaths, 1, wxEXPAND|wxALL, 0);
640 sISOButtons = new wxBoxSizer(wxHORIZONTAL);
641 sISOButtons->Add(RecersiveISOPath, 0, wxALL|wxALIGN_CENTER, 0);
642 sISOButtons->AddStretchSpacer(1);
643 sISOButtons->Add(AddISOPath, 0, wxALL, 0);
644 sISOButtons->Add(RemoveISOPath, 0, wxALL, 0);
645 sbISOPaths->Add(sISOButtons, 0, wxEXPAND|wxALL, 5);
646 sPaths->Add(sbISOPaths, 1, wxEXPAND|wxALL, 5);
648 sOtherPaths = new wxGridBagSizer(0, 0);
649 sOtherPaths->Add(DefaultISOText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
650 sOtherPaths->Add(DefaultISO, wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
651 sOtherPaths->Add(DVDRootText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
652 sOtherPaths->Add(DVDRoot, wxGBPosition(1, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
653 sOtherPaths->Add(ApploaderPathText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
654 sOtherPaths->Add(ApploaderPath, wxGBPosition(2, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
655 sOtherPaths->AddGrowableCol(1);
656 sPaths->Add(sOtherPaths, 0, wxEXPAND|wxALL, 5);
657 PathsPage->SetSizer(sPaths);
658 sPaths->Layout();
661 // Plugins page
662 sbGraphicsPlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginPage, wxT("Graphics"));
663 GraphicSelection = new wxChoice(PluginPage, ID_GRAPHIC_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator);
664 GraphicConfig = new wxButton(PluginPage, ID_GRAPHIC_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
666 sbDSPPlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginPage, wxT("DSP"));
667 DSPSelection = new wxChoice(PluginPage, ID_DSP_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator);
668 DSPConfig = new wxButton(PluginPage, ID_DSP_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
670 sbPadPlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginPage, wxT("Gamecube Pad"));
671 PADSelection = new wxChoice(PluginPage, ID_PAD_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator);
672 PADConfig = new wxButton(PluginPage, ID_PAD_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
674 sbWiimotePlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginPage, wxT("Wiimote"));
675 WiimoteSelection = new wxChoice(PluginPage, ID_WIIMOTE_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator);
676 WiimoteConfig = new wxButton(PluginPage, ID_WIIMOTE_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
679 sPlugins = new wxBoxSizer(wxVERTICAL);
680 sbGraphicsPlugin->Add(GraphicSelection, 1, wxEXPAND|wxALL, 5);
681 sbGraphicsPlugin->Add(GraphicConfig, 0, wxALL, 5);
682 sPlugins->Add(sbGraphicsPlugin, 0, wxEXPAND|wxALL, 5);
684 sbDSPPlugin->Add(DSPSelection, 1, wxEXPAND|wxALL, 5);
685 sbDSPPlugin->Add(DSPConfig, 0, wxALL, 5);
686 sPlugins->Add(sbDSPPlugin, 0, wxEXPAND|wxALL, 5);
688 sbPadPlugin->Add(PADSelection, 1, wxEXPAND|wxALL, 5);
689 sbPadPlugin->Add(PADConfig, 0, wxALL, 5);
690 sPlugins->Add(sbPadPlugin, 0, wxEXPAND|wxALL, 5);
692 sbWiimotePlugin->Add(WiimoteSelection, 1, wxEXPAND|wxALL, 5);
693 sbWiimotePlugin->Add(WiimoteConfig, 0, wxALL, 5);
694 sPlugins->Add(sbWiimotePlugin, 0, wxEXPAND|wxALL, 5);
695 PluginPage->SetSizer(sPlugins);
696 sPlugins->Layout();
700 m_Close = new wxButton(this, wxID_CLOSE);
702 wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL);
703 sButtons->Add(0, 0, 1, wxEXPAND, 5);
704 sButtons->Add(m_Close, 0, wxALL, 5);
706 wxBoxSizer* sMain = new wxBoxSizer(wxVERTICAL);
707 sMain->Add(Notebook, 1, wxEXPAND|wxALL, 5);
708 sMain->Add(sButtons, 0, wxEXPAND, 5);
710 InitializeGUIValues();
711 InitializeGUITooltips();
713 UpdateGUI();
715 this->SetSizer(sMain);
716 this->Layout();
718 Fit();
719 Center();
722 void CConfigMain::OnClose(wxCloseEvent& WXUNUSED (event))
724 EndModal((bRefreshList) ? wxID_OK : wxID_CLOSE);
726 // Sysconf saves when it gets deleted
727 //delete SConfig::GetInstance().m_SYSCONF;
729 // Save the config. Dolphin crashes to often to save the settings on closing only
730 SConfig::GetInstance().SaveSettings();
733 void CConfigMain::CloseClick(wxCommandEvent& WXUNUSED (event))
735 Close();
738 // Core AND Interface settings
739 void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
741 switch (event.GetId())
743 case ID_FRAMELIMIT_USEFPSFORLIMITING:
744 SConfig::GetInstance().b_UseFPS = UseFPSForLimiting->IsChecked();
745 break;
746 case ID_INTERFACE_CONFIRMSTOP: // Interface
747 SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop = ConfirmStop->IsChecked();
748 break;
749 case ID_INTERFACE_USEPANICHANDLERS: // Interface
750 SConfig::GetInstance().m_LocalCoreStartupParameter.bUsePanicHandlers = UsePanicHandlers->IsChecked();
751 SetEnableAlert(UsePanicHandlers->IsChecked());
752 break;
753 case ID_INTERFACE_THEME:
754 SConfig::GetInstance().m_LocalCoreStartupParameter.iTheme = Theme->GetSelection();
755 main_frame->InitBitmaps();
756 break;
757 case ID_INTERFACE_LANG:
758 SConfig::GetInstance().m_InterfaceLanguage = (INTERFACE_LANGUAGE)InterfaceLang->GetSelection();
759 bRefreshList = true;
760 break;
761 case ID_HOTKEY_CONFIG:
763 HotkeyConfigDialog *m_HotkeyDialog = new HotkeyConfigDialog(this);
764 m_HotkeyDialog->ShowModal();
765 m_HotkeyDialog->Destroy();
766 // Update the GUI in case menu accelerators were changed
767 main_frame->UpdateGUI();
769 break;
770 case ID_FRAMELIMIT:
771 SConfig::GetInstance().m_Framelimit = (u32)Framelimit->GetSelection();
772 break;
773 case ID_ALWAYS_HLE_BS2: // Core
774 SConfig::GetInstance().m_LocalCoreStartupParameter.bHLE_BS2 = AlwaysHLE_BS2->IsChecked();
775 break;
776 case ID_RADIOJIT:
777 SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore = 1;
778 if (main_frame->g_pCodeWindow) main_frame->g_pCodeWindow->GetMenuBar()->Check(IDM_INTERPRETER, false);
779 break;
780 case ID_RADIOJITIL:
781 SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore = 2;
782 if (main_frame->g_pCodeWindow) main_frame->g_pCodeWindow->GetMenuBar()->Check(IDM_INTERPRETER, false);
783 break;
784 case ID_RADIOINT:
785 SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore = 0;
786 if (main_frame->g_pCodeWindow) main_frame->g_pCodeWindow->GetMenuBar()->Check(IDM_INTERPRETER, true);
787 break;
788 case ID_CPUTHREAD:
789 SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread = CPUThread->IsChecked();
790 break;
791 case ID_DSPTHREAD:
792 SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPThread = DSPThread->IsChecked();
793 break;
794 case ID_LOCKTHREADS:
795 SConfig::GetInstance().m_LocalCoreStartupParameter.bLockThreads = LockThreads->IsChecked();
796 break;
797 case ID_IDLESKIP:
798 SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle = SkipIdle->IsChecked();
799 break;
800 case ID_ENABLECHEATS:
801 SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats = EnableCheats->IsChecked();
802 break;
803 case ID_DISPLAY_FULLSCREENRES:
804 SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution =
805 FullscreenResolution->GetStringSelection().mb_str();
806 #if defined(HAVE_XRANDR) && HAVE_XRANDR
807 main_frame->m_XRRConfig->Update();
808 #endif
809 break;
810 case ID_DISPLAY_WINDOWWIDTH:
811 SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth = WindowWidth->GetValue();
812 break;
813 case ID_DISPLAY_WINDOWHEIGHT:
814 SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight = WindowHeight->GetValue();
815 break;
816 case ID_DISPLAY_FULLSCREEN: // Display
817 SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen = Fullscreen->IsChecked();
818 break;
819 case ID_DISPLAY_HIDECURSOR:
820 SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor = HideCursor->IsChecked();
821 break;
822 case ID_DISPLAY_RENDERTOMAIN:
823 SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain = RenderToMain->IsChecked();
824 break;
829 // GC settings
830 // -----------------------
831 void CConfigMain::GCSettingsChanged(wxCommandEvent& event)
833 int sidevice = 0;
834 int exidevice = 0;
835 switch (event.GetId())
837 case ID_GC_SRAM_LNG:
838 SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage = GCSystemLang->GetSelection();
839 break;
841 case ID_GC_EXIDEVICE_SP1:
842 exidevice++;
843 case ID_GC_EXIDEVICE_SLOTB:
844 exidevice++;
845 case ID_GC_EXIDEVICE_SLOTA:
846 ChooseEXIDevice(std::string(event.GetString().mb_str()), exidevice);
847 break;
848 case ID_GC_EXIDEVICE_SLOTA_PATH:
849 ChooseMemcardPath(SConfig::GetInstance().m_strMemoryCardA, true);
850 break;
851 case ID_GC_EXIDEVICE_SLOTB_PATH:
852 ChooseMemcardPath(SConfig::GetInstance().m_strMemoryCardB, false);
853 break;
855 case ID_GC_SIDEVICE3:
856 sidevice++;
857 case ID_GC_SIDEVICE2:
858 sidevice++;
859 case ID_GC_SIDEVICE1:
860 sidevice++;
861 case ID_GC_SIDEVICE0:
862 ChooseSIDevice(std::string(event.GetString().mb_str()), sidevice);
863 break;
867 void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA)
869 std::string filename = std::string(wxFileSelector(
870 wxT("Choose a file to open"),
871 wxString::FromAscii(File::GetUserPath(D_GCUSER_IDX)),
872 isSlotA ? wxT(GC_MEMCARDA) : wxT(GC_MEMCARDB),
873 wxEmptyString,
874 wxT("Gamecube Memory Cards (*.raw,*.gcp)|*.raw;*.gcp")).mb_str());
876 if (!filename.empty())
878 // also check that the path isn't used for the other memcard...
879 if (filename.compare(isSlotA ? SConfig::GetInstance().m_strMemoryCardB
880 : SConfig::GetInstance().m_strMemoryCardA) != 0)
882 strMemcard = filename;
884 if (Core::GetState() != Core::CORE_UNINITIALIZED)
886 // Change memcard to the new file
887 ExpansionInterface::ChangeDevice(
888 isSlotA ? 0 : 1, // SlotA: channel 0, SlotB channel 1
889 isSlotA ? EXIDEVICE_MEMORYCARD_A : EXIDEVICE_MEMORYCARD_B,
890 0); // SP1 is device 2, slots are device 0
893 else
895 PanicAlert("Cannot use that file as a memory card.\n"
896 "Are you trying to use the same file in both slots?");
901 void CConfigMain::ChooseSIDevice(std::string deviceName, int deviceNum)
903 TSIDevices tempType;
904 if (!deviceName.compare(SIDEV_STDCONT_STR))
905 tempType = SI_GC_CONTROLLER;
906 else if (!deviceName.compare(SIDEV_GBA_STR))
907 tempType = SI_GBA;
908 else if (!deviceName.compare(SIDEV_AM_BB_STR))
909 tempType = SI_AM_BASEBOARD;
910 else
911 tempType = SI_NONE;
913 SConfig::GetInstance().m_SIDevice[deviceNum] = tempType;
915 if (Core::GetState() != Core::CORE_UNINITIALIZED)
917 // Change plugged device! :D
918 SerialInterface::ChangeDevice(tempType, deviceNum);
922 void CConfigMain::ChooseEXIDevice(std::string deviceName, int deviceNum)
924 TEXIDevices tempType;
926 if (!deviceName.compare(EXIDEV_MEMCARD_STR))
927 tempType = deviceNum ? EXIDEVICE_MEMORYCARD_B : EXIDEVICE_MEMORYCARD_A;
928 else if (!deviceName.compare(EXIDEV_MIC_STR))
929 tempType = EXIDEVICE_MIC;
930 else if (!deviceName.compare(EXIDEV_BBA_STR))
931 tempType = EXIDEVICE_ETH;
932 else if (!deviceName.compare(EXIDEV_AM_BB_STR))
933 tempType = EXIDEVICE_AM_BASEBOARD;
934 else if (!deviceName.compare(DEV_NONE_STR))
935 tempType = EXIDEVICE_NONE;
936 else
937 tempType = EXIDEVICE_DUMMY;
939 // Gray out the memcard path button if we're not on a memcard
940 if (tempType == EXIDEVICE_MEMORYCARD_A || tempType == EXIDEVICE_MEMORYCARD_B)
941 GCMemcardPath[deviceNum]->Enable();
942 else if (deviceNum == 0 || deviceNum == 1)
943 GCMemcardPath[deviceNum]->Disable();
945 SConfig::GetInstance().m_EXIDevice[deviceNum] = tempType;
947 if (Core::GetState() != Core::CORE_UNINITIALIZED)
949 // Change plugged device! :D
950 ExpansionInterface::ChangeDevice(
951 (deviceNum == 1) ? 1 : 0, // SlotB is on channel 1, slotA and SP1 are on 0
952 tempType, // The device enum to change to
953 (deviceNum == 2) ? 2 : 0); // SP1 is device 2, slots are device 0
960 // Wii settings
961 // -------------------
962 void CConfigMain::WiiSettingsChanged(wxCommandEvent& event)
964 switch (event.GetId())
966 case ID_WII_BT_BAR: // Wiimote settings
967 SConfig::GetInstance().m_SYSCONF->SetData("BT.BAR", WiiSensBarPos->GetSelection());
968 break;
970 case ID_WII_IPL_AR: // SYSCONF settings
971 SConfig::GetInstance().m_SYSCONF->SetData("IPL.AR", WiiAspectRatio->GetSelection());
972 break;
973 case ID_WII_IPL_SSV:
974 SConfig::GetInstance().m_SYSCONF->SetData("IPL.SSV", WiiScreenSaver->IsChecked());
975 break;
976 case ID_WII_IPL_LNG:
977 SConfig::GetInstance().m_SYSCONF->SetData("IPL.LNG", WiiSystemLang->GetSelection());
978 break;
979 case ID_WII_IPL_PGS:
980 SConfig::GetInstance().m_SYSCONF->SetData("IPL.PGS", WiiProgressiveScan->IsChecked());
981 break;
982 case ID_WII_IPL_E60:
983 SConfig::GetInstance().m_SYSCONF->SetData("IPL.E60", WiiEuRGB60->IsChecked());
984 break;
985 case ID_WII_SD_CARD:
986 SConfig::GetInstance().m_WiiSDCard = WiiSDCard->IsChecked();
987 break;
988 case ID_WII_KEYBOARD:
989 SConfig::GetInstance().m_WiiKeyboard = WiiKeyboard->IsChecked();
990 break;
998 // Paths settings
999 // -------------------
1000 void CConfigMain::ISOPathsSelectionChanged(wxCommandEvent& WXUNUSED (event))
1002 if (!ISOPaths->GetStringSelection().empty())
1004 RemoveISOPath->Enable(true);
1006 else
1008 RemoveISOPath->Enable(false);
1012 void CConfigMain::AddRemoveISOPaths(wxCommandEvent& event)
1014 if (event.GetId() == ID_ADDISOPATH)
1016 wxString dirHome;
1017 wxGetHomeDir(&dirHome);
1019 wxDirDialog dialog(this, _T("Choose a directory to add"), dirHome, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
1021 if (dialog.ShowModal() == wxID_OK)
1023 if (ISOPaths->FindString(dialog.GetPath()) != -1)
1025 wxMessageBox(_("The chosen directory is already in the list"), _("Error"), wxOK);
1027 else
1029 bRefreshList = true;
1030 ISOPaths->Append(dialog.GetPath());
1034 else
1036 bRefreshList = true;
1037 ISOPaths->Delete(ISOPaths->GetSelection());
1040 // Save changes right away
1041 SConfig::GetInstance().m_ISOFolder.clear();
1043 for (unsigned int i = 0; i < ISOPaths->GetCount(); i++)
1044 SConfig::GetInstance().m_ISOFolder.push_back(std::string(ISOPaths->GetStrings()[i].mb_str()));
1047 void CConfigMain::RecursiveDirectoryChanged(wxCommandEvent& WXUNUSED (event))
1049 SConfig::GetInstance().m_RecursiveISOFolder = RecersiveISOPath->IsChecked();
1050 bRefreshList = true;
1053 void CConfigMain::DefaultISOChanged(wxFileDirPickerEvent& WXUNUSED (event))
1055 SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM = DefaultISO->GetPath().mb_str();
1058 void CConfigMain::DVDRootChanged(wxFileDirPickerEvent& WXUNUSED (event))
1060 SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDVDRoot = DVDRoot->GetPath().mb_str();
1063 void CConfigMain::ApploaderPathChanged(wxFileDirPickerEvent& WXUNUSED (event))
1065 SConfig::GetInstance().m_LocalCoreStartupParameter.m_strApploader = ApploaderPath->GetPath().mb_str();
1069 // Plugin settings
1070 void CConfigMain::OnSelectionChanged(wxCommandEvent& WXUNUSED (event))
1072 // Update plugin filenames
1073 GetFilename(GraphicSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
1074 GetFilename(DSPSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
1075 for (int i = 0; i < MAXPADS; i++)
1076 GetFilename(PADSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[i]);
1077 for (int i = 0; i < MAXWIIMOTES; i++)
1078 GetFilename(WiimoteSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[i]);
1081 void CConfigMain::OnConfig(wxCommandEvent& event)
1083 switch (event.GetId())
1085 case ID_GRAPHIC_CONFIG:
1086 CallConfig(GraphicSelection);
1087 break;
1088 case ID_DSP_CONFIG:
1089 CallConfig(DSPSelection);
1090 break;
1091 case ID_PAD_CONFIG:
1092 CallConfig(PADSelection);
1093 break;
1094 case ID_WIIMOTE_CONFIG:
1095 CallConfig(WiimoteSelection);
1096 break;
1100 void CConfigMain::CallConfig(wxChoice* _pChoice)
1102 int Index = _pChoice->GetSelection();
1103 INFO_LOG(CONSOLE, "CallConfig: %i\n", Index);
1104 if (Index >= 0)
1106 const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
1107 if (pInfo != NULL)
1108 CPluginManager::GetInstance().OpenConfig((HWND) this->GetHandle(), pInfo->GetFilename().c_str(), pInfo->GetPluginInfo().Type);
1112 void CConfigMain::FillChoiceBox(wxChoice* _pChoice, int _PluginType, const std::string& _SelectFilename)
1114 _pChoice->Clear();
1116 int Index = -1;
1117 const CPluginInfos& rInfos = CPluginManager::GetInstance().GetPluginInfos();
1119 for (size_t i = 0; i < rInfos.size(); i++)
1121 const PLUGIN_INFO& rPluginInfo = rInfos[i].GetPluginInfo();
1123 if (rPluginInfo.Type == _PluginType)
1125 wxString temp;
1126 temp = wxString::FromAscii(rInfos[i].GetPluginInfo().Name);
1127 int NewIndex = _pChoice->Append(temp, (void*)&rInfos[i]);
1129 if (rInfos[i].GetFilename() == _SelectFilename)
1131 Index = NewIndex;
1136 _pChoice->Select(Index);
1139 bool CConfigMain::GetFilename(wxChoice* _pChoice, std::string& _rFilename)
1141 _rFilename.clear();
1142 int Index = _pChoice->GetSelection();
1143 if (Index >= 0)
1145 const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
1146 _rFilename = pInfo->GetFilename();
1147 INFO_LOG(CONSOLE, "GetFilename: %i %s\n", Index, _rFilename.c_str());
1148 return(true);
1151 return(false);
1154 // Search for avaliable resolutions
1155 void CConfigMain::AddResolutions()
1157 #ifdef _WIN32
1159 DWORD iModeNum = 0;
1160 DEVMODE dmi;
1161 ZeroMemory(&dmi, sizeof(dmi));
1162 dmi.dmSize = sizeof(dmi);
1163 std::vector<std::string> resos;
1165 while (EnumDisplaySettings(NULL, iModeNum++, &dmi) != 0)
1167 char res[100];
1168 sprintf(res, "%dx%d", dmi.dmPelsWidth, dmi.dmPelsHeight);
1169 std::string strRes(res);
1170 // Only add unique resolutions
1171 if (std::find(resos.begin(), resos.end(), strRes) == resos.end())
1173 resos.push_back(strRes);
1174 arrayStringFor_FullscreenResolution.Add(wxString::FromAscii(res));
1176 ZeroMemory(&dmi, sizeof(dmi));
1179 #elif defined(HAVE_XRANDR) && HAVE_XRANDR
1181 main_frame->m_XRRConfig->AddResolutions(arrayStringFor_FullscreenResolution);
1183 #elif defined(HAVE_COCOA) && HAVE_COCOA
1185 CGDisplayModeRef mode;
1186 CFArrayRef array;
1187 CFIndex n, i;
1188 int w, h;
1189 std::vector<std::string> resos;
1191 array = CGDisplayCopyAllDisplayModes(CGMainDisplayID(), NULL);
1192 n = CFArrayGetCount(array);
1194 for (i = 0; i < n; i++)
1196 mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(array, i);
1197 w = CGDisplayModeGetWidth(mode);
1198 h = CGDisplayModeGetHeight(mode);
1200 char res[32];
1201 sprintf(res,"%dx%d", w, h);
1202 std::string strRes(res);
1203 // Only add unique resolutions
1204 if (std::find(resos.begin(), resos.end(), strRes) == resos.end())
1206 resos.push_back(strRes);
1207 arrayStringFor_FullscreenResolution.Add(wxString::FromAscii(res));
1210 CFRelease(array);
1212 #endif