diff --git a/trunk/output/fceux.chm b/trunk/output/fceux.chm index 77049e98..e3d44b1a 100644 Binary files a/trunk/output/fceux.chm and b/trunk/output/fceux.chm differ diff --git a/trunk/src/config.cpp b/trunk/src/config.cpp index 2f007517..aa67461c 100644 --- a/trunk/src/config.cpp +++ b/trunk/src/config.cpp @@ -21,7 +21,7 @@ char *FCEUI_GetAboutString() { "zeromus, punkrockguy318 (Lukas Sabota)\n" "\n" "Current Contributors:\n" - "CaH4e3, rainwarrior, feos\n" + "CaH4e3, feos, rainwarrior\n" "\n" "Past Contributors:\n" "xhainingx, gocha, AnS\n" diff --git a/trunk/src/drivers/win/main.h b/trunk/src/drivers/win/main.h index 3589e816..195c5059 100644 --- a/trunk/src/drivers/win/main.h +++ b/trunk/src/drivers/win/main.h @@ -143,6 +143,8 @@ void RemoveDirs(); void CreateDirs(); void SetDirs(); void FCEUX_LoadMovieExtras(const char * fname); +bool ALoad(const char* nameo, char* innerFilename = 0, bool silent = false); //void initDirectories(); //adelikat 03/02/09 - commenting out reference to a directory that I commented out + #endif diff --git a/trunk/src/drivers/win/window.h b/trunk/src/drivers/win/window.h index b600c317..d0f145c8 100644 --- a/trunk/src/drivers/win/window.h +++ b/trunk/src/drivers/win/window.h @@ -32,7 +32,6 @@ void ByebyeWindow(); void DoTimingConfigFix(); int CreateMainWindow(); void UpdateCheckedMenuItems(); -bool ALoad(const char* nameo, char* innerFilename = 0, bool silent = false); void LoadNewGamey(HWND hParent, const char *initialdir); int BrowseForFolder(HWND hParent, const char *htext, char *buf); void SetMainWindowStuff(); diff --git a/trunk/src/lua-engine.cpp b/trunk/src/lua-engine.cpp index e4dabff8..74065e0c 100644 --- a/trunk/src/lua-engine.cpp +++ b/trunk/src/lua-engine.cpp @@ -28,6 +28,7 @@ #ifdef WIN32 #include "drivers/win/common.h" +#include "drivers/win/main.h" #include "drivers/win/taseditor/selection.h" #include "drivers/win/taseditor/laglog.h" #include "drivers/win/taseditor/markers.h" @@ -462,7 +463,44 @@ static int emu_message(lua_State *L) { FCEU_DispMessage("%s",0, msg); return 0; +} +// emu.getdir() +// +// Returns the path of fceux.exe as a string. +static int emu_getdir(lua_State *L) { +#ifdef WIN32 + TCHAR fullPath[2048]; + TCHAR driveLetter[3]; + TCHAR directory[2048]; + TCHAR finalPath[2048]; + + GetModuleFileName(NULL, fullPath, 2048); + _splitpath(fullPath, driveLetter, directory, NULL, NULL); + snprintf(finalPath, sizeof(finalPath), "%s%s", driveLetter, directory); + lua_pushstring(L, finalPath); + + return 1; +#endif +} + +// emu.loadrom(string filename) +// +// Loads the rom from the directory relative to the lua script or from the absolute path. +// If the rom can't e loaded, loads the most recent one. +static int emu_loadrom(lua_State *L) { +#ifdef WIN32 + const char *nameo2 = luaL_checkstring(L,1); + char nameo[2048]; + strncpy(nameo, nameo2, sizeof(nameo)); + if (!ALoad(nameo)) { + extern void LoadRecentRom(int slot); + LoadRecentRom(0); + return 0; + } else { + return 1; + } +#endif } @@ -5396,6 +5434,8 @@ static const struct luaL_reg emulib [] = { {"getscreenpixel", emu_getscreenpixel}, {"readonly", movie_getreadonly}, {"setreadonly", movie_setreadonly}, + {"getdir", emu_getdir}, + {"loadrom", emu_loadrom}, {"print", print}, // sure, why not {NULL,NULL} }; diff --git a/trunk/vc/Help/fceux.hnd b/trunk/vc/Help/fceux.hnd index dc625b6a..d4956db6 100644 Binary files a/trunk/vc/Help/fceux.hnd and b/trunk/vc/Help/fceux.hnd differ