Opened 11 months ago

Closed 6 months ago

Last modified 6 months ago

#11260 closed defect (fixed)

MAC OS X: App incomplete when launched on OS X 10.5.8.

Reported by: macca8 Owned by: criezy
Priority: blocker Component: Port: Mac OS X
Keywords: Cc:
Game:

Description (last modified by macca8)

This issue dates back to when the Help Menu was added to ScummVM’s application menu (28/29 August 2018)… earlier builds that predate this event (for example, a daily build from 8 June 2018 & the v2.0.0 release) launch correctly.

Affected ScummVM build: All current 32bit mac builds (includes v2.2.0git daily, v2.1.1pre daily, v2.1.0 PPC release, v2.1.0 intel release).
Platform: Intel Mac & PPC Mac (OS X 10.5.8)

When launching any current 32bit build on OS X 10.5.8, the app launches in an incomplete and unresponsive state when it fails to populate the app’s Help Menu… the only object present in the Menu is a search box (later versions of macOS load the Help Menu correctly and don’t have this issue).

The side effects of this are:

  • the ScummVM window is never launched.
  • the cursor disappears (can be revealed by scrolling to the bottom of the screen).
  • the user must Force Quit to close the app (can be activated from the Dock).

I’m using an Intel Mac, but these side effects also apply to PPC Macs (as reported by a user in https://forums.scummvm.org/viewtopic.php?f=2&t=14967#p87856 .

There’s no crash report, but the Mac OS X console reports the following:
7/11/19 2:12:47 PM scummvm[xxx] NSDocumentController Info.plist warning: The values of CFBundleTypeRole entries must be 'Editor', 'Viewer', 'None', or 'Shell'.
7/11/19 2:12:47 PM scummvm[xxx] * -[NSApplication setHelpMenu:]: unrecognized selector sent to instance 0x30115a0
7/11/19 2:12:47 PM scummvm[xxx] Exception raised during posting of notification. Ignored. exception: '* -[NSApplication setHelpMenu:]: unrecognized selector sent to instance 0x30115a0' invoked observer method: '* -[SDLMain applicationDidFinishLaunching:]' observer: 0x3022330 notification name: 'NSApplicationDidFinishLaunchingNotification'
7/11/19 2:13:56 PM com.apple.launchd[xx] ([0x0-0x25025].org.scummvm.scummvm[xxx]) Exited: Killed

The last line of the report refers to a Force Quit, and the first is a warning that appears even on successful launches.

The scummvm.log reports 'log opened'.

Note that this behaviour dates back to at least a daily build from 15 September 2018.
Also, unlike all the other builds (including the v2.1.0 OSX PPC release), the v2.1.0 intel release actually crashes immediately on launch (no backtrace is available on the crash report), though this may be related to an unresolved crash on OS X 10.6.8 involving the same build (refer #11203).

Attachments (2)

appmenu_osx.rtf (9.7 KB ) - added by macca8 6 months ago.
macosx-compat.rtf (1.7 KB ) - added by macca8 6 months ago.

Download all attachments as: .zip

Change History (12)

comment:1 by macca8, 6 months ago

Criezy, responding to your request in the Forums for feedback on the OSX PPC v2.1.0 release build.

I’ve tested this version under Rosetta on my Intel iMac running both 10.5 & 10.6. I can confirm that the app performs perfectly on 10.6 (not that that is of any value to a user with a PowerPC Mac), but on 10.5 it behaves exactly as reported above for the Intel Mac daily builds, including the macOS console report.

Out of curiosity, which version of SDL is included in the OSX PPC release build?

May I humbly suggest that we focus on resolving the only bug reported by the macOS console (the Help Menu error for the OSX PPC release & Intel Mac daily builds), then see how the various builds respond.

According to developer.apple.com, and other online sources - including another project that displayed the same selector error on macOS 10.5 - [NSApplication setHelpMenu] is NOT available until macOS 10.6.

The solution offered by the other project was to restrict the Help Menu to macOS 10.6 & later, and I believe that to be the appropriate course of action here as well, given that the current implementation of the Help Menu works perfectly with those later versions of macOS.

As such, there’s no need to change the current code, other than to place restrictions on its use.

With that in mind, may I suggest the following:

  • Define macOS 10.6 (in backends/platform/sdl/macosx/macosx-compat.h):

#ifndef MAC_OS_X_VERSION_10_6
#define MAC_OS_X_VERSION_10_6 1060
#endif

  • Restrict the construction of the Help Menu to macOS 10.6 & later by adding an appropriate conditional statement, for example:

#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
targeted code goes here
#endif

Apply this statement as necessary in backends/platform/sdl/macosx/appmenu_osx.mm.

Include each of these code segments within its own statement:

  1. Everything relevant to the delegate variable, including:
  • line 173

static ScummVMMenuHandler *delegate = nullptr;

  • lines 176-177 (in releaseMenu())

[delegate release];
delegate = nullptr;

  • lines 181-183 (in replaceApplicationMenuItems())

if (!delegate) {

delegate = [[ScummVMMenuHandler alloc] init];

}

  1. Everything relevant to the helpMenu variable, including:
  • lines 214-225 (in replaceApplicationMenuItems())

NSMenu *helpMenu = addMenu(_("Help"),…;
to
addMenuItem(_("BSD License"),…;

  • line 230 (in replaceApplicationMenuItems())

[helpMenu release];

Please note that, as presented, only macosx-compat.h & appmenu_osx.mm need adjusting. Also, I’ve avoided consolidating any of the code segments (in replaceApplicationMenuItems()) to preserve the existing flow of events in macOS 10.6 & later.

I would appreciate your support with this, as I see no downside to making this change.
At worst, we eliminate a known issue, while establishing if other factors are affecting the launch.

Since you can’t test the changes personally on macOS 10.5, by adding them to master I can at least give you feedback by testing the developmental build.

I’ve attached copies of both files to clarify the proposed changes.

Last edited 6 months ago by macca8 (previous) (diff)

by macca8, 6 months ago

Attachment: appmenu_osx.rtf added

by macca8, 6 months ago

Attachment: macosx-compat.rtf added

comment:2 by macca8, 6 months ago

Description: modified (diff)
Summary: MAC OS X: App stalls when launched on OS X 10.5.8.MAC OS X: App incomplete when launched on OS X 10.5.8.

comment:3 by macca8, 6 months ago

Description: modified (diff)

comment:4 by criezy, 6 months ago

Thanks a lot for the reminder. Somehow I missed that ticket when you first created it. That setHelpMenu call could indeed be the cause of all the issues, or at least some of them.

I have now pushed a change in commit 8eac960, It is different from the one you proposed, but that should have the same effect of not creating the help menu on versions of MacOS X that do not support the setHelpMenu call (the main difference is that I am making the check at runtime and not compile time).

You should be able to check this with the 32 bits development builds for Intel macs. I will also try to find the time to make a test PPC builds for the folks on the forum.

comment:5 by macca8, 6 months ago

Well done criezy!

The Intel Mac development build now works perfectly on macOS 10.5.8. The Help Menu is removed and all remaining menu items work correctly.
The Help Menu is retained and still working correctly on MacOS 10.6.8 (32 bit) & 10.11.6 (32 bit & 64 bit).

I’ll be interested to see how the OSX PPC test build performs natively on that system compared to its Intel Mac performance, since from the reports by those users, it appears the app menu didn't get beyond the ScummVM Menu.

As far as the OSX PPC test build is concerned, the existing scummvm.icns file must be removed from the app bundle before distribution to avoid the user ending up with an invisible icon.

If you remove but don’t replace it, the app will display with a generic Mac application icon.
Alternatively, I’ve uploaded a replacement icon to #11261 which you can use, assuming there’s no compatibility issues with using an icon file prepared on an Intel Mac on an OSX PPC system.

The same applies if you create a 32bit v2.1.1 Intel Mac test build, which will be needed at some point, but it's not as critical given that most users would have upgraded to a later version of macOS by now.

Last edited 6 months ago by macca8 (previous) (diff)

comment:6 by criezy, 6 months ago

With bug #11261 now fixed, I have generated a test PPC version. You can download it from https://www.dropbox.com/s/icbyg8kmo6rdb59/scummvm-2.2.0git-macosx-ppc.dmg?dl=0

comment:7 by macca8, 6 months ago

The PPC test version is working properly on macOS 10.5 under Rosetta on my Intel iMac, but I see from the Forum that there's still a problem on PowerPC Macs.
We really need someone to provide feedback about any messages in the Mac console on PPC machines.

The encouraging thing is that the app menu worked perfectly before the Help Menu was implemented, so there's got to be something in how construction of the ScummVM Menu was changed, that apparently affects PPC Macs but not Intel Macs.

Also, I can confirm that the app icon remains invisible on 10.5.

The legacy icon contains the correct set of images, but appears to retain an incompatible colour profile setting for the 128, 256 & 512 pixel images on macOS 10.5... which should be 'no profile'.
This is the same behaviour as those images displayed in the newer format.

The 16 & 32 pixel images display the correct setting and are visible, but unfortunately are too small to display the app file icon.

With the older format, the colour profile of ALL images within the icon file should automatically change to match the appropriate setting for each version of macOS, and this is exactly how the file I uploaded to #11261 works on 10.5, 10.6 & 10.11, as does the original scummvm.icns file in the older format.

I don't know how the legacy icon was constructed, but if it's of any help, I created my icon file on macOS 10.6.8, using Icon Composer & a 512x512-72 ppi PNG image extracted by Preview from the new-format scummvm.icns file.

comment:8 by criezy, 6 months ago

The tester on the forum does indicate that the test version *works* on PPC. The remaining issue he mentions is with the icon, so I have reopened bug #11261 and will continue the discussion about the icon there.

So I think this ticket can now be closed.
And thank you again for the detailed report. It helped a lot!

comment:9 by criezy, 6 months ago

Owner: set to criezy
Resolution: fixed
Status: newclosed

comment:10 by macca8, 6 months ago

Thank you criezy, and I sincerely apologize for doubting your success!
I completely misread the user's comments as not working instead of now working... time for an eye test.

Note: See TracTickets for help on using tickets.