diff --git a/src/gtk/joypadconfig.cpp b/src/gtk/joypadconfig.cpp index a11f9315..ca5a65b0 100644 --- a/src/gtk/joypadconfig.cpp +++ b/src/gtk/joypadconfig.cpp @@ -27,18 +27,20 @@ namespace VBA const JoypadConfigDialog::SJoypadKey JoypadConfigDialog::m_astKeys[] = { - { KEY_UP, "Up :" }, - { KEY_DOWN, "Down :" }, - { KEY_LEFT, "Left :" }, - { KEY_RIGHT, "Right :" }, - { KEY_BUTTON_A, "Button A :" }, - { KEY_BUTTON_B, "Button B :" }, - { KEY_BUTTON_L, "Button L :" }, - { KEY_BUTTON_R, "Button R :" }, - { KEY_BUTTON_SELECT, "Select :" }, - { KEY_BUTTON_START, "Start :" }, - { KEY_BUTTON_SPEED, "Speed :" }, - { KEY_BUTTON_CAPTURE, "Capture :" } + { KEY_UP, "Up :" }, + { KEY_DOWN, "Down :" }, + { KEY_LEFT, "Left :" }, + { KEY_RIGHT, "Right :" }, + { KEY_BUTTON_A, "Button A :" }, + { KEY_BUTTON_B, "Button B :" }, + { KEY_BUTTON_L, "Button L :" }, + { KEY_BUTTON_R, "Button R :" }, + { KEY_BUTTON_SELECT, "Select :" }, + { KEY_BUTTON_START, "Start :" }, + { KEY_BUTTON_SPEED, "Speed :" }, + { KEY_BUTTON_CAPTURE, "Capture :" }, + { KEY_BUTTON_AUTO_A, "Autofire A :" }, + { KEY_BUTTON_AUTO_B, "Autofire B :" } }; JoypadConfigDialog::JoypadConfigDialog() : @@ -93,6 +95,7 @@ JoypadConfigDialog::JoypadConfigDialog() : &JoypadConfigDialog::vOnDefaultJoypadSelect) ); m_oTitleCombo.signal_changed().connect(sigc::mem_fun(*this, &JoypadConfigDialog::vOnJoypadSelect) ); + m_oTitleCombo.set_active_text("1"); show_all_children(); @@ -218,26 +221,26 @@ bool JoypadConfigDialog::bOnConfigIdle() SDL_Event event; while(SDL_PollEvent(&event)) { - switch(event.type) - { - case SDL_JOYAXISMOTION: - if (abs(event.jaxis.value) < 16384) continue; - if (event.jaxis.which != m_oPreviousEvent.jaxis.which || - event.jaxis.axis != m_oPreviousEvent.jaxis.axis || - (event.jaxis.value > 0 && m_oPreviousEvent.jaxis.value < 0) || - (event.jaxis.value < 0 && m_oPreviousEvent.jaxis.value > 0)) - { - vOnInputEvent(event); - m_oPreviousEvent = event; - } - vEmptyEventQueue(); - break; - case SDL_JOYHATMOTION: - case SDL_JOYBUTTONUP: + switch(event.type) + { + case SDL_JOYAXISMOTION: + if (abs(event.jaxis.value) < 16384) continue; + if (event.jaxis.which != m_oPreviousEvent.jaxis.which + || event.jaxis.axis != m_oPreviousEvent.jaxis.axis + || (event.jaxis.value > 0 && m_oPreviousEvent.jaxis.value < 0) + || (event.jaxis.value < 0 && m_oPreviousEvent.jaxis.value > 0)) + { vOnInputEvent(event); - vEmptyEventQueue(); - break; - } + m_oPreviousEvent = event; + } + vEmptyEventQueue(); + break; + case SDL_JOYHATMOTION: + case SDL_JOYBUTTONUP: + vOnInputEvent(event); + vEmptyEventQueue(); + break; + } } return true; diff --git a/src/gtk/vba.glade b/src/gtk/vba.glade index 39f56f0e..721a413d 100644 --- a/src/gtk/vba.glade +++ b/src/gtk/vba.glade @@ -1031,64 +1031,10 @@ - + True - _Joypad + _Joypads ... True - - - - - True - _Configure ... - True - - - - - True - _Autofire - True - - - - - True - _A - True - - - - - - True - _B - True - - - - - - True - _L - True - - - - - - True - _R - True - - - - - - - - - diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 8957ea11..3281d9dd 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -70,7 +70,9 @@ const Window::SJoypadKey Window::m_astJoypad[] = { "speed", KEY_BUTTON_SPEED }, { "capture", KEY_BUTTON_CAPTURE }, { "speed", KEY_BUTTON_SPEED }, - { "capture", KEY_BUTTON_CAPTURE } + { "capture", KEY_BUTTON_CAPTURE }, + { "autoA", KEY_BUTTON_AUTO_A }, + { "autoB", KEY_BUTTON_AUTO_B } }; Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr & _poXml) : @@ -618,31 +620,6 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr & _poXml) : EPad eDefaultJoypad = (EPad)m_poInputConfig->oGetKey("active_joypad"); inputSetDefaultJoypad(eDefaultJoypad); - // Autofire menu - // - struct - { - const char * m_csName; - const char * m_csKey; - const EKey m_eKey; - } - astAutofire[] = - { - { "AutofireA", "autofire_A", KEY_BUTTON_A }, - { "AutofireB", "autofire_B", KEY_BUTTON_B }, - { "AutofireL", "autofire_L", KEY_BUTTON_L }, - { "AutofireR", "autofire_R", KEY_BUTTON_R } - }; - for (guint i = 0; i < G_N_ELEMENTS(astAutofire); i++) - { - poCMI = dynamic_cast(_poXml->get_widget(astAutofire[i].m_csName)); - poCMI->set_active(m_poInputConfig->oGetKey(astAutofire[i].m_csKey)); - vOnAutofireToggled(poCMI, astAutofire[i].m_eKey); - poCMI->signal_toggled().connect(sigc::bind( - sigc::mem_fun(*this, &Window::vOnAutofireToggled), - poCMI, astAutofire[i].m_eKey)); - } - // Fullscreen menu // poMI = dynamic_cast(_poXml->get_widget("VideoFullscreen")); @@ -767,7 +744,7 @@ void Window::vInitScreenArea(EVideoOutput _eVideoOutput) } catch (std::exception e) { - fprintf(stderr, "Unable to initialise output, falling back to Cairo\n"); + fprintf(stderr, "Unable to initialize output, falling back to Cairo\n"); m_poScreenArea = Gtk::manage(new ScreenAreaCairo(m_iScreenWidth, m_iScreenHeight)); } diff --git a/src/gtk/window.h b/src/gtk/window.h index 63267bfa..bb75b0e7 100644 --- a/src/gtk/window.h +++ b/src/gtk/window.h @@ -163,7 +163,6 @@ protected: virtual void vOnFilter2xToggled(Gtk::CheckMenuItem * _poCMI, int _iFilter2x); virtual void vOnFilterIBToggled(Gtk::CheckMenuItem * _poCMI, int _iFilterIB); virtual void vOnJoypadConfigure(); - virtual void vOnAutofireToggled(Gtk::CheckMenuItem * _poCMI, EKey _eKey); virtual void vOnHelpAbout(); virtual bool bOnEmuIdle(); diff --git a/src/gtk/windowcallbacks.cpp b/src/gtk/windowcallbacks.cpp index 94aadb97..9b4b4666 100644 --- a/src/gtk/windowcallbacks.cpp +++ b/src/gtk/windowcallbacks.cpp @@ -645,33 +645,6 @@ void Window::vOnJoypadConfigure() m_poInputConfig->vSetKey("active_joypad", inputGetDefaultJoypad()); } -void Window::vOnAutofireToggled(Gtk::CheckMenuItem * _poCMI, EKey _eKey) -{ - if (_poCMI->get_active() == inputGetAutoFire(_eKey)) - { - inputToggleAutoFire(_eKey); - } - - std::string sKey; - if (_eKey == KEY_BUTTON_A) - { - sKey = "autofire_A"; - } - else if (_eKey == KEY_BUTTON_B) - { - sKey = "autofire_B"; - } - else if (_eKey == KEY_BUTTON_L) - { - sKey = "autofire_L"; - } - else if (_eKey == KEY_BUTTON_R) - { - sKey = "autofire_R"; - } - m_poInputConfig->vSetKey(sKey, _poCMI->get_active()); -} - void Window::vOnHelpAbout() { Gtk::AboutDialog oAboutDialog;