Merge branch 'rr1-maint' into rr1-gambatte
This commit is contained in:
commit
ca6247559f
9 changed files with 60 additions and 26 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1-Δ11ε1-gb0
|
||||
1-Δ12-gb0
|
||||
|
|
|
@ -100,6 +100,10 @@ struct moviefile
|
|||
* Core savestate (if is_savestate is true).
|
||||
*/
|
||||
std::vector<char> savestate; //Savestate to load (if is_savestate is true).
|
||||
/**
|
||||
* Anchoring core savestate (if not empty).
|
||||
*/
|
||||
std::vector<char> anchor_savestate;
|
||||
/**
|
||||
* Host memory (if is_savestate is true).
|
||||
*/
|
||||
|
@ -161,10 +165,9 @@ struct moviefile
|
|||
/**
|
||||
* Get length of the movie
|
||||
*
|
||||
* parameter framebias: Number of frames to subtract.
|
||||
* returns: Length of the movie in nanoseconds.
|
||||
*/
|
||||
uint64_t get_movie_length(uint64_t framebias = 0) throw();
|
||||
uint64_t get_movie_length() throw();
|
||||
};
|
||||
|
||||
std::string sanitize_prefix(const std::string& in) throw(std::bad_alloc);
|
||||
|
|
16
manual.lyx
16
manual.lyx
|
@ -447,6 +447,14 @@ Set RTC subsecond.
|
|||
Default is 0.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsubsection
|
||||
--anchor-savestate=<file> (lsnes/SDL)
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
Set the anchor savestate file.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsection
|
||||
Misc.
|
||||
options:
|
||||
|
@ -6225,5 +6233,13 @@ rr1-delta11epsilon1
|
|||
Fix step poll function
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsection
|
||||
rr1-delta12
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
Non-insane savestate anchoring
|
||||
\end_layout
|
||||
|
||||
\end_body
|
||||
\end_document
|
||||
|
|
|
@ -195,6 +195,10 @@ Set RTC second (0 is 1st January 1970 00:00:00Z). Default is
|
|||
|
||||
Set RTC subsecond. Range is 0-. Unit is CPU cycle. Default is 0.
|
||||
|
||||
4.2.11 --anchor-savestate=<file> (lsnes/SDL)
|
||||
|
||||
Set the anchor savestate file.
|
||||
|
||||
4.3 Misc. options:
|
||||
|
||||
4.3.1 --run=<file> (lsnes/SDL)
|
||||
|
@ -3084,3 +3088,7 @@ set-axis joystick0axis19 disabled
|
|||
|
||||
• Fix step poll function
|
||||
|
||||
15.67 rr1-delta12
|
||||
|
||||
• Non-insane savestate anchoring
|
||||
|
||||
|
|
|
@ -285,6 +285,8 @@ void do_load_beginning(bool reload) throw(std::bad_alloc, std::runtime_error)
|
|||
load_sram(our_movie.movie_sram);
|
||||
our_movie.rtc_second = our_movie.movie_rtc_second;
|
||||
our_movie.rtc_subsecond = our_movie.movie_rtc_subsecond;
|
||||
if(!our_movie.anchor_savestate.empty())
|
||||
load_core_state(our_movie.anchor_savestate);
|
||||
redraw_framebuffer(screen_nosignal);
|
||||
lua_callback_do_rewind();
|
||||
} catch(std::bad_alloc& e) {
|
||||
|
@ -370,6 +372,8 @@ void do_load_state(struct moviefile& _movie, int lmode)
|
|||
controls.set_port(1, *_movie.port2, true);
|
||||
_movie.rtc_second = _movie.movie_rtc_second;
|
||||
_movie.rtc_subsecond = _movie.movie_rtc_subsecond;
|
||||
if(!_movie.anchor_savestate.empty())
|
||||
load_core_state(_movie.anchor_savestate);
|
||||
}
|
||||
} catch(std::bad_alloc& e) {
|
||||
OOM_panic();
|
||||
|
|
|
@ -356,6 +356,8 @@ moviefile::moviefile(const std::string& movie) throw(std::bad_alloc, std::runtim
|
|||
read_numeric_file(r, "starttime.subsecond", movie_rtc_subsecond, true);
|
||||
rtc_second = movie_rtc_second;
|
||||
rtc_subsecond = movie_rtc_subsecond;
|
||||
if(r.has_member("savestate.anchor"))
|
||||
anchor_savestate = read_raw_file(r, "savestate.anchor");
|
||||
if(r.has_member("savestate")) {
|
||||
is_savestate = true;
|
||||
if(r.has_member("moviestate"))
|
||||
|
@ -415,6 +417,8 @@ void moviefile::save(const std::string& movie, unsigned compression) throw(std::
|
|||
write_raw_file(w, "moviesram." + i.first, i.second);
|
||||
write_numeric_file(w, "starttime.second", movie_rtc_second);
|
||||
write_numeric_file(w, "starttime.subsecond", movie_rtc_subsecond);
|
||||
if(!anchor_savestate.empty())
|
||||
write_raw_file(w, "savestate.anchor", anchor_savestate);
|
||||
if(is_savestate) {
|
||||
write_numeric_file(w, "saveframe", save_frame);
|
||||
write_numeric_file(w, "lagcounter", lagged_frames);
|
||||
|
@ -424,8 +428,8 @@ void moviefile::save(const std::string& movie, unsigned compression) throw(std::
|
|||
write_raw_file(w, "screenshot", screenshot);
|
||||
for(auto i : sram)
|
||||
write_raw_file(w, "sram." + i.first, i.second);
|
||||
write_numeric_file(w, "savetime.second", rtc_second);
|
||||
write_numeric_file(w, "savetime.subsecond", rtc_subsecond);
|
||||
write_numeric_file(w, "savetime.second", rtc_second);
|
||||
write_numeric_file(w, "savetime.subsecond", rtc_subsecond);
|
||||
}
|
||||
write_authors_file(w, authors);
|
||||
write_input(w, input);
|
||||
|
@ -444,20 +448,11 @@ namespace
|
|||
const int BLOCK_FRAMES = 1;
|
||||
const int STEP_W = 2;
|
||||
const int STEP_N = 3;
|
||||
|
||||
uint64_t magic[2][4] = {
|
||||
{178683, 10738636, 16639264, 596096},
|
||||
{6448, 322445, 19997208, 266440}
|
||||
};
|
||||
}
|
||||
|
||||
uint64_t moviefile::get_movie_length(uint64_t framebias) throw()
|
||||
uint64_t moviefile::get_movie_length() throw()
|
||||
{
|
||||
uint64_t frames = get_frame_count();
|
||||
if(frames > framebias)
|
||||
frames -= framebias;
|
||||
else
|
||||
frames = 0;
|
||||
uint64_t _magic[4];
|
||||
gametype->fill_framerate_magic(_magic);
|
||||
uint64_t t = _magic[BLOCK_SECONDS] * 1000000000ULL * (frames / _magic[BLOCK_FRAMES]);
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "core/rrdata.hpp"
|
||||
#include "core/settings.hpp"
|
||||
#include "core/window.hpp"
|
||||
#include "library/zip.hpp"
|
||||
|
||||
#include "platform/sdl/platform.hpp"
|
||||
|
||||
|
@ -56,8 +57,9 @@ struct moviefile generate_movie_template(std::vector<std::string> cmdline, loade
|
|||
}
|
||||
if(o.length() >= 16 && o.substr(0, 16) == "--rtc-subsecond=") {
|
||||
movie.rtc_subsecond = movie.movie_rtc_subsecond = parse_value<int64_t>(o.substr(16));
|
||||
if(movie.rtc_subsecond < 0 || movie.rtc_subsecond > 3462619485019ULL)
|
||||
throw std::runtime_error("Bad RTC subsecond value (range is 0-3462619485019)");
|
||||
}
|
||||
if(o.length() >= 19 && o.substr(0, 19) == "--anchor-savestate=") {
|
||||
movie.anchor_savestate = read_file_relative(o.substr(19), "");
|
||||
}
|
||||
}
|
||||
movie.input.clear(*movie.port1, *movie.port2);
|
||||
|
|
|
@ -773,7 +773,7 @@ wxwin_project::wxwin_project(loaded_rom& rom)
|
|||
wxFlexGridSizer* new_sizer = new wxFlexGridSizer(3, 1, 0, 0);
|
||||
new_panel->SetSizer(new_sizer);
|
||||
//Controllertypes/Gamename/initRTC/SRAMs.
|
||||
wxFlexGridSizer* mainblock = new wxFlexGridSizer(5 + sram_set.size(), 2, 0, 0);
|
||||
wxFlexGridSizer* mainblock = new wxFlexGridSizer(6 + sram_set.size(), 2, 0, 0);
|
||||
mainblock->Add(new wxStaticText(new_panel, wxID_ANY, wxT("Controller 1 Type:")), 0, wxGROW);
|
||||
load_cchoices(cchoices, 0, dfltidx);
|
||||
mainblock->Add(controller1type = new wxComboBox(new_panel, wxID_ANY, cchoices[dfltidx], wxDefaultPosition,
|
||||
|
@ -797,8 +797,12 @@ wxwin_project::wxwin_project(loaded_rom& rom)
|
|||
mainblock->Add(prefix = new wxTextCtrl(new_panel, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(400, -1)), 1,
|
||||
wxGROW);
|
||||
unsigned idx = 0;
|
||||
sram_set.insert("");
|
||||
for(auto i : sram_set) {
|
||||
mainblock->Add(new wxStaticText(new_panel, wxID_ANY, towxstring("SRAM " + i)), 0, wxGROW);
|
||||
std::string name = "SRAM " + i;
|
||||
if(i == "")
|
||||
name = "Anchor savestate";
|
||||
mainblock->Add(new wxStaticText(new_panel, wxID_ANY, towxstring(name)), 0, wxGROW);
|
||||
wxFlexGridSizer* fileblock2 = new wxFlexGridSizer(1, 2, 0, 0);
|
||||
fileblock2->Add(sram_files[i] = new wxTextCtrl(new_panel, wxID_ANY, wxT(""), wxDefaultPosition,
|
||||
wxSize(500, -1)), 1, wxGROW);
|
||||
|
@ -970,8 +974,13 @@ struct moviefile wxwin_project::make_movie()
|
|||
}
|
||||
for(auto i : sram_files) {
|
||||
std::string sf = tostdstring(i.second->GetValue());
|
||||
if(sf != "")
|
||||
f.movie_sram[i.first] = read_file_relative(sf, "");
|
||||
if(i.first != "") {
|
||||
if(sf != "")
|
||||
f.movie_sram[i.first] = read_file_relative(sf, "");
|
||||
} else {
|
||||
if(sf != "")
|
||||
f.anchor_savestate = read_file_relative(sf, "");
|
||||
}
|
||||
}
|
||||
f.is_savestate = false;
|
||||
f.movie_rtc_second = f.rtc_second = boost::lexical_cast<int64_t>(tostdstring(rtc_sec->GetValue()));
|
||||
|
|
|
@ -98,11 +98,8 @@ int main(int argc, char** argv)
|
|||
<< " bytes)" << std::endl;
|
||||
} else
|
||||
std::cout << "Movie starts from clean state" << std::endl;
|
||||
if(m.get_frame_count() > starting_point)
|
||||
std::cout << "Movie frame count: " << (m.get_frame_count() - starting_point) << std::endl;
|
||||
else
|
||||
std::cout << "Movie frame count: 0" << std::endl;
|
||||
uint64_t length = m.get_movie_length(starting_point);
|
||||
std::cout << "Movie frame count: " << m.get_frame_count() << std::endl;
|
||||
uint64_t length = m.get_movie_length();
|
||||
{
|
||||
std::ostringstream x;
|
||||
if(length >= 3600000000000ULL) {
|
||||
|
|
Loading…
Add table
Reference in a new issue