Added emu.setlagflag() Lua function

This commit is contained in:
ansstuff 2012-09-13 19:48:14 +00:00
parent 95a301dbb2
commit 35541256d7
5 changed files with 22 additions and 4 deletions

View File

@ -622,7 +622,8 @@ void UpdateDebugger()
return; return;
//but if the debugger IS visible, then focus it //but if the debugger IS visible, then focus it
SetActiveWindow(hDebug); ShowWindow(hDebug, SW_SHOWNORMAL);
SetForegroundWindow(hDebug);
char str[512] = {0}, str2[512] = {0}, chr[8]; char str[512] = {0}, str2[512] = {0}, chr[8];
int tmp,ret,i; int tmp,ret,i;

View File

@ -802,7 +802,7 @@ BEGIN
END END
MESSAGELOG DIALOGEX 33, 38, 197, 229 MESSAGELOG DIALOGEX 33, 38, 197, 229
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Message Log" CAPTION "Message Log"
FONT 9, "MS Shell Dlg", 0, 0, 0x0 FONT 9, "MS Shell Dlg", 0, 0, 0x0
BEGIN BEGIN

View File

@ -2642,6 +2642,15 @@ int emu_lagged (lua_State *L) {
return 1; return 1;
} }
//emu_setlagflag(bool value)
//
//Returns true if the game is currently on a lag frame
int emu_setlagflag(lua_State *L)
{
FCEUI_SetLagFlag(lua_toboolean(L, 1) == 1);
return 0;
}
// boolean emu.emulating() // boolean emu.emulating()
int emu_emulating(lua_State *L) { int emu_emulating(lua_State *L) {
lua_pushboolean(L, GameInfo != NULL); lua_pushboolean(L, GameInfo != NULL);
@ -5199,6 +5208,7 @@ static const struct luaL_reg emulib [] = {
{"framecount", emu_framecount}, {"framecount", emu_framecount},
{"lagcount", emu_lagcount}, {"lagcount", emu_lagcount},
{"lagged", emu_lagged}, {"lagged", emu_lagged},
{"setlagflag", emu_setlagflag},
{"emulating", emu_emulating}, {"emulating", emu_emulating},
{"registerbefore", emu_registerbefore}, {"registerbefore", emu_registerbefore},
{"registerafter", emu_registerafter}, {"registerafter", emu_registerafter},

View File

@ -498,8 +498,14 @@ int FCEUI_GetLagCount(void)
bool FCEUI_GetLagged(void) bool FCEUI_GetLagged(void)
{ {
if (lagFlag) return true; if (lagFlag)
else return false; return true;
else
return false;
}
void FCEUI_SetLagFlag(bool value)
{
lagFlag = (value) ? 1 : 0;
} }
bool FCEUMOV_ShouldPause(void) bool FCEUMOV_ShouldPause(void)

View File

@ -82,6 +82,7 @@ bool FCEUMOV_ShouldPause(void);
int FCEUMOV_GetFrame(void); int FCEUMOV_GetFrame(void);
int FCEUI_GetLagCount(void); int FCEUI_GetLagCount(void);
bool FCEUI_GetLagged(void); bool FCEUI_GetLagged(void);
void FCEUI_SetLagFlag(bool value);
int FCEUMOV_WriteState(EMUFILE* os); int FCEUMOV_WriteState(EMUFILE* os);
bool FCEUMOV_ReadState(EMUFILE* is, uint32 size); bool FCEUMOV_ReadState(EMUFILE* is, uint32 size);