diff --git a/src/core/movie.cpp b/src/core/movie.cpp index 8ce995c4..bcf7c86c 100644 --- a/src/core/movie.cpp +++ b/src/core/movie.cpp @@ -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; } diff --git a/src/core/moviefile.cpp b/src/core/moviefile.cpp index 4333ab94..a31a57ac 100644 --- a/src/core/moviefile.cpp +++ b/src/core/moviefile.cpp @@ -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>& authors) throw(std::bad_alloc,