Lua - added movie.rerecordcount() and movie.length()

This commit is contained in:
adelikat 2009-03-15 21:12:15 +00:00
parent b947e0d25b
commit ee99847b35
4 changed files with 41 additions and 1 deletions

View File

@ -1,4 +1,5 @@
---version 2.0.4 yet to be released---
15-mar-2009 - adelikat - Lua - added movie.rerecordcount() and movie.length()
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

@ -939,7 +939,7 @@ static int movie_stop(lua_State *L) {
// movie.active()
//
//returns a bool value is there is a movie currently opn
//returns a bool value is there is a movie currently open
int movie_active (lua_State *L) {
bool movieactive = (FCEUMOV_IsRecording() || FCEUMOV_IsPlaying());
@ -947,6 +947,31 @@ int movie_active (lua_State *L) {
return 1;
}
//movie.rerecordcount()
//
//returns the rerecord count of the current movie
static int movie_rerecordcount (lua_State *L) {
if (!FCEUMOV_IsRecording() && !FCEUMOV_IsPlaying())
luaL_error(L, "No movie loaded.");
lua_pushinteger(L, FCEUI_GetMovieRerecordCount());
return 1;
}
//movie.length()
//
//returns an int value representing the total length of the current movie loaded
static int movie_length (lua_State *L) {
if (!FCEUMOV_IsRecording() && !FCEUMOV_IsPlaying())
luaL_error(L, "No movie loaded.");
lua_pushinteger(L, FCEUI_GetMovieLength());
return 1;
}
// Common code by the gui library: make sure the screen array is ready
static void gui_prepare() {
if (!gui_data)
@ -1851,6 +1876,8 @@ static const struct luaL_reg movielib[] = {
{"rerecordcounting", movie_rerecordcounting},
{"stop", movie_stop},
{"active", movie_active},
{"length", movie_length},
{"rerecordcount", movie_rerecordcount},
// {"record", movie_record},
// {"playback", movie_playback},

View File

@ -1149,6 +1149,16 @@ void FCEUI_ToggleInputDisplay(void)
}
}
int FCEUI_GetMovieLength()
{
return currMovieData.records.size();
}
int FCEUI_GetMovieRerecordCount()
{
return currMovieData.rerecordCount;
}
bool FCEUI_GetMovieToggleReadOnly()
{
return movie_readonly;

View File

@ -250,6 +250,8 @@ bool FCEUI_MovieGetInfo(FCEUFILE* fp, MOVIE_INFO& info, bool skipFrameCount = fa
char* FCEUI_MovieGetCurrentName(int addSlotNumber);
void FCEUI_MovieToggleReadOnly(void);
bool FCEUI_GetMovieToggleReadOnly();
int FCEUI_GetMovieLength();
int FCEUI_GetMovieRerecordCount();
void FCEUI_MovieToggleFrameDisplay();
void FCEUI_ToggleInputDisplay(void);