Opened 7 years ago

Last modified 7 years ago

#9994 closed defect

SCI: GK2 Demo: Surface:: convertTo() Crash for Windowed Movie — at Version 1

Reported by: dafioram Owned by:
Priority: low Component: Engine: SCI
Version: Keywords: sci32
Cc: Game: Gabriel Knight 2

Description (last modified by csnover)

Tester OS: Win7-64
Game: GK2 Demo from ScummVM website
ScummVM: 1.10.0git-4054-g96a1b70

If I try to watch the Movie in the demo on Windowed then scummvm crashes.

After I click Windowed it says "Could not Initialize color format".

Then it crashes and says
Error: Surface::convertTo() Can only convert to 2Bpp and 4Bpp!

Change History (4)

by dafioram, 7 years ago

Attachment: Untitled.png added

Menu before clicking widescreen

by dafioram, 7 years ago

Attachment: Untitled2.png added

After I clicked widescreen.

by dafioram, 7 years ago

Attachment: Untitled3.png added

The crash

comment:1 by csnover, 7 years ago

Description: modified (diff)
Summary: SCI: GK2 Demo: Surface:: convertTO() Crash for Widescreen MovieSCI: GK2 Demo: Surface:: convertTo() Crash for Windowed Movie

When a game calls to play a video at its original resolution, the video player tries to optimise rendering by setting the backend pixel format to the pixel format of the video (which is 32bpp) so it can be sent directly without any intermediate conversion step.

The OpenGL backend cannot handle the pixel format given by the decoder for this video, so fails, shows that alert, and the system pixel format remains 8bpp. At this point the game scripts will continue to try to play the video, and then the convertTo error happens because the system surface is 8bpp but the video is 32bpp so there is no way to down-convert to the system surface for rendering.

There is supposed to be an API for negotiating supported pixel formats between the backend and frontend, but this API is currently broken for SDL; 32bpp formats that are supported by SDL are not added to the supported list because ScummVM starts SDL at 16bpp and then only allows formats that are <= the currently set colour depth onto the supported formats list. When I was looking, it seems that all the engines that use 32bpp work around this by blindly setting a hard-coded 32bpp pixel format and assuming it will succeed. (The OSystem API for setting the surface format also doesn’t actually have any mechanism for communicating success/failure.)

I was hoping to avoid doing more work on backend but I just don’t know that there is any other way to resolve this (except to say not to use the OpenGL backend…).

Note: See TracTickets for help on using tickets.