From b38e181aa6b04c3723d73de91d2738bc98ace78c Mon Sep 17 00:00:00 2001 From: adelikat Date: Wed, 7 Apr 2010 23:56:15 +0000 Subject: [PATCH] Win32 - Lua console - filename updates when lua scripts are dragged to emulator or recent filenames invoked. This is done by implementing an UpdateLuaConsole() function. TOOD: there are probably other useful things for that function to do. --- changelog.txt | 3 ++- src/drivers/win/luaconsole.cpp | 9 +++++++++ src/drivers/win/window.cpp | 6 ++++++ src/lua-engine.cpp | 4 ++-- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index 615944f2..3fde0f35 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,5 @@ -07-april-2010 - adelikat - Lua console no longer unpauses the emulator when a script is loaded +07-april-2010 - adelikat - Win32 - Lua console - filename updates when lua scripts are dragged to emulator or recent filenames invoked +07-april-2010 - adelikat - Lua no longer unpauses the emulator when a script is loaded 30-march-2010 - ugetab - Win32 - Closing minimized windows no longer moves them the next time they get opened 28-march-2010 - adelikat - lua - fixed zapper.read() to read movie data if a movie is playing. Also changed the struct values to x,y,fire. This breaks lua scripts that used it previous, sorry. 04-march-2010 - prockguy - added menu buttons for loading nsf files diff --git a/src/drivers/win/luaconsole.cpp b/src/drivers/win/luaconsole.cpp index 1e9a76cc..5d65a83b 100644 --- a/src/drivers/win/luaconsole.cpp +++ b/src/drivers/win/luaconsole.cpp @@ -7,6 +7,8 @@ extern HWND hAppWnd; +void UpdateLuaConsole(const char* fname); + HWND LuaConsoleHWnd = NULL; HFONT hFont = NULL; LOGFONT LuaConsoleLogFont; @@ -355,3 +357,10 @@ INT_PTR CALLBACK DlgLuaScriptDialog(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l return false; } + +void UpdateLuaConsole(const char* fname) +{ + if (!LuaConsoleHWnd) return; + + SetWindowText(GetDlgItem(LuaConsoleHWnd, IDC_EDIT_LUAPATH), fname); +} \ No newline at end of file diff --git a/src/drivers/win/window.cpp b/src/drivers/win/window.cpp index d313c130..223d7ae7 100644 --- a/src/drivers/win/window.cpp +++ b/src/drivers/win/window.cpp @@ -144,8 +144,10 @@ const unsigned int MENU_FIRST_RECENT_FILE = 600; const unsigned int MAX_NUMBER_OF_RECENT_FILES = sizeof(recent_files)/sizeof(*recent_files); //Lua Console -------------------------------------------- +//TODO: these need to be in a header file instead extern HWND LuaConsoleHWnd; extern INT_PTR CALLBACK DlgLuaScriptDialog(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); +extern void UpdateLuaConsole(const char* fname); //Recent Lua Menu ---------------------------------------- char *recent_lua[] = {0,0,0,0,0}; @@ -1369,7 +1371,10 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) //------------------------------------------------------- #ifdef _S9XLUA_H else if (!(fileDropped.find(".lua") == string::npos) && (fileDropped.find(".lua") == fileDropped.length()-4)) + { FCEU_LoadLuaCode(ftmp); + UpdateLuaConsole(fileDropped.c_str()); + } #endif //------------------------------------------------------- //Check if Ram Watch file @@ -1433,6 +1438,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) //} //adelikat: Commenting this code out because it is annoying in context lua scripts since lua scripts will frequently give errors to those developing them. It is frustrating for this to pop up every time. } + UpdateLuaConsole(fname); } } #endif diff --git a/src/lua-engine.cpp b/src/lua-engine.cpp index 70a5d789..898a6eac 100644 --- a/src/lua-engine.cpp +++ b/src/lua-engine.cpp @@ -3578,8 +3578,8 @@ static int gui_text(lua_State *L) { y = luaL_checkinteger(L,2); msg = luaL_checkstring(L,3); -// if (x < 0 || x >= LUA_SCREEN_WIDTH || y < 0 || y >= (LUA_SCREEN_HEIGHT - font_height)) -// luaL_error(L,"bad coordinates"); + //if (x < 0 || x >= LUA_SCREEN_WIDTH || y < 0 || y >= (LUA_SCREEN_HEIGHT - font_height)) + // luaL_error(L,"bad coordinates"); #if 0 uint32 colour = gui_optcolour(L,4,LUA_BUILD_PIXEL(255, 255, 255, 255));