Logical reorderring of the GUI boot sequence. Also a little clean up in the OpenGL...
[dolphin.git] / Source / Core / DolphinWX / Src / ConfigMain.cpp
blobafde7d6ad455399bb1030ce16e8e42675e999394
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_DISPLAY_HIDECURSOR, CConfigMain::CoreSettingsChanged)
56 EVT_CHECKBOX(ID_DISPLAY_FULLSCREEN, CConfigMain::CoreSettingsChanged)
57 EVT_CHECKBOX(ID_DISPLAY_RENDERTOMAIN, CConfigMain::CoreSettingsChanged)
58 EVT_RADIOBOX(ID_INTERFACE_THEME, CConfigMain::CoreSettingsChanged)
59 EVT_CHOICE(ID_INTERFACE_LANG, CConfigMain::CoreSettingsChanged)
60 EVT_BUTTON(ID_HOTKEY_CONFIG, CConfigMain::CoreSettingsChanged)
62 EVT_CHECKBOX(ID_ALWAYS_HLE_BS2, CConfigMain::CoreSettingsChanged)
63 EVT_RADIOBUTTON(ID_RADIOJIT, CConfigMain::CoreSettingsChanged)
64 EVT_RADIOBUTTON(ID_RADIOJITIL, CConfigMain::CoreSettingsChanged)
65 EVT_RADIOBUTTON(ID_RADIOINT, CConfigMain::CoreSettingsChanged)
66 EVT_CHECKBOX(ID_CPUTHREAD, CConfigMain::CoreSettingsChanged)
67 EVT_CHECKBOX(ID_DSPTHREAD, CConfigMain::CoreSettingsChanged)
68 EVT_CHECKBOX(ID_LOCKTHREADS, CConfigMain::CoreSettingsChanged)
69 EVT_CHECKBOX(ID_IDLESKIP, CConfigMain::CoreSettingsChanged)
70 EVT_CHECKBOX(ID_ENABLECHEATS, CConfigMain::CoreSettingsChanged)
71 EVT_CHOICE(ID_FRAMELIMIT, CConfigMain::CoreSettingsChanged)
73 EVT_CHOICE(ID_GC_SRAM_LNG, CConfigMain::GCSettingsChanged)
74 EVT_CHOICE(ID_GC_EXIDEVICE_SLOTA, CConfigMain::GCSettingsChanged)
75 EVT_BUTTON(ID_GC_EXIDEVICE_SLOTA_PATH, CConfigMain::GCSettingsChanged)
76 EVT_CHOICE(ID_GC_EXIDEVICE_SLOTB, CConfigMain::GCSettingsChanged)
77 EVT_BUTTON(ID_GC_EXIDEVICE_SLOTB_PATH, CConfigMain::GCSettingsChanged)
78 EVT_CHOICE(ID_GC_EXIDEVICE_SP1, CConfigMain::GCSettingsChanged)
79 EVT_CHOICE(ID_GC_SIDEVICE0, CConfigMain::GCSettingsChanged)
80 EVT_CHOICE(ID_GC_SIDEVICE1, CConfigMain::GCSettingsChanged)
81 EVT_CHOICE(ID_GC_SIDEVICE2, CConfigMain::GCSettingsChanged)
82 EVT_CHOICE(ID_GC_SIDEVICE3, CConfigMain::GCSettingsChanged)
84 EVT_CHOICE(ID_WII_BT_BAR, CConfigMain::WiiSettingsChanged)
85 EVT_CHECKBOX(ID_WII_IPL_SSV, CConfigMain::WiiSettingsChanged)
86 EVT_CHECKBOX(ID_WII_IPL_PGS, CConfigMain::WiiSettingsChanged)
87 EVT_CHECKBOX(ID_WII_IPL_E60, CConfigMain::WiiSettingsChanged)
88 EVT_CHOICE(ID_WII_IPL_AR, CConfigMain::WiiSettingsChanged)
89 EVT_CHOICE(ID_WII_IPL_LNG, CConfigMain::WiiSettingsChanged)
90 EVT_CHECKBOX(ID_WII_SD_CARD, CConfigMain::WiiSettingsChanged)
91 EVT_CHECKBOX(ID_WII_KEYBOARD, CConfigMain::WiiSettingsChanged)
93 EVT_LISTBOX(ID_ISOPATHS, CConfigMain::ISOPathsSelectionChanged)
94 EVT_BUTTON(ID_ADDISOPATH, CConfigMain::AddRemoveISOPaths)
95 EVT_BUTTON(ID_REMOVEISOPATH, CConfigMain::AddRemoveISOPaths)
96 EVT_CHECKBOX(ID_RECERSIVEISOPATH, CConfigMain::RecursiveDirectoryChanged)
97 EVT_FILEPICKER_CHANGED(ID_DEFAULTISO, CConfigMain::DefaultISOChanged)
98 EVT_DIRPICKER_CHANGED(ID_DVDROOT, CConfigMain::DVDRootChanged)
99 EVT_FILEPICKER_CHANGED(ID_APPLOADERPATH, CConfigMain::ApploaderPathChanged)
101 EVT_CHOICE(ID_GRAPHIC_CB, CConfigMain::OnSelectionChanged)
102 EVT_BUTTON(ID_GRAPHIC_CONFIG, CConfigMain::OnConfig)
103 EVT_CHOICE(ID_DSP_CB, CConfigMain::OnSelectionChanged)
104 EVT_BUTTON(ID_DSP_CONFIG, CConfigMain::OnConfig)
105 EVT_CHOICE(ID_PAD_CB, CConfigMain::OnSelectionChanged)
106 EVT_BUTTON(ID_PAD_CONFIG, CConfigMain::OnConfig)
107 EVT_CHOICE(ID_WIIMOTE_CB, CConfigMain::OnSelectionChanged)
108 EVT_BUTTON(ID_WIIMOTE_CONFIG, CConfigMain::OnConfig)
110 END_EVENT_TABLE()
112 CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
113 : wxDialog(parent, id, title, position, size, style)
115 // Control refreshing of the ISOs list
116 bRefreshList = false;
118 CreateGUIControls();
120 // Update selected ISO paths
121 for(u32 i = 0; i < SConfig::GetInstance().m_ISOFolder.size(); i++)
123 ISOPaths->Append(wxString(SConfig::GetInstance().m_ISOFolder[i].c_str(), *wxConvCurrent));
127 CConfigMain::~CConfigMain()
131 // Used to restrict changing of some options while emulator is running
132 void CConfigMain::UpdateGUI()
134 if(Core::GetState() != Core::CORE_UNINITIALIZED)
136 // Disable the Core stuff on GeneralPage
137 AlwaysHLE_BS2->Disable();
138 m_RadioJIT->Disable();
139 m_RadioJITIL->Disable();
140 m_RadioInt->Disable();
141 CPUThread->Disable();
142 DSPThread->Disable();
143 LockThreads->Disable();
144 SkipIdle->Disable();
145 EnableCheats->Disable();
146 RenderToMain->Disable();
148 GCSystemLang->Disable();
150 WiiSensBarPos->Disable();
151 WiiScreenSaver->Disable();
152 WiiProgressiveScan->Disable();
153 WiiEuRGB60->Disable();
154 WiiAspectRatio->Disable();
155 WiiSystemLang->Disable();
157 PathsPage->Disable();
159 GraphicSelection->Disable();
160 DSPSelection->Disable();
161 PADSelection->Disable();
162 WiimoteSelection->Disable();
166 void CConfigMain::InitializeGUILists()
168 // Deal with all the language arrayStrings here
169 // GC
170 arrayStringFor_GCSystemLang.Add(wxT("English"));
171 arrayStringFor_GCSystemLang.Add(wxT("German"));
172 arrayStringFor_GCSystemLang.Add(wxT("French"));
173 arrayStringFor_GCSystemLang.Add(wxT("Spanish"));
174 arrayStringFor_GCSystemLang.Add(wxT("Italian"));
175 arrayStringFor_GCSystemLang.Add(wxT("Dutch"));
176 // Wii
177 arrayStringFor_WiiSystemLang = arrayStringFor_GCSystemLang;
178 arrayStringFor_WiiSystemLang.Insert(wxT("Japanese"), 0);
179 arrayStringFor_WiiSystemLang.Add(wxT("Simplified Chinese"));
180 arrayStringFor_WiiSystemLang.Add(wxT("Traditional Chinese"));
181 arrayStringFor_WiiSystemLang.Add(wxT("Korean"));
182 // GUI
183 arrayStringFor_InterfaceLang = arrayStringFor_GCSystemLang;
185 // Framelimit
186 arrayStringFor_Framelimit.Add(wxT("Off"));
187 arrayStringFor_Framelimit.Add(wxT("Auto"));
188 for (int i = 20; i <= 120; i += 10) // from 20 to 120
189 arrayStringFor_Framelimit.Add(wxString::Format(wxT("%i"), i));
191 // Themes
192 arrayStringFor_Themes.Add(wxT("Boomy"));
193 arrayStringFor_Themes.Add(wxT("Vista"));
194 arrayStringFor_Themes.Add(wxT("X-Plastik"));
195 arrayStringFor_Themes.Add(wxT("KDE"));
197 // Wii
198 // Sensorbar Position
199 arrayStringFor_WiiSensBarPos.Add(wxT("Bottom"));
200 arrayStringFor_WiiSensBarPos.Add(wxT("Top"));
201 // Aspect ratio
202 arrayStringFor_WiiAspectRatio.Add(wxT("4:3"));
203 arrayStringFor_WiiAspectRatio.Add(wxT("16:9"));
206 void CConfigMain::InitializeGUIValues()
208 // General - Basic
209 CPUThread->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread);
210 SkipIdle->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle);
211 EnableCheats->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats);
212 Framelimit->SetSelection(SConfig::GetInstance().m_Framelimit);
214 // General - Advanced
215 AlwaysHLE_BS2->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bHLE_BS2);
216 switch (SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore)
218 case 0: m_RadioInt->SetValue(true); break;
219 case 1: m_RadioJIT->SetValue(true); break;
220 case 2: m_RadioJITIL->SetValue(true); break;
222 LockThreads->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bLockThreads);
223 DSPThread->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPThread);
225 // General - Interface
226 ConfirmStop->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop);
227 UsePanicHandlers->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bUsePanicHandlers);
228 Theme->SetSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.iTheme);
229 // need redesign
230 InterfaceLang->SetSelection(SConfig::GetInstance().m_InterfaceLanguage);
232 // General - Display
233 Fullscreen->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen);
234 HideCursor->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor);
235 RenderToMain->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain);
237 // Gamecube - IPL
238 GCSystemLang->SetSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage);
240 // Gamecube - Devices
241 // Not here. They use some locals over in CreateGUIControls for initialization,
242 // which is why they are still there.
244 // Wii
245 WiiSensBarPos->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("BT.BAR"));
247 WiiScreenSaver->SetValue(!!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.SSV"));
248 WiiProgressiveScan->SetValue(!!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.PGS"));
249 WiiEuRGB60->SetValue(!!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.E60"));
250 WiiAspectRatio->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.AR"));
251 WiiSystemLang->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG"));
253 WiiSDCard->SetValue(SConfig::GetInstance().m_WiiSDCard);
254 WiiKeyboard->SetValue(SConfig::GetInstance().m_WiiKeyboard);
256 // Paths
257 RecersiveISOPath->SetValue(SConfig::GetInstance().m_RecursiveISOFolder);
258 DefaultISO->SetPath(wxString(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM.c_str(), *wxConvCurrent));
259 DVDRoot->SetPath(wxString(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDVDRoot.c_str(), *wxConvCurrent));
260 ApploaderPath->SetPath(wxString(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strApploader.c_str(), *wxConvCurrent));
262 // Plugins
263 FillChoiceBox(GraphicSelection, PLUGIN_TYPE_VIDEO, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
264 FillChoiceBox(DSPSelection, PLUGIN_TYPE_DSP, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
265 for (int i = 0; i < MAXPADS; i++)
266 FillChoiceBox(PADSelection, PLUGIN_TYPE_PAD, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[i]);
267 for (int i=0; i < MAXWIIMOTES; i++)
268 FillChoiceBox(WiimoteSelection, PLUGIN_TYPE_WIIMOTE, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[i]);
270 void CConfigMain::InitializeGUITooltips()
272 // General - Basic
273 CPUThread->SetToolTip(wxT("This splits the Video and CPU threads, so they can be run on separate cores.")
274 wxT("\nCauses major speed improvements on PCs with more than one core,")
275 wxT("\nbut can also cause occasional crashes/glitches."));
276 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."));
278 // General - Advanced
279 DSPThread->SetToolTip(wxT("Run DSPLLE on a dedicated thread (not recommended)."));
281 // General - Interface
282 ConfirmStop->SetToolTip(wxT("Show a confirmation box before stopping a game."));
283 UsePanicHandlers->SetToolTip(wxT("Show a message box when a potentially serious error has occured.")
284 wxT(" Disabling this may avoid annoying and non-fatal messages, but it may also mean that Dolphin")
285 wxT(" suddenly crashes without any explanation at all."));
286 InterfaceLang->SetToolTip(wxT("For the time being this will only change the text shown in")
287 wxT("\nthe game list of PAL GC games."));
289 // Themes: Copyright notice
290 Theme->SetItemToolTip(0, wxT("Created by Milosz Wlazlo [miloszwl@miloszwl.com, miloszwl.deviantart.com]"));
291 Theme->SetItemToolTip(1, wxT("Created by VistaIcons.com"));
292 Theme->SetItemToolTip(2, wxT("Created by black_rider and published on ForumW.org > Web Developments"));
293 Theme->SetItemToolTip(3, wxT("Created by KDE-Look.org"));
295 // General - Display
296 Fullscreen->SetToolTip(
297 wxT("Start the rendering window in fullscreen mode.")
298 wxT(" Press Alt+Enter to switch between Fullscreen and Windowed mode."));
299 HideCursor->SetToolTip(wxT("Hide the cursor when it is over the rendering window")
300 wxT("\n and the rendering window has focus."));
301 RenderToMain->SetToolTip(wxT("Render to main window."));
303 // Wii
304 WiiKeyboard->SetToolTip(wxT("This could cause slow down in Wii Menu and some games."));
306 void CConfigMain::CreateGUIControls()
308 InitializeGUILists();
310 // Create the notebook and pages
311 Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
312 GeneralPage = new wxPanel(Notebook, ID_GENERALPAGE, wxDefaultPosition, wxDefaultSize);
313 GamecubePage = new wxPanel(Notebook, ID_GAMECUBEPAGE, wxDefaultPosition, wxDefaultSize);
314 WiiPage = new wxPanel(Notebook, ID_WIIPAGE, wxDefaultPosition, wxDefaultSize);
315 PathsPage = new wxPanel(Notebook, ID_PATHSPAGE, wxDefaultPosition, wxDefaultSize);
316 PluginPage = new wxPanel(Notebook, ID_PLUGINPAGE, wxDefaultPosition, wxDefaultSize);
318 Notebook->AddPage(GeneralPage, wxT("General"));
319 Notebook->AddPage(GamecubePage, wxT("Gamecube"));
320 Notebook->AddPage(WiiPage, wxT("Wii"));
321 Notebook->AddPage(PathsPage, wxT("Paths"));
322 Notebook->AddPage(PluginPage, wxT("Plugins"));
324 // General page
325 sbBasic = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Basic Settings"));
326 sbAdvanced = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Advanced Settings"));
327 sbInterface = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Interface Settings"));
328 sbDisplay = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Emulator Display Settings"));
329 // Core Settings - Basic
330 CPUThread = new wxCheckBox(GeneralPage, ID_CPUTHREAD, wxT("Enable Dual Core (speedup)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
331 SkipIdle = new wxCheckBox(GeneralPage, ID_IDLESKIP, wxT("Enable Idle Skipping (speedup)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
332 EnableCheats = new wxCheckBox(GeneralPage, ID_ENABLECHEATS, wxT("Enable Cheats"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
334 // Framelimit
335 wxStaticText *FramelimitText = new wxStaticText(GeneralPage, ID_FRAMELIMIT_TEXT, wxT("Framelimit :"), wxDefaultPosition, wxDefaultSize);
336 Framelimit = new wxChoice(GeneralPage, ID_FRAMELIMIT, wxDefaultPosition, wxDefaultSize, arrayStringFor_Framelimit, 0, wxDefaultValidator);
338 // Core Settings - Advanced
339 wxStaticBoxSizer* sizerCoreType = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("CPU Emulator Engine"));
340 AlwaysHLE_BS2 = new wxCheckBox(GeneralPage, ID_ALWAYS_HLE_BS2, wxT("HLE the IPL (recommended)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
341 m_RadioJIT = new wxRadioButton(GeneralPage, ID_RADIOJIT, wxT("JIT recompiler (recommended)"));
342 m_RadioJITIL = new wxRadioButton(GeneralPage, ID_RADIOJITIL, wxT("JitIL experimental recompiler"));
343 m_RadioInt = new wxRadioButton(GeneralPage, ID_RADIOINT, wxT("Interpreter (VERY slow)"));
344 LockThreads = new wxCheckBox(GeneralPage, ID_LOCKTHREADS, wxT("Lock threads to cores"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
345 DSPThread = new wxCheckBox(GeneralPage, ID_DSPTHREAD, wxT("DSPLLE on thread"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
347 // Interface settings
348 ConfirmStop = new wxCheckBox(GeneralPage, ID_INTERFACE_CONFIRMSTOP, wxT("Confirm On Stop"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
349 UsePanicHandlers = new wxCheckBox(GeneralPage, ID_INTERFACE_USEPANICHANDLERS, wxT("Use Panic Handlers"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
351 // Interface Language
352 // At the moment this only changes the language displayed in m_gamelistctrl
353 // If someone wants to control the whole GUI's language, it should be set here too
354 wxStaticText *InterfaceLangText = new wxStaticText(GeneralPage, ID_INTERFACE_LANG_TEXT, wxT("Game List Language:"), wxDefaultPosition, wxDefaultSize);
355 InterfaceLang = new wxChoice(GeneralPage, ID_INTERFACE_LANG, wxDefaultPosition, wxDefaultSize, arrayStringFor_InterfaceLang, 0, wxDefaultValidator);
357 // Hotkey configuration
358 HotkeyConfig = new wxButton(GeneralPage, ID_HOTKEY_CONFIG, wxT("Hotkeys"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
360 // Themes - this should really be a wxChoice...
361 Theme = new wxRadioBox(GeneralPage, ID_INTERFACE_THEME, wxT("Theme"),wxDefaultPosition, wxDefaultSize, arrayStringFor_Themes, 1, wxRA_SPECIFY_ROWS);
363 // General display settings
364 Fullscreen = new wxCheckBox(GeneralPage, ID_DISPLAY_FULLSCREEN, wxT("Start Renderer in Fullscreen"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
365 HideCursor = new wxCheckBox(GeneralPage, ID_DISPLAY_HIDECURSOR, wxT("Hide Mouse Cursor"));
366 RenderToMain = new wxCheckBox(GeneralPage, ID_DISPLAY_RENDERTOMAIN, wxT("Render to Main Window"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
368 // Populate the settings
369 sCore = new wxBoxSizer(wxHORIZONTAL);
370 sbBasic->Add(CPUThread, 0, wxALL, 5);
371 sbBasic->Add(SkipIdle, 0, wxALL, 5);
372 sbBasic->Add(EnableCheats, 0, wxALL, 5);
373 wxBoxSizer *sFramelimit = new wxBoxSizer(wxHORIZONTAL);
374 sFramelimit->Add(FramelimitText, 0, wxALL | wxALIGN_CENTER, 1);
375 sFramelimit->Add(Framelimit, 0, wxALL | wxEXPAND, 5);
376 sbBasic->Add(sFramelimit, 0, wxALL | wxEXPAND, 5);
378 sbAdvanced->Add(AlwaysHLE_BS2, 0, wxALL, 5);
379 sizerCoreType->Add(m_RadioJIT, 0, wxALL | wxEXPAND, 5);
380 sizerCoreType->Add(m_RadioJITIL, 0, wxALL | wxEXPAND, 5);
381 sizerCoreType->Add(m_RadioInt, 0, wxALL | wxEXPAND, 5);
382 sbAdvanced->Add(sizerCoreType, 0, wxALL, 5);
383 sbAdvanced->Add(LockThreads, 0, wxALL, 5);
384 sbAdvanced->Add(DSPThread, 0, wxALL, 5);
385 sCore->Add(sbBasic, 0, wxEXPAND);
386 sCore->AddStretchSpacer();
387 sCore->Add(sbAdvanced, 0, wxEXPAND);
389 sbInterface->Add(ConfirmStop, 0, wxALL, 5);
390 sbInterface->Add(UsePanicHandlers, 0, wxALL, 5);
391 sbInterface->Add(Theme, 0, wxEXPAND | wxALL, 5);
392 wxBoxSizer *sInterface = new wxBoxSizer(wxHORIZONTAL);
393 sInterface->Add(InterfaceLangText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
394 sInterface->Add(InterfaceLang, 0, wxEXPAND | wxALL, 5);
395 sInterface->AddStretchSpacer();
396 sInterface->Add(HotkeyConfig, 0, wxALIGN_RIGHT | wxALL, 5);
397 sbInterface->Add(sInterface, 0, wxEXPAND | wxALL, 5);
399 sbDisplay->Add(Fullscreen, 0, wxEXPAND | wxALL, 5);
400 sbDisplay->Add(HideCursor, 0, wxALL, 5);
401 sbDisplay->Add(RenderToMain, 0, wxEXPAND | wxALL, 5);
403 // Populate the entire page
404 sGeneralPage = new wxBoxSizer(wxVERTICAL);
405 sGeneralPage->Add(sCore, 0, wxEXPAND | wxALL, 5);
406 sGeneralPage->Add(sbInterface, 0, wxEXPAND | wxALL, 5);
407 sGeneralPage->Add(sbDisplay, 0, wxEXPAND | wxALL, 5);
409 GeneralPage->SetSizer(sGeneralPage);
410 sGeneralPage->Layout();
414 // Gamecube page
415 sbGamecubeIPLSettings = new wxStaticBoxSizer(wxVERTICAL, GamecubePage, wxT("IPL Settings"));
416 // IPL settings
417 GCSystemLangText = new wxStaticText(GamecubePage, ID_GC_SRAM_LNG_TEXT, wxT("System Language:"), wxDefaultPosition, wxDefaultSize);
418 GCSystemLang = new wxChoice(GamecubePage, ID_GC_SRAM_LNG, wxDefaultPosition, wxDefaultSize, arrayStringFor_GCSystemLang, 0, wxDefaultValidator);
419 // Devices
420 wxStaticBoxSizer *sbGamecubeDeviceSettings = new wxStaticBoxSizer(wxVERTICAL, GamecubePage, wxT("Device Settings"));
421 // EXI Devices
422 wxStaticText *GCEXIDeviceText[3];
423 GCEXIDeviceText[0] = new wxStaticText(GamecubePage, ID_GC_EXIDEVICE_SLOTA_TEXT, wxT("Slot A"), wxDefaultPosition, wxDefaultSize);
424 GCEXIDeviceText[1] = new wxStaticText(GamecubePage, ID_GC_EXIDEVICE_SLOTB_TEXT, wxT("Slot B"), wxDefaultPosition, wxDefaultSize);
425 GCEXIDeviceText[2] = new wxStaticText(GamecubePage, ID_GC_EXIDEVICE_SP1_TEXT, wxT("SP1 "), wxDefaultPosition, wxDefaultSize);
426 GCEXIDeviceText[2]->SetToolTip(wxT("Serial Port 1 - This is the port which devices such as the net adapter use"));
427 const wxString SlotDevices[] = {wxT(DEV_NONE_STR),wxT(DEV_DUMMY_STR),wxT(EXIDEV_MEMCARD_STR)
428 #if HAVE_PORTAUDIO
429 , wxT(EXIDEV_MIC_STR)
430 #endif
432 static const int numSlotDevices = sizeof(SlotDevices)/sizeof(wxString);
433 const wxString SP1Devices[] = {wxT(DEV_NONE_STR),wxT(DEV_DUMMY_STR),wxT(EXIDEV_BBA_STR),wxT(EXIDEV_AM_BB_STR)};
434 static const int numSP1Devices = sizeof(SP1Devices)/sizeof(wxString);
435 GCEXIDevice[0] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SLOTA, wxDefaultPosition, wxDefaultSize, numSlotDevices, SlotDevices, 0, wxDefaultValidator);
436 GCEXIDevice[1] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SLOTB, wxDefaultPosition, wxDefaultSize, numSlotDevices, SlotDevices, 0, wxDefaultValidator);
437 GCEXIDevice[2] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SP1, wxDefaultPosition, wxDefaultSize, numSP1Devices, SP1Devices, 0, wxDefaultValidator);
438 GCMemcardPath[0] = new wxButton(GamecubePage, ID_GC_EXIDEVICE_SLOTA_PATH, wxT("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
439 GCMemcardPath[1] = new wxButton(GamecubePage, ID_GC_EXIDEVICE_SLOTB_PATH, wxT("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
440 // Can't move this one without making the 4 const's etc. above class members/fields,
441 for (int i = 0; i < 3; ++i)
443 bool isMemcard = false;
444 switch (SConfig::GetInstance().m_EXIDevice[i])
446 case EXIDEVICE_NONE:
447 GCEXIDevice[i]->SetStringSelection(SlotDevices[0]);
448 break;
449 case EXIDEVICE_MEMORYCARD_A:
450 case EXIDEVICE_MEMORYCARD_B:
451 isMemcard = GCEXIDevice[i]->SetStringSelection(SlotDevices[2]);
452 break;
453 case EXIDEVICE_MIC:
454 GCEXIDevice[i]->SetStringSelection(SlotDevices[3]);
455 break;
456 case EXIDEVICE_ETH:
457 GCEXIDevice[i]->SetStringSelection(SP1Devices[2]);
458 break;
459 case EXIDEVICE_AM_BASEBOARD:
460 GCEXIDevice[i]->SetStringSelection(SP1Devices[3]);
461 break;
462 case EXIDEVICE_DUMMY:
463 default:
464 GCEXIDevice[i]->SetStringSelection(SlotDevices[1]);
465 break;
467 if (!isMemcard && i < 2)
468 GCMemcardPath[i]->Disable();
470 //SI Devices
471 wxStaticText *GCSIDeviceText[4];
472 GCSIDeviceText[0] = new wxStaticText(GamecubePage, ID_GC_SIDEVICE_TEXT, wxT("Port 1"), wxDefaultPosition, wxDefaultSize);
473 GCSIDeviceText[1] = new wxStaticText(GamecubePage, ID_GC_SIDEVICE_TEXT, wxT("Port 2"), wxDefaultPosition, wxDefaultSize);
474 GCSIDeviceText[2] = new wxStaticText(GamecubePage, ID_GC_SIDEVICE_TEXT, wxT("Port 3"), wxDefaultPosition, wxDefaultSize);
475 GCSIDeviceText[3] = new wxStaticText(GamecubePage, ID_GC_SIDEVICE_TEXT, wxT("Port 4"), wxDefaultPosition, wxDefaultSize);
476 const wxString SIPort1Devices[] = {wxT(DEV_NONE_STR),wxT(SIDEV_STDCONT_STR),wxT(SIDEV_GBA_STR),wxT(SIDEV_AM_BB_STR)};
477 static const int numSIPort1Devices = sizeof(SIPort1Devices)/sizeof(wxString);
478 const wxString SIDevices[] = {wxT(DEV_NONE_STR),wxT(SIDEV_STDCONT_STR),wxT(SIDEV_GBA_STR)};
479 static const int numSIDevices = sizeof(SIDevices)/sizeof(wxString);
480 GCSIDevice[0] = new wxChoice(GamecubePage, ID_GC_SIDEVICE0, wxDefaultPosition, wxDefaultSize, numSIPort1Devices, SIPort1Devices, 0, wxDefaultValidator);
481 GCSIDevice[1] = new wxChoice(GamecubePage, ID_GC_SIDEVICE1, wxDefaultPosition, wxDefaultSize, numSIDevices, SIDevices, 0, wxDefaultValidator);
482 GCSIDevice[2] = new wxChoice(GamecubePage, ID_GC_SIDEVICE2, wxDefaultPosition, wxDefaultSize, numSIDevices, SIDevices, 0, wxDefaultValidator);
483 GCSIDevice[3] = new wxChoice(GamecubePage, ID_GC_SIDEVICE3, wxDefaultPosition, wxDefaultSize, numSIDevices, SIDevices, 0, wxDefaultValidator);
484 // Can't move this one without making the 2 const's etc. above class members/fields.
485 for (int i = 0; i < 4; ++i)
487 switch (SConfig::GetInstance().m_SIDevice[i])
489 case SI_GC_CONTROLLER:
490 GCSIDevice[i]->SetStringSelection(SIDevices[1]);
491 break;
492 case SI_GBA:
493 GCSIDevice[i]->SetStringSelection(SIDevices[2]);
494 break;
495 case SI_AM_BASEBOARD:
496 GCSIDevice[i]->SetStringSelection(SIDevices[3]);
497 break;
498 default:
499 GCSIDevice[i]->SetStringSelection(SIDevices[0]);
500 break;
503 sGamecube = new wxBoxSizer(wxVERTICAL);
504 sGamecubeIPLSettings = new wxGridBagSizer(0, 0);
505 sGamecubeIPLSettings->Add(GCSystemLangText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
506 sGamecubeIPLSettings->Add(GCSystemLang, wxGBPosition(0, 1), wxGBSpan(1, 1), wxALL, 5);
507 sbGamecubeIPLSettings->Add(sGamecubeIPLSettings);
508 sGamecube->Add(sbGamecubeIPLSettings, 0, wxEXPAND|wxALL, 5);
509 wxBoxSizer *sEXIDevices[4];
510 wxBoxSizer *sSIDevices[4];
511 for (int i = 0; i < 3; ++i)
513 sEXIDevices[i] = new wxBoxSizer(wxHORIZONTAL);
514 sEXIDevices[i]->Add(GCEXIDeviceText[i], 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
515 sEXIDevices[i]->Add(GCEXIDevice[i], 0, wxALL, 5);
516 if (i < 2)
517 sEXIDevices[i]->Add(GCMemcardPath[i], 0, wxALL, 5);
518 sbGamecubeDeviceSettings->Add(sEXIDevices[i]);
520 for (int i = 0; i < 4; ++i)
522 sSIDevices[i] = new wxBoxSizer(wxHORIZONTAL);
523 sSIDevices[i]->Add(GCSIDeviceText[i], 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
524 sSIDevices[i]->Add(GCSIDevice[i], 0, wxALL, 5);
525 sbGamecubeDeviceSettings->Add(sSIDevices[i]);
527 sGamecube->Add(sbGamecubeDeviceSettings, 0, wxEXPAND|wxALL, 5);
528 GamecubePage->SetSizer(sGamecube);
529 sGamecube->Layout();
531 // Wii page
532 sbWiimoteSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("Wiimote Settings"));
533 WiiSensBarPosText = new wxStaticText(WiiPage, ID_WII_BT_BAR_TEXT, wxT("Sensor Bar Position:"), wxDefaultPosition, wxDefaultSize);
534 WiiSensBarPos = new wxChoice(WiiPage, ID_WII_BT_BAR, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiSensBarPos, 0, wxDefaultValidator);
536 sbWiiIPLSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("Misc Settings"));
537 WiiScreenSaver = new wxCheckBox(WiiPage, ID_WII_IPL_SSV, wxT("Enable Screen Saver (burn-in reduction)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
538 WiiProgressiveScan = new wxCheckBox(WiiPage, ID_WII_IPL_PGS, wxT("Enable Progressive Scan"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
539 WiiEuRGB60 = new wxCheckBox(WiiPage, ID_WII_IPL_E60, wxT("Use EuRGB60 Mode (PAL60)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
540 WiiAspectRatioText = new wxStaticText(WiiPage, ID_WII_IPL_AR_TEXT, wxT("Aspect Ratio:"), wxDefaultPosition, wxDefaultSize);
541 WiiAspectRatio = new wxChoice(WiiPage, ID_WII_IPL_AR, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiAspectRatio, 0, wxDefaultValidator);
542 WiiSystemLangText = new wxStaticText(WiiPage, ID_WII_IPL_LNG_TEXT, wxT("System Language:"), wxDefaultPosition, wxDefaultSize);
543 WiiSystemLang = new wxChoice(WiiPage, ID_WII_IPL_LNG, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiSystemLang, 0, wxDefaultValidator);
545 // Devices
546 sbWiiDeviceSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("Device Settings"));
548 WiiSDCard = new wxCheckBox(WiiPage, ID_WII_SD_CARD, wxT("Insert SD Card"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
549 WiiKeyboard = new wxCheckBox(WiiPage, ID_WII_KEYBOARD, wxT("Connect USB Keyboard"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
551 // Populate sbWiimoteSettings
552 sWii = new wxBoxSizer(wxVERTICAL);
553 sWiimoteSettings = new wxGridBagSizer(0, 0);
554 sWiimoteSettings->Add(WiiSensBarPosText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
555 sWiimoteSettings->Add(WiiSensBarPos, wxGBPosition(0, 1), wxGBSpan(1, 1), wxALL, 5);
556 sbWiimoteSettings->Add(sWiimoteSettings);
557 sWii->Add(sbWiimoteSettings, 0, wxEXPAND|wxALL, 5);
559 sWiiIPLSettings = new wxGridBagSizer(0, 0);
560 sWiiIPLSettings->Add(WiiScreenSaver, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5);
561 sWiiIPLSettings->Add(WiiProgressiveScan, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
562 sWiiIPLSettings->Add(WiiEuRGB60, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5);
563 sWiiIPLSettings->Add(WiiAspectRatioText, wxGBPosition(3, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
564 sWiiIPLSettings->Add(WiiAspectRatio, wxGBPosition(3, 1), wxGBSpan(1, 1), wxALL, 5);
565 sWiiIPLSettings->Add(WiiSystemLangText, wxGBPosition(4, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
566 sWiiIPLSettings->Add(WiiSystemLang, wxGBPosition(4, 1), wxGBSpan(1, 1), wxALL, 5);
567 sbWiiIPLSettings->Add(sWiiIPLSettings);
568 sWii->Add(sbWiiIPLSettings, 0, wxEXPAND|wxALL, 5);
570 sbWiiDeviceSettings->Add(WiiSDCard, 0, wxALL, 5);
571 sbWiiDeviceSettings->Add(WiiKeyboard, 0, wxALL, 5);
572 sWii->Add(sbWiiDeviceSettings, 0, wxEXPAND|wxALL, 5);
573 WiiPage->SetSizer(sWii);
574 sWii->Layout();
578 // Paths page
579 sbISOPaths = new wxStaticBoxSizer(wxVERTICAL, PathsPage, wxT("ISO Directories"));
580 ISOPaths = new wxListBox(PathsPage, ID_ISOPATHS, wxDefaultPosition, wxDefaultSize, arrayStringFor_ISOPaths, wxLB_SINGLE, wxDefaultValidator);
581 AddISOPath = new wxButton(PathsPage, ID_ADDISOPATH, wxT("Add..."), wxDefaultPosition, wxDefaultSize, 0);
582 RemoveISOPath = new wxButton(PathsPage, ID_REMOVEISOPATH, wxT("Remove"), wxDefaultPosition, wxDefaultSize, 0);
583 RemoveISOPath->Enable(false);
584 RecersiveISOPath = new wxCheckBox(PathsPage, ID_RECERSIVEISOPATH, wxT("Search Subfolders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
585 DefaultISOText = new wxStaticText(PathsPage, ID_DEFAULTISO_TEXT, wxT("Default ISO:"), wxDefaultPosition, wxDefaultSize);
586 DefaultISO = new wxFilePickerCtrl(PathsPage, ID_DEFAULTISO, wxEmptyString, wxT("Choose a default ISO:"),
587 wxString::Format(wxT("All GC/Wii images (gcm, iso, gcz)|*.gcm;*.iso;*.gcz|All files (%s)|%s"), wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr),
588 wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_OPEN);
590 DVDRootText = new wxStaticText(PathsPage, ID_DVDROOT_TEXT, wxT("DVD Root:"), wxDefaultPosition, wxDefaultSize);
591 DVDRoot = new wxDirPickerCtrl(PathsPage, ID_DVDROOT, wxEmptyString, wxT("Choose a DVD root directory:"), wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL);
592 ApploaderPathText = new wxStaticText(PathsPage, ID_APPLOADERPATH_TEXT, wxT("Apploader:"), wxDefaultPosition, wxDefaultSize);
593 ApploaderPath = new wxFilePickerCtrl(PathsPage, ID_APPLOADERPATH, wxEmptyString, wxT("Choose file to use as apploader: (applies to discs constructed from directories only)"),
594 wxString::Format(wxT("apploader (.img)|*.img|All files (%s)|%s"), wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr),
595 wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_OPEN);
597 sPaths = new wxBoxSizer(wxVERTICAL);
599 sbISOPaths->Add(ISOPaths, 1, wxEXPAND|wxALL, 0);
601 sISOButtons = new wxBoxSizer(wxHORIZONTAL);
602 sISOButtons->Add(RecersiveISOPath, 0, wxALL|wxALIGN_CENTER, 0);
603 sISOButtons->AddStretchSpacer(1);
604 sISOButtons->Add(AddISOPath, 0, wxALL, 0);
605 sISOButtons->Add(RemoveISOPath, 0, wxALL, 0);
606 sbISOPaths->Add(sISOButtons, 0, wxEXPAND|wxALL, 5);
607 sPaths->Add(sbISOPaths, 1, wxEXPAND|wxALL, 5);
609 sOtherPaths = new wxGridBagSizer(0, 0);
610 sOtherPaths->AddGrowableCol(1);
611 sOtherPaths->Add(DefaultISOText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
612 sOtherPaths->Add(DefaultISO, wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
613 sOtherPaths->Add(DVDRootText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
614 sOtherPaths->Add(DVDRoot, wxGBPosition(1, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
615 sOtherPaths->Add(ApploaderPathText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
616 sOtherPaths->Add(ApploaderPath, wxGBPosition(2, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
617 sPaths->Add(sOtherPaths, 0, wxEXPAND|wxALL, 5);
618 PathsPage->SetSizer(sPaths);
619 sPaths->Layout();
622 // Plugins page
623 sbGraphicsPlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginPage, wxT("Graphics"));
624 GraphicSelection = new wxChoice(PluginPage, ID_GRAPHIC_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator);
625 GraphicConfig = new wxButton(PluginPage, ID_GRAPHIC_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
627 sbDSPPlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginPage, wxT("DSP"));
628 DSPSelection = new wxChoice(PluginPage, ID_DSP_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator);
629 DSPConfig = new wxButton(PluginPage, ID_DSP_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
631 sbPadPlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginPage, wxT("Gamecube Pad"));
632 PADSelection = new wxChoice(PluginPage, ID_PAD_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator);
633 PADConfig = new wxButton(PluginPage, ID_PAD_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
635 sbWiimotePlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginPage, wxT("Wiimote"));
636 WiimoteSelection = new wxChoice(PluginPage, ID_WIIMOTE_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator);
637 WiimoteConfig = new wxButton(PluginPage, ID_WIIMOTE_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
640 sPlugins = new wxBoxSizer(wxVERTICAL);
641 sbGraphicsPlugin->Add(GraphicSelection, 1, wxEXPAND|wxALL, 5);
642 sbGraphicsPlugin->Add(GraphicConfig, 0, wxALL, 5);
643 sPlugins->Add(sbGraphicsPlugin, 0, wxEXPAND|wxALL, 5);
645 sbDSPPlugin->Add(DSPSelection, 1, wxEXPAND|wxALL, 5);
646 sbDSPPlugin->Add(DSPConfig, 0, wxALL, 5);
647 sPlugins->Add(sbDSPPlugin, 0, wxEXPAND|wxALL, 5);
649 sbPadPlugin->Add(PADSelection, 1, wxEXPAND|wxALL, 5);
650 sbPadPlugin->Add(PADConfig, 0, wxALL, 5);
651 sPlugins->Add(sbPadPlugin, 0, wxEXPAND|wxALL, 5);
653 sbWiimotePlugin->Add(WiimoteSelection, 1, wxEXPAND|wxALL, 5);
654 sbWiimotePlugin->Add(WiimoteConfig, 0, wxALL, 5);
655 sPlugins->Add(sbWiimotePlugin, 0, wxEXPAND|wxALL, 5);
656 PluginPage->SetSizer(sPlugins);
657 sPlugins->Layout();
661 m_Close = new wxButton(this, wxID_CLOSE);
663 wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL);
664 sButtons->Add(0, 0, 1, wxEXPAND, 5);
665 sButtons->Add(m_Close, 0, wxALL, 5);
667 wxBoxSizer* sMain = new wxBoxSizer(wxVERTICAL);
668 sMain->Add(Notebook, 1, wxEXPAND|wxALL, 5);
669 sMain->Add(sButtons, 0, wxEXPAND, 5);
671 InitializeGUIValues();
672 InitializeGUITooltips();
674 UpdateGUI();
676 this->SetSizer(sMain);
677 this->Layout();
679 Fit();
680 Center();
683 void CConfigMain::OnClose(wxCloseEvent& WXUNUSED (event))
685 EndModal((bRefreshList) ? wxID_OK : wxID_CLOSE);
687 // Sysconf saves when it gets deleted
688 //delete SConfig::GetInstance().m_SYSCONF;
690 // Save the config. Dolphin crashes to often to save the settings on closing only
691 SConfig::GetInstance().SaveSettings();
694 void CConfigMain::CloseClick(wxCommandEvent& WXUNUSED (event))
696 Close();
700 // Core AND Interface settings
701 void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
703 switch (event.GetId())
705 case ID_INTERFACE_CONFIRMSTOP: // Interface
706 SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop = ConfirmStop->IsChecked();
707 break;
708 case ID_INTERFACE_USEPANICHANDLERS: // Interface
709 SConfig::GetInstance().m_LocalCoreStartupParameter.bUsePanicHandlers = UsePanicHandlers->IsChecked();
710 SetEnableAlert(UsePanicHandlers->IsChecked());
711 break;
712 case ID_INTERFACE_THEME:
713 SConfig::GetInstance().m_LocalCoreStartupParameter.iTheme = Theme->GetSelection();
714 main_frame->InitBitmaps();
715 break;
716 case ID_INTERFACE_LANG:
717 SConfig::GetInstance().m_InterfaceLanguage = (INTERFACE_LANGUAGE)InterfaceLang->GetSelection();
718 bRefreshList = true;
719 break;
720 case ID_HOTKEY_CONFIG:
722 HotkeyConfigDialog *m_HotkeyDialog = new HotkeyConfigDialog(this);
723 m_HotkeyDialog->ShowModal();
724 m_HotkeyDialog->Destroy();
725 // Update the GUI in case menu accelerators were changed
726 main_frame->UpdateGUI();
728 break;
729 case ID_FRAMELIMIT:
730 SConfig::GetInstance().m_Framelimit = (u32)Framelimit->GetSelection();
731 break;
732 case ID_ALWAYS_HLE_BS2: // Core
733 SConfig::GetInstance().m_LocalCoreStartupParameter.bHLE_BS2 = AlwaysHLE_BS2->IsChecked();
734 break;
735 case ID_RADIOJIT:
736 SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore = 1;
737 if (main_frame->g_pCodeWindow) main_frame->g_pCodeWindow->GetMenuBar()->Check(IDM_INTERPRETER, false);
738 break;
739 case ID_RADIOJITIL:
740 SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore = 2;
741 if (main_frame->g_pCodeWindow) main_frame->g_pCodeWindow->GetMenuBar()->Check(IDM_INTERPRETER, false);
742 break;
743 case ID_RADIOINT:
744 SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore = 0;
745 if (main_frame->g_pCodeWindow) main_frame->g_pCodeWindow->GetMenuBar()->Check(IDM_INTERPRETER, true);
746 break;
747 case ID_CPUTHREAD:
748 SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread = CPUThread->IsChecked();
749 break;
750 case ID_DSPTHREAD:
751 SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPThread = DSPThread->IsChecked();
752 break;
753 case ID_LOCKTHREADS:
754 SConfig::GetInstance().m_LocalCoreStartupParameter.bLockThreads = LockThreads->IsChecked();
755 break;
756 case ID_IDLESKIP:
757 SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle = SkipIdle->IsChecked();
758 break;
759 case ID_ENABLECHEATS:
760 SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats = EnableCheats->IsChecked();
761 break;
762 case ID_DISPLAY_FULLSCREEN: // Display
763 SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen = Fullscreen->IsChecked();
764 break;
765 case ID_DISPLAY_HIDECURSOR:
766 SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor = HideCursor->IsChecked();
767 break;
768 case ID_DISPLAY_RENDERTOMAIN:
769 SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain = RenderToMain->IsChecked();
770 break;
775 // GC settings
776 // -----------------------
777 void CConfigMain::GCSettingsChanged(wxCommandEvent& event)
779 int sidevice = 0;
780 int exidevice = 0;
781 switch (event.GetId())
783 case ID_GC_SRAM_LNG:
784 SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage = GCSystemLang->GetSelection();
785 break;
787 case ID_GC_EXIDEVICE_SP1:
788 exidevice++;
789 case ID_GC_EXIDEVICE_SLOTB:
790 exidevice++;
791 case ID_GC_EXIDEVICE_SLOTA:
792 ChooseEXIDevice(std::string(event.GetString().mb_str()), exidevice);
793 break;
794 case ID_GC_EXIDEVICE_SLOTA_PATH:
795 ChooseMemcardPath(SConfig::GetInstance().m_strMemoryCardA, true);
796 break;
797 case ID_GC_EXIDEVICE_SLOTB_PATH:
798 ChooseMemcardPath(SConfig::GetInstance().m_strMemoryCardB, false);
799 break;
801 case ID_GC_SIDEVICE3:
802 sidevice++;
803 case ID_GC_SIDEVICE2:
804 sidevice++;
805 case ID_GC_SIDEVICE1:
806 sidevice++;
807 case ID_GC_SIDEVICE0:
808 ChooseSIDevice(std::string(event.GetString().mb_str()), sidevice);
809 break;
813 void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA)
815 std::string filename = std::string(wxFileSelector(
816 wxT("Choose a file to open"),
817 wxString::FromAscii(File::GetUserPath(D_GCUSER_IDX)),
818 isSlotA ? wxT(GC_MEMCARDA) : wxT(GC_MEMCARDB),
819 wxEmptyString,
820 wxT("Gamecube Memory Cards (*.raw,*.gcp)|*.raw;*.gcp")).mb_str());
822 if (!filename.empty())
824 // also check that the path isn't used for the other memcard...
825 if (filename.compare(isSlotA ? SConfig::GetInstance().m_strMemoryCardB
826 : SConfig::GetInstance().m_strMemoryCardA) != 0)
828 strMemcard = filename;
830 if (Core::GetState() != Core::CORE_UNINITIALIZED)
832 // Change memcard to the new file
833 ExpansionInterface::ChangeDevice(
834 isSlotA ? 0 : 1, // SlotA: channel 0, SlotB channel 1
835 isSlotA ? EXIDEVICE_MEMORYCARD_A : EXIDEVICE_MEMORYCARD_B,
836 0); // SP1 is device 2, slots are device 0
839 else
841 PanicAlert("Cannot use that file as a memory card.\n"
842 "Are you trying to use the same file in both slots?");
847 void CConfigMain::ChooseSIDevice(std::string deviceName, int deviceNum)
849 TSIDevices tempType;
850 if (!deviceName.compare(SIDEV_STDCONT_STR))
851 tempType = SI_GC_CONTROLLER;
852 else if (!deviceName.compare(SIDEV_GBA_STR))
853 tempType = SI_GBA;
854 else if (!deviceName.compare(SIDEV_AM_BB_STR))
855 tempType = SI_AM_BASEBOARD;
856 else
857 tempType = SI_NONE;
859 SConfig::GetInstance().m_SIDevice[deviceNum] = tempType;
861 if (Core::GetState() != Core::CORE_UNINITIALIZED)
863 // Change plugged device! :D
864 SerialInterface::ChangeDevice(tempType, deviceNum);
868 void CConfigMain::ChooseEXIDevice(std::string deviceName, int deviceNum)
870 TEXIDevices tempType;
872 if (!deviceName.compare(EXIDEV_MEMCARD_STR))
873 tempType = deviceNum ? EXIDEVICE_MEMORYCARD_B : EXIDEVICE_MEMORYCARD_A;
874 else if (!deviceName.compare(EXIDEV_MIC_STR))
875 tempType = EXIDEVICE_MIC;
876 else if (!deviceName.compare(EXIDEV_BBA_STR))
877 tempType = EXIDEVICE_ETH;
878 else if (!deviceName.compare(EXIDEV_AM_BB_STR))
879 tempType = EXIDEVICE_AM_BASEBOARD;
880 else if (!deviceName.compare(DEV_NONE_STR))
881 tempType = EXIDEVICE_NONE;
882 else
883 tempType = EXIDEVICE_DUMMY;
885 // Gray out the memcard path button if we're not on a memcard
886 if (tempType == EXIDEVICE_MEMORYCARD_A || tempType == EXIDEVICE_MEMORYCARD_B)
887 GCMemcardPath[deviceNum]->Enable();
888 else if (deviceNum == 0 || deviceNum == 1)
889 GCMemcardPath[deviceNum]->Disable();
891 SConfig::GetInstance().m_EXIDevice[deviceNum] = tempType;
893 if (Core::GetState() != Core::CORE_UNINITIALIZED)
895 // Change plugged device! :D
896 ExpansionInterface::ChangeDevice(
897 (deviceNum == 1) ? 1 : 0, // SlotB is on channel 1, slotA and SP1 are on 0
898 tempType, // The device enum to change to
899 (deviceNum == 2) ? 2 : 0); // SP1 is device 2, slots are device 0
906 // Wii settings
907 // -------------------
908 void CConfigMain::WiiSettingsChanged(wxCommandEvent& event)
910 switch (event.GetId())
912 case ID_WII_BT_BAR: // Wiimote settings
913 SConfig::GetInstance().m_SYSCONF->SetData("BT.BAR", WiiSensBarPos->GetSelection());
914 break;
916 case ID_WII_IPL_AR: // SYSCONF settings
917 SConfig::GetInstance().m_SYSCONF->SetData("IPL.AR", WiiAspectRatio->GetSelection());
918 break;
919 case ID_WII_IPL_SSV:
920 SConfig::GetInstance().m_SYSCONF->SetData("IPL.SSV", WiiScreenSaver->IsChecked());
921 break;
922 case ID_WII_IPL_LNG:
923 SConfig::GetInstance().m_SYSCONF->SetData("IPL.LNG", WiiSystemLang->GetSelection());
924 break;
925 case ID_WII_IPL_PGS:
926 SConfig::GetInstance().m_SYSCONF->SetData("IPL.PGS", WiiProgressiveScan->IsChecked());
927 break;
928 case ID_WII_IPL_E60:
929 SConfig::GetInstance().m_SYSCONF->SetData("IPL.E60", WiiEuRGB60->IsChecked());
930 break;
931 case ID_WII_SD_CARD:
932 SConfig::GetInstance().m_WiiSDCard = WiiSDCard->IsChecked();
933 break;
934 case ID_WII_KEYBOARD:
935 SConfig::GetInstance().m_WiiKeyboard = WiiKeyboard->IsChecked();
936 break;
944 // Paths settings
945 // -------------------
946 void CConfigMain::ISOPathsSelectionChanged(wxCommandEvent& WXUNUSED (event))
948 if (!ISOPaths->GetStringSelection().empty())
950 RemoveISOPath->Enable(true);
952 else
954 RemoveISOPath->Enable(false);
958 void CConfigMain::AddRemoveISOPaths(wxCommandEvent& event)
960 if (event.GetId() == ID_ADDISOPATH)
962 wxString dirHome;
963 wxGetHomeDir(&dirHome);
965 wxDirDialog dialog(this, _T("Choose a directory to add"), dirHome, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
967 if (dialog.ShowModal() == wxID_OK)
969 if (ISOPaths->FindString(dialog.GetPath()) != -1)
971 wxMessageBox(_("The chosen directory is already in the list"), _("Error"), wxOK);
973 else
975 bRefreshList = true;
976 ISOPaths->Append(dialog.GetPath());
980 else
982 bRefreshList = true;
983 ISOPaths->Delete(ISOPaths->GetSelection());
986 // Save changes right away
987 SConfig::GetInstance().m_ISOFolder.clear();
989 for (unsigned int i = 0; i < ISOPaths->GetCount(); i++)
990 SConfig::GetInstance().m_ISOFolder.push_back(std::string(ISOPaths->GetStrings()[i].mb_str()));
993 void CConfigMain::RecursiveDirectoryChanged(wxCommandEvent& WXUNUSED (event))
995 SConfig::GetInstance().m_RecursiveISOFolder = RecersiveISOPath->IsChecked();
996 bRefreshList = true;
999 void CConfigMain::DefaultISOChanged(wxFileDirPickerEvent& WXUNUSED (event))
1001 SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM = DefaultISO->GetPath().mb_str();
1004 void CConfigMain::DVDRootChanged(wxFileDirPickerEvent& WXUNUSED (event))
1006 SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDVDRoot = DVDRoot->GetPath().mb_str();
1009 void CConfigMain::ApploaderPathChanged(wxFileDirPickerEvent& WXUNUSED (event))
1011 SConfig::GetInstance().m_LocalCoreStartupParameter.m_strApploader = ApploaderPath->GetPath().mb_str();
1015 // Plugin settings
1016 void CConfigMain::OnSelectionChanged(wxCommandEvent& WXUNUSED (event))
1018 // Update plugin filenames
1019 GetFilename(GraphicSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
1020 GetFilename(DSPSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
1021 for (int i = 0; i < MAXPADS; i++)
1022 GetFilename(PADSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[i]);
1023 for (int i = 0; i < MAXWIIMOTES; i++)
1024 GetFilename(WiimoteSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[i]);
1027 void CConfigMain::OnConfig(wxCommandEvent& event)
1029 switch (event.GetId())
1031 case ID_GRAPHIC_CONFIG:
1032 CallConfig(GraphicSelection);
1033 break;
1034 case ID_DSP_CONFIG:
1035 CallConfig(DSPSelection);
1036 break;
1037 case ID_PAD_CONFIG:
1038 CallConfig(PADSelection);
1039 break;
1040 case ID_WIIMOTE_CONFIG:
1041 CallConfig(WiimoteSelection);
1042 break;
1046 void CConfigMain::CallConfig(wxChoice* _pChoice)
1048 int Index = _pChoice->GetSelection();
1049 INFO_LOG(CONSOLE, "CallConfig: %i\n", Index);
1050 if (Index >= 0)
1052 const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
1053 if (pInfo != NULL)
1054 CPluginManager::GetInstance().OpenConfig((HWND) this->GetHandle(), pInfo->GetFilename().c_str(), pInfo->GetPluginInfo().Type);
1058 void CConfigMain::FillChoiceBox(wxChoice* _pChoice, int _PluginType, const std::string& _SelectFilename)
1060 _pChoice->Clear();
1062 int Index = -1;
1063 const CPluginInfos& rInfos = CPluginManager::GetInstance().GetPluginInfos();
1065 for (size_t i = 0; i < rInfos.size(); i++)
1067 const PLUGIN_INFO& rPluginInfo = rInfos[i].GetPluginInfo();
1069 if (rPluginInfo.Type == _PluginType)
1071 wxString temp;
1072 temp = wxString::FromAscii(rInfos[i].GetPluginInfo().Name);
1073 int NewIndex = _pChoice->Append(temp, (void*)&rInfos[i]);
1075 if (rInfos[i].GetFilename() == _SelectFilename)
1077 Index = NewIndex;
1082 _pChoice->Select(Index);
1085 bool CConfigMain::GetFilename(wxChoice* _pChoice, std::string& _rFilename)
1087 _rFilename.clear();
1088 int Index = _pChoice->GetSelection();
1089 if (Index >= 0)
1091 const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
1092 _rFilename = pInfo->GetFilename();
1093 INFO_LOG(CONSOLE, "GetFilename: %i %s\n", Index, _rFilename.c_str());
1094 return(true);
1097 return(false);