clementgallet / libTAS

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

Adobe Flash Player #390

Open clementgallet opened 3 years ago

clementgallet commented 3 years ago

Continuing issue #365, here is the current status of standalone adobe flash player support:

clementgallet commented 3 years ago

Flash player probably only uses VDPAU for its presentation API (basically queuing surface presentation and timing/vsync handling) and not its hardware video decoding API. If that's the case, I guess I could write my own implementation of this API, for example in SDL2 surfaces.

clementgallet commented 3 years ago

Savestates work by installing libvdpau-va-gl (bbe472f)

clementgallet commented 3 years ago

Tested a bit on Red Ball.

There's an issue with mouse movements, but not mouse press or keyboard. With native events, mouse movement is registered (menu items are highlighted when I drag over) until I click on the window. Then it stops working. To make it work again, I move the mouse cursor away and back in.

With preventing specific event types, I confirmed that the EnterNotify event makes the mouse movement work again.

By browsing GDK source code, I came up with this bit of code from gdkevents-x11.c:

      /* Move key events on focus window to the real toplevel, and
       * filter out all other events on focus window
       */          
      if (toplevel && xwindow == toplevel->focus_window)
    {
      switch (xevent->type)
        {
        case KeyPress:
        case KeyRelease:
          xwindow = GDK_WINDOW_XID (window);
          xevent->xany.window = xwindow;
          break;
        default:
          return FALSE;
        }
    }

I tried registering the mouse movement event to both the game window (interior gdk window) and top-level window, but it didn't work?

CasualPokePlayer commented 1 year ago

I did some experimentation with the Linux Flash Player with libTAS 1.4.4 myself, using Crystal Cove Online (AS3 game that does not run at all in Ruffle, so this was more my last resort).

For the most part it actually seems to work. Savestates work fine (at least as far as I've tested). TASes generally seem to desync however (even without any savestates in the mix), usually it's right at the beginning. It would seem the player spawns a ton of threads at once on startup, I assume this is to parallelize loading the swf? Interestingly if I select Recycle threads this ends up being a lot more stable (although generally this rather means you have a consistent desync rather than the movie syncing always).

There's also a random issue where sometimes the game seemingly just crashes immediately on load (resulting in frame counter being stuck at 6 and every frame being no draw). Trying to run the game again usually just results in no crashing.

The startup threading seems to be the likely culprit here for any desyncs, I would assume if that is solved then Linux Flash Player should be in a very TASable state.