From ee7b7dad5f689bf172c099bec18ace8dc224776a Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Wed, 26 Jan 2022 15:40:44 -0800 Subject: [PATCH] VGMStream: Add a bodge for PSF files For some incredibly dumb reason, PSF files get into FFmpeg 5.0, then just sit there and lock up, reading them forever and ever, doing nothing useful. Add a bodge to detect PSF files by signature and ignore them in the VGMStream container parser, and all other parts of VGMStream in Cog. Signed-off-by: Christopher Snowhill --- Plugins/vgmstream/vgmstream/VGMInterface.m | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Plugins/vgmstream/vgmstream/VGMInterface.m b/Plugins/vgmstream/vgmstream/VGMInterface.m index 9f9564993..ff00ef622 100644 --- a/Plugins/vgmstream/vgmstream/VGMInterface.m +++ b/Plugins/vgmstream/vgmstream/VGMInterface.m @@ -303,6 +303,14 @@ static STREAMFILE* open_cog_streamfile_buffer_from_url(NSURL* url, const char* c if (![infile seekable]) return NULL; + // XXX Goddammit, FFmpeg + uint8_t sig[3]; + if ([infile read:sig amount:3] == 3) { + [infile seek:0 whence:SEEK_SET]; + if (memcmp(sig, "PSF", 3) == 0) + return NULL; + } + return open_cog_streamfile_buffer_by_file(infile, filename, bufsize); }