Emulator Issues #8544
Input recording desyncs
When trying to record a movie in Dolphin using the Wii U GC adapter for input, I find that I get desyncs constantly. On average it seems to be about one desync per ~10 minutes of gameplay. The config settings are all set up correctly to minimize desyncs (dual core and idle skipping disabled, etc).
I even seem to get some degree of inconsistent playback... for instance, I'll play for 5 minutes, watch it back and verify there are no desyncs, play another 5 minutes, play back from the 4 minute mark, play another 5 minutes, play back from the 9 minute mark, have everything look correct, then play back from the beginning and have everything desync.
I asked about this on IRC and JMC47 thinks it's related to stick centering information not being saved/loaded from save states. I've also heard from him that there's a similar issue with real Wiimotes, and while I understand that's more complicated it would be fantastic if that was fixed as well.
#6 Updated by paraxade over 4 years ago
Well, I gave it a shot on 4.0-6112 (the build I was testing on before) and didn't run into the problem with the window freezing, so I gave recording a shot. Played on keyboard, GC adapter not plugged in. Got a desync after ~7 minutes. Hmm. Maybe it's not related?
Also oh god playing Metroid Prime on a keyboard is painful.
#9 Updated by paraxade over 4 years ago
So, I tried seeing if I could work around the desyncing problem. I ended up coming up with a system where I reserved the last three save state slots:
- Slot 10 is saved at the beginning of the movie
- Slot 9 is saved at the latest spot I've verified plays back correctly from the beginning
- Slot 8 is saved at the latest spot I've verified plays continuously (eg, only loading from slot 8/9/10 or playing back from the beginning).
I tried to set it up so I would never load and play directly from any of those three slots. I would always save them slightly before the movie ends, then save slot 1 after that (still before the end of the movie) and continue playing from slot 1. Therefore since 8/9 are only ever saved during playback, they -should- work consistently with playing back from the beginning. Except... that didn't happen. I ended up playing for about 10-15 minutes, verifying every so often that everything was fine via slots 8/9... then when I played it back from the start, it desynced.
This makes me think there has to be a bug related to saving and loading during movie playback. Otherwise this makes no sense.
To verify I did another test. The first 5 minutes of the movie are perfectly fine, and I know that because I've played it back from the beginning a ton of times and it's never desynced. I tried playing back from the beginning again, except this time I spammed save/load. And voila: I get a desync in a section of the movie that has never desynced before. Played it back again without any savestates, and it plays correctly.
It's definitely not the only desync-causing bug, because I can record for 10-15 minutes without using any save states whatsoever and have it desync on playback. That said, this is the most important one to fix IMO, because it makes doing any work practically impossible. I can work around desyncs, but I can't play back an hour+ of video every couple minutes to ensure it's not desynced. Not a workable solution.
#10 Updated by paraxade over 4 years ago
Tested a little bit further. Desyncing happens consistently if I save/load during movie playback. One single save/load during parts with a lot of movement is enough to cause it to desync. In addition, the problem occurs when a savestate is loaded; just saving it does not cause desyncs.
Hopefully this is enough info to track the issue down, but if there's anything else you guys would like me to test let me know. I would provide the movie file, but it's being recorded on a slightly modded version of the game and requires a save file, so I'm not sure it'll play back correctly for you.
#12 Updated by paraxade over 4 years ago
Yep - all of those are recorded.
On IRC, Jasper suggested reverting this: https://github.com/dolphin-emu/dolphin/commit/854f6b8688063544310edbc0fc27a8c42f517d9b
JosJuice created a branch and I built it and tested. Although the movie desyncs earlier now with that build, the desync is happening in a consistent spot and saving/loading save states does not seem to alter playback anymore.
#14 Updated by paraxade over 4 years ago
I think so. The branch is here if you want to check anything for yourself: https://github.com/JosJuice/dolphin/tree/revert-854f6b8
#15 Updated by paraxade over 4 years ago
I tested the branch a little further. Apparently it does actually still have the desync-on-state-load problem. I guess I didn't test it thoroughly enough earlier :/
It might just be me because this bug is difficult to really test properly, but it does seem harder to trigger at least. 6112 was desyncing very consistently when I saved+loaded from a certain spot. On this one I've only gotten it to desync when spamming it. That observation should probably be taken with a grain of salt though.
#16 Updated by paraxade over 4 years ago
Done some more testing... First of all, I'm starting to think that either there are two bugs that cause this issue, or something was changed to make it easier to trigger, because it's very easy to make it desync on 6112, but often takes me quite a few tries on the other builds I've tested (including 4.0-4222 and a couple test builds).
I tried comparing the movie when played from the beginning with the movie when loaded from a savestate. After the intro sequence of the game, there's a cutscene that plays where Samus lands on Tallon IV. If I savestate shortly before this cutscene begins, then when I reload the movie will play along correctly a little bit further before desyncing.
Using frame advance I tried comparing to see if there were any noticeable differences. As far as I can tell, there isn't; the inputs are mostly the same, and significant events (on-screen messages popping up, cutscenes beginning and ending, etc) happen on the same frame in both.
This is making me a bit confused as to what could be happening here. Some of those events teleport Samus to a specific spot, so if it's triggered on the same frame in both, then I don't know why they wouldn't be synced up at that point. I don't think I know enough about what Dolphin is doing internally to guess at what the problem could be.
Anyway, that might be the last thing I'm testing out unless someone else has any ideas, because I'm kind of running out of ideas for what else to try.