Opened 12 years ago

Closed 10 years ago

Last modified 10 years ago

#6136 closed defect (fixed)

SCI : loading savegames crashes when loading is disabled

Reported by: misterhands Owned by: wjp
Priority: normal Component: Engine: SCI
Version: Keywords:
Cc: Game:

Description

SCUMMVM 1.6.0git1351-g74d5214 Win64

This occurs in certain SCI games, like QFG1VGA, and LSL2. This may happen in other SCI games too.

When you load a savegame at a time when you're not supposed to (and loading is disabled in the original interpreter), quite logically, SCUMMVM crashes, with output that looks like this :

For LSL2, when trying to load at the copy protection screen : WARNING: Attempt to free Hunk from address 001a:0004: Invalid segment type! WARNING: getObject(): Trying to get an invalid object! lookupSelector(): Attempt to send to non-object or invalid script. Address was 0017:00c0!

For QFG1VGA, when trying to load at the legal messages at the start of the game : WARNING: getObject(): Trying to get an invalid object! lookupSelector(): Attempt to send to non-object or invalid script. Address was 002c:00cc!

So the fix would be to either disable loading at these places like the original, or make sure that everything is properly initialized so that a savegame can be loaded without crashing. I think the latter would be better, if that's possible.

Thanks!

Ticket imported from: #3565505. Ticket imported from: bugs/6136.

Change History (23)

comment:1 by misterhands, 12 years ago

I also got this in SQ1VGA in the same conditions : WARNING: getObject(): Trying to get an invalid object! lookupSelector(): Attempt to send to non-object or invalid script. Address was 002a:004c!

I won't test every game, I think you get the idea ! :-)

comment:2 by bluegr, 12 years ago

This has hopefully been fixed in 76ff4c700166d69b416dae324ee616ab57265c34.

The fix should be in the next daily build. Please test if you find any other cases, hopefully this change fixes all of such cases. Once there is enough testing done, we can close this bug as resolved.

comment:3 by bluegr, 12 years ago

Owner: set to bluegr

comment:4 by misterhands, 12 years ago

LSL2 looks good after your fix. SQ1VGA too. LSL1VGA never had the problem.

QFG1 is better but: 1) if you skip the sierra logo and try to load at the main game menu, the crash will occur some times 2) after you restart the game, the crash still occurs every time

That's all the SCI games I have installed right now. I will try to install more and test them soon.

comment:5 by bluegr, 12 years ago

The load dialog was incorrectly enabled after a restart. This has now been fixed in commit c347049, and should be available in the next daily version of ScummVM. This fixes issue (2).

As for issue (1)... I can't reproduce this, and since you mentioned that it doesn't happen reliably, I assume it was just a very rare occurrence.

Have you found any other cases with your testing? If not, perhaps it's time to close this bug as resolved?

comment:6 by misterhands, 12 years ago

Thanks for issue 2)

I wouldn't call issue 1) a very rare occurrence. I just tried 5 times and got the crash : lookupSelector(): Attempt to send to non-object or invalid script. Address was 002c:002c!

comment:7 by misterhands, 12 years ago

Didn't get the chance to test other games. I will try to do so shortly.

I just tried KQ4 and found a new case, when loading on the "is this your first time playing KQ4?" question : lookupSelector(): Attempt to send to non-object or invalid script. Address was 0 017:06b9!

comment:8 by misterhands, 12 years ago

Another occurrence in LB2. To replicate, choose "Play game" at the main menu or hit ESC at the Sierra logo. After the ACT I screen, Laura starts talking with this guy Rube. Trying to load during the 5-6 first lines triggers the crash :

WARNING: getObject(): Trying to get an invalid object! lookupSelector(): Attempt to send to non-object or invalid script. Address was 0029:0175!

comment:9 by misterhands, 12 years ago

