Closed jlefebure closed 2 months ago
Does this happen consistently?
Please copy the version from Help
> About...
, obviously you didn't mean to write 2.5.2.
Yup, always. Save states made using the UI works.
You're right, i'm on 2.9.2, last version from master branch (rev a803407cdd80b3bad10096edf6b1e63f303b5973)
Is this savestate possibly occurring in a separate thread? The error seems to indicate you are in a separate thread and it's when the main thread has the Encore OpenGL context active (and therefore other threads cannot make it active). You should not be calling SaveState outside of the main thread (this is more an OpenGL limitation if anything; even then savestates APIs (along with any other API touching emulator state) should not be considered safe outside of the main thread).
Hi, Yep, i'm on a separate thread. I'm actually calling the SaveState method every 10 minutes to make an autosave. I did not encounter any issue with NDS or GBA emulation, but I assume that it does not use OpenGL
Just to be sure, there is no workaround ?
Doing savestates with other cores have very high risks of causing crashes (especially any waterbox cores like NDS due to non-thread safe code in its handling) and whatever savestates produced would very likely be garbage / not load correctly. Your code is fundamentally wrong here.
Can't we make the call on the correct thread regardless of where the API was called from?
The API user could do that with the WinForms BeginInvoke/Invoke API.
Good to know. Thanks a lot @CasualPokePlayer, @YoshiRulz !
If API methods are not threadsafe, I close the issue and will work with BeginInvoke and Invoke methods
Summary
Exception when saving state via SaveState API with a c# external tool
Repro
Output
Host env.