alinebee / Boxer

The DOS game emulator that's fit for your Mac.
http://boxerapp.com/
773 stars 139 forks source link

Music/SFX collision in Dragonsphere #7

Closed ghost closed 12 years ago

ghost commented 12 years ago

First, it's important to note that this is a bug with Boxer and not with the game itself; this problem does not occur in standard DOSBox 0.74.

While playing GOG's Dragonsphere bundle (which is free, so this should hopefully be pretty easy to reproduce), I realized that there was no MIDI music playing in the background while in-game. The MIDI works fine for the main menu of the game, though. After trying a number of different settings in the installer, I have found that:

I have set up Boxer's MT-32 emulation feature (which is pretty awesome!), but this bug also occurs if I select other cards for MIDI.

alinebee commented 12 years ago

OK, I can replicate what you're describing and the in-game music does indeed play in both OS X and Windows DOSBox, but is absent in Boxer.

For the sake of precision I should note that the missing music isn't necessarily MIDI: the GOG release comes preconfigured to use Sound Blaster 16 for music, which plays it via FM synthesis (which uses quite a different emulation pathway than actual MIDI playback).

This indicates that it's not a problem with Boxer's own custom MIDI-handling, but probably that some difference between Boxer's emulation environment and DOSBox's is confusing the game into not playing the music. The trial continues.

alinebee commented 12 years ago

I've tracked the problem now and boy what a doozy…

For its own use, Boxer sets a bunch of extra variables in the DOS environment that point to its own temp paths and things like that. These are pushing the DOS environment size into a zone where Dragonsphere will (for some bizarre buggy reason of its own) stop being able to play music and SFX at the same time.

Adding more environment variables, or removing enough existing variables, will cause the music to play properly once again. (I discovered this paradoxically by re-enabling Gravis Ultrasound emulation, which had been disabled by GOG's configuration for the game: GUS emulation adds a couple of extra environment variables that push the environment size back out of that sweet-spot that was fucking with Dragonsphere.)

I'll do some more testing to figure out exactly what the cutoff is for this. The solution will probably be to disable some of Boxer's own environment variables when running Dragonsphere to avoid the bug arising.

alinebee commented 12 years ago

OK, commit #b807845 adds a configuration for Dragonsphere which should ensure that music + SFX work properly with GOG and non-GOG releases of Dragonsphere alike.

Rather than change environment variables or conventional memory size, the fix simply runs the LOADFIX -F command before launching the game. This would normally be useless, but here has the side-effect of consolidating conventional memory, which seems to be enough to keep the game happy. If you are able to build from source, please try doing so from the latest commit and see if any other spots in the game exhibit missing music.

ghost commented 12 years ago

Thanks, great work on a pretty weird bug! I'm not able to build from source on this computer, but I can confirm that either running "loadfix -f" or enabling GUS emulation causes the in-game background music to play again. I'll play through the rest of the game in Boxer using the loadfix fix, and I'll report it if I have any other music problems.

Oh, and I don't know if this is the correct place to tell you, but since you've added a configuration for Dragonsphere just now, you'll probably want to set it to enforce normal CPU core emulation instead of dynamic. As reported on the GOG forums (and experienced by myself), the dynamic core causes occasional random crashes when going from one screen to another in-game. I've had no problems since I've set the core emulation to normal.

alinebee commented 12 years ago

Ok, thanks for the heads-up - I'll force it to normal, and add a flag to disregard GOG's own configuration for this game. Is there a particular CPU speed that has worked out better for you than the 8000 that GOG have assigned it?

ghost commented 12 years ago

Great! I've been running it on 10000 cycles, but mostly because I was playing around with the settings (it's my first time using Boxer) and forgot what they were originally set to. I'm sure 8000 cycles work just as well.

ghost commented 12 years ago

Quick update: I've finished the game now using loadfix. I had no further problems, either with sound or with crashing, so it seems like things are working perfectly.

alinebee commented 12 years ago

Great, thanks for that confirmation! :)