clementgallet / libTAS

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

86Box time tracking #501

Open slamotas opened 1 year ago

slamotas commented 1 year ago

I'd thought 86Box wouldn't work with libTAS due to the UI, but I was able to get it to work recently by compiling 86Box without QT. The way I built it was (following https://86box.readthedocs.io/en/latest/dev/buildguide.html):

git clone https://github.com/86Box/86Box.git cmake -B /home/slamo/86box091222/ -S /home/slamo/86box091222/86Box/ -D QT=OFF -D CPPTHREADS=OFF cmake --build /home/slamo/86box091222/

(I'm unsure what CPPTHREADS does exactly, I was hoping it would help with single threading)

This results in an 86Box build without a UI, it just looks like a regular SDL2 window now. libTAS almost wants to play nice with it! The only problem is that it softlocks on frame 0. Normally some time tracking would fix this, but no cocktail of option seems to work. However, if you use uncontrolled time, it boots perfectly. It looks like it might want clock_gettime() but that doesn't help. Maybe there is some time option that hasn't been hooked yet?

clementgallet commented 1 year ago

This would need the same kind of modifications as PCem:

I could rewrite this if it does matter.

slamotas commented 1 year ago

That would be fantastic! I think it's wise to switch from using PCem to 86Box, since 86Box development is way more active and it emulates more machines, and it has a greater likelihood of implementing more advanced machines in the future.

clementgallet commented 1 year ago

Then maybe @vadosnaprimer can setup a fork on TASEmulators so that I can make the changes?

vadosnaprimer commented 1 year ago

Then maybe @vadosnaprimer can setup a fork on TASEmulators so that I can make the changes?

Invited! Ideally we'd ask them for something and they'd implement it. If they generally agree to have a feature but no one can work on it, then we'd send a patch. And only if they don't think a feature critical for us makes sense for them, we'd have to actually rely on our own fork. As always, please keep master even to upstream.

clementgallet commented 1 year ago

It would be difficult to present it like a feature, because it is basically making the emulator run slower (how much slower, I have no idea).

Looking at the code, it would be hard to keep both single-threaded and multithreaded possible options, without a lot of if statements, or lot of duplicate code. It is a big rewrite of some of the code (moving code around and removing all sync functions). I don't currently see how to not make the code look bad.

vadosnaprimer commented 1 year ago

Oh well, I think it's still worth a shot to ask what they think about it, in general. The benefit for them would not be direct of course, but people would be able to just use upstream to tas.

clementgallet commented 1 year ago

https://github.com/86Box/86Box/issues/2687

clementgallet commented 1 year ago

I forgot to tell that we would also need to patch all video drivers that use threading (voodoo, s3virge, etc.)

vadosnaprimer commented 1 year ago

86Box/86Box#2687

Thank you!!!