Post subject: Solution for a desynch problem in all consoles
Player (200)
Joined: 7/6/2004
Posts: 511
A common problem occurs when you load a state in read only mode, in which you have previously redone something before that state. Now if you save state while playing in read only, but then later rerecord from that state you will have an invalid movie that will desynch. For those who don't know about this it might sound a little contrived, but it can easily happen by mistake. This is not a serious problem, but there is an easy solution: that would be, when in read only mode during a load state make sure that the state is from the correct movie as usual, but in addition, go through every frame of input and check to make sure they are the same, if they differ then display snapshot not from this movie. I think the only disadvantage to the solution is that it might seem a little slow, but it would theoretically only be twice as slow as saving a state, and it could be improved to the same speed by storing the md5 sum of all the inputs in the state, then all you would have to do is calculate the md5 sum of the movie file inputs upto the current frame. I said the problem is not that serious because if you know about it its easy to avoid, but I think the biggest problem is if someone claims a desynch it is hard for people like Nitsuja to track it down, because he won't know if it was their mistake or the emulators that caused it. I bring this up because Erim was working on FF6 at the imperial base in Sabin's quest and had a desynch problem, after he resolved it, I told him to play the movie from the beginning to make sure his save states were current. I thought that the problem may have just been the load in read only thing, but then it happened again, and it cost him alot of work and frustration. Had we been able to narrow it down, maybe he could have avoided more problems by being more suspicious of emulator bugs and rewatching progress often. Anyways just thought it would be could to discuss such options and curious if any emulators do this already?
g,o,p,i=1e4,a[10001];main(x){for(;p?g=g/x*p+a[p]*i+2*!o: 53^(printf("%.4d",o+g/i),p=i,o=g%i);a[p--]=g%x)x=p*2-1;}
Active player (278)
Joined: 5/29/2004
Posts: 5712
Uh... Uh... That does sound contrived. I think if you're smart, you won't let it happen. Yeah.
put yourself in my rocketpack if that poochie is one outrageous dude
Post subject: Read Only Oops
Joined: 11/17/2005
Posts: 278
Location: Massachusetts, USA
Bag of Magic Food wrote:
Uh... Uh... That does sound contrived. I think if you're smart, you won't let it happen. Yeah.
I used to have 'desyncs' during Dadaluma and Kefka #1 that I 'resolved' by deleting all of my save states. In Zelda the mistake is obvious: "Hey, that darknut just teleported! Oops!" But in FF6 the difference between frame 441678 and 441700 can be slight or non-existant. Sometimes I've used all my save states and I need to rewind to make some more. That's where the trouble starts.
Post subject: Re: Solution for a desynch problem in all consoles
Joined: 12/17/2004
Posts: 99
Location: Karlsruhe, Germany
flagitious wrote:
A common problem occurs when you load a state in read only mode, in which you have previously redone something before that state. N
Yeah, I had that problem also once. If you want a fast solution, which just wastes space, you could store a unique id with the movie When re-recording this unique id, a new uniqueid is created and the old one is just valid until this point. (so now there need to be two uniqueids stored) So in loading a savestate, you just have to see if it matches one of the uniqueids and if frame-count < valid frame. Its still not a perfect solution, but I can't think of anything better at the moment. Wanted to share anyway ... cu Fabian
Editor, Skilled player (1941)
Joined: 6/15/2005
Posts: 3247
After editing, I immediately refresh all savestates past the edit point. You should get into that habit, too. http://tasvideos.org/DesyncHelp.html "The movie I'm making desyncs while I make it"
Player (200)
Joined: 7/6/2004
Posts: 511
Fabian, your idea sounds good, but either I fail to comprehend how it works or it would need to add a new unique id everytime you save state, and this list could get quite large after a while. FractalFusion, we don't need to be told how to avoid the problem, we already know how to do that, this topic is to provide a way for those who don't know about it to never have to learn about it, if it can be implemented.
g,o,p,i=1e4,a[10001];main(x){for(;p?g=g/x*p+a[p]*i+2*!o: 53^(printf("%.4d",o+g/i),p=i,o=g%i);a[p--]=g%x)x=p*2-1;}
Emulator Coder, Skilled player (1301)
Joined: 12/21/2004
Posts: 2687
flagitious: I don't know why I didn't consider this idea when you brought it up before. Well, the way you described the solution, I thought you meant that it should play back the entire movie and compare the resulting state of emulation, which would be much too slow. But what I now think you meant is really quite simple to do:
if(memcmp(Movie.InputBuffer, Savestate.InputBuffer, Savestate.InputBufferSize))
{
	return SNAPSHOT_INCONSISTENT;
}
So you can expect subsequent versions of Snes9x (at least) to not have this desync problem anymore. EDIT: And also that problem where the movie suddenly stops playing when you watch your progress a little too far.
Player (200)
Joined: 7/6/2004
Posts: 511
Cool thanks nitsuja. Here is another idea, that might be desired by some, but it's rather minor: When not in read only mode, do not give the error "movie snapshot not from this movie" when loading a movie snapshot that is not from the current movie, instead just replace the file. This might be harder to implement than I think, but if it's easy it would be nice because I always like to work with movie files under the same name as the rom so when I go to play them I don't have to go into the file menu to select the movie file. However I only commonly do this because I use it as a replacement to toggle read-write button since one time I think that caused a desynch and I am paranoid about it/habbit of not using it.
g,o,p,i=1e4,a[10001];main(x){for(;p?g=g/x*p+a[p]*i+2*!o: 53^(printf("%.4d",o+g/i),p=i,o=g%i);a[p--]=g%x)x=p*2-1;}
Emulator Coder, Skilled player (1301)
Joined: 12/21/2004
Posts: 2687
That would be incredibly easy but some people definitely wouldn't want that, that makes it likely for someone to accidentally overwrite their movie with a different movie they're comparing it to, and continue recording for a while before realizing it. The only additional thing that could be done safely is to allow it if the state you are loading matches the input that's been recorded so far (which incidentally means that if you start recording and haven't recorded anything yet, it will always allow it).
Player (200)
Joined: 7/6/2004
Posts: 511
Ok that is understandable, I can see how some people wouldn't want that. Although it should be safe because they should have a backup save state or a backup file if they do overwrite.
g,o,p,i=1e4,a[10001];main(x){for(;p?g=g/x*p+a[p]*i+2*!o: 53^(printf("%.4d",o+g/i),p=i,o=g%i);a[p--]=g%x)x=p*2-1;}
Emulator Coder, Skilled player (1301)
Joined: 12/21/2004
Posts: 2687
I'll try making it an option in the .cfg file to have it always allow it. Question: Should it change the movie to have the same recording date as the movie that the state was originally made in?
Player (200)
Joined: 7/6/2004
Posts: 511
I don't think it should, but do what ever is easiest. Thanks alot, again :)
g,o,p,i=1e4,a[10001];main(x){for(;p?g=g/x*p+a[p]*i+2*!o: 53^(printf("%.4d",o+g/i),p=i,o=g%i);a[p--]=g%x)x=p*2-1;}