mickelson / attract

A graphical front-end for command line emulators that hides the underlying operating system and is intended to be controlled with a joystick or gamepad.
http://attractmode.org
GNU General Public License v3.0
393 stars 115 forks source link

Vid.NoAutostart flag not checked when returnig from game #585

Open oomek opened 4 years ago

oomek commented 4 years ago

I would like to propose changes to how video_flags and video_playing properties behave during launching an emulator.

Currently when a snap has set Vid.NoAutoStart it does not have any effect on video state when returning from a game. The only way to have video not playing is to set snap.video_playing = false in Transition.FromGame

Additionally there is a stalled frame showing for 5 frames when video is restarted after returning from an emulator and persistent stalled frame when video is stopped in Transition.FromGame This is very noticeable when an emulator does not force resolution change and looks particularly bad on videos that have fade-ins.

So, to get rid of that stalled frame I suggest to call preload() on all videos to fill the texture buffer with the first frame in post_run()

Regarding the video state on exiting an emulator I'm not yet sure what should determine its state: Vid.NoAutostart flag, or previously called video_playing = false before launching an emulator

Please tell me what you think. I have a test branch and an example layout if you would like to discuss it further.

mickelson commented 4 years ago

I’ll get back on the other points, but I think the 5 frame stall may be caused by this:

https://github.com/mickelson/attract/blob/9b89765ff40ccd3217e4756b5abb2222c1381b75/src/fe_image.cpp#L203

try changing play_count to a lower number and see if that helps...

oomek commented 4 years ago

Yes, that's exactly what is causing it.

oomek commented 4 years ago

I've tried, the only thing that works is what I did here: https://github.com/oomek/attract/commits/fix-video-play-state

It fixes both, things NoAutostart check after exiting from an emulator and stalled buffer