summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2014-10-01 23:56:09 -0400
committerSimon Howard2014-10-01 23:56:09 -0400
commit0ec3d826f0b0f2b25f8652287f2c1027c8229e34 (patch)
tree8326fab73bcb452611e5aeb9df0865c4a1e483b3 /src
parent7e9d6e29bae68f9b9971660f7b59ddd5731e4d22 (diff)
downloadchocolate-doom-0ec3d826f0b0f2b25f8652287f2c1027c8229e34.tar.gz
chocolate-doom-0ec3d826f0b0f2b25f8652287f2c1027c8229e34.tar.bz2
chocolate-doom-0ec3d826f0b0f2b25f8652287f2c1027c8229e34.zip
hexen: Add workaround for Mac Hexen IWAD.
The Mac version of hexen.wad is slightly different from the normal DOS one: it contains a bunch of extra lumps but more importantly, the GENMIDI and DMXGUS lumps are missing. This means that Chocolate Hexen would crash on startup with the default settings (as OPL is the default music output). To work around this problem and allow the game to start up properly, detect if the required lump is missing and adjust the music settings, printing a helpful message to stdout to inform the user.
Diffstat (limited to 'src')
-rw-r--r--src/hexen/h2_main.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/hexen/h2_main.c b/src/hexen/h2_main.c
index 66dc535e..23131e9b 100644
--- a/src/hexen/h2_main.c
+++ b/src/hexen/h2_main.c
@@ -186,6 +186,40 @@ static void D_SetDefaultSavePath(void)
}
}
+// The Mac version of the Hexen IWAD is different to the "normal" DOS
+// version - it doesn't include lumps used by the DOS DMX library.
+// This means that we can't do GUS or OPL emulation and need to apply
+// a workaround.
+static void AdjustForMacIWAD(void)
+{
+ boolean adjust_music = false;
+
+ switch (snd_musicdevice)
+ {
+ case SNDDEVICE_ADLIB:
+ case SNDDEVICE_SB:
+ adjust_music = W_CheckNumForName("GENMIDI") < 0;
+ break;
+
+ case SNDDEVICE_GUS:
+ adjust_music = W_CheckNumForName("DMXGUS") < 0;
+ break;
+
+ default:
+ break;
+ }
+
+ if (adjust_music)
+ {
+ printf("** Note: You appear to be using the Mac version of the Hexen\n"
+ "** IWAD file. This is missing the lumps required for OPL or\n"
+ "** GUS emulation. Your music configuration is being adjusted\n"
+ "** to a different setting that won't cause the game to "
+ "crash.\n");
+ snd_musicdevice = SNDDEVICE_GENMIDI;
+ }
+}
+
//
// D_GrabMouseCallback
//
@@ -297,6 +331,7 @@ void D_DoomMain(void)
D_AddFile(iwadfile);
W_CheckCorrectIWAD(hexen);
+ AdjustForMacIWAD();
HandleArgs();