From ee44841002db3b2475ce02619d141aee6631242b Mon Sep 17 00:00:00 2001 From: Shamus Hammons Date: Mon, 8 Aug 2011 23:11:41 +0000 Subject: [PATCH] Quick fix to make controller #1 work properly again. Controller #2 is disabled. --- src/gui/help.cpp | 4 ++-- src/gui/mainwin.cpp | 18 +++++++++++------- src/joystick.cpp | 3 +++ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/gui/help.cpp b/src/gui/help.cpp index cb4f2eb..8bafe98 100644 --- a/src/gui/help.cpp +++ b/src/gui/help.cpp @@ -25,7 +25,7 @@ HelpWindow::HelpWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog) resize(560, 480); layout = new QVBoxLayout(); - layout->setSizeConstraint(QLayout::SetFixedSize); +// layout->setSizeConstraint(QLayout::SetFixedSize); setLayout(layout); // image = new QLabel(); @@ -37,7 +37,7 @@ HelpWindow::HelpWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog) QString s;// = QString(""); s.append(tr( "

Virtual Jaguar Documentation

" - "

" + "
" "Coming soon!" )); text = new QTextBrowser; diff --git a/src/gui/mainwin.cpp b/src/gui/mainwin.cpp index 4841190..41c1a0e 100644 --- a/src/gui/mainwin.cpp +++ b/src/gui/mainwin.cpp @@ -17,10 +17,10 @@ // - Add dbl click/enter to select in cart list, ESC to dimiss [DONE] // - Autoscan/autoload all available BIOS from 'software' folder [DONE] // - Add 1 key jumping in cartridge list (press 'R', jumps to carts starting with 'R', etc) [DONE] +// - Controller configuration [DONE] // // STILL TO BE DONE: // -// - Controller configuration // - Remove SDL dependencies (sound, mainly) from Jaguar core lib // - Fix inconsistency with trailing slashes in paths (eeproms needs one, software doesn't) // @@ -325,23 +325,27 @@ void MainWin::HandleKeys(QKeyEvent * e, bool state) joypad_0_buttons[BUTTON_U] = 0; if (e->key() == (int)vjs.p2KeyBindings[BUTTON_L] && joypad_1_buttons[BUTTON_R]) - joypad_0_buttons[BUTTON_R] = 0; + joypad_1_buttons[BUTTON_R] = 0; if (e->key() == (int)vjs.p2KeyBindings[BUTTON_R] && joypad_1_buttons[BUTTON_L]) - joypad_0_buttons[BUTTON_L] = 0; + joypad_1_buttons[BUTTON_L] = 0; if (e->key() == (int)vjs.p2KeyBindings[BUTTON_U] && joypad_1_buttons[BUTTON_D]) - joypad_0_buttons[BUTTON_D] = 0; + joypad_1_buttons[BUTTON_D] = 0; if (e->key() == (int)vjs.p2KeyBindings[BUTTON_D] && joypad_1_buttons[BUTTON_U]) - joypad_0_buttons[BUTTON_U] = 0; + joypad_1_buttons[BUTTON_U] = 0; #endif // No bad combos exist, let's stuff the emulator key buffers...! for(int i=BUTTON_FIRST; i<=BUTTON_LAST; i++) { if (e->key() == (int)vjs.p1KeyBindings[i]) - joypad_0_buttons[i] = (uint8)state; +// joypad_0_buttons[i] = (uint8)state; + joypad_0_buttons[i] = (state ? 0x01 : 0x00); +// Pad #2 is screwing up pad #1. Prolly a problem in joystick.cpp... +// So let's try to fix it there. :-P if (e->key() == (int)vjs.p2KeyBindings[i]) - joypad_1_buttons[i] = (uint8)state; +// joypad_1_buttons[i] = (uint8)state; + joypad_1_buttons[i] = (state ? 0x01 : 0x00); } } diff --git a/src/joystick.cpp b/src/joystick.cpp index fd8977f..894301d 100644 --- a/src/joystick.cpp +++ b/src/joystick.cpp @@ -325,6 +325,9 @@ void JoystickDone(void) uint8 JoystickReadByte(uint32 offset) { +// For now, until we can fix the 2nd controller... :-P +memset(joypad_1_buttons, 0, 21); + #warning "No bounds checking done in JoystickReadByte!" // extern bool hardwareTypeNTSC; offset &= 0x03; -- 2.37.2