Opened 2 weeks ago

Closed 2 weeks ago

#15353 closed defect (fixed)

SCUMM: MONKEY1 (Macintosh) Crash in saveLoadWithSerializer loading 2.8.0 saves on 2.9.0git

Reported by: dwatteau Owned by: AndywinXp
Priority: high Component: Engine: SCUMM
Version: Keywords: saves, macintosh
Cc: Game: Monkey Island 1

Description

If I try loading one of my older saves (made with ScummVM 2.8.0) for Monkey1 Macintosh, on current ScummVM 2.9.0git HEAD, I always get the following crash:

(lldb) run
User picked target 'monkey-mac' (engine ID 'scumm', game ID 'monkey')...
Process 51726 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x7ff7c017c8e0)
    frame #0: 0x0000000100004c1c scummvm`Common::BaseString<char>::c_str(this=0x00007ff7c017c8d8) const at str-base.h:173:50
   170 			return begin() + size();
   171 		}
   172 	
-> 173 		inline const value_type *c_str() const { return _str; }
   174 		inline uint size() const         { return _size; }
   175 	
   176 		inline bool empty() const { return (_size == 0); }
Target 0: (scummvm) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x7ff7c017c8e0)
  * frame #0: 0x0000000100004c1c scummvm`Common::BaseString<char>::c_str(this=0x00007ff7c017c8d8) const at str-base.h:173:50
    frame #1: 0x00000001001670d3 scummvm`Scumm::ScummEngine::saveLoadWithSerializer(this=0x00000001100d0000, s=0x00007ff7bfefcb20) at saveload.cpp:1973:35
    frame #2: 0x000000010016a391 scummvm`Scumm::ScummEngine_v5::saveLoadWithSerializer(this=0x00000001100d0000, s=0x00007ff7bfefcb20) at saveload.cpp:2151:15
    frame #3: 0x000000010016289b scummvm`Scumm::ScummEngine::loadState(this=0x00000001100d0000, slot=2, compat=false, filename=0x00007ff7bfefcc40) at saveload.cpp:771:2
    frame #4: 0x00000001001621ed scummvm`Scumm::ScummEngine::loadState(this=0x00000001100d0000, slot=2, compat=false) at saveload.cpp:625:9
    frame #5: 0x00000001001b94b4 scummvm`Scumm::ScummEngine::go(this=0x00000001100d0000) at scumm.cpp:2417:29
    frame #6: 0x00000001001bed42 scummvm`Scumm::ScummEngine::run(this=0x00000001100d0000) at scumm.h:583:10
    frame #7: 0x000000010001e796 scummvm`runGame(enginePlugin=0x0000600000221b80, system=0x0000000101a04df0, game=0x00007ff7bfefda00, meDescriptor=0x0000000000000000) at main.cpp:311:33
    frame #8: 0x000000010001c9a0 scummvm`::scummvm_main(argc=1, argv=0x00007ff7bfeff930) at main.cpp:796:13
    frame #9: 0x0000000100015dad scummvm`main(argc=1, argv=0x00007ff7bfeff930) at macosx-main.cpp:44:12
    frame #10: 0x0000000100df952e dyld`start + 462

I'm attaching two saves below.

Attachments (2)

monkey-mac.s02 (17.5 KB ) - added by dwatteau 2 weeks ago.
First example of 2.8.0 save causing a crash in 2.9.0git (Monkey1-Macintosh)
monkey-mac.s05 (21.0 KB ) - added by dwatteau 2 weeks ago.
Other save example showing the same issue

Download all attachments as: .zip

Change History (5)

by dwatteau, 2 weeks ago

Attachment: monkey-mac.s02 added

First example of 2.8.0 save causing a crash in 2.9.0git (Monkey1-Macintosh)

by dwatteau, 2 weeks ago

Attachment: monkey-mac.s05 added

Other save example showing the same issue

comment:1 by AndywinXp, 2 weeks ago

IIRC this game/version had some massive changes on the sound engine a while ago. Could this be the cause? (I have yet to debug the issue)

comment:2 by AndywinXp, 2 weeks ago

	if (s.isLoading() && VAR_SOUNDCARD != 0xFF && (_game.heversion < 70 && _game.version <= 6)) {
		if (currentSoundCard != VAR(VAR_SOUNDCARD)) {
			Common::String soundCards[] = {"PC Speaker", "IBM PCjr/Tandy", "Creative Music System", "AdLib", "Roland MT-32/CM-32L"};
			
			GUI::MessageDialog dialog(
				Common::U32String::format(_("Warning: incompatible sound settings detected between the current configuration and this saved game.\n\n"
					"Current music device: %s (id %d)\nSave file music device: %s (id %d)\n\n"
					"Loading will be attempted, but the game may behave incorrectly or crash.\n"
					"Please change the audio configuration accordingly in order to properly load this save file."),
					soundCards[currentSoundCard].c_str(), currentSoundCard, soundCards[VAR(VAR_SOUNDCARD)].c_str(), VAR(VAR_SOUNDCARD))
			);
			runDialog(dialog);
		}
	}

It's crashing here... why is it crashing here? :S

Last edited 2 weeks ago by AndywinXp (previous) (diff)

comment:3 by AndywinXp, 2 weeks ago

Owner: set to AndywinXp
Resolution: fixed
Status: newclosed

In fd5e6086:

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.

Note: See TracTickets for help on using tickets.