# HG changeset patch # User chainsaw # Date 1144791196 25200 # Node ID 5ef13028e42dddc69b2f943eb159431d31daa722 # Parent ddadd6828a1a3a1b59d3f42e5cdded31cc6f2b2e [svn] Allow to disable grabbing Amiga MOD files so a diferent plugin such as UADE gets a chance. Adds a few extra magic strings for Amiga files. Amiga MOD grabbing defaults to on for that Just Works(TM) feeling. diff -r ddadd6828a1a -r 5ef13028e42d Plugins/Input/modplug/gui/callbacks.cpp --- a/Plugins/Input/modplug/gui/callbacks.cpp Mon Apr 10 17:18:44 2006 -0700 +++ b/Plugins/Input/modplug/gui/callbacks.cpp Tue Apr 11 14:33:16 2006 -0700 @@ -58,6 +58,10 @@ lProps.mNoiseReduction = true; else lProps.mNoiseReduction = false; + if(gtk_toggle_button_get_active((GtkToggleButton*)lookup_widget((GtkWidget*)button, "fxAmigaMOD"))) + lProps.mGrabAmigaMOD = true; + else + lProps.mGrabAmigaMOD = false; if(gtk_toggle_button_get_active((GtkToggleButton*)lookup_widget((GtkWidget*)button, "fxFastInfo"))) lProps.mFastinfo = true; else diff -r ddadd6828a1a -r 5ef13028e42d Plugins/Input/modplug/gui/interface.cpp --- a/Plugins/Input/modplug/gui/interface.cpp Mon Apr 10 17:18:44 2006 -0700 +++ b/Plugins/Input/modplug/gui/interface.cpp Tue Apr 11 14:33:16 2006 -0700 @@ -59,6 +59,7 @@ GtkWidget *fxFastInfo; GtkWidget *vbox9; GtkWidget *fxNR; + GtkWidget *fxAmigaMOD; GtkWidget *frame5; GtkWidget *hbox4; GtkWidget *fxReverb; @@ -362,6 +363,14 @@ gtk_box_pack_start (GTK_BOX (vbox9), fxNR, FALSE, FALSE, 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fxNR), TRUE); + fxAmigaMOD = gtk_check_button_new_with_label (_("Play Amiga MOD")); + gtk_widget_ref (fxAmigaMOD); + gtk_object_set_data_full (GTK_OBJECT (Config), "fxAmigaMOD", fxAmigaMOD, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (fxAmigaMOD); + gtk_box_pack_start (GTK_BOX (vbox9), fxAmigaMOD, FALSE, FALSE, 0); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fxAmigaMOD), TRUE); + frame5 = gtk_frame_new (_("Reverb")); gtk_widget_ref (frame5); gtk_object_set_data_full (GTK_OBJECT (Config), "frame5", frame5, diff -r ddadd6828a1a -r 5ef13028e42d Plugins/Input/modplug/gui/main.cpp --- a/Plugins/Input/modplug/gui/main.cpp Mon Apr 10 17:18:44 2006 -0700 +++ b/Plugins/Input/modplug/gui/main.cpp Tue Apr 11 14:33:16 2006 -0700 @@ -86,6 +86,11 @@ else gtk_toggle_button_set_active((GtkToggleButton*)lookup_widget(ConfigWin, "fxNR"), FALSE); + if(aProps.mGrabAmigaMOD) + gtk_toggle_button_set_active((GtkToggleButton*)lookup_widget(ConfigWin, "fxAmigaMOD"), TRUE); + else + gtk_toggle_button_set_active((GtkToggleButton*)lookup_widget(ConfigWin, "fxAmigaMOD"), FALSE); + if(aProps.mFastinfo) gtk_toggle_button_set_active((GtkToggleButton*)lookup_widget(ConfigWin, "fxFastInfo"), TRUE); else diff -r ddadd6828a1a -r 5ef13028e42d Plugins/Input/modplug/modplugbmp.cpp --- a/Plugins/Input/modplug/modplugbmp.cpp Mon Apr 10 17:18:44 2006 -0700 +++ b/Plugins/Input/modplug/modplugbmp.cpp Tue Apr 11 14:33:16 2006 -0700 @@ -41,6 +41,7 @@ mVolumeRamp = true; mFastinfo = true; mUseFilename = false; + mGrabAmigaMOD = true; mChannels = 2; mFrequency = 44100; @@ -74,6 +75,7 @@ bmp_cfg_db_get_bool(db,"modplug","Reverb", &mModProps.mReverb); bmp_cfg_db_get_bool(db,"modplug","FastInfo", &mModProps.mFastinfo); bmp_cfg_db_get_bool(db,"modplug","UseFileName", &mModProps.mUseFilename); + bmp_cfg_db_get_bool(db,"modplug","GrabAmigaMOD", &mModProps.mGrabAmigaMOD); bmp_cfg_db_get_bool(db,"modplug","PreAmp", &mModProps.mPreamp); bmp_cfg_db_get_float(db,"modplug","PreAmpLevel", &mModProps.mPreampLevel); bmp_cfg_db_get_int(db,"modplug", "Channels", &mModProps.mChannels); @@ -131,6 +133,7 @@ vfs_fclose(file); return 1; } + if(mModProps.mGrabAmigaMOD) { vfs_fseek(file, 1080, SEEK_SET); vfs_fread(magic, 1, 4, file); if (!memcmp(magic, MOD_MAGIC_PROTRACKER4, 4)) { @@ -141,6 +144,10 @@ 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; @@ -149,6 +156,14 @@ 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; @@ -181,6 +196,7 @@ vfs_fclose(file); return 1; } + } /* end of if(mModProps.mGrabAmigaMOD) */ /* We didn't find the magic bytes, fall back to extension check */ vfs_fclose(file); @@ -207,8 +223,6 @@ return true; if (lExt == ".mdl") return true; - if (lExt == ".med") - return true; if (lExt == ".stm") return true; if (lExt == ".ult") @@ -769,6 +783,7 @@ bmp_cfg_db_set_bool(db,"modplug","Reverb", mModProps.mReverb); bmp_cfg_db_set_bool(db,"modplug","FastInfo", mModProps.mFastinfo); bmp_cfg_db_set_bool(db,"modplug","UseFileName", mModProps.mUseFilename); + bmp_cfg_db_set_bool(db,"modplug","GrabAmigaMOD", mModProps.mGrabAmigaMOD); bmp_cfg_db_set_bool(db,"modplug","PreAmp", mModProps.mPreamp); bmp_cfg_db_set_float(db,"modplug","PreAmpLevel", mModProps.mPreampLevel); bmp_cfg_db_set_int(db,"modplug", "Channels", mModProps.mChannels); diff -r ddadd6828a1a -r 5ef13028e42d Plugins/Input/modplug/modplugbmp.h --- a/Plugins/Input/modplug/modplugbmp.h Mon Apr 10 17:18:44 2006 -0700 +++ b/Plugins/Input/modplug/modplugbmp.h Tue Apr 11 14:33:16 2006 -0700 @@ -16,11 +16,14 @@ #include "audacious/plugin.h" -/* Module files have their magic deep inside the file, at offset 1080; source: http://www.onicos.com/staff/iz/formats/mod.html */ +/* Module files have their magic deep inside the file, at offset 1080; source: http://www.onicos.com/staff/iz/formats/mod.html and information by Michael Doering from UADE */ #define MOD_MAGIC_PROTRACKER4 (unsigned char [4]) { 0x4D, 0x2E, 0x4B, 0x2E } // "M.K." - Protracker 4 channel #define MOD_MAGIC_PROTRACKER4X (unsigned char [4]) { 0x4D, 0x21, 0x4B, 0x21 } // "M!K!" - Protracker 4 channel -#define MOD_MAGIC_STARTRACKER4 (unsigned char [4]) { 0x46, 0x4C, 0x54, 0x34 } // "FLT4" - Startracker 4 channel -#define MOD_MAGIC_STARTRACKER8 (unsigned char [4]) { 0x46, 0x4C, 0x54, 0x38 } // "FLT8" - Startracker 8 channel +#define MOD_MAGIC_NOISETRACKER (unsigned char [4]) { 0x4D, 0x26, 0x4B, 0x21 } // "M&K!" - Noisetracker 1.3 by Kaktus & Mahoney +#define MOD_MAGIC_STARTRACKER4 (unsigned char [4]) { 0x46, 0x4C, 0x54, 0x34 } // "FLT4" - Startracker 4 channel (Startrekker/AudioSculpture) +#define MOD_MAGIC_STARTRACKER8 (unsigned char [4]) { 0x46, 0x4C, 0x54, 0x38 } // "FLT8" - Startracker 8 channel (Startrekker/AudioSculpture) +#define MOD_MAGIC_STARTRACKER4X (unsigned char [4]) { 0x45, 0x58, 0x30, 0x34 } // "EX04" - Startracker 4 channel (Startrekker/AudioSculpture) +#define MOD_MAGIC_STARTRACKER8X (unsigned char [4]) { 0x45, 0x58, 0x30, 0x38 } // "EX08" - Startracker 8 channel (Startrekker/AudioSculpture) #define MOD_MAGIC_FASTTRACKER4 (unsigned char [4]) { 0x34, 0x43, 0x48, 0x4E } // "4CHN" - Fasttracker 4 channel #define MOD_MAGIC_FASTTRACKER6 (unsigned char [4]) { 0x36, 0x43, 0x48, 0x4E } // "6CHN" - Fasttracker 6 channel #define MOD_MAGIC_FASTTRACKER8 (unsigned char [4]) { 0x38, 0x43, 0x48, 0x4E } // "8CHN" - Fasttracker 8 channel @@ -58,6 +61,7 @@ gboolean mReverb; gboolean mFastinfo; gboolean mUseFilename; + gboolean mGrabAmigaMOD; gboolean mPreamp; gint mChannels;