# HG changeset patch # User nenolod # Date 1172291442 28800 # Node ID 94b22cc75eb8a47ed5f855ec0655a570de970624 # Parent cae46214b8bf642aae99163485c27cc59a1e47a7 [svn] - VFS probing support patch by Christian Birchinger (joker). diff -r cae46214b8bf -r 94b22cc75eb8 ChangeLog --- a/ChangeLog Fri Feb 23 20:23:34 2007 -0800 +++ b/ChangeLog Fri Feb 23 20:30:42 2007 -0800 @@ -1,3 +1,83 @@ +2007-02-24 04:23:34 +0000 William Pitcock + revision [1492] + - rework AdPlug to use VFS properly + see http://sacredspiral.co.uk/~nenolod/adplug-vfs-ng.diff for a diff. + + trunk/src/adplug/adplug-xmms.cc | 62 ++++++++++++++++++++++++++++----- + trunk/src/adplug/core/README.audacious | 10 +++++ + trunk/src/adplug/core/a2m.cxx | 4 +- + trunk/src/adplug/core/a2m.h | 2 - + trunk/src/adplug/core/adl.cxx | 5 +- + trunk/src/adplug/core/adl.h | 2 - + trunk/src/adplug/core/adplug.cxx | 11 ++--- + trunk/src/adplug/core/adplug.h | 2 - + trunk/src/adplug/core/adtrack.cxx | 11 +++-- + trunk/src/adplug/core/adtrack.h | 2 - + trunk/src/adplug/core/amd.cxx | 4 +- + trunk/src/adplug/core/amd.h | 2 - + trunk/src/adplug/core/bam.cxx | 4 +- + trunk/src/adplug/core/bam.h | 2 - + trunk/src/adplug/core/binio_virtual.h | 20 +++++----- + trunk/src/adplug/core/cff.cxx | 4 +- + trunk/src/adplug/core/cff.h | 2 - + trunk/src/adplug/core/d00.cxx | 5 +- + trunk/src/adplug/core/d00.h | 2 - + trunk/src/adplug/core/dfm.cxx | 4 +- + trunk/src/adplug/core/dfm.h | 2 - + trunk/src/adplug/core/dmo.cxx | 5 +- + trunk/src/adplug/core/dmo.h | 2 - + trunk/src/adplug/core/dro.cxx | 4 +- + trunk/src/adplug/core/dro.h | 2 - + trunk/src/adplug/core/dtm.cxx | 4 +- + trunk/src/adplug/core/dtm.h | 2 - + trunk/src/adplug/core/fmc.cxx | 4 +- + trunk/src/adplug/core/fmc.h | 2 - + trunk/src/adplug/core/fprovide.cxx | 4 +- + trunk/src/adplug/core/fprovide.h | 4 +- + trunk/src/adplug/core/hsc.cxx | 8 ++-- + trunk/src/adplug/core/hsc.h | 2 - + trunk/src/adplug/core/hsp.cxx | 5 +- + trunk/src/adplug/core/hsp.h | 2 - + trunk/src/adplug/core/imf.cxx | 8 ++-- + trunk/src/adplug/core/imf.h | 2 - + trunk/src/adplug/core/ksm.cxx | 9 +++- + trunk/src/adplug/core/ksm.h | 2 - + trunk/src/adplug/core/lds.cxx | 5 +- + trunk/src/adplug/core/lds.h | 2 - + trunk/src/adplug/core/mad.cxx | 4 +- + trunk/src/adplug/core/mad.h | 2 - + trunk/src/adplug/core/mid.cxx | 11 +++-- + trunk/src/adplug/core/mid.h | 2 - + trunk/src/adplug/core/mkj.cxx | 6 +-- + trunk/src/adplug/core/mkj.h | 2 - + trunk/src/adplug/core/msc.cxx | 4 +- + trunk/src/adplug/core/msc.h | 2 - + trunk/src/adplug/core/mtk.cxx | 4 +- + trunk/src/adplug/core/mtk.h | 2 - + trunk/src/adplug/core/player.h | 2 - + trunk/src/adplug/core/rad.cxx | 4 +- + trunk/src/adplug/core/rad.h | 2 - + trunk/src/adplug/core/raw.cxx | 4 +- + trunk/src/adplug/core/raw.h | 2 - + trunk/src/adplug/core/rix.cxx | 5 +- + trunk/src/adplug/core/rix.h | 2 - + trunk/src/adplug/core/rol.cxx | 9 +++- + trunk/src/adplug/core/rol.h | 2 - + trunk/src/adplug/core/s3m.cxx | 4 +- + trunk/src/adplug/core/s3m.h | 2 - + trunk/src/adplug/core/sa2.cxx | 6 +-- + trunk/src/adplug/core/sa2.h | 2 - + trunk/src/adplug/core/sng.cxx | 4 +- + trunk/src/adplug/core/sng.h | 2 - + trunk/src/adplug/core/u6m.cxx | 4 +- + trunk/src/adplug/core/u6m.h | 2 - + trunk/src/adplug/core/xad.cxx | 4 +- + trunk/src/adplug/core/xad.h | 2 - + trunk/src/adplug/core/xsm.cxx | 4 +- + trunk/src/adplug/core/xsm.h | 2 - + 72 files changed, 210 insertions(+), 139 deletions(-) + + 2007-02-22 15:19:39 +0000 William Pitcock revision [1490] - remove %expect 37 diff -r cae46214b8bf -r 94b22cc75eb8 src/modplug/modplugbmp.cxx --- a/src/modplug/modplugbmp.cxx Fri Feb 23 20:23:34 2007 -0800 +++ b/src/modplug/modplugbmp.cxx Fri Feb 23 20:30:42 2007 -0800 @@ -93,111 +93,65 @@ bmp_cfg_db_close(db); } -bool ModplugXMMS::CanPlayFile(const string& aFilename) +bool ModplugXMMS::CanPlayFileFromVFS(const string& aFilename, VFSFile *file) { string lExt; uint32 lPos; - VFSFile *file; gchar magic[4]; - if ((file = vfs_fopen(aFilename.c_str(), "rb"))) { vfs_fread(magic, 1, 4, file); - if (!memcmp(magic, UMX_MAGIC, 4)) { - vfs_fclose(file); - return 1; - } - if (!memcmp(magic, XM_MAGIC, 4)) { - vfs_fclose(file); - return 1; - } - if (!memcmp(magic, M669_MAGIC, 2)) { - vfs_fclose(file); - return 1; - } - if (!memcmp(magic, IT_MAGIC, 4)) { - vfs_fclose(file); - return 1; - } - if (!memcmp(magic, MTM_MAGIC, 4)) { - vfs_fclose(file); - return 1; - } - if (!memcmp(magic, PSM_MAGIC, 4)) { - vfs_fclose(file); - return 1; - } + if (!memcmp(magic, UMX_MAGIC, 4)) + return true; + if (!memcmp(magic, XM_MAGIC, 4)) + return true; + if (!memcmp(magic, M669_MAGIC, 2)) + return true; + if (!memcmp(magic, IT_MAGIC, 4)) + return true; + if (!memcmp(magic, MTM_MAGIC, 4)) + return true; + if (!memcmp(magic, PSM_MAGIC, 4)) + return true; + vfs_fseek(file, 44, SEEK_SET); vfs_fread(magic, 1, 4, file); - if (!memcmp(magic, S3M_MAGIC, 4)) { - vfs_fclose(file); - return 1; - } + if (!memcmp(magic, S3M_MAGIC, 4)) + return true; vfs_fseek(file, 1080, SEEK_SET); vfs_fread(magic, 1, 4, file); - if (!memcmp(magic, MOD_MAGIC_FASTTRACKER6, 4)) { - vfs_fclose(file); - return 1; - } - if (!memcmp(magic, MOD_MAGIC_FASTTRACKER8, 4)) { - vfs_fclose(file); - return 1; - } + if (!memcmp(magic, MOD_MAGIC_FASTTRACKER6, 4)) + return true; + if (!memcmp(magic, MOD_MAGIC_FASTTRACKER8, 4)) + return true; if(mModProps.mGrabAmigaMOD) { - if (!memcmp(magic, MOD_MAGIC_PROTRACKER4, 4)) { - vfs_fclose(file); - return 1; - } - if (!memcmp(magic, MOD_MAGIC_PROTRACKER4X, 4)) { - vfs_fclose(file); - return 1; - } - if (!memcmp(magic, MOD_MAGIC_NOISETRACKER, 4)) { - vfs_fclose(file); - return 1; - } - if (!memcmp(magic, MOD_MAGIC_STARTRACKER4, 4)) { - vfs_fclose(file); - return 1; - } - if (!memcmp(magic, MOD_MAGIC_STARTRACKER8, 4)) { - vfs_fclose(file); - return 1; - } - if (!memcmp(magic, MOD_MAGIC_STARTRACKER4X, 4)) { - vfs_fclose(file); - return 1; - } - if (!memcmp(magic, MOD_MAGIC_STARTRACKER8X, 4)) { - vfs_fclose(file); - return 1; - } - if (!memcmp(magic, MOD_MAGIC_FASTTRACKER4, 4)) { - vfs_fclose(file); - return 1; - } - if (!memcmp(magic, MOD_MAGIC_OKTALYZER8, 4)) { - vfs_fclose(file); - return 1; - } - if (!memcmp(magic, MOD_MAGIC_OKTALYZER8X, 4)) { - vfs_fclose(file); - return 1; - } - if (!memcmp(magic, MOD_MAGIC_TAKETRACKER16, 4)) { - vfs_fclose(file); - return 1; - } - if (!memcmp(magic, MOD_MAGIC_TAKETRACKER32, 4)) { - vfs_fclose(file); - return 1; - } + if (!memcmp(magic, MOD_MAGIC_PROTRACKER4, 4)) + return true; + if (!memcmp(magic, MOD_MAGIC_PROTRACKER4X, 4)) + return true; + if (!memcmp(magic, MOD_MAGIC_NOISETRACKER, 4)) + return true; + if (!memcmp(magic, MOD_MAGIC_STARTRACKER4, 4)) + return true; + if (!memcmp(magic, MOD_MAGIC_STARTRACKER8, 4)) + return true; + if (!memcmp(magic, MOD_MAGIC_STARTRACKER4X, 4)) + return true; + if (!memcmp(magic, MOD_MAGIC_STARTRACKER8X, 4)) + return true; + if (!memcmp(magic, MOD_MAGIC_FASTTRACKER4, 4)) + return true; + if (!memcmp(magic, MOD_MAGIC_OKTALYZER8, 4)) + return true; + if (!memcmp(magic, MOD_MAGIC_OKTALYZER8X, 4)) + return true; + if (!memcmp(magic, MOD_MAGIC_TAKETRACKER16, 4)) + return true; + if (!memcmp(magic, MOD_MAGIC_TAKETRACKER32, 4)) + return true; } /* end of if(mModProps.mGrabAmigaMOD) */ /* We didn't find the magic bytes, fall back to extension check */ - vfs_fclose(file); - } /* end of vfs_open main if statement */ - lPos = aFilename.find_last_of('.'); if((int)lPos == -1) return false; diff -r cae46214b8bf -r 94b22cc75eb8 src/modplug/modplugbmp.h --- a/src/modplug/modplugbmp.h Fri Feb 23 20:23:34 2007 -0800 +++ b/src/modplug/modplugbmp.h Fri Feb 23 20:30:42 2007 -0800 @@ -84,7 +84,7 @@ ~ModplugXMMS(); void Init(); // Called when the plugin is loaded - bool CanPlayFile(const string& aFilename);// Return true if the plugin can handle the file + bool CanPlayFileFromVFS(const string& aFilename, VFSFile *file); // Return true if the plugin can handle the file void CloseConfigureBox(); diff -r cae46214b8bf -r 94b22cc75eb8 src/modplug/plugin.cxx --- a/src/modplug/plugin.cxx Fri Feb 23 20:23:34 2007 -0800 +++ b/src/modplug/plugin.cxx Fri Feb 23 20:30:42 2007 -0800 @@ -16,9 +16,9 @@ gModplugXMMS.Init(); } -static int CanPlayFile(char* aFilename) +static int CanPlayFileFromVFS(char* aFilename, VFSFile *VFSFile) { - if(gModplugXMMS.CanPlayFile(aFilename)) + if(gModplugXMMS.CanPlayFileFromVFS(aFilename, VFSFile)) return 1; return 0; } @@ -88,7 +88,7 @@ Init, ShowAboutBox, ShowConfigureBox, - CanPlayFile, + NULL, NULL, PlayFile, Stop, @@ -109,7 +109,7 @@ NULL, // tuple NULL, NULL, - NULL, // vfs + CanPlayFileFromVFS, // vfs fmts, };