[Fixed] Fix wrong logic of snapshot inconsistent with movie

This is for people involved in the developement of Snes9x, or SNES emulators in general.
BUG REPORTS BELONG IN TECH SUPPORT/BUG TRACKING!
Post Reply
User avatar
gocha
Snes9x Yellow Belt
Posts: 64
Joined: Sun Dec 30, 2007 12:14 am
Location: Japan, Nagoya

[Fixed] Fix wrong logic of snapshot inconsistent with movie

Post by gocha » Tue Jan 04, 2011 2:38 pm

One of fatal glitches since 1.51.

Code: Select all

diff --git a/movie.cpp b/movie.cpp
index de5dc48..9286b8f 100644
--- a/movie.cpp
+++ b/movie.cpp
@@ -745,7 +745,8 @@ int S9xMovieUnfreeze (uint8 *buf, uint32 size)
 	}
 	else
 	{
-		if (current_frame > Movie.MaxFrame || current_sample > Movie.MaxSample || memcmp(Movie.InputBuffer, ptr, space_needed))
+		uint32	space_processed = (Movie.BytesPerSample * (current_sample + 1));
+		if (current_frame > Movie.MaxFrame || current_sample > Movie.MaxSample || memcmp(Movie.InputBuffer, ptr, space_processed))
 			return (SNAPSHOT_INCONSISTENT);
 
 		change_state(MOVIE_STATE_PLAY);
Last edited by gocha on Mon Jan 10, 2011 1:46 pm, edited 2 times in total.

User avatar
BearOso
Official GTK/Linux Porter/Dev
Posts: 460
Joined: Tue Oct 02, 2007 12:50 am

Post by BearOso » Fri Jan 07, 2011 1:16 pm

Committed.

Also, if you post any more patches, could you just upload them somewhere like pastebin instead of putting it directly in the post? The Snes9x forums badly mangle the whitespace.

User avatar
gocha
Snes9x Yellow Belt
Posts: 64
Joined: Sun Dec 30, 2007 12:14 am
Location: Japan, Nagoya

Post by gocha » Sat Jan 08, 2011 2:28 pm

BearOso wrote:Committed.

Also, if you post any more patches, could you just upload them somewhere like pastebin instead of putting it directly in the post? The Snes9x forums badly mangle the whitespace.
Thank you very much, I'll do so next time.

Post Reply