FNA-XNA / FNA

FNA - Accuracy-focused XNA4 reimplementation for open platforms
https://fna-xna.github.io/
2.65k stars 272 forks source link

Don't throw exception for missing Video until it's played #487

Closed redmcg closed 5 months ago

redmcg commented 5 months ago

This is a PR I originally raised against the wine-mono fork to fix an issue with Hell Yeah! Wrath of the Dead Rabbit (205230): https://github.com/madewokherd/FNA/pull/6

@madewokherd and I thought it would be worth checking to see if this was something wanted upstream.

The PR changes the behavior when a Video file is missing to match what Windows does. Windows will only throw an exception when you attempt to play the Video (rather than when loading the resource).

The aim of the patch is match Windows behavior, and therefore the focus is on the scenario where an XNB file is present. But as it is, this will also modify the behavior when:

which may not be desirable.

flibitijibibo commented 5 months ago

Interesting, so it's kind of like Song where it's really just metadata that gets ignored until VideoPlayer uses it... works for me, but I may have another way of doing this - will report back in a moment.

flibitijibibo commented 5 months ago

Did my own version of this - the main thing is that raw file behavior is preserved, which is what FNA games will prefer, but I redesigned the Video class in such a way that it acts more like Song, so VideoPlayer now does most of the work:

https://github.com/FNA-XNA/FNA/commit/e86dbccba022f5889a90f7e6ed197834650530bb

Thanks for the PR, this was very useful information to have!

flibitijibibo commented 5 months ago

Actually woops, I forgot about the path normalizer - I'll apply this next.

flibitijibibo commented 5 months ago

https://github.com/FNA-XNA/FNA/commit/65f98a8f99a01a3548ed0e01c3782e402cd2176a

redmcg commented 5 months ago

Thanks @flibitijibibo , can confirm merging this in to wine-mono FNA fixes the issue. :+1: