Bug fixes for a few Qt hot key shortcuts.

This commit is contained in:
mjbudd77 2021-04-05 22:09:59 -04:00
parent e0f5c3c58e
commit 2f2abfdbb2
5 changed files with 237 additions and 156 deletions

View File

@ -43,6 +43,8 @@
#include "../../fceu.h"
#include "../../fds.h"
#include "../../file.h"
#include "../../input.h"
#include "../../movie.h"
#include "../../version.h"
@ -565,6 +567,16 @@ void consoleWin_t::initHotKeys(void)
{
Hotkeys[HK_FRAME_ADVANCE].getShortcut()->setEnabled(false);
}
connect( Hotkeys[ HK_VOLUME_DOWN ].getShortcut(), SIGNAL(activated()), this, SLOT(decrSoundVolume(void)) );
connect( Hotkeys[ HK_VOLUME_UP ].getShortcut(), SIGNAL(activated()), this, SLOT(incrSoundVolume(void)) );
connect( Hotkeys[ HK_LAG_COUNTER_DISPLAY ].getShortcut(), SIGNAL(activated()), this, SLOT(toggleLagCounterDisplay(void)) );
connect( Hotkeys[ HK_FA_LAG_SKIP ].getShortcut(), SIGNAL(activated()), this, SLOT(toggleFrameAdvLagSkip(void)) );
connect( Hotkeys[ HK_BIND_STATE ].getShortcut(), SIGNAL(activated()), this, SLOT(toggleMovieBindSaveState(void)));
connect( Hotkeys[ HK_TOGGLE_FRAME_DISPLAY ].getShortcut(), SIGNAL(activated()), this, SLOT(toggleMovieFrameDisplay(void)));
connect( Hotkeys[ HK_MOVIE_TOGGLE_RW ].getShortcut(), SIGNAL(activated()), this, SLOT(toggleMovieReadWrite(void)));
connect( Hotkeys[ HK_TOGGLE_INPUT_DISPLAY ].getShortcut(), SIGNAL(activated()), this, SLOT(toggleInputDisplay(void)));
}
//---------------------------------------------------------------------------
void consoleWin_t::createMainMenu(void)
@ -2711,6 +2723,65 @@ void consoleWin_t::setAutoFireOffFrames(void)
}
}
void consoleWin_t::incrSoundVolume(void)
{
fceuWrapperLock();
FCEUD_SoundVolumeAdjust( 1);
fceuWrapperUnLock();
}
void consoleWin_t::decrSoundVolume(void)
{
fceuWrapperLock();
FCEUD_SoundVolumeAdjust(-1);
fceuWrapperUnLock();
}
void consoleWin_t::toggleLagCounterDisplay(void)
{
fceuWrapperLock();
lagCounterDisplay = !lagCounterDisplay;
fceuWrapperUnLock();
}
void consoleWin_t::toggleFrameAdvLagSkip(void)
{
fceuWrapperLock();
frameAdvanceLagSkip = !frameAdvanceLagSkip;
FCEUI_DispMessage ("Skipping lag in Frame Advance %sabled.", 0, frameAdvanceLagSkip ? "en" : "dis");
fceuWrapperUnLock();
}
void consoleWin_t::toggleMovieBindSaveState(void)
{
fceuWrapperLock();
bindSavestate = !bindSavestate;
FCEUI_DispMessage ("Savestate binding to movie %sabled.", 0, bindSavestate ? "en" : "dis");
fceuWrapperUnLock();
}
void consoleWin_t::toggleMovieFrameDisplay(void)
{
fceuWrapperLock();
FCEUI_MovieToggleFrameDisplay();
fceuWrapperUnLock();
}
void consoleWin_t::toggleMovieReadWrite(void)
{
fceuWrapperLock();
FCEUI_SetMovieToggleReadOnly (!FCEUI_GetMovieToggleReadOnly ());
fceuWrapperUnLock();
}
void consoleWin_t::toggleInputDisplay(void)
{
fceuWrapperLock();
FCEUI_ToggleInputDisplay();
g_config->setOption ("SDL.InputDisplay", input_display);
fceuWrapperUnLock();
}
void consoleWin_t::openMovie(void)
{
MoviePlayDialog_t *win;

View File

@ -303,6 +303,14 @@ class consoleWin_t : public QMainWindow
void recordMovieAs(void);
void setAutoFireOnFrames(void);
void setAutoFireOffFrames(void);
void incrSoundVolume(void);
void decrSoundVolume(void);
void toggleLagCounterDisplay(void);
void toggleFrameAdvLagSkip(void);
void toggleMovieBindSaveState(void);
void toggleMovieFrameDisplay(void);
void toggleMovieReadWrite(void);
void toggleInputDisplay(void);
};

