#9994 closed defect (fixed)

SCI: GK2 Demo: Surface:: convertTo() Crash for Windowed Movie

Reported by: dafioram Owned by: csnover
Priority: low Component: Engine: SCI
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!

Attachments (3)

Untitled.png (42.6 KB) - added by dafioram 21 months ago.
Menu before clicking widescreen
Untitled2.png (45.2 KB) - added by dafioram 21 months ago.
After I clicked widescreen.
Untitled3.png (43.0 KB) - added by dafioram 21 months ago.
The crash

Download all attachments as: .zip

Change History (6)

Changed 21 months ago by dafioram

Attachment: Untitled.png added

Menu before clicking widescreen

Changed 21 months ago by dafioram

Attachment: Untitled2.png added

After I clicked widescreen.

Changed 21 months ago by dafioram

Attachment: Untitled3.png added

The crash

comment:1 Changed 21 months ago by csnover

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…).

comment:2 Changed 20 months ago by csnover

Owner: set to csnover

I have a fix for this issue which depends on PR#1008. Once that PR lands I will also land the fix for this bug.

comment:3 Changed 20 months ago by csnover

Resolution: fixed
Status: newclosed

Thanks for your report! A patch for this issue has been added in commit 533bb5b257b7788b99b307381d96f8e54d9e9c75 and will be available in daily builds 1.10.0git-4847 and higher.

Note: See TracTickets for help on using tickets.