diff --git a/gfx.cpp b/gfx.cpp index 7397338f..d934bf38 100644 --- a/gfx.cpp +++ b/gfx.cpp @@ -186,6 +186,7 @@ #include "screenshot.h" #include "font.h" #include "display.h" +#include "lua-engine.h" extern struct SCheatData Cheat; extern struct SLineData LineData[240]; @@ -433,6 +434,9 @@ void S9xEndScreenRefresh (void) if (Settings.AutoDisplayMessages) S9xDisplayMessages(GFX.Screen, GFX.RealPPL, IPPU.RenderedScreenWidth, IPPU.RenderedScreenHeight, 1); +#ifdef HAVE_LUA + CallRegisteredLuaFunctions(LUACALL_AFTEREMULATIONGUI); +#endif S9xDeinitUpdate(IPPU.RenderedScreenWidth, IPPU.RenderedScreenHeight); } } diff --git a/lua-engine.cpp b/lua-engine.cpp index 870c59c9..bc9fa7b4 100644 --- a/lua-engine.cpp +++ b/lua-engine.cpp @@ -3,6 +3,7 @@ #include "port.h" #include "snes9x.h" +#include "display.h" #include "lua-engine.h" #include #include @@ -1020,14 +1021,14 @@ DEFINE_LUA_FUNCTION(print, "...") } -/* + DEFINE_LUA_FUNCTION(emu_message, "str") { const char* str = toCString(L); - osd->addLine(str); + S9xSetInfoString(str); return 0; } -*/ + // provides an easy way to copy a table from Lua // (simple assignment only makes an alias, but sometimes an independent table is desired) @@ -3694,7 +3695,7 @@ static const struct luaL_reg emulib [] = {"registerstart", emu_registerstart}, {"registerexit", emu_registerexit}, {"persistglobalvariables", emu_persistglobalvariables}, -// {"message", emu_message}, + {"message", emu_message}, {"print", print}, // sure, why not {"openscript", emu_openscript}, // {"loadrom", emu_loadrom}, diff --git a/win32/win32_display.cpp b/win32/win32_display.cpp index 0bf3498b..52a34df2 100644 --- a/win32/win32_display.cpp +++ b/win32/win32_display.cpp @@ -183,6 +183,7 @@ #include "../snes9x.h" #include "../ppu.h" #include "../font.h" +#include "../lua-engine.h" #include "wsnes9x.h" #include "win32_display.h" #include "CDirect3D.h" @@ -221,6 +222,10 @@ void WinRefreshDisplay(void) if(!Src.Width) return; +#ifdef HAVE_LUA + CallRegisteredLuaFunctions(LUACALL_AFTEREMULATIONGUI); +#endif + SelectRenderMethod (); S9xDisplayOutput->Render(Src);