From 06e3f96b3d18009c02fac722fce84dd036ae74e5 Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Sat, 21 Apr 2012 10:48:59 +0300 Subject: [PATCH] Add start paused option This is handy for capturing --- include/core/moviefile.hpp | 5 ++++- manual.lyx | 8 ++++++++ manual.txt | 22 +++++++++++++--------- src/core/mainloop.cpp | 4 ++-- src/core/moviefile.cpp | 2 ++ src/platform/sdl/main.cpp | 3 +++ src/platform/wxwidgets/romselect.cpp | 10 ++++++++-- 7 files changed, 40 insertions(+), 14 deletions(-) diff --git a/include/core/moviefile.hpp b/include/core/moviefile.hpp index e301ac72..12017dae 100644 --- a/include/core/moviefile.hpp +++ b/include/core/moviefile.hpp @@ -165,12 +165,15 @@ struct moviefile */ std::string prefix; /** + * Start paused flag. + */ + bool start_paused; +/** * Get number of frames in movie. * * returns: Number of frames. */ uint64_t get_frame_count() throw(); - /** * Get length of the movie * diff --git a/manual.lyx b/manual.lyx index 2a4082eb..1a15ecf8 100644 --- a/manual.lyx +++ b/manual.lyx @@ -582,6 +582,14 @@ Session options \end_layout \begin_layout Subsubsection +--pause +\end_layout + +\begin_layout Standard +Start paused +\end_layout + +\begin_layout Subsubsection (lsnes/SDL, lsnes-avidump, movieinfo) \end_layout diff --git a/manual.txt b/manual.txt index 404669b4..6cba35d2 100644 --- a/manual.txt +++ b/manual.txt @@ -247,12 +247,16 @@ Force ROM to be considered NTSC-only. 4.2 Session options -4.2.1 (lsnes/SDL, lsnes-avidump, movieinfo) +4.2.1 --pause + +Start paused + +4.2.2 (lsnes/SDL, lsnes-avidump, movieinfo) Load as movie or savestate file. All other session options are ignored. -4.2.2 --port1= (lsnes/SDL) +4.2.3 --port1= (lsnes/SDL) Set type of port1. Valid values are: @@ -265,7 +269,7 @@ Set type of port1. Valid values are: • mouse: Mouse. -4.2.3 --port2= (lsnes/SDL) +4.2.4 --port2= (lsnes/SDL) Set type of port2. Valid values are: @@ -283,29 +287,29 @@ Set type of port2. Valid values are: • justifiers: Two justifiers -4.2.4 --gamename= (lsnes/SDL) +4.2.5 --gamename= (lsnes/SDL) Set the name of game to . Default is blank. -4.2.5 --author= (lsnes/SDL) +4.2.6 --author= (lsnes/SDL) Add author with full name of (no nickname). -4.2.6 --author=| (lsnes/SDL) +4.2.7 --author=| (lsnes/SDL) Add author with nickname of (no full name). -4.2.7 --author=| (lsnes/SDL) +4.2.8 --author=| (lsnes/SDL) Add author with full name of and nickname of . -4.2.8 --rtc-second= (lsnes/SDL) +4.2.9 --rtc-second= (lsnes/SDL) Set RTC second (0 is 1st January 1970 00:00:00Z). Default is 1,000,000,000. -4.2.9 --rtc-subsecond= (lsnes/SDL) +4.2.10 --rtc-subsecond= (lsnes/SDL) Set RTC subsecond. Range is 0-. Unit is CPU cycle. Default is 0. diff --git a/src/core/mainloop.cpp b/src/core/mainloop.cpp index 11adc560..4248b49a 100644 --- a/src/core/mainloop.cpp +++ b/src/core/mainloop.cpp @@ -867,8 +867,8 @@ void main_loop(struct loaded_rom& rom, struct moviefile& initial, bool load_has_ lua_callback_startup(); - platform::set_paused(false); - amode = ADVANCE_AUTO; + platform::set_paused(initial.start_paused); + amode = initial.start_paused ? ADVANCE_PAUSE : ADVANCE_AUTO; uint64_t time_x = get_utime(); while(amode != ADVANCE_QUIT || !queued_saves.empty()) { if(handle_corrupt()) { diff --git a/src/core/moviefile.cpp b/src/core/moviefile.cpp index 6dc53210..cdd61ea2 100644 --- a/src/core/moviefile.cpp +++ b/src/core/moviefile.cpp @@ -306,10 +306,12 @@ moviefile::moviefile() throw(std::bad_alloc) is_savestate = false; movie_rtc_second = rtc_second = DEFAULT_RTC_SECOND; movie_rtc_subsecond = rtc_subsecond = DEFAULT_RTC_SUBSECOND; + start_paused = false; } moviefile::moviefile(const std::string& movie) throw(std::bad_alloc, std::runtime_error) { + start_paused = false; force_corrupt = false; is_savestate = false; std::string tmp; diff --git a/src/platform/sdl/main.cpp b/src/platform/sdl/main.cpp index 649d0c51..20531819 100644 --- a/src/platform/sdl/main.cpp +++ b/src/platform/sdl/main.cpp @@ -221,6 +221,9 @@ int main(int argc, char** argv) } if(!tried) movie = generate_movie_template(cmdline, r); + for(auto i = cmdline.begin(); i != cmdline.end(); i++) + if(*i == "--pause") + movie.start_paused = true; sdl_main_loop(r, movie); } catch(std::bad_alloc& e) { OOM_panic(); diff --git a/src/platform/wxwidgets/romselect.cpp b/src/platform/wxwidgets/romselect.cpp index 74ed16ea..e9364f61 100644 --- a/src/platform/wxwidgets/romselect.cpp +++ b/src/platform/wxwidgets/romselect.cpp @@ -474,6 +474,7 @@ private: std::map sram_choosers; wxComboBox* controller1type; wxComboBox* controller2type; + wxCheckBox* start_pause; wxTextCtrl* projectname; wxTextCtrl* prefix; wxTextCtrl* rtc_sec; @@ -857,13 +858,16 @@ wxwin_project::wxwin_project(loaded_rom& rom) //The load page. wxSizer* load_sizer = new wxFlexGridSizer(1, 3, 0, 0); - load_panel->SetSizer(load_sizer); + wxSizer* load_sizer2 = new wxBoxSizer(wxVERTICAL); + load_panel->SetSizer(load_sizer2); + load_sizer2->Add(load_sizer, 0, wxGROW); load_sizer->Add(new wxStaticText(load_panel, wxID_ANY, wxT("File to load:")), 0, wxGROW); load_sizer->Add(savefile = new wxTextCtrl(load_panel, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(500, -1)), 1, wxGROW); savefile->SetDropTarget(new textboxloadfilename(savefile)); load_sizer->Add(ask_savefile = new wxButton(load_panel, ASK_FILENAME_BUTTON, wxT("Pick")), 0, wxGROW); + load_sizer2->Add(start_pause = new wxCheckBox(load_panel, wxID_ANY, wxT("Start paused")), 0, wxGROW); savefile->Connect(wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler(wxwin_project::on_filename_change), NULL, this); ask_savefile->Connect(wxEVT_COMMAND_BUTTON_CLICKED, @@ -1034,7 +1038,9 @@ void wxwin_project::on_load(wxCommandEvent& e) { try { if(load_file) { - boot_emulator(*our_rom, *new moviefile(tostdstring(savefile->GetValue()))); + moviefile& mov = *new moviefile(tostdstring(savefile->GetValue())); + mov.start_paused = start_pause->GetValue(); + boot_emulator(*our_rom, mov); } else { boot_emulator(*our_rom, *new moviefile(make_movie())); } -- 2.11.4.GIT