Changes to how read-only works
* Add command that loads savestate in current mode. * Make jukebox loads use current mode. * Fix truncation of movie when current_frame = 0 * Add command to set read-only mode * Add command to toggle read-only mode
This commit is contained in:
parent
3517ba2eee
commit
95b0df8a8b
5 changed files with 57 additions and 3 deletions
|
@ -622,7 +622,7 @@ namespace
|
|||
[]() throw(std::bad_alloc, std::runtime_error) {
|
||||
if(!save_jukebox.size())
|
||||
throw std::runtime_error("No saves in jukebox");
|
||||
mark_pending_load(save_jukebox[save_jukebox_pointer], LOAD_STATE_RW);
|
||||
mark_pending_load(save_jukebox[save_jukebox_pointer], LOAD_STATE_CURRENT);
|
||||
});
|
||||
|
||||
function_ptr_command<> save_jukebox_c("save-jukebox", "Save save to jukebox",
|
||||
|
@ -683,6 +683,12 @@ namespace
|
|||
pending_reset_cycles = 0;
|
||||
});
|
||||
|
||||
function_ptr_command<arg_filename> load_c("load", "Load savestate (current mode)",
|
||||
"Syntax: load <file>\nLoads SNES state from <file> in current mode\n",
|
||||
[](arg_filename args) throw(std::bad_alloc, std::runtime_error) {
|
||||
mark_pending_load(args, LOAD_STATE_CURRENT);
|
||||
});
|
||||
|
||||
function_ptr_command<arg_filename> load_state_c("load-state", "Load savestate (R/W)",
|
||||
"Syntax: load-state <file>\nLoads SNES state from <file> in Read/Write mode\n",
|
||||
[](arg_filename args) throw(std::bad_alloc, std::runtime_error) {
|
||||
|
@ -729,6 +735,25 @@ namespace
|
|||
window::notify_screen_update();
|
||||
});
|
||||
|
||||
function_ptr_command<> set_romode("set-romode", "Switch to read-only mode",
|
||||
"Syntax: set-romode\nSwitches to read-only mode\n",
|
||||
[]() throw(std::bad_alloc, std::runtime_error) {
|
||||
movb.get_movie().readonly_mode(true);
|
||||
update_movie_state();
|
||||
window::notify_screen_update();
|
||||
});
|
||||
|
||||
function_ptr_command<> toggle_rwmode("toggle-rwmode", "Toggle read/write mode",
|
||||
"Syntax: toggle-rwmode\nToggles read/write mode\n",
|
||||
[]() throw(std::bad_alloc, std::runtime_error) {
|
||||
bool c = movb.get_movie().readonly_mode();
|
||||
movb.get_movie().readonly_mode(!c);
|
||||
if(c)
|
||||
lua_callback_do_readwrite();
|
||||
update_movie_state();
|
||||
window::notify_screen_update();
|
||||
});
|
||||
|
||||
function_ptr_command<> repaint("repaint", "Redraw the screen",
|
||||
"Syntax: repaint\nRedraws the screen\n",
|
||||
[]() throw(std::bad_alloc, std::runtime_error) {
|
||||
|
|
|
@ -450,6 +450,7 @@ void movie::readonly_mode(bool enable) throw(std::bad_alloc)
|
|||
//Transitioning to readwrite mode, we have to adjust the length of the movie data.
|
||||
if(current_frame == 0) {
|
||||
//WTF... At before first frame. Blank the entiere movie.
|
||||
frames_in_movie = 0;
|
||||
movie_data.clear();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -177,6 +177,7 @@ void do_save_movie(const std::string& filename) throw(std::bad_alloc, std::runti
|
|||
//Load state from loaded movie file (does not catch errors).
|
||||
void do_load_state(struct moviefile& _movie, int lmode)
|
||||
{
|
||||
bool current_mode = movb.get_movie().readonly_mode();
|
||||
if(_movie.force_corrupt)
|
||||
throw std::runtime_error("Movie file invalid");
|
||||
bool will_load_state = _movie.is_savestate && lmode != LOAD_STATE_MOVIE;
|
||||
|
@ -258,7 +259,9 @@ void do_load_state(struct moviefile& _movie, int lmode)
|
|||
//Activate RW mode if needed.
|
||||
if(lmode == LOAD_STATE_RW)
|
||||
movb.get_movie().readonly_mode(false);
|
||||
if(lmode == LOAD_STATE_DEFAULT && !(movb.get_movie().get_frame_count()))
|
||||
if(lmode == LOAD_STATE_DEFAULT && movb.get_movie().get_frame_count() <= movb.get_movie().get_current_frame())
|
||||
movb.get_movie().readonly_mode(false);
|
||||
if(lmode == LOAD_STATE_CURRENT && !current_mode)
|
||||
movb.get_movie().readonly_mode(false);
|
||||
messages << "ROM Type ";
|
||||
switch(our_rom->rtype) {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#define LOAD_STATE_PRESERVE 2
|
||||
#define LOAD_STATE_MOVIE 3
|
||||
#define LOAD_STATE_DEFAULT 4
|
||||
#define LOAD_STATE_CURRENT 5
|
||||
#define SAVE_STATE 0
|
||||
#define SAVE_MOVIE 1
|
||||
|
||||
|
|
26
manual.lyx
26
manual.lyx
|
@ -1095,6 +1095,14 @@ reset
|
|||
Reset the SNES after this frame.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsubsection
|
||||
load <filename>
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
Load savestate <filename> in current mode.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsubsection
|
||||
load-state <filename>
|
||||
\end_layout
|
||||
|
@ -1151,6 +1159,22 @@ set-rwmode
|
|||
Set read-write mode.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsubsection
|
||||
set-romode
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
Set read-only mode
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsubsection
|
||||
toggle-rwmode
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
Toggle between read-only and read-write modes.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsubsection
|
||||
set-gamename <name>
|
||||
\end_layout
|
||||
|
@ -1353,7 +1377,7 @@ load-jukebox
|
|||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
Do R/W load from jukebox.
|
||||
Do load from jukebox (current mode).
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsubsection
|
||||
|
|
Loading…
Add table
Reference in a new issue