Lua - added movie.getname()

This commit is contained in:
adelikat 2009-03-15 23:46:57 +00:00
parent 8768ea1c5e
commit 5c4579f859
4 changed files with 23 additions and 2 deletions

View File

@ -1,5 +1,5 @@
---version 2.0.4 yet to be released---
15-mar-2009 - adelikat - Lua - added movie.rerecordcount(), movie.length(), FCEU.getreadonly(), FCEU.setreadonly()
15-mar-2009 - adelikat - Lua - added movie.rerecordcount(), movie.length(), movie.getname, FCEU.getreadonly(), FCEU.setreadonly()
14-mar-2009 - adelikat - Lua - added movie.active() - returns a bool value based on whether a movie is currently loaded
14-mar-2009 - adelikat - Fixed Joypad.set, it uses 3 values instead of 2 now. True will take control of a button and make it on, False will take control and make it off, and Nil will not take control (allowing the user to press the button)
14-mar-2009 - adelikat - Fix major crash issue where NROM game savestates were writing erroneous information if a non NROM game was loaded prior

View File

@ -981,6 +981,9 @@ static int fceu_getreadonly (lua_State *L) {
return 1;
}
//FCEU.setreadonly
//
//Sets readonly / read+write status
static int fceu_setreadonly (lua_State *L) {
bool which = (lua_toboolean( L, 1 ) == 1);
FCEUI_SetMovieToggleReadOnly(which);
@ -988,6 +991,19 @@ static int fceu_setreadonly (lua_State *L) {
return 0;
}
//movie.getname
//
//returns the filename of the movie loaded
static int movie_getname (lua_State *L) {
if (!FCEUMOV_IsRecording() && !FCEUMOV_IsPlaying())
luaL_error(L, "No movie loaded.");
std::string name = FCEUI_GetMovieName();
lua_pushstring(L, name.c_str());
return 1;
}
// Common code by the gui library: make sure the screen array is ready
static void gui_prepare() {
if (!gui_data)
@ -1896,6 +1912,7 @@ static const struct luaL_reg movielib[] = {
{"active", movie_active},
{"length", movie_length},
{"rerecordcount", movie_rerecordcount},
{"getname", movie_getname},
// {"record", movie_record},
// {"playback", movie_playback},

View File

@ -1187,7 +1187,6 @@ void FCEUI_SetMovieToggleReadOnly(bool which)
FCEU_DispMessage("Movie is Read+Write.");
}
}
void FCEUI_MovieToggleReadOnly()
{
if(movie_readonly)
@ -1209,6 +1208,10 @@ void FCEUI_MoviePlayFromBeginning(void)
}
}
string FCEUI_GetMovieName(void)
{
return curMovieFilename;
}
bool FCEUI_MovieGetInfo(FCEUFILE* fp, MOVIE_INFO& info, bool skipFrameCount)
{

View File

@ -253,6 +253,7 @@ bool FCEUI_GetMovieToggleReadOnly();
void FCEUI_SetMovieToggleReadOnly(bool which);
int FCEUI_GetMovieLength();
int FCEUI_GetMovieRerecordCount();
std::string FCEUI_GetMovieName(void);
void FCEUI_MovieToggleFrameDisplay();
void FCEUI_ToggleInputDisplay(void);