2 * Copyright (C) Volition, Inc. 1999. All rights reserved.
4 * All source code herein is the property of Volition, Inc. You may not sell
5 * or otherwise commercially exploit the source or things you created based on
12 #include "launchersetup.h"
13 #include "osregistry.h"
15 #include "wx/valnum.h"
16 #include "wx/access.h"
19 wxBEGIN_EVENT_TABLE(LauncherSetup, wxDialog)
20 EVT_BUTTON(wxID_OK, LauncherSetup::onOk)
21 EVT_CHECKBOX(ID_CB_MSAA, LauncherSetup::onToggleMSAA)
25 LauncherSetup::LauncherSetup( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
27 this->SetSizeHints( wxSize(370, -1), wxDefaultSize );
30 wxNotebook *nbook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
34 initTab_Joystick(nbook);
36 initTab_Network(nbook);
39 wxBoxSizer* bSizer = new wxBoxSizer( wxVERTICAL );
40 bSizer->Add( nbook, 0, wxALL|wxEXPAND, 5 );
43 wxStdDialogButtonSizer* sdbSizer = new wxStdDialogButtonSizer();
44 sdbSizer->AddButton( new wxButton(this, wxID_OK) );
45 sdbSizer->AddButton( new wxButton(this, wxID_CANCEL) );
48 bSizer->Add( sdbSizer, 0, wxALL|wxEXPAND, 5 );
51 this->SetSizer( bSizer );
56 this->Centre( wxBOTH );
59 LauncherSetup::~LauncherSetup()
63 void LauncherSetup::initTab_Video(wxNotebook *parent)
65 unsigned int checked = 0;
67 wxPanel* panel = new wxPanel( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
69 wxBoxSizer* bSizer = new wxBoxSizer( wxVERTICAL );
73 wxStaticBoxSizer* sbSizer = new wxStaticBoxSizer( new wxStaticBox( panel, wxID_ANY, wxT("Renderer") ), wxVERTICAL );
75 m_Video_Renderer = new wxComboBox( panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN|wxCB_READONLY );
76 sbSizer->Add( m_Video_Renderer, 1, wxALL|wxEXPAND, 5 );
78 bSizer->Add( sbSizer, 0, wxALL|wxEXPAND, 5 );
80 m_Video_Renderer->Append( wxT("OpenGL") );
81 m_Video_Renderer->SetSelection( 0 );
84 m_Video_Fullscreen = new wxCheckBox( panel, wxID_ANY, wxT("Fullscreen"), wxDefaultPosition, wxDefaultSize, 0 );
85 bSizer->Add( m_Video_Fullscreen, 0, wxALL, 5 );
87 checked = os_config_read_uint("Video", "Fullscreen", 1);
89 m_Video_Fullscreen->SetValue( (checked == 1) );
92 m_Video_ShowFPS = new wxCheckBox( panel, wxID_ANY, wxT("Show FPS"), wxDefaultPosition, wxDefaultSize, 0 );
93 bSizer->Add( m_Video_ShowFPS, 0, wxALL, 5 );
95 checked = os_config_read_uint("Video", "ShowFPS", 0);
97 m_Video_ShowFPS->SetValue( (checked == 1) );
100 wxBoxSizer* bSizer_aa = new wxBoxSizer( wxHORIZONTAL );
102 m_Video_MSAA = new wxCheckBox( panel, ID_CB_MSAA, wxT("Anti-Alias"), wxDefaultPosition, wxDefaultSize, 0 );
103 bSizer_aa->Add( m_Video_MSAA, 0, wxALIGN_CENTER_VERTICAL, 5 );
105 const wxString msaa_samples[] = { wxT("2x"), wxT("4x"), wxT("8x"), wxT("16x") };
106 const int num_msaa_samples = sizeof( msaa_samples ) / sizeof( wxString );
107 m_Video_MSAASamples = new wxChoice( panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, num_msaa_samples, msaa_samples, 0 );
108 bSizer_aa->Add( m_Video_MSAASamples, 0, wxLEFT, 15 );
110 bSizer->Add( bSizer_aa, 0, wxALL, 5 );
112 checked = os_config_read_uint("Video", "AntiAlias", 0);
115 m_Video_MSAA->SetValue(true);
118 m_Video_MSAASamples->SetSelection(0);
119 } else if (checked < 8) {
120 m_Video_MSAASamples->SetSelection(1);
121 } else if (checked < 16) {
122 m_Video_MSAASamples->SetSelection(2);
124 m_Video_MSAASamples->SetSelection(3);
127 m_Video_MSAA->SetValue(false);
128 m_Video_MSAASamples->SetSelection(wxNOT_FOUND);
129 m_Video_MSAASamples->Disable();
133 panel->SetSizer( bSizer );
136 bSizer->Fit( panel );
138 parent->AddPage( panel, wxT("Video"), true );
141 void LauncherSetup::saveTab_Video()
144 unsigned int msaa = 0;
146 value = m_Video_Renderer->GetValue();
148 os_config_write_string("Video", "Renderer", value.c_str());
150 if ( m_Video_MSAA->IsChecked() ) {
151 int sel = m_Video_MSAASamples->GetSelection();
153 if ( (sel >= 0) && (sel < 4) ) {
158 os_config_write_uint("Video", "AntiAlias", msaa);
160 os_config_write_uint("Video", "Fullscreen", m_Video_Fullscreen->IsChecked() ? 1 : 0);
161 os_config_write_uint("Video", "ShowFPS", m_Video_ShowFPS->IsChecked() ? 1 : 0);
164 void LauncherSetup::initTab_Audio(wxNotebook *parent)
166 unsigned int checked = 0;
167 ALint ver_major = 0, ver_minor = 0;
168 const ALCchar *ptr = NULL;
169 const char *conf_ptr = NULL;
170 bool audio_enabled = false;
172 alcGetIntegerv(NULL, ALC_MAJOR_VERSION, 1, &ver_major);
173 alcGetIntegerv(NULL, ALC_MINOR_VERSION, 1, &ver_minor);
175 if ( (ver_major >= 1) && (ver_minor >= 1) ) {
176 audio_enabled = true;
179 wxPanel* panel = new wxPanel( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
181 wxBoxSizer* bSizer = new wxBoxSizer( wxVERTICAL );
185 wxStaticBoxSizer* sbSizer_playback = new wxStaticBoxSizer( new wxStaticBox( panel, wxID_ANY, wxT("Playback Device") ), wxVERTICAL );
187 m_Audio_PlaybackDevice = new wxComboBox( panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN|wxCB_READONLY );
188 sbSizer_playback->Add( m_Audio_PlaybackDevice, 0, wxALL|wxEXPAND, 5 );
190 bSizer->Add( sbSizer_playback, 0, wxALL|wxEXPAND, 5 );
192 m_Audio_PlaybackDevice->Append("<Default>");
193 m_Audio_PlaybackDevice->SetSelection(0);
195 conf_ptr = os_config_read_string("Audio", "PlaybackDevice", NULL);
198 if ( alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT") != AL_FALSE ) {
199 ptr = alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER);
201 ptr = alcGetString(NULL, ALC_DEVICE_SPECIFIER);
206 m_Audio_PlaybackDevice->Append(ptr);
208 if ( conf_ptr && !SDL_strcasecmp(conf_ptr, ptr) ) {
209 unsigned int sel = m_Audio_PlaybackDevice->GetCount() - 1;
211 m_Audio_PlaybackDevice->SetSelection(sel);
216 ptr += strlen(ptr) + 1;
222 wxStaticBoxSizer* sbSizer_capture = new wxStaticBoxSizer( new wxStaticBox( panel, wxID_ANY, wxT("Capture Device") ), wxVERTICAL );
224 m_Audio_CaptureDevice = new wxComboBox( panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN|wxCB_READONLY );
225 sbSizer_capture->Add( m_Audio_CaptureDevice, 0, wxALL|wxEXPAND, 5 );
227 bSizer->Add( sbSizer_capture, 0, wxALL|wxEXPAND, 5 );
229 m_Audio_CaptureDevice->Append("<Default>");
230 m_Audio_CaptureDevice->SetSelection(0);
232 conf_ptr = os_config_read_string("Audio", "CaptureDevice", NULL);
235 ptr = alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER);
239 m_Audio_CaptureDevice->Append(ptr);
241 if ( conf_ptr && !SDL_strcasecmp(conf_ptr, ptr) ) {
242 unsigned int sel = m_Audio_CaptureDevice->GetCount() - 1;
244 m_Audio_CaptureDevice->SetSelection(sel);
249 ptr += strlen(ptr) + 1;
255 m_Audio_EFX = new wxCheckBox( panel, wxID_ANY, wxT("EFX / EAX Reverb"), wxDefaultPosition, wxDefaultSize, 0 );
256 bSizer->Add( m_Audio_EFX, 0, wxALL, 5 );
258 checked = os_config_read_uint("Audio", "EFX", 0);
260 m_Audio_EFX->SetValue( (checked == 1) );
264 m_Audio_LauncherSounds = new wxCheckBox( panel, wxID_ANY, wxT("Enable Launcher Sounds"), wxDefaultPosition, wxDefaultSize, 0 );
265 bSizer->Add( m_Audio_LauncherSounds, 0, wxALL, 5 );
267 checked = os_config_read_uint("Audio", "LauncherSoundEnabled", 1);
269 m_Audio_LauncherSounds->SetValue( (checked == 1) );
273 panel->SetSizer( bSizer );
276 bSizer->Fit( panel );
278 parent->AddPage( panel, wxT("Audio"), false );
281 void LauncherSetup::saveTab_Audio()
285 value = m_Audio_PlaybackDevice->GetValue();
287 if ( value.IsSameAs( wxT("<Default>") ) ) {
288 os_config_write_string("Audio", "PlaybackDevice", "");
290 os_config_write_string("Audio", "PlaybackDevice", value.c_str());
293 value = m_Audio_CaptureDevice->GetValue();
295 if ( value.IsSameAs( wxT("<Default>") ) ) {
296 os_config_write_string("Audio", "CaptureDevice", "");
298 os_config_write_string("Audio", "CaptureDevice", value.c_str());
301 os_config_write_uint("Audio", "EFX", m_Audio_EFX->IsChecked() ? 1 : 0);
303 os_config_write_uint("Audio", "LauncherSoundEnabled", m_Audio_LauncherSounds->IsChecked() ? 1 : 0);
305 Launcher* parent = (Launcher*)GetParent();
306 parent->SndEnable( m_Audio_LauncherSounds->IsChecked() );
310 void LauncherSetup::initTab_Joystick(wxNotebook *parent)
312 unsigned int checked = 0;
313 const char *conf_ptr = NULL;
314 bool joystick_enabled = false;
316 if ( !SDL_InitSubSystem(SDL_INIT_JOYSTICK) ) {
317 joystick_enabled = true;
320 wxPanel* panel = new wxPanel( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
322 wxBoxSizer* bSizer = new wxBoxSizer( wxVERTICAL );
324 wxStaticBoxSizer* sbSizer = new wxStaticBoxSizer( new wxStaticBox( panel, wxID_ANY, wxT("Joystick") ), wxVERTICAL );
327 // 'current joystick'
328 m_Joystick_Device = new wxComboBox( panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
329 sbSizer->Add( m_Joystick_Device, 0, wxALL|wxEXPAND, 5 );
331 m_Joystick_Device->Append( wxT("<Default>") );
332 m_Joystick_Device->SetSelection( 0 );
334 conf_ptr = os_config_read_string("Controls", "CurrentJoystick", NULL);
336 if (joystick_enabled) {
337 int num_sticks = SDL_NumJoysticks();
339 for (int i = 0; i < num_sticks; i++) {
340 const char *jname = SDL_JoystickNameForIndex(i);
343 m_Joystick_Device->Append(jname);
345 if ( conf_ptr && !SDL_strcasecmp(conf_ptr, jname) ) {
346 unsigned int sel = m_Joystick_Device->GetCount() - 1;
348 m_Joystick_Device->SetSelection(sel);
355 SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
358 bSizer->Add( sbSizer, 0, wxALL|wxEXPAND, 5 );
361 m_Joystick_FF = new wxCheckBox( panel, wxID_ANY, wxT("Enable Force Feedback"), wxDefaultPosition, wxDefaultSize, 0 );
362 bSizer->Add( m_Joystick_FF, 0, wxALL|wxEXPAND, 5 );
364 checked = os_config_read_uint("Controls", "EnableJoystickFF", 0);
366 m_Joystick_FF->SetValue( (checked == 1) );
369 m_Joystick_Directional = new wxCheckBox( panel, wxID_ANY, wxT("Enable directional hit effect (Force Feedback)"), wxDefaultPosition, wxDefaultSize, 0 );
370 bSizer->Add( m_Joystick_Directional, 0, wxALL|wxEXPAND, 5 );
372 checked = os_config_read_uint("Controls", "EnableHitEffect", 0);
374 m_Joystick_Directional->SetValue( (checked == 1) );
377 panel->SetSizer( bSizer );
380 bSizer->Fit( panel );
382 parent->AddPage( panel, wxT("Joystick"), false );
385 void LauncherSetup::saveTab_Joystick()
389 value = m_Joystick_Device->GetValue();
391 if ( value.IsSameAs( wxT("<Default>") ) ) {
392 os_config_write_string("Controls", "CurrentJoystick", "");
394 os_config_write_string("Controls", "CurrentJoystick", value.c_str());
397 os_config_write_uint("Controls", "EnableJoystickFF", m_Joystick_FF->IsChecked() ? 1 : 0);
398 os_config_write_uint("Controls", "EnableHitEffect", m_Joystick_Directional->IsChecked() ? 1 : 0);
401 void LauncherSetup::initTab_Speed(wxNotebook *parent)
403 unsigned int detail_lvl = 0;
405 wxPanel* panel = new wxPanel( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
407 wxBoxSizer* bSizer = new wxBoxSizer( wxVERTICAL );
410 wxStaticBoxSizer* sbSizer = new wxStaticBoxSizer( new wxStaticBox( panel, wxID_ANY, wxT("Default Detail Level") ), wxVERTICAL );
412 m_Speed_DefaultDetail = new wxComboBox( panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN );
413 sbSizer->Add( m_Speed_DefaultDetail, 0, wxALL|wxEXPAND, 5 );
415 m_Speed_DefaultDetail->Append( wxT("Low") );
416 m_Speed_DefaultDetail->Append( wxT("Medium") );
417 m_Speed_DefaultDetail->Append( wxT("High") );
418 m_Speed_DefaultDetail->Append( wxT("Very High") );
420 detail_lvl = os_config_read_uint(NULL, "ComputerSpeed", 2);
422 if (detail_lvl > 3) {
426 m_Speed_DefaultDetail->SetSelection(detail_lvl);
429 bSizer->Add( sbSizer, 0, wxALL|wxEXPAND, 5 );
431 panel->SetSizer( bSizer );
434 bSizer->Fit( panel );
436 parent->AddPage( panel, wxT("Speed"), false );
439 void LauncherSetup::saveTab_Speed()
443 sel = m_Speed_DefaultDetail->GetSelection();
445 if ( (sel < 0) || (sel > 3) ) {
449 os_config_write_uint(NULL, "ComputerSpeed", sel);
452 void LauncherSetup::initTab_Network(wxNotebook* parent)
454 const char *conf_ptr = NULL;
455 unsigned int val = 0;
457 wxPanel* panel = new wxPanel( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
459 wxBoxSizer* bSizer = new wxBoxSizer( wxVERTICAL );
462 const wxString conn_types[] = { wxT("None"), wxT("Dialup Networking"), wxT("LAN/Direct Connection") };
463 const int num_conn_types = sizeof( conn_types ) / sizeof( wxString );
464 m_Network_Connection = new wxRadioBox( panel, wxID_ANY, wxT("Internet Connection"), wxDefaultPosition, wxDefaultSize, num_conn_types, conn_types, 1, wxRA_SPECIFY_COLS );
465 bSizer->Add( m_Network_Connection, 0, wxALL|wxEXPAND, 5 );
467 conf_ptr = os_config_read_string("Network", "NetworkConnection", NULL);
471 if ( !SDL_strcasecmp(conf_ptr, "dialup") ) {
473 } else if ( !SDL_strcasecmp(conf_ptr, "lan") ) {
478 m_Network_Connection->SetSelection(val);
480 // 'connection speed'
481 const wxString speed_types[] = { wxT("None Specified"), wxT("Slower than 56K Modem"), wxT("56K Modem"), wxT("Single Channel ISDN"), wxT("Dual Channel ISDN, Cable Modems"), wxT("T1, ADSL, T3, etc.") };
482 const int num_speed_types = sizeof( speed_types ) / sizeof( wxString );
483 m_Network_Speed = new wxRadioBox( panel, wxID_ANY, wxT("Connection Speed"), wxDefaultPosition, wxDefaultSize, num_speed_types, speed_types, 1, wxRA_SPECIFY_COLS );
484 bSizer->Add( m_Network_Speed, 0, wxALL|wxEXPAND, 5 );
486 conf_ptr = os_config_read_string("Network", "ConnectionSpeed", NULL);
490 if ( !SDL_strcasecmp(conf_ptr, "Slow") ) {
492 } else if ( !SDL_strcasecmp(conf_ptr, "56K") ) {
494 } else if ( !SDL_strcasecmp(conf_ptr, "ISDN") ) {
496 } else if ( !SDL_strcasecmp(conf_ptr, "Cable") ) {
498 } else if ( !SDL_strcasecmp(conf_ptr, "Fast") ) {
503 m_Network_Speed->SetSelection(val);
505 wxStaticBoxSizer* sbSizer = new wxStaticBoxSizer( new wxStaticBox( panel, wxID_ANY, wxT("Misc") ), wxVERTICAL );
507 wxFlexGridSizer* fgSizer_port = new wxFlexGridSizer( 0, 2, 0, 0 );
508 fgSizer_port->SetFlexibleDirection( wxBOTH );
509 fgSizer_port->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
512 wxStaticText* txt_port = new wxStaticText( panel, wxID_ANY, wxT("Force local port"), wxDefaultPosition, wxDefaultSize, 0 );
513 txt_port->Wrap( -1 );
514 fgSizer_port->Add( txt_port, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
516 m_Network_Port = new wxTextCtrl( panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
517 fgSizer_port->Add( m_Network_Port, 0, wxALL|wxEXPAND, 5 );
520 wxIntegerValidator<unsigned short> vald( &m_port_validate );
521 vald.SetStyle(wxNUM_VAL_ZERO_AS_BLANK);
523 m_Network_Port->SetValidator(vald);
525 sbSizer->Add( fgSizer_port, 1, wxEXPAND, 5 );
527 val = os_config_read_uint("Network", "ForcePort", 0);
530 wxString sval = wxString::Format( wxT("%u"), val );
532 m_Network_Port->SetValue(sval);
536 bSizer->Add( sbSizer, 0, wxALL|wxEXPAND, 5 );
538 panel->SetSizer( bSizer );
541 bSizer->Fit( panel );
543 parent->AddPage( panel, wxT("Network"), false );
546 void LauncherSetup::saveTab_Network()
548 const char *conn_types[] = { "none", "dialup", "lan" };
549 const char *conn_speed[] = { "none", "Slow", "56K", "ISDN", "Cable", "Fast" };
553 sel = m_Network_Connection->GetSelection();
555 if ( (sel < 0) || (sel > 2) ) {
559 os_config_write_string("Network", "NetworkConnection", conn_types[sel]);
561 sel = m_Network_Speed->GetSelection();
563 if ( (sel < 0) || (sel > 5) ) {
567 os_config_write_string("Network", "ConnectionSpeed", conn_speed[sel]);
569 if ( !m_Network_Port->GetValue().IsEmpty() ) {
570 m_Network_Port->GetValue().ToLong(&port);
571 wxASSERT( port <= USHRT_MAX );
574 os_config_write_uint("Network", "ForcePort", (unsigned int)port);
577 void LauncherSetup::initTab_PXO(wxNotebook *parent)
579 const char *conf_ptr = NULL;
580 unsigned int val = 0;
582 wxPanel* panel = new wxPanel( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
584 wxBoxSizer* bSizer = new wxBoxSizer( wxVERTICAL );
587 wxStaticBoxSizer* sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( panel, wxID_ANY, wxT("PXO Account") ), wxVERTICAL );
589 wxBoxSizer*bSizer3 = new wxBoxSizer( wxVERTICAL );
591 wxFlexGridSizer* fgSizer2 = new wxFlexGridSizer( 0, 2, 0, 0 );
592 fgSizer2->SetFlexibleDirection( wxBOTH );
593 fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
596 wxStaticText* m_staticText3 = new wxStaticText( panel, wxID_ANY, wxT("Login"), wxDefaultPosition, wxDefaultSize, 0 );
597 m_staticText3->Wrap( -1 );
598 fgSizer2->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
600 m_PXO_Login = new wxTextCtrl( panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
601 m_PXO_Login->SetMaxLength( 31 );
603 fgSizer2->Add( m_PXO_Login, 0, wxALL|wxEXPAND, 5 );
605 conf_ptr = os_config_read_string("PXO", "Login", NULL);
608 m_PXO_Login->SetValue(conf_ptr);
612 wxStaticText* m_staticText4 = new wxStaticText( panel, wxID_ANY, wxT("Password"), wxDefaultPosition, wxDefaultSize, 0 );
613 m_staticText4->Wrap( -1 );
614 fgSizer2->Add( m_staticText4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
616 m_PXO_Password = new wxTextCtrl( panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
617 m_PXO_Password->SetMaxLength( 16 );
619 fgSizer2->Add( m_PXO_Password, 0, wxALL|wxEXPAND, 5 );
620 bSizer3->Add( fgSizer2, 1, wxEXPAND, 5 );
622 conf_ptr = os_config_read_string("PXO", "Password", NULL);
625 m_PXO_Password->SetValue(conf_ptr);
629 wxBoxSizer* bSizer4 = new wxBoxSizer( wxHORIZONTAL );
631 m_SkipVerify = new wxCheckBox( panel, wxID_ANY, wxT("Skip version check"), wxDefaultPosition, wxDefaultSize, 0 );
632 bSizer4->Add( m_SkipVerify, 0, wxALL, 5 );
634 val = os_config_read_uint("PXO", "SkipVerify", 0);
636 m_SkipVerify->SetValue( val ? true : false );
638 m_PXOBanners = new wxCheckBox( panel, wxID_ANY, wxT("PXO Banners"), wxDefaultPosition, wxDefaultSize, 0 );
639 bSizer4->Add( m_PXOBanners, 0, wxALL, 5 );
641 val = os_config_read_uint("PXO", "PXOBanners", 1);
643 m_PXOBanners->SetValue( val ? true : false );
645 bSizer3->Add( bSizer4, 0, wxALL|wxEXPAND, 5 );
646 sbSizer1->Add( bSizer3, 0, wxALL|wxEXPAND, 5 );
649 bSizer->Add( sbSizer1, 0, wxALL|wxEXPAND, 5 );
651 panel->SetSizer( bSizer );
654 bSizer->Fit( panel );
656 parent->AddPage( panel, wxT("PXO"), false );
659 void LauncherSetup::saveTab_PXO()
662 unsigned int val = 0;
664 value = m_PXO_Login->GetValue();
666 os_config_write_string("PXO", "Login", value.c_str());
668 value = m_PXO_Password->GetValue();
670 os_config_write_string("PXO", "Password", value.c_str());
672 val = m_SkipVerify->GetValue() ? 1 : 0;
674 os_config_write_uint("PXO", "SkipVerify", val);
676 val = m_PXOBanners->GetValue() ? 1 : 0;
678 os_config_write_uint("PXO", "PXOBanners", val);
681 void LauncherSetup::save_settings()
683 const char *ptr = NULL;
686 ptr = os_config_read_string(NULL, "Language", NULL);
689 os_config_write_string(NULL, "Language", ptr);
691 os_config_write_string(NULL, "Language", "");
694 ptr = os_config_read_string(NULL, "LastPlayer", NULL);
697 os_config_write_string(NULL, "LastPlayer", ptr);
699 os_config_write_string(NULL, "LastPlayer", "");
702 ptr = os_config_read_string(NULL, "ExtrasPath", NULL);
705 os_config_write_string(NULL, "ExtrasPath", ptr);
707 os_config_write_string(NULL, "ExtrasPath", "");
710 os_config_write_uint(NULL, "StraightToSetup", 0);
720 // 'Controls' section
730 void LauncherSetup::onOk(wxCommandEvent& WXUNUSED(event))
732 if ( Validate() && TransferDataFromWindow() ) {
738 SetReturnCode(wxID_OK);
744 void LauncherSetup::onToggleMSAA(wxCommandEvent& event)
746 if ( event.IsChecked() ) {
747 m_Video_MSAASamples->Enable();
749 if (m_Video_MSAASamples->GetSelection() == wxNOT_FOUND) {
750 m_Video_MSAASamples->SetSelection(0);
753 m_Video_MSAASamples->Disable();