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 "../../fceu.h"
#include "../../fds.h" #include "../../fds.h"
#include "../../file.h"
#include "../../input.h"
#include "../../movie.h" #include "../../movie.h"
#include "../../version.h" #include "../../version.h"
@ -565,6 +567,16 @@ void consoleWin_t::initHotKeys(void)
{ {
Hotkeys[HK_FRAME_ADVANCE].getShortcut()->setEnabled(false); 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) 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) void consoleWin_t::openMovie(void)
{ {
MoviePlayDialog_t *win; MoviePlayDialog_t *win;

View File

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

View File

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

View File

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