View File

@ -911,32 +911,32 @@ static void KeyboardCommands (void)
}
if ( Hotkeys[HK_DECREASE_SPEED].getRisingEdge() )
{
DecreaseEmulationSpeed();
}
//if ( Hotkeys[HK_DECREASE_SPEED].getRisingEdge() )
//{
// DecreaseEmulationSpeed();
//}
if ( Hotkeys[HK_INCREASE_SPEED].getRisingEdge() )
{
IncreaseEmulationSpeed ();
}
//if ( Hotkeys[HK_INCREASE_SPEED].getRisingEdge() )
//{
// IncreaseEmulationSpeed ();
//}
if ( Hotkeys[HK_TOGGLE_FRAME_DISPLAY].getRisingEdge() )
{
FCEUI_MovieToggleFrameDisplay ();
}
//if ( Hotkeys[HK_TOGGLE_FRAME_DISPLAY].getRisingEdge() )
//{
// FCEUI_MovieToggleFrameDisplay ();
//}
if ( Hotkeys[HK_TOGGLE_INPUT_DISPLAY].getRisingEdge() )
{
FCEUI_ToggleInputDisplay ();
extern int input_display;
g_config->setOption ("SDL.InputDisplay", input_display);
}
//if ( Hotkeys[HK_TOGGLE_INPUT_DISPLAY].getRisingEdge() )
//{
// FCEUI_ToggleInputDisplay ();
// extern int input_display;
// g_config->setOption ("SDL.InputDisplay", input_display);
//}
if ( Hotkeys[HK_MOVIE_TOGGLE_RW].getRisingEdge() )
{
FCEUI_SetMovieToggleReadOnly (!FCEUI_GetMovieToggleReadOnly ());
}
//if ( Hotkeys[HK_MOVIE_TOGGLE_RW].getRisingEdge() )
//{
// FCEUI_SetMovieToggleReadOnly (!FCEUI_GetMovieToggleReadOnly ());
//}
#ifdef CREATE_AVI
if ( Hotkeys[HK_MUTE_CAPTURE].getRisingEdge() )
@ -946,13 +946,13 @@ static void KeyboardCommands (void)
}
#endif
if ( Hotkeys[HK_PAUSE].getRisingEdge() )
{
//FCEUI_ToggleEmulationPause();
// use the wrapper function instead of the fceui function directly
// so we can handle cursor grabbage
TogglePause ();
}
//if ( Hotkeys[HK_PAUSE].getRisingEdge() )
//{
// //FCEUI_ToggleEmulationPause();
// // use the wrapper function instead of the fceui function directly
// // so we can handle cursor grabbage
// TogglePause ();
//}
// Toggle throttling
if ( Hotkeys[HK_TURBO].getRisingEdge() )
@ -981,10 +981,10 @@ static void KeyboardCommands (void)
}
}
if ( Hotkeys[HK_RESET].getRisingEdge() )
{
FCEUI_ResetNES ();
}
//if ( Hotkeys[HK_RESET].getRisingEdge() )
//{
// FCEUI_ResetNES ();
//}
//if( Hotkeys[HK_POWER].getRisingEdge() )
//{
// FCEUI_PowerNES();
@ -1025,136 +1025,136 @@ static void KeyboardCommands (void)
// FCEUI_SelectStateNext (-1);
//}
if ( Hotkeys[HK_BIND_STATE].getRisingEdge() )
{
bindSavestate ^= 1;
FCEUI_DispMessage ("Savestate binding to movie %sabled.", 0,
bindSavestate ? "en" : "dis");
}
//if ( Hotkeys[HK_BIND_STATE].getRisingEdge() )
//{
// bindSavestate ^= 1;
// FCEUI_DispMessage ("Savestate binding to movie %sabled.", 0,
// bindSavestate ? "en" : "dis");
//}
if ( Hotkeys[HK_FA_LAG_SKIP].getRisingEdge() )
{
frameAdvanceLagSkip ^= 1;
FCEUI_DispMessage ("Skipping lag in Frame Advance %sabled.", 0,
frameAdvanceLagSkip ? "en" : "dis");
}
//if ( Hotkeys[HK_FA_LAG_SKIP].getRisingEdge() )
//{
// frameAdvanceLagSkip ^= 1;
// FCEUI_DispMessage ("Skipping lag in Frame Advance %sabled.", 0,
// frameAdvanceLagSkip ? "en" : "dis");
//}
if ( Hotkeys[HK_LAG_COUNTER_DISPLAY].getRisingEdge() )
{
lagCounterDisplay ^= 1;
}
//if ( Hotkeys[HK_LAG_COUNTER_DISPLAY].getRisingEdge() )
//{
// lagCounterDisplay ^= 1;
//}
if ( Hotkeys[HK_TOGGLE_SUBTITLE].getRisingEdge() )
{
movieSubtitles = !movieSubtitles;
FCEUI_DispMessage ("Movie subtitles o%s.", 0,
movieSubtitles ? "n" : "ff");
}
//if ( Hotkeys[HK_TOGGLE_SUBTITLE].getRisingEdge() )
//{
// movieSubtitles = !movieSubtitles;
// FCEUI_DispMessage ("Movie subtitles o%s.", 0,
// movieSubtitles ? "n" : "ff");
//}
if ( Hotkeys[HK_VOLUME_DOWN].getRisingEdge() )
{
FCEUD_SoundVolumeAdjust(-1);
}
//if ( Hotkeys[HK_VOLUME_DOWN].getRisingEdge() )
//{
// FCEUD_SoundVolumeAdjust(-1);
//}
if ( Hotkeys[HK_VOLUME_UP].getRisingEdge() )
{
FCEUD_SoundVolumeAdjust(1);
}
//if ( Hotkeys[HK_VOLUME_UP].getRisingEdge() )
//{
// FCEUD_SoundVolumeAdjust(1);
//}
// VS Unisystem games
if (gametype == GIT_VSUNI)
{
// insert coin
if ( Hotkeys[HK_VS_INSERT_COIN].getRisingEdge() )
{
FCEUI_VSUniCoin ();
}
// toggle dipswitch display
if ( Hotkeys[HK_VS_TOGGLE_DIPSWITCH].getRisingEdge() )
{
DIPS ^= 1;
FCEUI_VSUniToggleDIPView ();
}
if (!(DIPS & 1))
goto DIPSless;
// toggle the various dipswitches
for(int i=1; i<=8;i++)
{
if(keyonly(i))
FCEUI_VSUniToggleDIP(i-1);
}
}
else
{
static uint8 bbuf[32];
static int bbuft;
static int barcoder = 0;
if (keyonly (H))
FCEUI_NTSCSELHUE ();
if (keyonly (T))
FCEUI_NTSCSELTINT ();
if (Hotkeys[HK_DECREASE_SPEED].getRisingEdge())
{
FCEUI_NTSCDEC ();
}
if (Hotkeys[HK_INCREASE_SPEED].getRisingEdge())
{
FCEUI_NTSCINC ();
}
if ((CurInputType[2] == SIFC_BWORLD) || (cspec == SIS_DATACH))
{
if (keyonly (F8))
{
barcoder ^= 1;
if (!barcoder)
{
if (CurInputType[2] == SIFC_BWORLD)
{
strcpy ((char *) &BWorldData[1], (char *) bbuf);
BWorldData[0] = 1;
}
else
{
FCEUI_DatachSet (bbuf);
}
FCEUI_DispMessage ("Barcode Entered", 0);
}
else
{
bbuft = 0;
FCEUI_DispMessage ("Enter Barcode", 0);
}
}
}
else
{
barcoder = 0;
}
#define SSM(x) \
do { \
if(barcoder) { \
if(bbuft < 13) { \
bbuf[bbuft++] = '0' + x; \
bbuf[bbuft] = 0; \
} \
FCEUI_DispMessage("Barcode: %s",0, bbuf); \
} \
} while(0)
DIPSless:
for(int i=0; i<10;i++)
{
if (keyonly (i))
SSM (i);
}
#undef SSM
}
// if (gametype == GIT_VSUNI)
// {
// // insert coin
// if ( Hotkeys[HK_VS_INSERT_COIN].getRisingEdge() )
// {
// FCEUI_VSUniCoin ();
// }
//
// // toggle dipswitch display
// if ( Hotkeys[HK_VS_TOGGLE_DIPSWITCH].getRisingEdge() )
// {
// DIPS ^= 1;
// FCEUI_VSUniToggleDIPView ();
// }
// if (!(DIPS & 1))
// goto DIPSless;
//
// // toggle the various dipswitches
// for(int i=1; i<=8;i++)
// {
// if(keyonly(i))
// FCEUI_VSUniToggleDIP(i-1);
// }
// }
// else
// {
// static uint8 bbuf[32];
// static int bbuft;
// static int barcoder = 0;
//
// if (keyonly (H))
// FCEUI_NTSCSELHUE ();
// if (keyonly (T))
// FCEUI_NTSCSELTINT ();
//
// if (Hotkeys[HK_DECREASE_SPEED].getRisingEdge())
// {
// FCEUI_NTSCDEC ();
// }
// if (Hotkeys[HK_INCREASE_SPEED].getRisingEdge())
// {
// FCEUI_NTSCINC ();
// }
//
// if ((CurInputType[2] == SIFC_BWORLD) || (cspec == SIS_DATACH))
// {
// if (keyonly (F8))
// {
// barcoder ^= 1;
// if (!barcoder)
// {
// if (CurInputType[2] == SIFC_BWORLD)
// {
// strcpy ((char *) &BWorldData[1], (char *) bbuf);
// BWorldData[0] = 1;
// }
// else
// {
// FCEUI_DatachSet (bbuf);
// }
// FCEUI_DispMessage ("Barcode Entered", 0);
// }
// else
// {
// bbuft = 0;
// FCEUI_DispMessage ("Enter Barcode", 0);
// }
// }
// }
// else
// {
// barcoder = 0;
// }
//
//#define SSM(x) \
//do { \
// if(barcoder) { \
// if(bbuft < 13) { \
// bbuf[bbuft++] = '0' + x; \
// bbuf[bbuft] = 0; \
// } \
// FCEUI_DispMessage("Barcode: %s",0, bbuf); \
// } \
//} while(0)
//
// DIPSless:
// for(int i=0; i<10;i++)
// {
// if (keyonly (i))
// SSM (i);
// }
//#undef SSM
// }
}
/**

View File

@ -17,6 +17,7 @@ extern int postrenderscanlines;
extern int vblankscanlines;
extern bool AutoResumePlay;
extern bool frameAdvanceLagSkip;
extern char romNameWhenClosingEmulator[];
#define DECLFR(x) uint8 x (uint32 A)

View File

@ -278,6 +278,7 @@ extern bool movie_readonly;
extern bool autoMovieBackup;
extern bool fullSaveStateLoads;
extern int movieRecordMode;
extern int input_display;
//--------------------------------------------------
void FCEUI_MakeBackupMovie(bool dispMessage);