Added initial framework for being able to bind gamepad button presses to emulator key sequences. This makes it possible to trigger any short cut or hot key.
This commit is contained in:
parent
afe54a5ab9
commit
9e1eb03b96
|
@ -19,6 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
#include "Qt/main.h"
|
#include "Qt/main.h"
|
||||||
#include "Qt/dface.h"
|
#include "Qt/dface.h"
|
||||||
|
@ -407,6 +408,31 @@ setHotKeys (void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gamepad_function_key_t::gamepad_function_key_t(void)
|
||||||
|
{
|
||||||
|
qKey = 0;
|
||||||
|
qModifier = Qt::NoModifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
gamepad_function_key_t::~gamepad_function_key_t(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void gamepad_function_key_t::sendKeyPressEvent(void)
|
||||||
|
{
|
||||||
|
QKeyEvent *k = new QKeyEvent (QEvent::KeyPress, qKey, (Qt::KeyboardModifiers)qModifier );
|
||||||
|
|
||||||
|
qApp->postEvent((QObject*)consoleWindow,(QEvent *)k);
|
||||||
|
}
|
||||||
|
|
||||||
|
void gamepad_function_key_t::sendKeyReleaseEvent(void)
|
||||||
|
{
|
||||||
|
QKeyEvent *k = new QKeyEvent (QEvent::KeyRelease, qKey, (Qt::KeyboardModifiers)qModifier );
|
||||||
|
|
||||||
|
qApp->postEvent((QObject*)consoleWindow,(QEvent *)k);
|
||||||
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* This function is a wrapper for FCEUI_ToggleEmulationPause that handles
|
* This function is a wrapper for FCEUI_ToggleEmulationPause that handles
|
||||||
* releasing/capturing mouse pointer during pause toggles
|
* releasing/capturing mouse pointer during pause toggles
|
||||||
|
|
|
@ -17,7 +17,7 @@ struct ButtConfig
|
||||||
int ButtType;
|
int ButtType;
|
||||||
int DeviceNum;
|
int DeviceNum;
|
||||||
int ButtonNum;
|
int ButtonNum;
|
||||||
int state;
|
int state;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int NoWaiting;
|
extern int NoWaiting;
|
||||||
|
@ -51,6 +51,20 @@ struct hotkey_t
|
||||||
};
|
};
|
||||||
extern struct hotkey_t Hotkeys[];
|
extern struct hotkey_t Hotkeys[];
|
||||||
|
|
||||||
|
struct gamepad_function_key_t
|
||||||
|
{
|
||||||
|
int qKey;
|
||||||
|
unsigned int qModifier;
|
||||||
|
|
||||||
|
struct ButtConfig bc;
|
||||||
|
|
||||||
|
gamepad_function_key_t(void);
|
||||||
|
~gamepad_function_key_t(void);
|
||||||
|
|
||||||
|
void sendKeyPressEvent(void);
|
||||||
|
void sendKeyReleaseEvent(void);
|
||||||
|
};
|
||||||
|
|
||||||
#define FCFGD_GAMEPAD 1
|
#define FCFGD_GAMEPAD 1
|
||||||
#define FCFGD_POWERPAD 2
|
#define FCFGD_POWERPAD 2
|
||||||
#define FCFGD_HYPERSHOT 3
|
#define FCFGD_HYPERSHOT 3
|
||||||
|
|
Loading…
Reference in New Issue