From 0c6ed444bbb07e5cc0513a7d3075fb24d06e61eb Mon Sep 17 00:00:00 2001 From: Shamus Hammons Date: Thu, 21 Jul 2011 17:53:35 +0000 Subject: [PATCH] Hooked up the UI/frontend controller #2 to the Jaguar core, final fixes to the controller configuration dialog. --- src/gui/configdialog.cpp | 21 ++-- src/gui/controllertab.cpp | 124 ++-------------------- src/gui/controllertab.h | 13 +-- src/gui/controllerwidget.cpp | 193 ++++++++++++++++++++++++++++++++++- src/gui/controllerwidget.h | 27 ++++- src/gui/keygrabber.cpp | 10 +- src/gui/keygrabber.h | 18 +--- src/gui/mainwin.cpp | 12 +++ src/joystick.cpp | 1 + 9 files changed, 265 insertions(+), 154 deletions(-) diff --git a/src/gui/configdialog.cpp b/src/gui/configdialog.cpp index 4107e6b..ab12b13 100644 --- a/src/gui/configdialog.cpp +++ b/src/gui/configdialog.cpp @@ -14,9 +14,10 @@ #include "configdialog.h" -#include "generaltab.h" -#include "controllertab.h" #include "alpinetab.h" +#include "controllertab.h" +#include "controllerwidget.h" +#include "generaltab.h" #include "settings.h" @@ -50,8 +51,8 @@ ConfigDialog::ConfigDialog(QWidget * parent/*= 0*/): QDialog(parent) setWindowTitle(tr("Virtual Jaguar Settings")); LoadDialogFromSettings(); - controllerTab1->UpdateLabel(); // Now it's safe to do this... ;-) - controllerTab2->UpdateLabel(); // Now it's safe to do this... ;-) +// controllerTab1->UpdateLabel(); // Now it's safe to do this... ;-) +// controllerTab2->UpdateLabel(); // Now it's safe to do this... ;-) } ConfigDialog::~ConfigDialog() @@ -78,8 +79,10 @@ void ConfigDialog::LoadDialogFromSettings(void) for(int i=0; i<21; i++) { - controllerTab1->p1Keys[i] = vjs.p1KeyBindings[i]; - controllerTab2->p1Keys[i] = vjs.p2KeyBindings[i]; +// controllerTab1->p1Keys[i] = vjs.p1KeyBindings[i]; +// controllerTab2->p1Keys[i] = vjs.p2KeyBindings[i]; + controllerTab1->controllerWidget->keys[i] = vjs.p1KeyBindings[i]; + controllerTab2->controllerWidget->keys[i] = vjs.p2KeyBindings[i]; } } @@ -103,7 +106,9 @@ void ConfigDialog::UpdateVJSettings(void) for(int i=0; i<21; i++) { - vjs.p1KeyBindings[i] = controllerTab1->p1Keys[i]; - vjs.p2KeyBindings[i] = controllerTab2->p1Keys[i]; +// vjs.p1KeyBindings[i] = controllerTab1->p1Keys[i]; +// vjs.p2KeyBindings[i] = controllerTab2->p1Keys[i]; + vjs.p1KeyBindings[i] = controllerTab1->controllerWidget->keys[i]; + vjs.p2KeyBindings[i] = controllerTab2->controllerWidget->keys[i]; } } diff --git a/src/gui/controllertab.cpp b/src/gui/controllertab.cpp index f6d8cbc..34ca155 100644 --- a/src/gui/controllertab.cpp +++ b/src/gui/controllertab.cpp @@ -15,43 +15,18 @@ #include "controllertab.h" +#include "controllerwidget.h" #include "joystick.h" #include "keygrabber.h" -#include "settings.h" -// These tables are used to convert Qt keycodes into human readable form. Note that -// a lot of these are just filler. -char ControllerTab::keyName1[96][16] = { - "Space", - "!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-", ".", "/", - "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";", "<", "=", ">", "?", - "@", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", - "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", - "[", "]", "\\", "^", "_", "`", - "$61", "$62", "$63", "$64", "$65", "$66", "$67", "$68", "$69", "$6A", "$6B", "$6C", "$6D", - "$6E", "$6F", "$70", "$71", "$72", "$73", "$74", "$75", "$76", "$77", "$78", "$79", "$7A", - "{", "|", "}", "~" -}; - -char ControllerTab::keyName2[64][16] = { - "Esc", "Tab", "BTab", "BS", "Ret", "Ent", "Ins", "Del", "Pause", "Prt", "SRq", "Clr", - "$C", "$D", "$E", "$F", "Hm", "End", "Lf", "Up", "Rt", "Dn", "PgU", "PgD", "$18", - "$19", "$1A", "$1B", "$1C", "$1D", "$1E", "$1F", "Shf", "Ctl", "Mta", "Alt", - "Cap", "Num", "ScL", "$27", "$28", "$29", "$2A", "$2B", "$2C", "$2D", "$2E", "$2F", - "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13", - "F14", "F15", "F16" -}; ControllerTab::ControllerTab(QWidget * parent/*= 0*/): QWidget(parent) { - controllerPic = new QLabel; - QImage controller(":/res/controller.png"); - controllerPic->setPixmap(QPixmap::fromImage(controller)); - - redefineAll = new QPushButton(tr("Redefine All Keys")); + controllerWidget = new ControllerWidget(this); + redefineAll = new QPushButton(tr("Define All Keys")); QVBoxLayout * layout = new QVBoxLayout; - layout->addWidget(controllerPic); + layout->addWidget(controllerWidget); layout->addWidget(redefineAll); setLayout(layout); @@ -64,15 +39,16 @@ ControllerTab::~ControllerTab() void ControllerTab::DefineAllKeys(void) { - char jagButtonName[21][10] = { "Up", "Down", "Left", "Right", - "*", "7", "4", "1", "0", "8", "5", "2", "#", "9", "6", "3", - "A", "B", "C", "Option", "Pause" }; +// char jagButtonName[21][10] = { "Up", "Down", "Left", "Right", +// "*", "7", "4", "1", "0", "8", "5", "2", "#", "9", "6", "3", +// "A", "B", "C", "Option", "Pause" }; int orderToDefine[21] = { 0, 1, 2, 3, 18, 17, 16, 20, 19, 7, 11, 15, 6, 10, 14, 5, 9, 13, 8, 4, 12 }; KeyGrabber keyGrab(this); for(int i=BUTTON_FIRST; i<=BUTTON_LAST; i++) { - keyGrab.SetText(jagButtonName[orderToDefine[i]]); +// keyGrab.SetText(jagButtonName[orderToDefine[i]]); + keyGrab.SetKeyText(orderToDefine[i]); keyGrab.exec(); int key = keyGrab.key; @@ -80,85 +56,7 @@ void ControllerTab::DefineAllKeys(void) break; // Otherwise, populate the appropriate spot in the settings & update screen... - p1Keys[orderToDefine[i]] = key; - UpdateLabel(); + controllerWidget->keys[orderToDefine[i]] = key; + controllerWidget->update(); } } - -void ControllerTab::UpdateLabel(void) -{ - QImage controller(":/res/controller.png"); - QPainter painter(&controller); - painter.setRenderHint(QPainter::Antialiasing); - - // Bump up the size of the default font... - QFont font = painter.font(); - font.setPixelSize(15); - font.setBold(true); - painter.setFont(font); -// painter.setPen(QColor(48, 255, 255, 255)); // This is R,G,B,A - painter.setPen(QColor(0, 0, 0, 255)); // This is R,G,B,A - painter.setBrush(QBrush(QColor(48, 255, 255, 255))); - - // This is hard-coded crap. It's crap-tastic! - int buttonPos[21][2] = { { 87-1, 64-5 }, { 87-1, 94 }, { 73-5, 78-2 }, { 105+3, 77-1 }, - { 125, 223 }, { 125, 200 }, { 125, 177 }, { 125, 153 }, - { 160, 223 }, { 160, 200 }, { 160, 177 }, { 160, 153 }, - { 196, 223 }, { 196, 200 }, { 196, 177 }, { 196, 153 }, - { 242, 60 }, { 225-1, 80 }, { 209-2, 104 }, { 162+2, 108-7}, { 141, 108+13 } - }; - - // First, draw black oversize line, then dot, then colored line - QPen blackPen(QColor(0, 0, 0, 255)); - blackPen.setWidth(4); - QPen colorPen(QColor(48, 255, 255, 255)); - colorPen.setWidth(2); - QLine line(QPoint(141, 100), QPoint(141, 108+5)); - - painter.setPen(blackPen); - painter.drawLine(line);//QPoint(141, 100), QPoint(141, 108+5)); - blackPen.setWidth(1); - painter.setPen(blackPen); - painter.drawEllipse(QPoint(141, 100), 4, 4); - painter.setPen(colorPen); - painter.drawLine(line);//QPoint(141, 100), QPoint(141, 108+5)); - - for(int i=BUTTON_FIRST; i<=BUTTON_LAST; i++) - { - if (p1Keys[i] < 0x80) - DrawBorderedText(painter, buttonPos[i][0] /*- 5*/, buttonPos[i][1] /*+ 5*/, - QString(keyName1[p1Keys[i] - 0x20])); - else if ((p1Keys[i] & 0xFFFFFF00) == 0x01000000) - { - DrawBorderedText(painter, buttonPos[i][0] /*- 5*/, buttonPos[i][1] /*+ 5*/, - QString(keyName2[p1Keys[i] & 0x3F])); - } - else - DrawBorderedText(painter, buttonPos[i][0] - 5, buttonPos[i][1] + 5, QString("???")); - } - - painter.end(); - controllerPic->setPixmap(QPixmap::fromImage(controller)); -} - -void ControllerTab::DrawBorderedText(QPainter & painter, int x, int y, QString text) -{ - // Text is drawn centered at (x, y) as well, using a bounding rect for the purpose. - QRect rect(0, 0, 60, 30); - painter.setPen(QColor(0, 0, 0, 255)); // This is R,G,B,A - - for(int i=-1; i<=1; i++) - { - for(int j=-1; j<=1; j++) - { -// painter.drawText(QPoint(x + i, y + j), text); - rect.moveCenter(QPoint(x + i, y + j)); - painter.drawText(rect, Qt::AlignCenter, text); - } - } - - painter.setPen(QColor(48, 255, 255, 255)); // This is R,G,B,A -// painter.drawText(QPoint(x, y), text); - rect.moveCenter(QPoint(x, y)); - painter.drawText(rect, Qt::AlignCenter, text); -} diff --git a/src/gui/controllertab.h b/src/gui/controllertab.h index 545e5bc..011eec2 100644 --- a/src/gui/controllertab.h +++ b/src/gui/controllertab.h @@ -4,6 +4,8 @@ #include #include +class ControllerWidget; + class ControllerTab: public QWidget { Q_OBJECT @@ -11,24 +13,15 @@ class ControllerTab: public QWidget public: ControllerTab(QWidget * parent = 0); ~ControllerTab(); - void UpdateLabel(void); protected slots: void DefineAllKeys(void); private: QPushButton * redefineAll; - void DrawBorderedText(QPainter &, int, int, QString); public: - uint32_t p1Keys[21]; - - private: - QLabel * controllerPic; - - // Class data - static char keyName1[96][16]; - static char keyName2[64][16]; + ControllerWidget * controllerWidget; }; #endif // __CONTROLLERTAB_H__ diff --git a/src/gui/controllerwidget.cpp b/src/gui/controllerwidget.cpp index c33a863..c5167b1 100644 --- a/src/gui/controllerwidget.cpp +++ b/src/gui/controllerwidget.cpp @@ -14,16 +14,201 @@ #include "controllerwidget.h" -//#include "joystick.h" -//#include "keygrabber.h" -//#include "settings.h" +#include "joystick.h" +#include "keygrabber.h" +// These tables are used to convert Qt keycodes into human readable form. Note that +// a lot of these are just filler. +char ControllerWidget::keyName1[96][16] = { + "Space", + "!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-", ".", "/", + "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";", "<", "=", ">", "?", + "@", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", + "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", + "[", "]", "\\", "^", "_", "`", + "$61", "$62", "$63", "$64", "$65", "$66", "$67", "$68", "$69", "$6A", "$6B", "$6C", "$6D", + "$6E", "$6F", "$70", "$71", "$72", "$73", "$74", "$75", "$76", "$77", "$78", "$79", "$7A", + "{", "|", "}", "~" +}; -ControllerWidget::ControllerWidget(QWidget * parent/*= 0*/): QWidget(parent) +char ControllerWidget::keyName2[64][16] = { + "Esc", "Tab", "BTab", "BS", "Ret", "Ent", "Ins", "Del", "Pause", "Prt", "SRq", "Clr", + "$C", "$D", "$E", "$F", "Hm", "End", "Lf", "Up", "Rt", "Dn", "PgU", "PgD", "$18", + "$19", "$1A", "$1B", "$1C", "$1D", "$1E", "$1F", "Shf", "Ctl", "Mta", "Alt", + "Cap", "Num", "ScL", "$27", "$28", "$29", "$2A", "$2B", "$2C", "$2D", "$2E", "$2F", + "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13", + "F14", "F15", "F16" +}; + +// This is hard-coded crap. It's crap-tastic! +// These are the positions to draw the button names at, ordered by the BUTTON_* sequence +// found in joystick.h. +int ControllerWidget::buttonPos[21][2] = { { 86, 59 }, { 86, 94 }, { 68, 76 }, { 108, 76 }, + { 125, 223 }, { 125, 200 }, { 125, 177 }, { 125, 153 }, + { 160, 223 }, { 160, 200 }, { 160, 177 }, { 160, 153 }, + { 196, 223 }, { 196, 200 }, { 196, 177 }, { 196, 153 }, + { 242, 60 }, { 224, 80 }, { 207, 104 }, { 164, 101 }, { 141, 108+13 } +}; + +ControllerWidget::ControllerWidget(QWidget * parent/*= 0*/): QWidget(parent), + controllerPic(":/res/controller.png"), widgetSize(controllerPic.size()), + keyToHighlight(-1), mouseDown(false) { + // Seems we have to pad this stuff, otherwise it clips on the right side + widgetSize += QSize(4, 4); + // We want to know when the mouse is moving over our widget... + setMouseTracking(true); } ControllerWidget::~ControllerWidget() { } +QSize ControllerWidget::sizeHint(void) const +{ + return widgetSize; +} + +QSizePolicy ControllerWidget::sizePolicy(void) const +{ + return QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); +} + +void ControllerWidget::paintEvent(QPaintEvent * /*event*/) +{ + QPainter painter(this); + painter.setRenderHint(QPainter::Antialiasing); + painter.drawImage(QPoint(0, 0), controllerPic); + + // Bump up the size of the default font... + QFont font = painter.font(); + font.setPixelSize(15); + font.setBold(true); + painter.setFont(font); +// painter.setPen(QColor(48, 255, 255, 255)); // This is R,G,B,A + painter.setPen(QColor(0, 0, 0, 255)); // This is R,G,B,A + painter.setBrush(QBrush(QColor(48, 255, 255, 255))); + + // First, draw black oversize line, then dot, then colored line + QPen blackPen(QColor(0, 0, 0, 255)); + blackPen.setWidth(4); + QPen colorPen(QColor(48, 255, 255, 255)); + colorPen.setWidth(2); + QLine line(QPoint(141, 100), QPoint(141, 108+5)); + + painter.setPen(blackPen); + painter.drawLine(line); + blackPen.setWidth(1); + painter.setPen(blackPen); + painter.drawEllipse(QPoint(141, 100), 4, 4); + painter.setPen(colorPen); + painter.drawLine(line); + + for(int i=BUTTON_FIRST; i<=BUTTON_LAST; i++) + { + if (keyToHighlight == i) + { + painter.setPen(QColor(255, 48, 255, 255)); // This is R,G,B,A + font.setPixelSize(mouseDown ? 15 : 18); + painter.setFont(font); + } + else + { + painter.setPen(QColor(48, 255, 255, 255)); // This is R,G,B,A + font.setPixelSize(15); + painter.setFont(font); + } + + if (keys[i] < 0x80) + DrawBorderedText(painter, buttonPos[i][0], buttonPos[i][1], + QString(keyName1[keys[i] - 0x20])); + else if ((keys[i] & 0xFFFFFF00) == 0x01000000) + { + DrawBorderedText(painter, buttonPos[i][0], buttonPos[i][1], + QString(keyName2[keys[i] & 0x3F])); + } + else + DrawBorderedText(painter, buttonPos[i][0], buttonPos[i][1], QString("???")); + } +} + +void ControllerWidget::mousePressEvent(QMouseEvent * event) +{ + mouseDown = true; + update(); +} + +void ControllerWidget::mouseReleaseEvent(QMouseEvent * event) +{ + mouseDown = false; + // Spawning the keygrabber causes leaveEvent() to be called, so we need to save this + int keyToHighlightSave = keyToHighlight; + + KeyGrabber keyGrab(this); + keyGrab.SetKeyText(keyToHighlightSave); + keyGrab.exec(); + int key = keyGrab.key; + + if (key != Qt::Key_Escape) + keys[keyToHighlightSave] = key; + + keyToHighlight = keyToHighlightSave; + update(); +} + +void ControllerWidget::mouseMoveEvent(QMouseEvent * event) +{ + if (mouseDown) + return; + + // Save the current closest item + int keyToHighlightOld = keyToHighlight; + // Set up closest distance (this should be large enough) +// uint32_t closestX = 100000, closestY = 100000; + double closest = 1e9; + + for(int i=BUTTON_FIRST; i<=BUTTON_LAST; i++) + { + // We loop through the button text positions, to see which one is closest. + double distX = (double)(event->x() - buttonPos[i][0]); + double distY = (double)(event->y() - buttonPos[i][1]); + double currentDistance = sqrt((distX * distX) + (distY * distY)); + + if (currentDistance < closest) + { + closest = currentDistance; + keyToHighlight = i; + } + } + + if (keyToHighlightOld != keyToHighlight) + update(); +} + +void ControllerWidget::leaveEvent(QEvent * /*event*/) +{ + keyToHighlight = -1; +// mouseDown = false; + update(); +} + +void ControllerWidget::DrawBorderedText(QPainter & painter, int x, int y, QString text) +{ + // Text is drawn centered at (x, y) as well, using a bounding rect for the purpose. + QRect rect(0, 0, 60, 30); + QPen oldPen = painter.pen(); + painter.setPen(QColor(0, 0, 0, 255)); // This is R,G,B,A + + for(int i=-1; i<=1; i++) + { + for(int j=-1; j<=1; j++) + { + rect.moveCenter(QPoint(x + i, y + j)); + painter.drawText(rect, Qt::AlignCenter, text); + } + } + + painter.setPen(oldPen); + rect.moveCenter(QPoint(x, y)); + painter.drawText(rect, Qt::AlignCenter, text); +} diff --git a/src/gui/controllerwidget.h b/src/gui/controllerwidget.h index 09dae52..cf42469 100644 --- a/src/gui/controllerwidget.h +++ b/src/gui/controllerwidget.h @@ -2,6 +2,7 @@ #define __CONTROLLERWIDGET_H__ #include +#include class ControllerWidget: public QWidget { @@ -10,8 +11,32 @@ class ControllerWidget: public QWidget public: ControllerWidget(QWidget * parent = 0); ~ControllerWidget(); + QSize sizeHint(void) const; + QSizePolicy sizePolicy(void) const; - //need paint, mousemove, mousedown, mouseup, etc + protected: + void paintEvent(QPaintEvent *); + void mousePressEvent(QMouseEvent *); + void mouseReleaseEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + void leaveEvent(QEvent *); + + private: + void DrawBorderedText(QPainter &, int, int, QString); + + public: + uint32_t keys[21]; + + private: + QImage controllerPic; + QSize widgetSize; + int keyToHighlight; + bool mouseDown; + + // Class data + static char keyName1[96][16]; + static char keyName2[64][16]; + static int buttonPos[21][2]; }; #endif // __CONTROLLERWIDGET_H__ diff --git a/src/gui/keygrabber.cpp b/src/gui/keygrabber.cpp index 371c619..0bea66f 100644 --- a/src/gui/keygrabber.cpp +++ b/src/gui/keygrabber.cpp @@ -27,9 +27,15 @@ KeyGrabber::~KeyGrabber() { } -void KeyGrabber::SetText(QString keyText) +//void KeyGrabber::SetText(QString keyText) +void KeyGrabber::SetKeyText(int keyNum) { - QString text = QString(tr("Press key for \"%1\"
(ESC to cancel)")).arg(keyText); + char jagButtonName[21][10] = { "Up", "Down", "Left", "Right", + "*", "7", "4", "1", "0", "8", "5", "2", "#", "9", "6", "3", + "A", "B", "C", "Option", "Pause" }; + + QString text = QString(tr("Press key for \"%1\"
(ESC to cancel)")) + .arg(QString(jagButtonName[keyNum])); label->setText(text); } diff --git a/src/gui/keygrabber.h b/src/gui/keygrabber.h index 481debb..6ea19d2 100644 --- a/src/gui/keygrabber.h +++ b/src/gui/keygrabber.h @@ -10,10 +10,6 @@ #include -//class GeneralTab; -//class ControllerTab; -//class AlpineTab; - class KeyGrabber: public QDialog { Q_OBJECT @@ -21,26 +17,16 @@ class KeyGrabber: public QDialog public: KeyGrabber(QWidget * parent = 0); ~KeyGrabber(); -// void UpdateVJSettings(void); - void SetText(QString); -// int GetKeyGrabbed(void); + void SetKeyText(int); protected: void keyPressEvent(QKeyEvent *); -// private: -// void LoadDialogFromSettings(void); - - private: -// QTabWidget * tabWidget; -// QDialogButtonBox * buttonBox; +private: QLabel * label; public: int key; -// GeneralTab * generalTab; -// ControllerTab * controllerTab; -// AlpineTab * alpineTab; }; #endif // __KEYGRABBER_H__ diff --git a/src/gui/mainwin.cpp b/src/gui/mainwin.cpp index 5794f2b..892fb1f 100644 --- a/src/gui/mainwin.cpp +++ b/src/gui/mainwin.cpp @@ -316,6 +316,15 @@ void MainWin::HandleKeys(QKeyEvent * e, bool state) joypad_0_buttons[BUTTON_D] = 0; if (e->key() == (int)vjs.p1KeyBindings[BUTTON_D] && joypad_0_buttons[BUTTON_U]) 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; + if (e->key() == (int)vjs.p2KeyBindings[BUTTON_R] && joypad_1_buttons[BUTTON_L]) + joypad_0_buttons[BUTTON_L] = 0; + if (e->key() == (int)vjs.p2KeyBindings[BUTTON_U] && joypad_1_buttons[BUTTON_D]) + joypad_0_buttons[BUTTON_D] = 0; + if (e->key() == (int)vjs.p2KeyBindings[BUTTON_D] && joypad_1_buttons[BUTTON_U]) + joypad_0_buttons[BUTTON_U] = 0; #endif // No bad combos exist, let's stuff the emulator key buffers...! @@ -323,6 +332,9 @@ void MainWin::HandleKeys(QKeyEvent * e, bool state) { if (e->key() == (int)vjs.p1KeyBindings[i]) joypad_0_buttons[i] = (uint8)state; + + if (e->key() == (int)vjs.p2KeyBindings[i]) + joypad_1_buttons[i] = (uint8)state; } } diff --git a/src/joystick.cpp b/src/joystick.cpp index dc498d0..fd8977f 100644 --- a/src/joystick.cpp +++ b/src/joystick.cpp @@ -377,6 +377,7 @@ uint8 JoystickReadByte(uint32 offset) //unused int pad1Index = (joystick_ram[1] >> 4) & 0x0F; //WTF is this shit? +#warning "!!! What is this? !!!" if (!(pad0Index & 0x01)) { if (joypad_0_buttons[BUTTON_PAUSE]) -- 2.37.2