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
|
@ -722,6 +722,25 @@ void consoleWin_t::createMainMenu(void)
|
|||
|
||||
subMenu->addAction(act);
|
||||
|
||||
emuMenu->addSeparator();
|
||||
|
||||
// Emulation -> AutoFire Pattern
|
||||
subMenu = emuMenu->addMenu(tr("AutoFire Pattern"));
|
||||
|
||||
// Emulation -> AutoFire Pattern -> # On Frames
|
||||
act = new QAction(tr("# On Frames"), this);
|
||||
act->setStatusTip(tr("# On Frames"));
|
||||
connect(act, SIGNAL(triggered()), this, SLOT(setAutoFireOnFrames(void)) );
|
||||
|
||||
subMenu->addAction(act);
|
||||
|
||||
// Emulation -> AutoFire Pattern -> # Off Frames
|
||||
act = new QAction(tr("# Off Frames"), this);
|
||||
act->setStatusTip(tr("# Off Frames"));
|
||||
connect(act, SIGNAL(triggered()), this, SLOT(setAutoFireOffFrames(void)) );
|
||||
|
||||
subMenu->addAction(act);
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Tools
|
||||
toolsMenu = menuBar()->addMenu(tr("&Tools"));
|
||||
|
@ -1977,6 +1996,48 @@ void consoleWin_t::emuSetFrameAdvDelay(void)
|
|||
}
|
||||
}
|
||||
|
||||
void consoleWin_t::setAutoFireOnFrames(void)
|
||||
{
|
||||
int ret;
|
||||
QInputDialog dialog(this);
|
||||
|
||||
dialog.setWindowTitle( tr("AutoFire Pattern ON Frames") );
|
||||
dialog.setLabelText( tr("Specify desired number of ON frames in autofire pattern:") );
|
||||
dialog.setOkButtonText( tr("Ok") );
|
||||
dialog.setInputMode( QInputDialog::IntInput );
|
||||
dialog.setIntRange( 1, 30 );
|
||||
dialog.setIntValue( autoFireOnFrames );
|
||||
|
||||
dialog.show();
|
||||
ret = dialog.exec();
|
||||
|
||||
if ( QDialog::Accepted == ret )
|
||||
{
|
||||
autoFireOnFrames = dialog.intValue();
|
||||
}
|
||||
}
|
||||
|
||||
void consoleWin_t::setAutoFireOffFrames(void)
|
||||
{
|
||||
int ret;
|
||||
QInputDialog dialog(this);
|
||||
|
||||
dialog.setWindowTitle( tr("AutoFire Pattern OFF Frames") );
|
||||
dialog.setLabelText( tr("Specify desired number of OFF frames in autofire pattern:") );
|
||||
dialog.setOkButtonText( tr("Ok") );
|
||||
dialog.setInputMode( QInputDialog::IntInput );
|
||||
dialog.setIntRange( 1, 30 );
|
||||
dialog.setIntValue( autoFireOffFrames );
|
||||
|
||||
dialog.show();
|
||||
ret = dialog.exec();
|
||||
|
||||
if ( QDialog::Accepted == ret )
|
||||
{
|
||||
autoFireOffFrames = dialog.intValue();
|
||||
}
|
||||
}
|
||||
|
||||
void consoleWin_t::openMovie(void)
|
||||
{
|
||||
MoviePlayDialog_t *win;
|
||||
|
|
|
@ -236,6 +236,8 @@ class consoleWin_t : public QMainWindow
|
|||
void stopMovie(void);
|
||||
void recordMovie(void);
|
||||
void recordMovieAs(void);
|
||||
void setAutoFireOnFrames(void);
|
||||
void setAutoFireOffFrames(void);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -1193,12 +1196,29 @@ UpdateGamepad(void)
|
|||
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);
|
||||
|
@ -1244,15 +1264,28 @@ UpdateGamepad(void)
|
|||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
// rapid-fire a, rapid-fire b
|
||||
if (rapid)
|
||||
{
|
||||
for (x = 0; x < 2; 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