Hello everybody!
I am writing here on this forum to get some feedback/advice on an idea that I have.
My goal is to create a branch of Dolphin with more accurate/complete savestates, which will hopefully prevent a specific type of desync, which I will describe below:
1. You TAS a game (recording your inputs in a dtm file) from power on up to frame 100, and then make a savestate.
2. You advance to frame 105, then load a save state to go back to frame 100.
3. From there, you keep TASing to frame 200, and then you save the resulting dtm file that this created.
4. When you try to play your TAS back from power on, it desyncs after frame 100! Creating a TAS from power on up to frame 200 without making or loading a single save state, however, results in a TAS that will sync from power on.
After seeing this type of desync, my working theory of why this can happen is that certain information is either not stored when you make a save state, or not written back out when you load a save state (likely both are happening, since it's unlikely that a dev altered save states to save certain info when saving but not to load that info back when loading a save state).
From all of this, there are a few potential culprits which could be not getting fully saved and creating the problem:
1. RAM
2. Registers
3. System Clock
4. Basic Properties, like idle skip on (though this is unlikely, since it's stored in the dtm file specifically)
5. Some other type of memory.
6. Some graphics or audio being different, and this causing something different to be written to memory (though I don't know how/if this could happen?)
I've started looking through the State.h and State.cpp files to figure out how save states work in Dolphin, although I can't quite figure out where a key function is. State.h is located in (from the root of the dolphin project) Source/Core/Core. saving a save state appears to occur in the doState(PointerWrap& P) function (which also handles loading save states). One of the function calls in this class seems to handle this functionality, but I'm not quite sure where. I think it's Movie:: DoState(PointerWrap). However, Since PointerWrap is an external dependency, I'm not sure which class it would be when Dolphin is actually running.
If anyone has any experience with the save state code on Dolphin or has any ideas for how I could proceed from here, I would greatly appreciate it!
Many thanks!
I am writing here on this forum to get some feedback/advice on an idea that I have.
My goal is to create a branch of Dolphin with more accurate/complete savestates, which will hopefully prevent a specific type of desync, which I will describe below:
1. You TAS a game (recording your inputs in a dtm file) from power on up to frame 100, and then make a savestate.
2. You advance to frame 105, then load a save state to go back to frame 100.
3. From there, you keep TASing to frame 200, and then you save the resulting dtm file that this created.
4. When you try to play your TAS back from power on, it desyncs after frame 100! Creating a TAS from power on up to frame 200 without making or loading a single save state, however, results in a TAS that will sync from power on.
After seeing this type of desync, my working theory of why this can happen is that certain information is either not stored when you make a save state, or not written back out when you load a save state (likely both are happening, since it's unlikely that a dev altered save states to save certain info when saving but not to load that info back when loading a save state).
From all of this, there are a few potential culprits which could be not getting fully saved and creating the problem:
1. RAM
2. Registers
3. System Clock
4. Basic Properties, like idle skip on (though this is unlikely, since it's stored in the dtm file specifically)
5. Some other type of memory.
6. Some graphics or audio being different, and this causing something different to be written to memory (though I don't know how/if this could happen?)
I've started looking through the State.h and State.cpp files to figure out how save states work in Dolphin, although I can't quite figure out where a key function is. State.h is located in (from the root of the dolphin project) Source/Core/Core. saving a save state appears to occur in the doState(PointerWrap& P) function (which also handles loading save states). One of the function calls in this class seems to handle this functionality, but I'm not quite sure where. I think it's Movie:: DoState(PointerWrap). However, Since PointerWrap is an external dependency, I'm not sure which class it would be when Dolphin is actually running.
If anyone has any experience with the save state code on Dolphin or has any ideas for how I could proceed from here, I would greatly appreciate it!
Many thanks!