For Qt GUI, fixed thread timing bug in rapid autofire pattern. Also, added hooks to make the autofire pattern number of on/off frames configurable. Minor indentation fixes in code.
This commit is contained in:
parent
e8bd912830
commit
049f1017d4
File diff suppressed because it is too large
Load Diff
|
@ -62,7 +62,7 @@ class consoleWin_t : public QMainWindow
|
|||
|
||||
public:
|
||||
consoleWin_t(QWidget *parent = 0);
|
||||
~consoleWin_t(void);
|
||||
~consoleWin_t(void);
|
||||
|
||||
ConsoleViewGL_t *viewport_GL;
|
||||
ConsoleViewSDL_t *viewport_SDL;
|
||||
|
@ -89,70 +89,70 @@ class consoleWin_t : public QMainWindow
|
|||
emulatorThread_t *emulatorThread;
|
||||
|
||||
protected:
|
||||
QMenu *fileMenu;
|
||||
QMenu *optMenu;
|
||||
QMenu *emuMenu;
|
||||
QMenu *toolsMenu;
|
||||
QMenu *debugMenu;
|
||||
QMenu *movieMenu;
|
||||
QMenu *helpMenu;
|
||||
QMenu *fileMenu;
|
||||
QMenu *optMenu;
|
||||
QMenu *emuMenu;
|
||||
QMenu *toolsMenu;
|
||||
QMenu *debugMenu;
|
||||
QMenu *movieMenu;
|
||||
QMenu *helpMenu;
|
||||
|
||||
QAction *openROM;
|
||||
QAction *closeROM;
|
||||
QAction *playNSF;
|
||||
QAction *loadStateAct;
|
||||
QAction *saveStateAct;
|
||||
QAction *quickLoadAct;
|
||||
QAction *quickSaveAct;
|
||||
QAction *loadLuaAct;
|
||||
QAction *scrShotAct;
|
||||
QAction *quitAct;
|
||||
QAction *inputConfig;
|
||||
QAction *gamePadConfig;
|
||||
QAction *gameSoundConfig;
|
||||
QAction *gameVideoConfig;
|
||||
QAction *hotkeyConfig;
|
||||
QAction *paletteConfig;
|
||||
QAction *guiConfig;
|
||||
QAction *timingConfig;
|
||||
QAction *movieConfig;
|
||||
QAction *autoResume;
|
||||
QAction *fullscreen;
|
||||
QAction *aboutAct;
|
||||
QAction *aboutActQt;
|
||||
QAction *msgLogAct;
|
||||
QAction *state[10];
|
||||
QAction *powerAct;
|
||||
QAction *resetAct;
|
||||
QAction *sresetAct;
|
||||
QAction *pauseAct;
|
||||
QAction *gameGenieAct;
|
||||
QAction *loadGgROMAct;
|
||||
QAction *insCoinAct;
|
||||
QAction *fdsSwitchAct;
|
||||
QAction *fdsEjectAct;
|
||||
QAction *fdsLoadBiosAct;
|
||||
QAction *cheatsAct;
|
||||
QAction *ramWatchAct;
|
||||
QAction *ramSearchAct;
|
||||
QAction *debuggerAct;
|
||||
QAction *codeDataLogAct;
|
||||
QAction *traceLogAct;
|
||||
QAction *hexEditAct;
|
||||
QAction *ppuViewAct;
|
||||
QAction *ntViewAct;
|
||||
QAction *ggEncodeAct;
|
||||
QAction *iNesEditAct;
|
||||
QAction *openMovAct;
|
||||
QAction *stopMovAct;
|
||||
QAction *recMovAct;
|
||||
QAction *recAsMovAct;
|
||||
|
||||
QAction *openROM;
|
||||
QAction *closeROM;
|
||||
QAction *playNSF;
|
||||
QAction *loadStateAct;
|
||||
QAction *saveStateAct;
|
||||
QAction *quickLoadAct;
|
||||
QAction *quickSaveAct;
|
||||
QAction *loadLuaAct;
|
||||
QAction *scrShotAct;
|
||||
QAction *quitAct;
|
||||
QAction *inputConfig;
|
||||
QAction *gamePadConfig;
|
||||
QAction *gameSoundConfig;
|
||||
QAction *gameVideoConfig;
|
||||
QAction *hotkeyConfig;
|
||||
QAction *paletteConfig;
|
||||
QAction *guiConfig;
|
||||
QAction *timingConfig;
|
||||
QAction *movieConfig;
|
||||
QAction *autoResume;
|
||||
QAction *fullscreen;
|
||||
QAction *aboutAct;
|
||||
QAction *aboutActQt;
|
||||
QAction *msgLogAct;
|
||||
QAction *state[10];
|
||||
QAction *powerAct;
|
||||
QAction *resetAct;
|
||||
QAction *sresetAct;
|
||||
QAction *pauseAct;
|
||||
QAction *gameGenieAct;
|
||||
QAction *loadGgROMAct;
|
||||
QAction *insCoinAct;
|
||||
QAction *fdsSwitchAct;
|
||||
QAction *fdsEjectAct;
|
||||
QAction *fdsLoadBiosAct;
|
||||
QAction *cheatsAct;
|
||||
QAction *ramWatchAct;
|
||||
QAction *ramSearchAct;
|
||||
QAction *debuggerAct;
|
||||
QAction *codeDataLogAct;
|
||||
QAction *traceLogAct;
|
||||
QAction *hexEditAct;
|
||||
QAction *ppuViewAct;
|
||||
QAction *ntViewAct;
|
||||
QAction *ggEncodeAct;
|
||||
QAction *iNesEditAct;
|
||||
QAction *openMovAct;
|
||||
QAction *stopMovAct;
|
||||
QAction *recMovAct;
|
||||
QAction *recAsMovAct;
|
||||
QTimer *gameTimer;
|
||||
|
||||
QTimer *gameTimer;
|
||||
|
||||
std::string errorMsg;
|
||||
bool errorMsgValid;
|
||||
bool closeRequested;
|
||||
std::string errorMsg;
|
||||
bool errorMsgValid;
|
||||
bool closeRequested;
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
@ -236,6 +236,8 @@ class consoleWin_t : public QMainWindow
|
|||
void stopMovie(void);
|
||||
void recordMovie(void);
|
||||
void recordMovieAs(void);
|
||||
void setAutoFireOnFrames(void);
|
||||
void setAutoFireOffFrames(void);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -29,15 +29,15 @@ class HotKeyConfDialog_t : public QDialog
|
|||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void keyReleaseEvent(QKeyEvent *event);
|
||||
void keyReleaseEvent(QKeyEvent *event);
|
||||
void assignHotkey(QKeyEvent *event);
|
||||
|
||||
QTreeWidget *tree;
|
||||
|
||||
private:
|
||||
|
||||
public slots:
|
||||
void closeWindow(void);
|
||||
public slots:
|
||||
void closeWindow(void);
|
||||
private slots:
|
||||
|
||||
};
|
||||
|
|
|
@ -95,7 +95,7 @@ static int periodic_saves = 0;
|
|||
static int mutexLocks = 0;
|
||||
static int mutexPending = 0;
|
||||
static bool emulatorHasMutux = 0;
|
||||
static unsigned int emulatorCycleCount = 0;
|
||||
unsigned int emulatorCycleCount = 0;
|
||||
|
||||
extern double g_fpsScale;
|
||||
|
||||
|
|
|
@ -15,8 +15,10 @@ extern bool turbo;
|
|||
extern bool swapDuty;
|
||||
extern bool pauseAfterPlayback;
|
||||
extern bool suggestReadOnlyReplay;
|
||||
extern bool emulatorCycleToggle;
|
||||
extern unsigned int gui_draw_area_width;
|
||||
extern unsigned int gui_draw_area_height;
|
||||
extern unsigned int emulatorCycleCount;
|
||||
|
||||
// global configuration object
|
||||
extern Config *g_config;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "Qt/dface.h"
|
||||
#include "Qt/input.h"
|
||||
#include "Qt/config.h"
|
||||
#include "Qt/fceuWrapper.h"
|
||||
#include "Qt/ConsoleWindow.h"
|
||||
#include "Qt/ConsoleUtilities.h"
|
||||
|
||||
|
@ -44,6 +45,8 @@
|
|||
|
||||
/** GLOBALS **/
|
||||
int NoWaiting = 0;
|
||||
int autoFireOnFrames = 1;
|
||||
int autoFireOffFrames = 1;
|
||||
extern Config *g_config;
|
||||
extern bool bindSavestate, frameAdvanceLagSkip, lagCounterDisplay;
|
||||
|
||||
|
@ -1191,14 +1194,31 @@ UpdateGamepad(void)
|
|||
if (FCEUMOV_Mode (MOVIEMODE_PLAY))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static int rapid = 0;
|
||||
static int rapid[4][2] = { 0 };
|
||||
uint32 JS = 0;
|
||||
int x;
|
||||
int wg;
|
||||
int onFrames;
|
||||
int offFrames;
|
||||
int totalFrames;
|
||||
bool fire, emuUpdated = false;
|
||||
static unsigned int emuCount = 0;
|
||||
|
||||
rapid ^= 1;
|
||||
if ( emulatorCycleCount != emuCount)
|
||||
{
|
||||
emuUpdated = true;
|
||||
emuCount = emulatorCycleCount;
|
||||
}
|
||||
|
||||
onFrames = autoFireOnFrames;
|
||||
offFrames = autoFireOffFrames;
|
||||
|
||||
if ( onFrames < 1 ) onFrames = 1;
|
||||
if ( offFrames < 1 ) offFrames = 1;
|
||||
|
||||
totalFrames = onFrames + offFrames;
|
||||
|
||||
int opposite_dirs;
|
||||
g_config->getOption("SDL.Input.EnableOppositeDirectionals", &opposite_dirs);
|
||||
|
@ -1219,40 +1239,53 @@ UpdateGamepad(void)
|
|||
// test for left+right and up+down
|
||||
if(x == 4){
|
||||
up = true;
|
||||
}
|
||||
}
|
||||
if((x == 5) && (up == true)){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if(x == 6){
|
||||
left = true;
|
||||
}
|
||||
}
|
||||
if((x == 7) && (left == true)){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
JS |= (1 << x) << (wg << 3);
|
||||
}
|
||||
}
|
||||
|
||||
int four_button_exit;
|
||||
g_config->getOption("SDL.ABStartSelectExit", &four_button_exit);
|
||||
// if a+b+start+select is pressed, exit
|
||||
if (four_button_exit && JS == 15) {
|
||||
FCEUI_printf("all buttons pressed, exiting\n");
|
||||
CloseGame();
|
||||
FCEUI_Kill();
|
||||
exit(0);
|
||||
}
|
||||
int four_button_exit;
|
||||
g_config->getOption("SDL.ABStartSelectExit", &four_button_exit);
|
||||
// if a+b+start+select is pressed, exit
|
||||
if (four_button_exit && JS == 15) {
|
||||
FCEUI_printf("all buttons pressed, exiting\n");
|
||||
CloseGame();
|
||||
FCEUI_Kill();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
// rapid-fire a, rapid-fire b
|
||||
if (rapid)
|
||||
for (x = 0; x < 2; x++)
|
||||
{
|
||||
for (x = 0; x < 2; x++)
|
||||
if (DTestButton (&GamePad[wg].bmap[8 + x]))
|
||||
{
|
||||
if (DTestButton (&GamePad[wg].bmap[8 + x]))
|
||||
fire = (rapid[wg][x] < onFrames);
|
||||
|
||||
//printf("wg:%i x:%i %i Fire:%i \n", wg, x, rapid[wg][x], fire );
|
||||
|
||||
if ( fire )
|
||||
{
|
||||
JS |= (1 << x) << (wg << 3);
|
||||
}
|
||||
if ( emuUpdated )
|
||||
{
|
||||
rapid[wg][x] = (rapid[wg][x] + 1) % totalFrames;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rapid[wg][x] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ struct ButtConfig
|
|||
};
|
||||
|
||||
extern int NoWaiting;
|
||||
extern int autoFireOnFrames;
|
||||
extern int autoFireOffFrames;
|
||||
extern CFGSTRUCT InputConfig[];
|
||||
extern ARGPSTRUCT InputArgs[];
|
||||
void ParseGIInput(FCEUGI *GI);
|
||||
|
|
Loading…
Reference in New Issue