Opened 7 weeks ago

Closed 6 weeks ago

#15006 closed defect (fixed)

GRAPHICS: MACGUI: Screen can change between menu is activated and menu is drawn, causing glitches

Reported by: eriktorbjorn Owned by: eriktorbjorn
Priority: normal Component: Video
Version: Keywords:
Cc: Game: Indiana Jones 3

Description (last modified by eriktorbjorn)

I don't know which games this will affect, but I've managed to reproduce it reliably with the Macintosh version of Indiana Jones and the Last Crusade.

When the menu is activated (by moving the mouse to the top of the screen), it will make a copy of the screen and flag the menu as visible. When the menu is closed, the screen is restored to that copy. But if the screen changes in the brief time between the menu is activated and it's first drawn, it will have saved an outdated version of the screen.

Try this in Last Crusade:

Walk from one room to another. There is a quick graphics transition. While the transition is running, quickly move the mouse to the top of the screen. If you time it right, you will have caused it to save the screen while it was still mostly black.

When the menu closes again, your screen may look something like this:

So instead of copying the screen right away, it should probably set a flag that the screen should be copied, and then do that right before the menu is actually drawn. But I'm a bit fuzzy on exactly how the Mac Window Manager class works.

Attachments (4)

scummvm-indy3-ega-mac-00000.png (7.7 KB ) - added by eriktorbjorn 7 weeks ago.
macgui-menu-corruption.txt (1.5 KB ) - added by eriktorbjorn 7 weeks ago.
macgui-menu-corruption2.txt (2.3 KB ) - added by eriktorbjorn 7 weeks ago.
macgui_menu_corruption3.txt (3.9 KB ) - added by eriktorbjorn 7 weeks ago.

Download all attachments as: .zip

Change History (10)

by eriktorbjorn, 7 weeks ago

comment:1 by eriktorbjorn, 7 weeks ago

Description: modified (diff)

by eriktorbjorn, 7 weeks ago

Attachment: macgui-menu-corruption.txt added

comment:2 by eriktorbjorn, 7 weeks ago

I've attached a possible patch, along the lines that I described. I'm not sure if it's correct.

comment:3 by eriktorbjorn, 7 weeks ago

When I was testing my patch in the 2.8 branch, I somehow got into a situation where the game became unresponsive. I could press the Mac verb buttons, but they didn't pop back out, and everything in the scene was frozen.

Another time, it froze in mid screen-transition.

Have I mentioned that I hate threads? :-(

In both cases, the Mac menu kept working. It was just the game itself that was frozen. Or possibly just paused. I just noticed that while the game is paused, the verb buttons behave as I described above, i.e. they can be pressed but don't pop back up. (I have fixed that now, but that doesn't change the problem.)

Last edited 7 weeks ago by eriktorbjorn (previous) (diff)

comment:4 by eriktorbjorn, 7 weeks ago

I tried a more paranoid version of my patch, but I was still able to trigger the glitch. Am I barking up the completely wrong tree here?

by eriktorbjorn, 7 weeks ago

Attachment: macgui-menu-corruption2.txt added

by eriktorbjorn, 7 weeks ago

Attachment: macgui_menu_corruption3.txt added

comment:5 by eriktorbjorn, 7 weeks ago

Here's a third version of the patch that eliminates the use of a timer, and the glitch still happens. I have a feeling that it may have to do with that the menu can actually appear in the middle of a screen transition, not after it's finished as I first thought. You can verify that easily by changing delay in the waitForTimer() call at the end of ScummEngine::transitionEffect() to delay * 10 or something like that.

I see two possibilities here: Either we need our transition effects to honor engine pausing in mid-transition, or we need to suspend the Mac GUI's event processing so that the menu doesn't appear until the screen transition is finished.

Or is there a third way? I'm not sure how to proceed here...

comment:6 by eriktorbjorn, 6 weeks ago

Owner: set to eriktorbjorn
Resolution: fixed
Status: newclosed

Hopefully fixed now.

Note: See TracTickets for help on using tickets.