AGOS: Fix DOS PN and FF demo crash

The engine would try to initialize the MidiPlayer for all DOS games, even the
ones that don't use MIDI (Personal Nightmare and Feeble Files demos). This
caused a problem with the new MIDI code, which does not set up the necessary
objects for these games and crashed on a null pointer.
This is fixed by adding PN and FF as exceptions to the if condition guarding
initialization of the MidiPlayer.
This commit is contained in:
Coen Rampen 2022-08-04 21:44:16 +02:00
parent 69662ee9a4
commit 03de0244ed
2 changed files with 5 additions and 4 deletions

View File

@ -612,9 +612,10 @@ Common::Error AGOSEngine::init() {
_midi = new MidiPlayer(this);
if ((getGameType() == GType_SIMON2 && getPlatform() == Common::kPlatformWindows) ||
(getGameType() == GType_SIMON1 && getPlatform() == Common::kPlatformWindows) ||
((getFeatures() & GF_TALKIE) && getPlatform() == Common::kPlatformAcorn) ||
(getPlatform() == Common::kPlatformDOS || getPlatform() == Common::kPlatformPC98)) {
(getGameType() == GType_SIMON1 && getPlatform() == Common::kPlatformWindows) ||
((getFeatures() & GF_TALKIE) && getPlatform() == Common::kPlatformAcorn) ||
(getPlatform() == Common::kPlatformDOS && getGameType() != GType_PN && getGameType() != GType_FF) ||
getPlatform() == Common::kPlatformPC98) {
int ret = _midi->open();
if (ret)

View File

@ -533,7 +533,7 @@ bool MidiPlayer::isPlaying(bool checkQueued) {
void MidiPlayer::stop(bool sfx) {
Common::StackLock lock(_mutex);
if (!sfx) {
if (!sfx) {
// Clear the queued track to prevent it from starting when the current
// track is stopped.
_queuedTrack = 255;