From b77c835d8a388c935516b5ce14ecf827ff5b0142 Mon Sep 17 00:00:00 2001 From: feos-tas Date: Sat, 15 Mar 2014 22:04:04 +0000 Subject: [PATCH] Lua doesn't anymore remind the speed is *still* normal each time the script is edited. That uncovered a design bug, uncomment back the message no one saw because of the above, once some solution (and good use for it) is found. --- trunk/src/lua-engine.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/trunk/src/lua-engine.cpp b/trunk/src/lua-engine.cpp index ba1dae37..0d184d86 100644 --- a/trunk/src/lua-engine.cpp +++ b/trunk/src/lua-engine.cpp @@ -120,6 +120,7 @@ extern void AddRecentLuaFile(const char *filename); #endif extern bool turbo; +extern int32 fps_scale; struct LuaSaveState { std::string filename; @@ -274,7 +275,8 @@ static void FCEU_LuaOnStop() gui_used = GUI_CLEAR; //if (wasPaused && !FCEUI_EmulationPaused()) // FCEUI_ToggleEmulationPause(); - FCEUD_SetEmulationSpeed(EMUSPEED_NORMAL); //TODO: Ideally lua returns the speed to the speed the user set before running the script + if (fps_scale != 256) //thanks, we already know it's on normal speed + FCEUD_SetEmulationSpeed(EMUSPEED_NORMAL); //TODO: Ideally lua returns the speed to the speed the user set before running the script //rather than returning it to normal, and turbo off. Perhaps some flags and a FCEUD_GetEmulationSpeed function turbo = false; //FCEUD_TurboOff(); @@ -5607,7 +5609,10 @@ void FCEU_LuaFrameBoundary() } else { FCEU_LuaOnStop(); - FCEU_DispMessage("Script died of natural causes.\n",0); + //FCEU_DispMessage("Script died of natural causes.\n",0); + // weird sequence of functions calls the above message each time the script starts or stops, + // then this message is overrided by "emu speed" within the same frame, which hides this bug + // uncomment onse solution is found } // Past here, the nes actually runs, so any Lua code is called mid-frame. We must