Lua - added FCEU.setreadonly()

This commit is contained in:
adelikat 2009-03-15 23:21:52 +00:00
parent c9e6ca74a7
commit 8768ea1c5e
4 changed files with 36 additions and 3 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()
15-mar-2009 - adelikat - Lua - added movie.rerecordcount(), movie.length(), 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

@ -975,12 +975,19 @@ static int movie_length (lua_State *L) {
//FCEU.getreadonly
//
//returns true is emulator is in read-only mode, false if it is in read+wrte
static int fceu_readonly (lua_State *L) {
static int fceu_getreadonly (lua_State *L) {
lua_pushboolean(L, FCEUI_GetMovieToggleReadOnly());
return 1;
}
static int fceu_setreadonly (lua_State *L) {
bool which = (lua_toboolean( L, 1 ) == 1);
FCEUI_SetMovieToggleReadOnly(which);
return 0;
}
// Common code by the gui library: make sure the screen array is ready
static void gui_prepare() {
if (!gui_data)
@ -1828,7 +1835,8 @@ static const struct luaL_reg fceulib [] = {
{"message", fceu_message},
{"lagcount", fceu_lagcount},
{"lagged", fceu_lagged},
{"getreadonly", fceu_readonly},
{"getreadonly", fceu_getreadonly},
{"setreadonly", fceu_setreadonly},
{NULL,NULL}
};

View File

@ -1164,6 +1164,30 @@ bool FCEUI_GetMovieToggleReadOnly()
return movie_readonly;
}
void FCEUI_SetMovieToggleReadOnly(bool which)
{
if (which) //If set to readonly
{
if (!movie_readonly) //If not already set
{
movie_readonly = true;
FCEU_DispMessage("Movie is now Read-Only.");
}
else //Else restate message
FCEU_DispMessage("Movie is Read-Only.");
}
else //If set to read+write
{
if (movie_readonly) //If not already set
{
movie_readonly = false;
FCEU_DispMessage("Movie is now Read+Write.");
}
else //Else restate message
FCEU_DispMessage("Movie is Read+Write.");
}
}
void FCEUI_MovieToggleReadOnly()
{
if(movie_readonly)

View File

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