From d2cae8aef01a50821ae6ab1bb6dd07173adcf615 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 22 Feb 2009 18:13:38 +0000 Subject: [PATCH] Win32 - Lua - a -lua commandline argument added. Loads a lua script on startup. --- changelog.txt | 1 + src/drivers/win/args.cpp | 2 ++ src/drivers/win/args.h | 3 ++- src/drivers/win/main.cpp | 7 +++++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index c8648f29..2223a3f6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,5 @@ ---version 2.0.4 yet to be released--- +21-feb-2009 - adelikat - win32 - Lua - Added -lua commandline argment, loads a lua script on startup 21-feb-2009 - adelikat - win32 - Debugger - Added pixel display after scanline display - Thanks to DWEdit for this patch 21-feb-2009 - adelikat - win32 - Debugger - Added Run Line, Run 128 Lines buttons - Thanks to DWEdit for this patch 21-feb-2009 - adelikat - win32 - Message Log - remembers X,Y position diff --git a/src/drivers/win/args.cpp b/src/drivers/win/args.cpp index cfdd6d98..a693e762 100644 --- a/src/drivers/win/args.cpp +++ b/src/drivers/win/args.cpp @@ -26,6 +26,7 @@ char* MovieToLoad = 0; //Loads a movie file on startup char* StateToLoad = 0; //Loads a savestate on startup (after a movie is loaded, if any) char* ConfigToLoad = 0; //Loads a specific .cfg file (loads before any other commandline options +char* LuaToLoad = 0; //Loads a specific lua file extern bool turbo; // TODO: Parsing arguments needs to be improved a lot. A LOT. @@ -44,6 +45,7 @@ char *ParseArgies(int argc, char *argv[]) {"-clipsides",0,&eoptions,0x8000|EO_CLIPSIDES}, {"-nothrottle",0,&eoptions,0x8000|EO_NOTHROTTLE}, {"-playmovie",0,&MovieToLoad,0x4001}, + {"-lua",0,&LuaToLoad,0x4001}, {"-loadstate",0,&StateToLoad,0x4001}, {"-readonly",0,&replayReadOnlySetting,0}, {"-stopframe",0,&replayStopFrameSetting,0}, diff --git a/src/drivers/win/args.h b/src/drivers/win/args.h index 6f7234de..1dba10e2 100644 --- a/src/drivers/win/args.h +++ b/src/drivers/win/args.h @@ -1,6 +1,7 @@ extern char* MovieToLoad; //Contains the filename of the savestate specified in the command line argument extern char* StateToLoad; //Contains the filename of the movie file specified in the command line argument -extern char* ConfigToLoad; //Conatins the filename of the config file specified in the command line argument +extern char* ConfigToLoad; //Contains the filename of the config file specified in the command line argument +extern char* LuaToLoad; //Contains the filename of the lua script specified in the command line argument extern bool replayReadOnlySetting; extern int replayStopFrameSetting; extern int PauseAfterLoad; diff --git a/src/drivers/win/main.cpp b/src/drivers/win/main.cpp index 77b3800b..fd815ddd 100644 --- a/src/drivers/win/main.cpp +++ b/src/drivers/win/main.cpp @@ -100,6 +100,7 @@ // External functions extern std::string cfgFile; //Contains the filename of the config file used. extern bool turbo; //Is game in turbo mode? +extern int FCEU_LoadLuaCode(const char *filename); //From lua-engine.cpp. Used here to auto-load a lua script from commandline void ResetVideo(void); void ShowCursorAbs(int w); void HideFWindow(int h); @@ -679,6 +680,12 @@ int main(int argc,char *argv[]) free(StateToLoad); StateToLoad = NULL; } + if(LuaToLoad); + { + FCEU_LoadLuaCode(LuaToLoad); + free(LuaToLoad); + LuaToLoad = NULL; + } if (MemWatchLoadOnStart) CreateMemWatch(); if (PauseAfterLoad) FCEUI_ToggleEmulationPause(); SetAutoFirePattern(AFon, AFoff);