From: Shamus Hammons Date: Tue, 19 Jul 2011 03:53:40 +0000 (+0000) Subject: Fixed OP regression in Rayman, probably others. X-Git-Tag: 2.0.0~15 X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=166019baeee39e3867ecf6c4eddd0855dc3507a4;p=virtualjaguar Fixed OP regression in Rayman, probably others. --- diff --git a/src/gui/configdialog.cpp b/src/gui/configdialog.cpp index 2613412..5c8e0b3 100644 --- a/src/gui/configdialog.cpp +++ b/src/gui/configdialog.cpp @@ -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]; } diff --git a/src/gui/controllertab.cpp b/src/gui/controllertab.cpp index 722ee10..98c9c01 100644 --- a/src/gui/controllertab.cpp +++ b/src/gui/controllertab.cpp @@ -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 diff --git a/src/gui/controllertab.h b/src/gui/controllertab.h index 0ec1844..64e291a 100644 --- a/src/gui/controllertab.h +++ b/src/gui/controllertab.h @@ -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 index 0000000..371c619 --- /dev/null +++ b/src/gui/keygrabber.cpp @@ -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 +// +// 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\"
(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 index 0000000..481debb --- /dev/null +++ b/src/gui/keygrabber.h @@ -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 + +//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__ diff --git a/src/tom.cpp b/src/tom.cpp index 10a29f0..0465472 100644 --- a/src/tom.cpp +++ b/src/tom.cpp @@ -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) diff --git a/virtualjaguar.pro b/virtualjaguar.pro index bb4b623..60653bf 100644 --- a/virtualjaguar.pro +++ b/virtualjaguar.pro @@ -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