Fix two bugs in new movie checking code
- Fix off-by-one in movie comparison code. - Fix wrong offsets for poll counters and lag in compat code
This commit is contained in:
parent
fde7c4e09a
commit
5b1a808645
2 changed files with 9 additions and 9 deletions
|
@ -29,7 +29,7 @@ namespace
|
|||
//sync done.
|
||||
uint64_t syncs_seen = 0;
|
||||
uint64_t frames_read = 0;
|
||||
while(syncs_seen < frame) {
|
||||
while(syncs_seen < frame - 1) {
|
||||
controls_t oldc(true), newc(true);
|
||||
//Due to way subframes are stored, we can ignore syncing when comparing.
|
||||
if(frames_read < old_movie.size())
|
||||
|
@ -53,11 +53,11 @@ namespace
|
|||
for(unsigned i = 0; i < TOTAL_CONTROLS; i++) {
|
||||
uint32_t p = polls[i] & 0x7FFFFFFFUL;
|
||||
short ov = 0, nv = 0;
|
||||
for(uint32_t i = 0; i < p; i++) {
|
||||
if(i < readable_old_subframes)
|
||||
ov = old_movie[i + frames_read](i);
|
||||
if(i < readable_new_subframes)
|
||||
nv = new_movie[i + frames_read](i);
|
||||
for(uint32_t j = 0; j < p; j++) {
|
||||
if(j < readable_old_subframes)
|
||||
ov = old_movie[j + frames_read](i);
|
||||
if(j < readable_new_subframes)
|
||||
nv = new_movie[j + frames_read](i);
|
||||
if(ov != nv)
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -135,12 +135,12 @@ void read_moviestate_file(zip_reader& r, const std::string& file, uint64_t& save
|
|||
if(s.size() != sizeof(buf))
|
||||
throw std::runtime_error("Invalid moviestate file");
|
||||
memcpy(buf, &s[0], sizeof(buf));
|
||||
//Interesting offsets: 32-39: Current frame, 40-47: Lagged frames, 48-447: Poll counters. All bigendian.
|
||||
//Interesting offsets: 32-39: Current frame, 40-439: Poll counters, 440-447 lagged frames. All bigendian.
|
||||
save_frame = decode_uint64(buf + 32);
|
||||
lagged_frames = decode_uint64(buf + 40);
|
||||
lagged_frames = decode_uint64(buf + 440);
|
||||
pollcounters.resize(100);
|
||||
for(unsigned i = 0; i < 100; i++)
|
||||
pollcounters[i] = decode_uint32(buf + 48 + 4 * i);
|
||||
pollcounters[i] = decode_uint32(buf + 40 + 4 * i);
|
||||
}
|
||||
|
||||
void read_authors_file(zip_reader& r, std::vector<std::pair<std::string, std::string>>& authors) throw(std::bad_alloc,
|
||||
|
|
Loading…
Add table
Reference in a new issue