clementgallet / libTAS

GNU/Linux software to (hopefully) give TAS tools to games
GNU General Public License v3.0
476 stars 56 forks source link

Visual indication of save states becoming invalid due to a new thread being started #114

Closed BenLubar closed 5 years ago

BenLubar commented 5 years ago

It would be nice to have some visual indication similar to the "Saving/Loading/Saved/Loaded" message in this screenshot for when a new thread is started by the game which would make all existing save states invalid.

image

(If this already exists, it's not showing up in Undertale/Deltarune due to the lag frame between scenes where nothing is rendered.)

Masterjun3 commented 5 years ago

If it's possible to detect when new threads are started, wouldn't it also make sense to automatically make a special savestate at the end of that frame? A sort of earliest backtrack point, which keeps getting overwritten as old ones become invalid.

InfamousKnight commented 5 years ago

Yeah, this should get fixed. I even make new save states to “work around it” and that doesn’t work either.. real annoying issue.

clementgallet commented 5 years ago

Implemented this in c95a8edffca7dd078e67a9b9084716f6684c0995 . It makes a savestate (at slot 10) each time the savestates are becoming invalid. This savestate can be loaded with F10 by default (but you need to map it if you already have a config file). You cannot manually save on that slot. There is an option in the menu to enable or disable this feature.

Also, I choose to only enable it after a first (manual) savestate has been performed. The reason is to prevent a savestate to be made at the very first frame, making incremental savestate feature pretty much useless.

InfamousKnight commented 5 years ago

While this is a good start, I'm currrently having trouble with test drive iii the passion on dosbox. It looks like the game is constantly creating new threads, and when I make a save state, a flood of backup save states are made, and eventually the game hangs with this message in the console:

[libTAS f:537] Thread 2349 (main) Saved state 10 of size 51543850 in 0.698576 seconds [libTAS f:538] Thread 2349 (main) Saved state 10 of size 51692571 in 0.600856 seconds [libTAS f:539] Thread 2349 (main) Saved state 10 of size 51841326 in 0.335257 seconds [libTAS f:540] Thread 2349 (main) Saved state 10 of size 52022850 in 0.419577 seconds ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection terminated

Something with ALSA lib it appears. Idk.

clementgallet commented 5 years ago

Is the sound muted in the tool ? If not, it is because making a savestate closes the audio driver while the savestate is performed, and opens it again. So depending on how your driver is configured, it might spawn a new thread each time a savestate is made.

InfamousKnight commented 5 years ago

Sound was not muted in tool. I muted it and it fixed the problem. Pretty neat how it still works when you play it back with mute off!

BenLubar commented 5 years ago

fixed in c95a8edffca7dd078e67a9b9084716f6684c0995