SCUMM: MONKEY1 (Macintosh): Fix crash when loading 2.8.0 saves

This fixes #15353:
"SCUMM: MONKEY1 (Macintosh) Crash in saveLoadWithSerializer loading 2.8.0 saves on 2.9.0git"

I didn't take into account the fact that this version had 0xFFFF as VAR_SOUNDCARD,
at startup. I'm not disabling this soundcard detection thingy for the Mac versions for now,
because I'm not sure how different sound quality settings behave during saving/loading.
This commit is contained in:
AndywinXp 2024-09-02 22:57:56 +02:00
parent dea9b1ec90
commit fd5e608612

View File

@ -1954,6 +1954,10 @@ void ScummEngine::saveLoadWithSerializer(Common::Serializer &s) {
s.syncArray(_roomVars, _numRoomVariables, Common::Serializer::Sint32LE, VER(38));
int currentSoundCard = VAR_SOUNDCARD != 0xFF ? VAR(VAR_SOUNDCARD) : -1;
bool isMonkey1MacDefaultSoundCardValue =
(_game.id == GID_MONKEY &&
(_sound->_musicType & MidiDriverFlags::MDT_MACINTOSH) &&
currentSoundCard == 0xFFFF);
// The variables grew from 16 to 32 bit.
if (s.getVersion() < VER(15))
@ -1962,7 +1966,7 @@ void ScummEngine::saveLoadWithSerializer(Common::Serializer &s) {
s.syncArray(_scummVars, _numVariables, Common::Serializer::Sint32LE);
if (s.isLoading() && VAR_SOUNDCARD != 0xFF && (_game.heversion < 70 && _game.version <= 6)) {
if (currentSoundCard != VAR(VAR_SOUNDCARD)) {
if (currentSoundCard != VAR(VAR_SOUNDCARD) && !isMonkey1MacDefaultSoundCardValue) {
Common::String soundCards[] = {"PC Speaker", "IBM PCjr/Tandy", "Creative Music System", "AdLib", "Roland MT-32/CM-32L"};
GUI::MessageDialog dialog(