Lag Counter implementation
This commit is contained in:
parent
d1981c8950
commit
1ebff1d250
11
src/fceu.cpp
11
src/fceu.cpp
|
@ -57,7 +57,11 @@
|
|||
#include "drivers/sdl/sdl.h"
|
||||
#endif
|
||||
|
||||
int AFon, AFoff, AutoFireOffset = 0;
|
||||
int AFon, AFoff, AutoFireOffset = 0; //For keeping track of autofire settings
|
||||
|
||||
unsigned int LagCounter = 0; //This will increment everytime input is not polled by the game
|
||||
bool lagCounterDisplay = true;
|
||||
bool lagFlag = true;
|
||||
|
||||
static void CloseGame(void)
|
||||
{
|
||||
|
@ -498,6 +502,7 @@ void UpdateAutosave(void);
|
|||
///Skip may be passed in, if FRAMESKIP is #defined, to cause this to emulate more than one frame
|
||||
void FCEUI_Emulate(uint8 **pXBuf, int32 **SoundBuf, int32 *SoundBufSize, int skip)
|
||||
{
|
||||
lagFlag = true;
|
||||
int r,ssize;
|
||||
|
||||
JustFrameAdvanced = false;
|
||||
|
@ -567,6 +572,8 @@ void FCEUI_Emulate(uint8 **pXBuf, int32 **SoundBuf, int32 *SoundBufSize, int ski
|
|||
}
|
||||
|
||||
currMovieData.TryDumpIncremental();
|
||||
if (lagFlag) LagCounter++;
|
||||
if (lagCounterDisplay)FCEU_DispMessage("%d",LagCounter) ;
|
||||
}
|
||||
|
||||
void FCEUI_CloseGame(void)
|
||||
|
@ -633,7 +640,7 @@ void PowerNES(void)
|
|||
|
||||
SetReadHandler(0x800,0x1FFF,ARAMH); // Part of a little
|
||||
SetWriteHandler(0x800,0x1FFF,BRAMH); //hack for a small speed boost.
|
||||
|
||||
|
||||
InitializeInput();
|
||||
FCEUSND_Power();
|
||||
FCEUPPU_Power();
|
||||
|
|
|
@ -66,6 +66,9 @@ extern INPUTCFC *FCEU_InitTopRider(void);
|
|||
extern INPUTCFC *FCEU_InitBarcodeWorld(void);
|
||||
//---------------
|
||||
|
||||
extern unsigned int LagCounter;
|
||||
extern bool lagCounterDisplay;
|
||||
extern bool lagFlag;
|
||||
static uint8 joy_readbit[2];
|
||||
uint8 joy[4]={0,0,0,0}; //HACK - should be static but movie needs it
|
||||
static uint8 LastStrobe;
|
||||
|
@ -91,6 +94,7 @@ FCPORT portFC;
|
|||
|
||||
static DECLFR(JPRead)
|
||||
{
|
||||
lagFlag = false;
|
||||
uint8 ret=0;
|
||||
|
||||
ret|=joyports[A&1].driver->Read(A&1);
|
||||
|
@ -344,6 +348,7 @@ void FCEU_UpdateInput(void)
|
|||
|
||||
static DECLFR(VSUNIRead0)
|
||||
{
|
||||
lagFlag = false;
|
||||
uint8 ret=0;
|
||||
|
||||
ret|=(joyports[0].driver->Read(0))&1;
|
||||
|
@ -356,6 +361,7 @@ static DECLFR(VSUNIRead0)
|
|||
|
||||
static DECLFR(VSUNIRead1)
|
||||
{
|
||||
lagFlag = false;
|
||||
uint8 ret=0;
|
||||
|
||||
ret|=(joyports[1].driver->Read(1))&1;
|
||||
|
@ -618,6 +624,8 @@ static void CommandSoundAdjust(void);
|
|||
static void CommandUsePreset(void);
|
||||
static void BackgroundDisplayToggle(void);
|
||||
static void ObjectDisplayToggle(void);
|
||||
static void LagCounterReset(void);
|
||||
static void LagCounterToggle(void);
|
||||
static void ViewSlots(void);
|
||||
|
||||
struct EMUCMDTABLE FCEUI_CommandTable[]=
|
||||
|
@ -747,6 +755,9 @@ struct EMUCMDTABLE FCEUI_CommandTable[]=
|
|||
{ EMUCMD_MISC_USE_INPUT_PRESET_3, EMUCMDTYPE_MISC, CommandUsePreset, 0, 0, "Use Input Preset 3", 0 },
|
||||
{ EMUCMD_MISC_DISPLAY_BG_TOGGLE, EMUCMDTYPE_MISC, BackgroundDisplayToggle, 0, 0, "Toggle Background Display", 0 },
|
||||
{ EMUCMD_MISC_DISPLAY_OBJ_TOGGLE, EMUCMDTYPE_MISC, ObjectDisplayToggle, 0, 0, "Toggle Object Display", 0 },
|
||||
{ EMUCMD_MISC_DISPLAY_LAGCOUNTER_TOGGLE, EMUCMDTYPE_MISC, LagCounterToggle, 0, 0, "Lag Counter Toggle", 0 },
|
||||
{ EMUCMD_MISC_LAGCOUNTER_RESET, EMUCMDTYPE_MISC, LagCounterReset, 0, 0, "Lag Counter Reset", 0}
|
||||
//memory watch, cheat search, debugger, ppu, hex editor, trace logger, code/data logger,
|
||||
};
|
||||
|
||||
#define NUM_EMU_CMDS (sizeof(FCEUI_CommandTable)/sizeof(FCEUI_CommandTable[0]))
|
||||
|
@ -877,4 +888,14 @@ static void ObjectDisplayToggle(void)
|
|||
FCEUI_GetRenderPlanes(spr,bg);
|
||||
spr = !spr;
|
||||
FCEUI_SetRenderPlanes(spr,bg);
|
||||
}
|
||||
}
|
||||
|
||||
static void LagCounterReset(void)
|
||||
{
|
||||
LagCounter = 0;
|
||||
}
|
||||
|
||||
static void LagCounterToggle(void)
|
||||
{
|
||||
lagCounterDisplay ^= 1;
|
||||
}
|
||||
|
|
|
@ -228,6 +228,8 @@ enum EMUCMD
|
|||
EMUCMD_MISC_USE_INPUT_PRESET_3,
|
||||
EMUCMD_MISC_DISPLAY_BG_TOGGLE,
|
||||
EMUCMD_MISC_DISPLAY_OBJ_TOGGLE,
|
||||
EMUCMD_MISC_DISPLAY_LAGCOUNTER_TOGGLE,
|
||||
EMUCMD_MISC_LAGCOUNTER_RESET,
|
||||
|
||||
EMUCMD_MAX
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue