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.

This commit is contained in:
adelikat 2010-04-07 23:56:15 +00:00
parent b7b4629019
commit b38e181aa6
4 changed files with 19 additions and 3 deletions

View File

@ -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 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. 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 04-march-2010 - prockguy - added menu buttons for loading nsf files

View File

@ -7,6 +7,8 @@
extern HWND hAppWnd; extern HWND hAppWnd;
void UpdateLuaConsole(const char* fname);
HWND LuaConsoleHWnd = NULL; HWND LuaConsoleHWnd = NULL;
HFONT hFont = NULL; HFONT hFont = NULL;
LOGFONT LuaConsoleLogFont; LOGFONT LuaConsoleLogFont;
@ -355,3 +357,10 @@ INT_PTR CALLBACK DlgLuaScriptDialog(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
return false; return false;
} }
void UpdateLuaConsole(const char* fname)
{
if (!LuaConsoleHWnd) return;
SetWindowText(GetDlgItem(LuaConsoleHWnd, IDC_EDIT_LUAPATH), fname);
}

View File

@ -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); const unsigned int MAX_NUMBER_OF_RECENT_FILES = sizeof(recent_files)/sizeof(*recent_files);
//Lua Console -------------------------------------------- //Lua Console --------------------------------------------
//TODO: these need to be in a header file instead
extern HWND LuaConsoleHWnd; extern HWND LuaConsoleHWnd;
extern INT_PTR CALLBACK DlgLuaScriptDialog(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); extern INT_PTR CALLBACK DlgLuaScriptDialog(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
extern void UpdateLuaConsole(const char* fname);
//Recent Lua Menu ---------------------------------------- //Recent Lua Menu ----------------------------------------
char *recent_lua[] = {0,0,0,0,0}; 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 #ifdef _S9XLUA_H
else if (!(fileDropped.find(".lua") == string::npos) && (fileDropped.find(".lua") == fileDropped.length()-4)) else if (!(fileDropped.find(".lua") == string::npos) && (fileDropped.find(".lua") == fileDropped.length()-4))
{
FCEU_LoadLuaCode(ftmp); FCEU_LoadLuaCode(ftmp);
UpdateLuaConsole(fileDropped.c_str());
}
#endif #endif
//------------------------------------------------------- //-------------------------------------------------------
//Check if Ram Watch file //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. //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 #endif

View File

@ -3578,8 +3578,8 @@ static int gui_text(lua_State *L) {
y = luaL_checkinteger(L,2); y = luaL_checkinteger(L,2);
msg = luaL_checkstring(L,3); msg = luaL_checkstring(L,3);
// if (x < 0 || x >= LUA_SCREEN_WIDTH || y < 0 || y >= (LUA_SCREEN_HEIGHT - font_height)) //if (x < 0 || x >= LUA_SCREEN_WIDTH || y < 0 || y >= (LUA_SCREEN_HEIGHT - font_height))
// luaL_error(L,"bad coordinates"); // luaL_error(L,"bad coordinates");
#if 0 #if 0
uint32 colour = gui_optcolour(L,4,LUA_BUILD_PIXEL(255, 255, 255, 255)); uint32 colour = gui_optcolour(L,4,LUA_BUILD_PIXEL(255, 255, 255, 255));