Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#13113 closed defect (fixed)

Humongous Games crash when loading save

Reported by: Satertek Owned by: eriktorbjorn
Priority: normal Component: Engine: SCUMM
Version: Keywords: puttzoo
Cc: Satertek Game: Putt-Putt Saves the Zoo

Description (last modified by Satertek)

Platform: Windows 11 (10.0.22000)
ScummVM: ScummVM 2.5 and (nightly) ScummVM 2.6.0git1648-ga9e8ee893a (Nov 28 2021 22:36:38)

Steps to reproduce in Putt Putt Saves the Zoo:
1) Launch game
2) Advance Putt-Putt forward two screens (EDIT/NOTE: sometimes two screens works but advancing 4 screens causes the issue. unsure of the inconsistency)
3) Create a save with in-game "S" hotkey
4) Close and relaunch game
5) Load previously created save with "L" hotkey
6) Crash:

WARNING: Unrecognized base tag 0x524d4948 in sound 1!
Assertion failed: ptr, file engines/scumm/resource.cpp, line 741

Game file source: English version of puttzoo-win sourced from Steam.

Notes:
Advancing to the screen that is at the save location will allow successful load
Issue was not present in 2.2, occurs in 2.5 and 2.6 nightly (tested Nov 28 2021)
Occurs in other Humongous Games as well (at least Freddi Fish 1 and Putt Putt Travels Through Time)
Have only tested game content sourced from Steam

Change History (6)

comment:1 by Satertek, 3 years ago

Description: modified (diff)

comment:2 by eriktorbjorn, 3 years ago

I was able to reproduce the crash with a save on the fourth screen

Perhaps interestingly, if I advanced to the fourth screen before loading the savegame, it didn't crash. Is it relying on resources already being loaded, or something like that?

comment:3 by eriktorbjorn, 3 years ago

Some more thinking out loud...

While loading the savegame, it will apparently load a list of resources. See saveLoadWithSerializer():

			uint16 tmp;
			while (s.syncAsUint16LE(tmp), tmp != 0xFFFF) {
				type = (ResType)tmp;
				while (s.syncAsUint16LE(idx), idx != 0xFFFF) {
					assert(idx < _res->_types[type].size());
					loadResource(s, type, idx);
					applyWorkaroundIfNeeded(type, idx);
				}
			}

But loadResource() has a special case for Humongous Games and sound resources:

	} else if (type == rtSound) {
		// HE Games use sound resource 1 for speech
		if (_game.heversion >= 60 && idx == 1)
			return;

		ensureResourceLoaded(rtSound, idx);
	} else if (_res->_types[type]._mode == kDynamicResTypeMode) {

Which apparently means that sound resource 1 isn't (and shouldn't) loaded after all.

The applyWorkaroundIfNeeded() function was added recently to work around some script problems. Initially for allowing FM Towns games to be cropped to 320x200 pixels, but later it was extended for other things as well.

This function assumes that the resource is loaded. I guess it shouldn't do that.

comment:4 by eriktorbjorn, 3 years ago

Based on what I wrote above, I've pushed a fix that should take care of the problem. It should appear both in the next nightly build and in the upcoming 2.5.1. Let me know if there are any further problems.

comment:5 by eriktorbjorn, 3 years ago

Owner: set to eriktorbjorn
Resolution: fixed
Status: newclosed

comment:6 by Satertek, 3 years ago

Confirming the fix, I cannot reproduce the problem in ScummVM 2.6.0git1700-g89cba0db97 (Nov 29 2021 23:33:29)

Thanks!

Note: See TracTickets for help on using tickets.