Win32 - Lua - a -lua commandline argument added. Loads a lua script on startup.

This commit is contained in:
adelikat 2009-02-22 18:13:38 +00:00
parent c998ec322c
commit d2cae8aef0
4 changed files with 12 additions and 1 deletions

View File

@ -1,4 +1,5 @@
---version 2.0.4 yet to be released--- ---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 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 - 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 21-feb-2009 - adelikat - win32 - Message Log - remembers X,Y position

View File

@ -26,6 +26,7 @@
char* MovieToLoad = 0; //Loads a movie file on startup 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* 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* ConfigToLoad = 0; //Loads a specific .cfg file (loads before any other commandline options
char* LuaToLoad = 0; //Loads a specific lua file
extern bool turbo; extern bool turbo;
// TODO: Parsing arguments needs to be improved a lot. A LOT. // 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}, {"-clipsides",0,&eoptions,0x8000|EO_CLIPSIDES},
{"-nothrottle",0,&eoptions,0x8000|EO_NOTHROTTLE}, {"-nothrottle",0,&eoptions,0x8000|EO_NOTHROTTLE},
{"-playmovie",0,&MovieToLoad,0x4001}, {"-playmovie",0,&MovieToLoad,0x4001},
{"-lua",0,&LuaToLoad,0x4001},
{"-loadstate",0,&StateToLoad,0x4001}, {"-loadstate",0,&StateToLoad,0x4001},
{"-readonly",0,&replayReadOnlySetting,0}, {"-readonly",0,&replayReadOnlySetting,0},
{"-stopframe",0,&replayStopFrameSetting,0}, {"-stopframe",0,&replayStopFrameSetting,0},

View File

@ -1,6 +1,7 @@
extern char* MovieToLoad; //Contains the filename of the savestate specified in the command line argument 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* 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 bool replayReadOnlySetting;
extern int replayStopFrameSetting; extern int replayStopFrameSetting;
extern int PauseAfterLoad; extern int PauseAfterLoad;

View File

@ -100,6 +100,7 @@
// External functions // External functions
extern std::string cfgFile; //Contains the filename of the config file used. extern std::string cfgFile; //Contains the filename of the config file used.
extern bool turbo; //Is game in turbo mode? 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 ResetVideo(void);
void ShowCursorAbs(int w); void ShowCursorAbs(int w);
void HideFWindow(int h); void HideFWindow(int h);
@ -679,6 +680,12 @@ int main(int argc,char *argv[])
free(StateToLoad); free(StateToLoad);
StateToLoad = NULL; StateToLoad = NULL;
} }
if(LuaToLoad);
{
FCEU_LoadLuaCode(LuaToLoad);
free(LuaToLoad);
LuaToLoad = NULL;
}
if (MemWatchLoadOnStart) CreateMemWatch(); if (MemWatchLoadOnStart) CreateMemWatch();
if (PauseAfterLoad) FCEUI_ToggleEmulationPause(); if (PauseAfterLoad) FCEUI_ToggleEmulationPause();
SetAutoFirePattern(AFon, AFoff); SetAutoFirePattern(AFon, AFoff);