Also found the crash in QFG3 during the credits, and at the start of the intro. WARNING: getObject(): Trying to get an invalid object! lookupSelector(): Attempt to send to non-object or invalid script. Address was 002c:00d9!

comment:10 by bluegr, 12 years ago

Updated the description

comment:11 by bluegr, 12 years ago

Summary: SCI : crash when loading a savegameSCI : loading savegames crashes when loading is disabled

comment:12 by digitall, 10 years ago

misterhands: What is the status of this item?

I am going to assign it to pending / outdated. Unless an update is received within 14 days, it will be automatically closed. Thanks.

comment:13 by digitall, 10 years ago

Status: newpending

comment:14 by misterhands, 10 years ago

Well, the cases I reported previously have not been fixed, thus the crashes are still occurring (in GFQ1VGA, KQ4, LB2, GFQ3).

I also found the crash in castlebrain by accident some time ago, when loading during the alien card puzzle: WARNING: Failed to locate base object for object at 0027:316A; skipping! WARNING: Failed to locate base object for object at 0027:2F88; skipping! WARNING: Failed to locate base object for object at 0027:2D8C; skipping! WARNING: Failed to locate base object for object at 0027:23AC; skipping! WARNING: Failed to locate base object for object at 0027:2ABE; skipping! WARNING: Failed to locate base object for object at 0041:0588; skipping! WARNING: Attempt to free Hunk from address 003b:0020: Invalid segment type! WARNING: Attempt to free Hunk from address 003b:0021: Invalid segment type! WARNING: getObject(): Trying to get an invalid object! lookupSelector(): Attempt to send to non-object or invalid script. Address was 0021:0d3b!

And I'm sure there are many more cases to be found, given the number of supported games and occurrences of disabled save/load.

Maybe the best to avoid this crash once and for all would be to disable loading at the GMM level when it is disabled by the scripts.

comment:15 by bluegr, 10 years ago

Status: pendingnew

comment:16 by bluegr, 10 years ago

This isn't easy to fix. The crashes occur because the game scripts are not in the main game loop at that point, and all sort of things break when the user tries to load.

I'm reverting to "open", please do not change to "pending" until a proper solution is found for this

comment:17 by m-kiewitz, 10 years ago

Component: Engine: SCI

comment:18 by m-kiewitz, 10 years ago

wjp has just committed a change, that fixes most of it

we are currently figuring out a way to solve even more of the problems

It was actually a problem of ScummVM. ScummVM game menu caused a saved game to get loaded and then we still continued with event processing, which includes writing to certain selectors of objects. Which didn't work after restoring of course.

comment:19 by wjp, 10 years ago

The problem in most (and hopefully all) of these cases was that the ScummVM menu was triggering a load in the middle of kGetEvent, which rather confused that function.

comment:20 by m-kiewitz, 10 years ago

misterhands, if you are still available, can you please check a few games now? I just implemented delayed restore, which should now fully solve the issue.

In Eco Quest 2, I implemented a workaround for the credits, which is why restoring a saved game doesn't work while the credits are scrolling through atm, but everywhere else it should work now.

comment:21 by misterhands, 10 years ago

Hey, I think you meant the Eco Quest 1 credits?

Anyway, I've tested LSL2, SQ1 & QFG1 remakes, QFG3, LB2, KQ4, Dr. Brain 1 again. And that lookupSelector did no attempt to send to non-object or invalid script ! :)

Some games still spam "Failed to locate base object for object at 00XX:XXXX; skipping!", though. Other than that it looks good to me.

comment:22 by m-kiewitz, 10 years ago

Owner: changed from bluegr to wjp
Resolution: fixed
Status: newclosed

comment:23 by m-kiewitz, 10 years ago

Oh right, Eco Quest 1 of course. It will load right after the credits, so it's not a big deal.

The "failed to locate base object" is another issue, but it has nothing to do with the ScummVM menu. Thanks for testing. I will now close this bug as fixed.

Note: See TracTickets for help on using tickets.