]> Shamusworld >> Repos - virtualjaguar/commitdiff
Fixed OP regression in Rayman, probably others.
authorShamus Hammons <jlhamm@acm.org>
Tue, 19 Jul 2011 03:53:40 +0000 (03:53 +0000)
committerShamus Hammons <jlhamm@acm.org>
Tue, 19 Jul 2011 03:53:40 +0000 (03:53 +0000)
src/gui/configdialog.cpp
src/gui/controllertab.cpp
src/gui/controllertab.h
src/gui/keygrabber.cpp [new file with mode: 0644]
src/gui/keygrabber.h [new file with mode: 0644]
src/tom.cpp
virtualjaguar.pro

index 26134121f8577e68a7761f79665695cd966185dc..5c8e0b33a2d64ed76aa655922d550e0ee3e2ce4b 100644 (file)
@@ -71,6 +71,9 @@ void ConfigDialog::LoadDialogFromSettings(void)
                alpineTab->edit2->setText(vjs.absROMPath);
                alpineTab->writeROM->setChecked(vjs.allowWritesToROM);
        }
+
+       for(int i=0; i<21; i++)
+               controllerTab->p1Keys[i] = vjs.p1KeyBindings[i];
 }
 
 void ConfigDialog::UpdateVJSettings(void)
@@ -90,4 +93,7 @@ void ConfigDialog::UpdateVJSettings(void)
                strcpy(vjs.absROMPath,    alpineTab->edit2->text().toAscii().data());
                vjs.allowWritesToROM = alpineTab->writeROM->isChecked();
        }
+
+       for(int i=0; i<21; i++)
+               vjs.p1KeyBindings[i] = controllerTab->p1Keys[i];
 }
index 722ee10e8bc4cef677dfb0c0ab4d94a0fda739c1..98c9c017c4de46a23a543572e2631418a12796d6 100644 (file)
@@ -14,6 +14,7 @@
 #include "controllertab.h"
 
 #include "joystick.h"
+#include "keygrabber.h"
 
 
 ControllerTab::ControllerTab(QWidget * parent/*= 0*/): QWidget(parent)
@@ -127,6 +128,24 @@ 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" };
+       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.exec();
+               int key = keyGrab.key;
+
+               if (key == Qt::Key_Escape)
+                       break;
+
+               // Otherwise, populate the appropriate spot in the settings...
+               p1Keys[orderToDefine[i]] = key;
+       }
 }
 
 #if 0
index 0ec18448ae1f06f3727928e9f939ebb3751eec27..64e291a9998ea23e4978021ef02b6361f536ce84 100644 (file)
@@ -14,8 +14,11 @@ class ControllerTab: public QWidget
        protected slots:
                void DefineAllKeys(void);
 
-       public:
+       private:
                QPushButton * redefineAll;
+
+       public:
+               int p1Keys[21];
 };
 
 #endif // __CONTROLLERTAB_H__
diff --git a/src/gui/keygrabber.cpp b/src/gui/keygrabber.cpp
new file mode 100644 (file)
index 0000000..371c619
--- /dev/null
@@ -0,0 +1,40 @@
+//
+// keygrabber.cpp - Widget to grab a key and dismiss itself
+//
+// by James L. Hammons
+// (C) 2011 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who  When        What
+// ---  ----------  -------------------------------------------------------------
+// JLH  07/18/2011  Created this file
+//
+
+#include "keygrabber.h"
+
+
+KeyGrabber::KeyGrabber(QWidget * parent/*= 0*/): QDialog(parent)
+{
+       label = new QLabel(this);
+       QVBoxLayout * mainLayout = new QVBoxLayout;
+       mainLayout->addWidget(label);
+       setLayout(mainLayout);
+       setWindowTitle(tr("Grab"));
+}
+
+KeyGrabber::~KeyGrabber()
+{
+}
+
+void KeyGrabber::SetText(QString keyText)
+{
+       QString text = QString(tr("Press key for \"%1\"<br>(ESC to cancel)")).arg(keyText);
+       label->setText(text);
+}
+
+void KeyGrabber::keyPressEvent(QKeyEvent * e)
+{
+       key = e->key();
+       accept();
+}
diff --git a/src/gui/keygrabber.h b/src/gui/keygrabber.h
new file mode 100644 (file)
index 0000000..481debb
--- /dev/null
@@ -0,0 +1,46 @@
+//
+// keygrabber.h - Widget to grab a key and dismiss itself
+//
+// by James L. Hammons
+// (C) 2011 Underground Software
+//
+
+#ifndef __KEYGRABBER_H__
+#define __KEYGRABBER_H__
+
+#include <QtGui>
+
+//class GeneralTab;
+//class ControllerTab;
+//class AlpineTab;
+
+class KeyGrabber: public QDialog
+{
+       Q_OBJECT
+
+       public:
+               KeyGrabber(QWidget * parent = 0);
+               ~KeyGrabber();
+//             void UpdateVJSettings(void);
+               void SetText(QString);
+//             int GetKeyGrabbed(void);
+
+       protected:
+               void keyPressEvent(QKeyEvent *);
+
+//     private:
+//             void LoadDialogFromSettings(void);
+
+       private:
+//             QTabWidget * tabWidget;
+//             QDialogButtonBox * buttonBox;
+               QLabel * label;
+
+       public:
+               int key;
+//             GeneralTab * generalTab;
+//             ControllerTab * controllerTab;
+//             AlpineTab * alpineTab;
+};
+
+#endif // __KEYGRABBER_H__
index 10a29f0f1913d1f0d4d2bc1d711376d6cde7ad47..046547248d5c41372490a2a99784e7fa476ee179 100644 (file)
@@ -775,7 +775,8 @@ void TOMExecScanline(uint16 scanline, bool render)
 //Hm, it seems that the OP needs to execute from zero, so let's try it:
 // And it works! But need to do some optimizations in the OP to keep it from attempting
 // to do a scanline render in the non-display area... [DONE]
-#if 0
+//this seems to cause a regression in certain games, like rayman
+#if 1
        if (scanline >= (uint16)GET16(tomRam8, VDB) && scanline < (uint16)GET16(tomRam8, VDE))
        {
                if (render)
index bb4b623953d2713757920fe1587c6ef80b66b2bd..60653bfae6d4938926ba953ee62745de99a9b54a 100644 (file)
@@ -63,6 +63,7 @@ HEADERS = \
        src/gui/generaltab.h \
        src/gui/glwidget.h \
        src/gui/imagedelegate.h \
+       src/gui/keygrabber.h \
        src/gui/mainwin.h
 
 SOURCES = \
@@ -77,4 +78,5 @@ SOURCES = \
        src/gui/generaltab.cpp \
        src/gui/glwidget.cpp \
        src/gui/imagedelegate.cpp \
+       src/gui/keygrabber.cpp \
        src/gui/mainwin.cpp