GTK : Reenabled joypad switching.

This commit is contained in:
bgk 2008-09-03 20:26:18 +00:00
parent 2491d71bc7
commit a3afc456bf
5 changed files with 22 additions and 11 deletions

View File

@ -712,22 +712,22 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
poMI->signal_activate().connect(sigc::bind( poMI->signal_activate().connect(sigc::bind(
sigc::mem_fun(*this, &Window::vOnJoypadConfigure), 4)); sigc::mem_fun(*this, &Window::vOnJoypadConfigure), 4));
/*int iDefaultJoypad = m_poInputConfig->oGetKey<int>("active_joypad"); int iDefaultJoypad = m_poInputConfig->oGetKey<int>("active_joypad");
for (int i = m_iJoypadMin; i <= m_iJoypadMax; i++) for (int i = m_iJoypadMin; i <= m_iJoypadMax; i++)
{ {
char csName[20]; char csName[20];
snprintf(csName, sizeof(csName), "Joypad%d", i); snprintf(csName, sizeof(csName), "Joypad%d", i + 1);
poCMI = dynamic_cast<Gtk::CheckMenuItem *>(_poXml->get_widget(csName)); poCMI = dynamic_cast<Gtk::CheckMenuItem *>(_poXml->get_widget(csName));
if (i == iDefaultJoypad) if (i == iDefaultJoypad)
{ {
poCMI->set_active(); poCMI->set_active();
vOnJoypadToggled(poCMI, iDefaultJoypad); vOnJoypadToggled(poCMI, (EPad)iDefaultJoypad);
} }
poCMI->signal_toggled().connect(sigc::bind( poCMI->signal_toggled().connect(sigc::bind(
sigc::mem_fun(*this, &Window::vOnJoypadToggled), sigc::mem_fun(*this, &Window::vOnJoypadToggled),
poCMI, i)); poCMI, (EPad)i));
}*/ }
// Autofire menu // Autofire menu
// //

View File

@ -165,7 +165,7 @@ protected:
virtual void vOnFilter2xToggled(Gtk::CheckMenuItem * _poCMI, int _iFilter2x); virtual void vOnFilter2xToggled(Gtk::CheckMenuItem * _poCMI, int _iFilter2x);
virtual void vOnFilterIBToggled(Gtk::CheckMenuItem * _poCMI, int _iFilterIB); virtual void vOnFilterIBToggled(Gtk::CheckMenuItem * _poCMI, int _iFilterIB);
virtual void vOnJoypadConfigure(int _iJoypad); virtual void vOnJoypadConfigure(int _iJoypad);
virtual void vOnJoypadToggled(Gtk::CheckMenuItem * _poCMI, int _iJoypad); virtual void vOnJoypadToggled(Gtk::CheckMenuItem * _poCMI, EPad _eJoypad);
virtual void vOnAutofireToggled(Gtk::CheckMenuItem * _poCMI, u32 _uiKeyFlag); virtual void vOnAutofireToggled(Gtk::CheckMenuItem * _poCMI, u32 _uiKeyFlag);
#ifndef NO_DEBUGGER #ifndef NO_DEBUGGER
virtual void vOnGDBWait(); virtual void vOnGDBWait();

View File

@ -881,16 +881,16 @@ void Window::vOnJoypadConfigure(int _iJoypad)
delete poDialog; delete poDialog;
} }
void Window::vOnJoypadToggled(Gtk::CheckMenuItem * _poCMI, int _iJoypad) void Window::vOnJoypadToggled(Gtk::CheckMenuItem * _poCMI, EPad _eJoypad)
{ {
/* if (! _poCMI->get_active()) if (! _poCMI->get_active())
{ {
return; return;
} }
m_oKeymap = m_oJoypads[_iJoypad - 1].oCreateKeymap(); inputSetDefaultJoypad(_eJoypad);
m_poInputConfig->vSetKey("active_joypad", _iJoypad);*/ m_poInputConfig->vSetKey("active_joypad", _eJoypad);
} }
void Window::vOnAutofireToggled(Gtk::CheckMenuItem * _poCMI, u32 _uiKeyFlag) void Window::vOnAutofireToggled(Gtk::CheckMenuItem * _poCMI, u32 _uiKeyFlag)

View File

@ -47,7 +47,7 @@ static bool sdlMotionButtons[4] = { false, false, false, false };
static int sdlNumDevices = 0; static int sdlNumDevices = 0;
static SDL_Joystick **sdlDevices = NULL; static SDL_Joystick **sdlDevices = NULL;
static int sdlDefaultJoypad = 0; static EPad sdlDefaultJoypad = PAD_MAIN;
static int autoFire = 0; static int autoFire = 0;
static bool autoFireToggle = false; static bool autoFireToggle = false;
@ -568,3 +568,8 @@ int inputGetSensorY()
{ {
return sensorY; return sensorY;
} }
void inputSetDefaultJoypad(EPad pad)
{
sdlDefaultJoypad = pad;
}

View File

@ -121,4 +121,10 @@ int inputGetSensorX();
*/ */
int inputGetSensorY(); int inputGetSensorY();
/**
* Set which joypad configuration use when the core doesn't ask for a specific
* pad
*/
void inputSetDefaultJoypad(EPad pad);
#endif // VBAM_SDL_INPUT_H #endif // VBAM_SDL_INPUT_H