ValleyBell / in_vgm-libvgm

a new libvgm-based version of the in_vgm Winamp plugin
20 stars 3 forks source link

in_vgm does not "claim" VGM files #4

Open ValleyBell opened 1 year ago

ValleyBell commented 1 year ago

in_vgm should implement the IsOurFile function properly and return 1 for supported files.

I think it would be a good idea to only return 1 for the file types enabled via .ini - i.e. claim S98/DRO only when explicitly enabled, just like with the file type dialog. (It will still be able to play them regardless of the extension, but this should control plugin preferences.)

bnnm commented 1 year ago

Just to clarify a bit (since I think this is related to this issue), as far as I see Winamp's IsOurFile was mainly meant to allow plugins to accept custom protocols like something://blah, just by checking the filename (rather than relying on the exception or contents) and default extension<>plugin matching was the standard, since back then there weren't that many audio extensions, so it's common to just return 0.

But in effect IsOurFile can be used to do more complex detection and "claim" the file (returning 1 immediately takes the file). Good in case of 2 plugins clashing, but that's uncommon so plugins rarely do it (a few do though). Checking the file's contents would be slightly slower (needs to open+read) too so for vgmstream I added some cache since after IsOurFile winamp will (always?) call GetInfo right after.

I'll update in_vgmstream.c's IsOurFile later with some extra comments about Winamp's loading system for reference too.