rakslice / macemu

Basilisk II and SheepShaver Macintosh emulators
0 stars 0 forks source link

SS: App resolution change, bad graphics state? #47

Closed rakslice closed 3 years ago

rakslice commented 3 years ago

Changing resolution/mode sometimes leaves the system without functional image decompressors, which causes QuickTime PictureViewer to error with -8988 (codecOffscreenFailedErr) and apps that use such images in panels to fail to render properly. The condition is temporary; subsequent resolution/mode changes have a chance of making them work again.

mode fail

How to reproduce:

  1. With an image open in PictureViewer, or iTunes 2.0.4 running with visualization on (Cmd-T),
  2. Change the screen resolution, colour mode, and gray/colour setting; try making changes with the monitors control panel and the control strip; try launching sessions of the monitors control panel under different conditions.

Initial issue:

Testing iTunes 2.0.4 visualization in Mac OS 9:

If iTunes has already been used in the current Mac OS session but the resolution has been changed since,

Visualization full screen mode doesn't work unless the Mac resolution is 640x480 (I expect this is because it is the only case where it doesn't try to switch resolutions for it)

rakslice commented 3 years ago

There is a similar behaviour with QuickTime's PictureViewer, if the resolution has been changed since startup, erroring (usually with error -8988), sometimes followed by a crash. However notably unlike #27, it doesn't affect some applications that use QuickTime JPEG PICT resources like Audion.

rakslice commented 3 years ago

This only happens when switching the resolution with the control strip... [Not quite, see note below]

rakslice commented 3 years ago

(Testing in kanjitalk755 win32 https://github.com/rakslice/macemu/commit/0b9b6401d6bd4246b4d58d395974c787ffc108c1)

Also testing PictureViewer in Mac OS 7.6.1 with Quicktime 4.1.2, I find a similar situation where the most recent resolution change can lead to error -8988 , but with a couple of differences.

rakslice commented 3 years ago

No, it doesn't happen only when switching resolution with the control strip, it also happens when switching resolution with the monitors control panel depending on the state when the monitors control panel opened...

Note that unlike resolution, switching colour mode with the monitors control panel always works even if switching resolution with the same control panel instance would lead to a bad state

rakslice commented 3 years ago

I can't figure out the condition that leads to a monitors control panel that gives bad resolution changes.

rakslice commented 3 years ago

[this ended up not being important; the hardcursor cursor jumps are a separate issue that is just the result of the implementation using the wrong SDL call and probably not having been tested before the default was changed]

Due to the clicks on icons repositioned by these resolution changes leading to off-screen jumps in #36, I think I need to ask a stupid question:

Where is the screen in QuickDraw coordinate space? What effect does changing the resolution have on that? Is the right thing happening to coordinate space after a resolution change in SS? Does the video driver have any responsibility to do any bookkeeping for that?

rakslice commented 3 years ago

Similar behaviour is mentioned in this ancient forum post https://www.emaculation.com/forum/viewtopic.php?t=7138 The commenter correctly notes that this is codecOffscreenFailedErr, based on the presence of this error code by that name in the QuickTime API reference error list. http://web.archive.org/web/20040305060523/developer.apple.com/documentation/QuickTime/APIREF/SOURCESIV/errorcodes.htm

The QuickTime 3 version of PictureViewer, stock in Mac OS 8.5, actually gives an error message for this error instead of the error number:

Couldn't display "Sample Image" because a suitable decompressor could not be found.

I just tried to reproduce the problem in my qemu ppc 2019-04-24 build Mac OS 9.2.x install, and couldn't! That version of qemu's ndrv has basically no support for <256 colour modes, but almost any mode switch with the control strip hits the bug in SS, so it's quite something that mode changes are working in qemu.

Scouring its ndrv for any difference that might account for the difference, I found something it is initializing that SS isn't: https://github.com/qemu/QemuMacDrivers/blob/90c488d5f4a407342247b9ea869df1c2d9c8e266/QemuVGADriver/src/DriverQDCalls.c#L585

rakslice commented 3 years ago

I couldn't reproduce this issue in BII (tested Mac OS 7.6.1 with control strip and QT 4.0.3, which have the issue in SS).