How to get Autostart working on the Mac in 2023

Ask for help with ScummVM problems

Moderator: ScummVM Team

Post Reply
VMSZealot
Posts: 5
Joined: Mon May 22, 2023 5:33 pm

How to get Autostart working on the Mac in 2023

Post by VMSZealot »

I followed the autostart instructions here (https://docs.scummvm.org/en/latest/adva ... start.html), with the Mac tab selected, very carefully - but no luck. I get a couple of bounces of the icon in the dock - and then ScummVM dies.

My ScummVM autorun is in the Contents/Resources folder, and named scummvm-autorun, and it contains the following…

Code: Select all

--fullscreen
--shader=crt/crt-lottes.glslp
--path=./game/
--auto-detect
The game folder (Contents/Resources/game) contains Broken Sword 2.5.

Is it possible to have autorun working in 2023? My Mac is an M1 Mac Mini, running Ventura.
User avatar
criezy
ScummVM Developer
Posts: 955
Joined: Sat Sep 23, 2006 10:41 am
Location: West Sussex, UK

Re: How to get Autostart working on the Mac in 2023

Post by criezy »

First, which version of ScummVM are you using? The autostart feature is new and not present in ScummVM 2.7.0. So you need to use a daily build or build ScummVM yourself from the latest code.

Your scummvm-autorun file is also probably incorrect. When using a relative path in the command line, it is relative to the current directory of the executable. I am not sure what the current directory is when launching an app bundle, but it may not be the Resources folder. And in any case on macOS, if there is a "game" folder it the bundle Resources folder, it will by default use --auto-detect (with the correct path), so you can remove the "--path=" and "--auto-detect" lines from your scummvm-autorun file.
VMSZealot
Posts: 5
Joined: Mon May 22, 2023 5:33 pm

Re: How to get Autostart working on the Mac in 2023

Post by VMSZealot »

I'm using Daily Build v 2.7.1

The result I get is the same as if I run stable build 2.7.0.

If I just have the game folder in resources then it opens Scumm as usual (it doesn't autostart the game).

If I have the scummvm-autorun, even with the changes you suggest, then I get the bounce and then nothing. The console contains the following…

Code: Select all

default	15:04:52.559720+0100	runningboardd	Launch request for app<application.org.scummvm.scummvm.170788767.170788772(501)> is using uid 501 (divined from auid 501 euid 501)
default	15:04:52.559839+0100	runningboardd	Acquiring assertion targeting app<application.org.scummvm.scummvm.170788767.170788772(501)> from originator [osservice<com.apple.Finder(501)>:684] with description <RBSAssertionDescriptor| "LS launch org.scummvm.scummvm" ID:399-684-10470 target:app<application.org.scummvm.scummvm.170788767.170788772(501)> attributes:[
	<RBSDomainAttribute| domain:"com.apple.launchservicesd" name:"LaunchRoleUserInteractive" sourceEnvironment:"(null)">
	]>
default	15:04:52.559964+0100	runningboardd	Assertion 399-684-10470 (target:app<application.org.scummvm.scummvm.170788767.170788772(501)>) will be created as active
default	15:04:52.560254+0100	runningboardd	Executing launch request for app<application.org.scummvm.scummvm.170788767.170788772(501)> (LS launch org.scummvm.scummvm)
default	15:04:52.560297+0100	runningboardd	Checking PreventLaunch: global:0 exPath:/Users/pascalharris/Downloads/macosx-arm64-stable-c4f24b2f/ScummVM.app/Contents/MacOS/scummvm predicates:(null)
default	15:04:52.560354+0100	runningboardd	Creating and launching job for: app<application.org.scummvm.scummvm.170788767.170788772(501)>
default	15:04:52.560431+0100	runningboardd	_mutateContextIfNeeded called for org.scummvm.scummvm
default	15:04:52.560873+0100	runningboardd	'app<application.org.scummvm.scummvm.170788767.170788772(501)>' Constructed job description (context <RBSLaunchContext: 0x137b0daf0>):
<dictionary: 0x136672770> { count = 22, transaction: 0, voucher = 0x0, contents =
	"Platform" => <int64: 0xb2753712894051bf>: 1
	"ProcessType" => <string: 0x1367809c0> { length = 3, contents = "App" }
	"EnableTransactions" => <bool: 0x1eff7c6b0>: false
	"_ManagedBy" => <string: 0x136760360> { length = 22, contents = "com.apple.runningboard" }
	"CFBundleIdentifier" => <string: 0x136769d90> { length = 19, contents = "org.scummvm.scummvm" }
	"_ResourceCoalition" => <string: 0x136762860> { length = 61, contents = "app<application.org.scummvm.scummvm.170788767.170788772(501)>" }
	"_DisablePointerAuth" => <bool: 0x1eff7c690>: true
	"ThrottleInterval" => <int64: 0xb275371176bfae4f>: 2147483647
	"MachServices" => <dictionary: 0x1367761b0> { count = 0, transaction: 0, voucher = 0x0, contents =
	}
	"EnablePressuredExit" => <bool: 0x1eff7c6b0>: false
	"LimitLoadToSessionType" => <array: 0x136754b00> { count<…>
default	15:04:52.572931+0100	runningboardd	[app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609] Memory Limits: active 0 inactive 0
 <private>
default	15:04:52.572976+0100	runningboardd	[app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609] This process will not be managed.
default	15:04:52.573009+0100	runningboardd	[app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609] HOME is <private>
default	15:04:52.573049+0100	runningboardd	[app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609] TMPDIR is <private>
default	15:04:52.573126+0100	runningboardd	Now tracking process: [app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609]
default	15:04:52.573337+0100	runningboardd	Calculated state for app<application.org.scummvm.scummvm.170788767.170788772(501)>: running-active (role: UserInteractive)
default	15:04:52.573621+0100	runningboardd	Using default underlying assertion for app: [app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609]
default	15:04:52.573862+0100	runningboardd	Acquiring assertion targeting [app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609] from originator [app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609] with description <RBSAssertionDescriptor| "RB Underlying Assertion" ID:399-399-10471 target:9609 attributes:[
	<RBSDomainAttribute| domain:"com.apple.underlying" name:"defaultUnderlyingAppAssertion" sourceEnvironment:"(null)">,
	<RBSAcquisitionCompletionAttribute| policy:AfterApplication>
	]>
default	15:04:52.574052+0100	runningboardd	Assertion 399-399-10471 (target:[app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609]) will be created as active
default	15:04:52.574229+0100	runningboardd	[app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609] Ignoring jetsam update because this process is not memory-managed
default	15:04:52.574307+0100	runningboardd	[app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609] Ignoring suspend because this process is not lifecycle managed
default	15:04:52.574444+0100	runningboardd	[app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609] Set darwin role to: UserInteractive
default	15:04:52.574606+0100	runningboardd	[app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609] Ignoring GPU update because this process is not GPU managed
default	15:04:52.574848+0100	runningboardd	[app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609] Ignoring memory limit update because this process is not memory-managed
default	15:04:52.574934+0100	runningboardd	[app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609] reported to RB as running
default	15:04:52.575479+0100	runningboardd	Calculated state for app<application.org.scummvm.scummvm.170788767.170788772(501)>: running-active (role: UserInteractive)
default	15:04:52.577634+0100	runningboardd	Acquiring assertion targeting [app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609] from originator [osservice<com.apple.coreservices.launchservicesd>:366] with description <RBSAssertionDescriptor| "foregroundApp:9609" ID:399-366-10472 target:9609 attributes:[
	<RBSDomainAttribute| domain:"com.apple.launchservicesd" name:"RoleUserInteractiveNonFocal" sourceEnvironment:"(null)">
	]>
default	15:04:52.577842+0100	runningboardd	Assertion 399-366-10472 (target:[app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609]) will be created as active
default	15:04:52.578938+0100	runningboardd	Calculated state for app<application.org.scummvm.scummvm.170788767.170788772(501)>: running-active (role: UserInteractive)
default	15:04:52.582089+0100	runningboardd	[app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609] Ignoring jetsam update because this process is not memory-managed
default	15:04:52.582192+0100	runningboardd	[app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609] Ignoring suspend because this process is not lifecycle managed
default	15:04:52.582225+0100	runningboardd	[app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609] Ignoring GPU update because this process is not GPU managed
default	15:04:52.582285+0100	runningboardd	[app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609] Ignoring memory limit update because this process is not memory-managed
default	15:04:52.582367+0100	runningboardd	[app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609] Ignoring jetsam update because this process is not memory-managed
default	15:04:52.582403+0100	runningboardd	[app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609] Ignoring suspend because this process is not lifecycle managed
default	15:04:52.582432+0100	runningboardd	[app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609] Ignoring GPU update because this process is not GPU managed
default	15:04:52.582498+0100	runningboardd	Successfully acquired underlying assertion for [app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609]
default	15:04:52.582753+0100	runningboardd	[app<application.org.scummvm.scummvm.170788767.170788772(501)>:9609] Ignoring memory limit update because this process is not memory-managed
default	15:04:52.584237+0100	Finder	LAUNCH: 0x0-0x271271 org.scummvm.scummvm starting stopped process.
default	15:04:52.580548+0100	loginwindow	-[PersistentAppsSupport applicationReady:] | App: ScummVM, ready, updating active tracking timer
default	15:04:52.580602+0100	loginwindow	-[ApplicationManager checkInAppContext:eventData:] | ApplicationManager: Checked in app : ScummVM
default	15:04:52.583803+0100	distnoted	register name: com.apple.sharedfilelist.change object: com.apple.LSSharedFileList.ApplicationRecentDocuments/org.scummvm.scummvm token: 7200000054 pid: 681
default	15:04:52.586044+0100	runningboardd	Invalidating assertion 399-684-10470 (target:app<application.org.scummvm.scummvm.170788767.170788772(501)>) from originator [osservice<com.apple.Finder(501)>:684]
default	15:04:52.641040+0100	tccd	AUTHREQ_ATTRIBUTION: msgID=9609.1, attribution={requesting={TCCDProcess: identifier=org.scummvm.scummvm, pid=9609, auid=501, euid=501, binary_path=/Users/pascalharris/Downloads/macosx-arm64-stable-c4f24b2f/ScummVM.app/Contents/MacOS/scummvm}, },
default	15:04:52.643271+0100	tccd	AUTHREQ_SUBJECT: msgID=9609.1, subject=org.scummvm.scummvm,
default	15:04:52.645190+0100	tccd	-[TCCDAccessIdentity staticCode]: static code for: identifier org.scummvm.scummvm, type: 0: 0x14c03f5a0 at /Users/pascalharris/Downloads/macosx-arm64-stable-c4f24b2f/ScummVM.app
If I try running the game in the usual SCUMM way then it runs perfectly - but I don't want to run the usual SCUMM way. I want the whole 1990s experience - double click the icon, straight into the game!

Thank you for your help with this.
User avatar
criezy
ScummVM Developer
Posts: 955
Joined: Sat Sep 23, 2006 10:41 am
Location: West Sussex, UK

Re: How to get Autostart working on the Mac in 2023

Post by criezy »

Given the last few lines, the issue might be related to this note from the documentation:
https://docs.scummvm.org/en/latest/advanced_topics/autostart.html wrote: Note that modifying a signed bundle will invalidate the signature. So the bundle needs to be signed again after for example adding a game folder inside the ScummVM.app bundle.
I think our daily builds are ad-hoc signed, so you might need to update the signature. This can be done in a Terminal with the following command:

Code: Select all

codesign -s - --deep --force ScummVM.app
VMSZealot
Posts: 5
Joined: Mon May 22, 2023 5:33 pm

Re: How to get Autostart working on the Mac in 2023

Post by VMSZealot »

I did try that, but I used my own developer ID (because I wasn’t aware I could run it without specifying an ID). I’ll try the command again exactly as you specify it. Fingers crossed.
VMSZealot
Posts: 5
Joined: Mon May 22, 2023 5:33 pm

Re: How to get Autostart working on the Mac in 2023

Post by VMSZealot »

Okay - I tried that. It didn't make any difference though. I think that, for the time being, this functionality is broken.

It might be helpful to be able to download an example of a successfully autostarting ScummVM bundle - perhaps with one of the freely redistributable games - which can act as a template for others who are trying to accomplish the same thing.

Thank you for all your work on this excellent software though, and thank you for spending a little time to help me with this edgiest of edge cases!
User avatar
criezy
ScummVM Developer
Posts: 955
Joined: Sat Sep 23, 2006 10:41 am
Location: West Sussex, UK

Re: How to get Autostart working on the Mac in 2023

Post by criezy »

I tried using the "stable" daily build, and indeed it doesn't work. I think the implementation may be incomplete in branch-2-7. I will need to check this. But it worked as expected using the "latest" daily build, which is good news.

Here are the steps I used to create a bundle that automatically starts Beneath a Steel Sky:
1. Download a ScummVM "latest" (not "stable") daily build for macOS

Files downloaded from the internet are quarantined by macOS. This can be cleared by starting the application once using a right mouse button click on ScummVM.app and select Open.

But this can also be cleared with the following command from a terminal:

Code: Select all

xattr -d -r com.apple.quarantine ScummVM.app

2. Download Beneath a Steel Sky from https://www.scummvm.org/games/

Unzip, clear quantile and macl matter, rename the folder to "game" and move it to ScummVM.app/Content/Resources/

Code: Select all

unzip bass-cd-1.2.zip
xattr -c bass-cd-1.2
mv bass-cd-1.2 ScummVM.app/Contents/Resources/game
The ScummVM.app/Contents/Resources/game/ folder now contains the following files:

Code: Select all

readme.txt	sky.cpt		sky.dnr		sky.dsk
3. Add default settings (optional)

This could be done using a scummvm-autorun file to specify command line arguments, but I used a scummvm.ini file instead.
The main difference between the two options, is that the command line arguments specified in scummvm-autorun are used every time the app is started and overwrite any settings saved. The scummvm.ini file on the other hand is only used on the first start to provide the initial settings. But if the user then changes the settings (e.g. to toggle off fullscreen), this gets saved.

Code: Select all

echo "[scummvm]" > ScummVM.app/Contents/Resources/scummvm.ini
echo "fullscreen=true" >>  ScummVM.app/Contents/Resources/scummvm.ini
echo "shader=crt/crt-lottes.glslp" >>  ScummVM.app/Contents/Resources/scummvm.ini
echo "updates_check=0" >>  ScummVM.app/Contents/Resources/scummvm.ini
The commands above result in a scummvm.ini that contains:
scummvm.ini wrote: [scummvm]
fullscreen=true
shader=crt/crt-lottes.glslp
updates_check=0
4. Create custom icon (optional)
Download sky-sky.png icon from https://github.com/scummvm/scummvm-icon ... ster/icons

I wrote a script to automate the creation of an icon file from a png file (see below). It can be used as follow togenerate a bass.icns from the sky-sky.png file.

Code: Select all

./create_icns.sh sky-sky.png bass
Move the icon to bundle

Code: Select all

mv bass.icns ScummVM.app/Contents/Resources/
Edit icon name in the Info.plist

Code: Select all

sed -i '' 's|scummvm.icns|bass.icns|' ScummVM.app/Contents/Info.plist
(or open ScummVM.app/Contents/Info.plist and edit manually)

Note that it takes a bit of time for macOS to refresh the app icon in Finder.

The create_icns.sh script is:

Code: Select all

#!/bin/bash

if [ $# -ne 2 ];  then
    echo "Usage: $0 <png file> <output name>"
    echo "Example: $0 sky-sky.png bass"    
    exit 1
fi

input=$1
output=$2
echo "Generating $output.icns from $input..."

iconset_dir=${output}.iconset
if [ ! -d $iconset_dir ] ; then
    mkdir $iconset_dir
fi
for size in 16 32 128 256 512 ; do
    sips -z $size $size $input --out $iconset_dir/icon_${size}x${size}.png > /dev/null
done
for size in 32 64 256 512 1024 ; do
    sips -z $size $size $input --out $iconset_dir/icon_${size}x${size}@2x.png > /dev/null
done
iconutil -c icns  $iconset_dir
rm -r $iconset_dir
5. Change the bundle name, bundle display name, and bundle identifiers (optional)

In particular, the bundle name defined in the Info.plist is used to name the preference file. So changing it means that our game bundle will have its own set of settings instead of sharing settings with other ScummVM games.

You again need to edit the ScummVM.app/Contents/Info.plist, for example using the following commands:

Code: Select all

sed -i '' 's|org.scummvm.scummvm|org.scummvm.bass|' ScummVM.app/Contents/Info.plist
sed -i '' 's|<string>ScummVM</string>|<string>BASS</string>|' ScummVM.app/Contents/Info.plist
6. Regenerate the ad hoc signature

Code: Select all

codesign -s - --deep --force ScummVM.app
7. Rename ScummVM.app (optional)

Code: Select all

mv ScummVM.app BASS.app
I have uploaded the resulting BASS application for mac M1 to my dropbox: https://www.dropbox.com/s/cpkzybub4npc9 ... 5.zip?dl=0
For now I will keep it there as it is using a daily build and only works on M1 macs, but it is indeed a good idea to have an example available from our web site. I will try to prepare one at the same time I build the macOS ScummVM package for the next release.

It is also probably a good time to mention that as part of this year's Google Summer of Code, we have got a contributor working on an automated system for packaging games with ScummVM. So hopefully this will make the whole process easier for users. You can follow his progress on https://blogs.scummvm.org/ankushdutt/
VMSZealot
Posts: 5
Joined: Mon May 22, 2023 5:33 pm

Re: How to get Autostart working on the Mac in 2023

Post by VMSZealot »

That's fantastic! Thank you so much for this. What a great guide as well!
Post Reply