PrismLauncher
PrismLauncher copied to clipboard
Implement Game Mode on macOS Sonoma
Goal
macOS Sonoma has a new feature called Game Mode, where, upon full-screening a game, it is given priority on the CPU/GPU, and the Bluetooth latency with AirPods and MFi controllers decreases. The Vanilla launcher has this, and implementing it into Prism Launcher would make Prism Launcher feel that much more native.
Motivation
I recently switched from the Vanilla launcher to Prism because the Vanilla one is quite slow, it almost performs as well (badly) as an Electron app. So I found Prism Launcher after rooting through some comparisons and it has been a fantastic experience so far, between the mod management and modloader installers, the ability to symlink between instances, etc. However, the one feature I miss from Vanilla is implementation of macOS Sonoma's Game Mode. I have experienced a noticeable drop in FPS between Minecraft in and out of Game Mode.
The comment on this Reddit thread regarding Game Mode details how apps can mark themselves as a game:
<key>LSApplicationCategoryType</key>
<string>public.app-category.games</string>
I have added this to the Info.plist myself, resigned the app and opened Minecraft, but Game Mode does not activate (presumably because java is a separate process from Prism Launcher). However, the Vanilla launcher demonstrates that it is possible to do this.
Specification
Adding some way for macOS to pick up on java being used for a game, and activating Game Mode for the process. As I have not developed Java-based programs for macOS, I am not sure how to go about this. But I am hoping someone else here might know.
Drawbacks
The only drawback I foresee is additional code, making Prism slightly bigger.
Unresolved Questions
Do that many people need this? I don't know how many Prism users run macOS Sonoma (especially since it's still in beta) but it comes out to the public quite soon and being ready for that release is good form.
Alternatives Considered
I have a bunch of optimization mods in my main Minecraft instance, but performance can always be improved, and on a Mac that matters even more.
This suggestion is unique
- [X] I have searched the issue tracker and did not find an issue describing my suggestion, especially not one that has been rejected.
You may use the editor below to elaborate further.
No response
I know this doesn't really solve anything but it's worth a shot: can you add the following java argument -DAnythingHereButShouldMostLikelyBeAMessageOfWhatItDoes="net.minecraft.client.main.Main"
Let me know if there are any changes.
This doesn't appear to enable Game Mode, unfortunately.
Sad some programs do use that class name to detect if Minecraft is running or not
The confusing thing to me is, according to the reddit thread I linked in OP the fix is to add the <key>LSApplicationCategoryType</key> in Info.plist. But the Vanilla launcher doesn't have that key. 🤔
That game mode is really annoying, after a simple test just can’t play the game with shader on not full screen…
That game mode is really annoying, after a simple test just can’t play the game with shader on not full screen…
That's quite odd, Game Mode does improve fullscreen performance but it shouldn't affect windowed performance.
That game mode is really annoying, after a simple test just can’t play the game with shader on not full screen…
I would say try the Vanilla launcher too.
Seems like setting the app category in Info.plist worked for osu: https://github.com/ppy/osu/discussions/24557
However, I confirmed it doesn't work for Prism Launcher. This could be because it applies to the current process only, not the entire process group. Osu works fine because it's a single process, but Minecraft launchers need to run an unrelated java process, and that's where things break. I tried making the app category changes to the underlying Java framework used by Prism Launcher, but it still didn't work. It's possible that setting the app category doesn't work for a framework like Java, as it's very different from a real app (for example, the CFBundleExecutable points to libjli.dylib, this is not even the process which runs the game).
But anyway, how does the official launcher work? Neither the launcher nor the Java framework it uses have the app category set. I dug into the system libraries and noticed that its bundle id is explicitly marked as a game by Apple in: /System/Library/PrivateFrameworks/Categories.framework/Versions/A/Categories (this is a virtual filesystem in dyld_shared_cache, so you won't find it on your Macs).
Most likely, Apple's special handling applies to the entire process group unlike the Info.plist setting. If you change the official launcher's bundle id via Info.plist, Game Mode stops working. Likewise, if you change Prism Launcher's bundle id to com.mojang.minecraftlauncher, suddenly Game Mode works.
For now, feel free to use this workaround. It has no downsides as far as I'm aware. For a proper solution, we need to find a way to set this category so it applies to the underlying java process. Maybe if it's possible to do in runtime, we could write a simple mod.
EDIT: You need to resign Prism Launcher after you modify the bundle id, or you may get Operation not permitted errors and crashes. The command is:
sudo codesign -f --no-strict -s - "/Applications/Prism Launcher.app"
First of all, thank you for looking into this. The workaround of changing Prism's Bundle ID sounds fair enough, especially for users who intend to replace the Vanilla Launcher. I will certainly do that myself. My question is, why does Apple have Minecraft's Bundle ID baked into macOS? I am curious as to the logistics of this happening. Anyways, thank you again. Do you think this should close the issue? Or do you think there's another viable solution?
Please keep the issue open, my solution is nothing more but a hack. The reason the bundle id is baked into macOS is because most likely 90% of developers will never be bothered to update their apps to support Game Mode, so the feature would have been unusable if Apple relied just on third-party developers. Minecraft is not the only baked-in bundle id by the way, there are a lot more. This was just an easy way to make sure Game Mode mostly works even on release day.
By the way, you need to resign Prism Launcher after you modify the bundle id, or you may get Operation not permitted errors and crashes. The command is:
sudo codesign -f --no-strict -s - "/Applications/Prism Launcher.app"
Will do on the issue. Also +1 for the codesign command.
I would like to mention, I have been successfully using the modified Bundle ID setup for weeks now. Yesterday, however, I opened Minecraft from Prism and the icon was Mojang's green creeper icon. I quit Prism and opened it again and it was back to normal. I have never seen this any other times, but I wonder if macOS did that since it thinks Prism is Mojang's launcher. Just thought I'd mention this.
I think I saw this happen once, it's because macOS caches the icon based on bundle id, so if you run the official launcher, its icon may get shown on Prism and vice versa. Should be only a cosmetic thing, nothing to worry about.
Ah okay, makes sense. I didn't worry I just wanted to point this out in case it was some new feature or something.
That game mode is really annoying, after a simple test just can’t play the game with shader on not full screen…
![]()
I would say try the Vanilla launcher too.
Just found out why, the windowed mode use full resolution and full screen mode follows the hidpi settings of macOS. So it windowed mode heavily infact the performance
I am bumping this because I severely need Game Mode for Minecraft to run at an acceptable performance. Prism is the only launcher that allows damn microphone permissions and I'm not going to be forced to pick between performance and proximity chat, there's no reason a Mac user shouldn't get to have both.
@TSwany-the-Real there’s a workaround identified above where you change the bundle ID in Prism Launcher’s Info.plist and re-sign the app. I’ve been using that successfully for a while now.
if you change Prism Launcher's bundle id to
com.mojang.minecraftlauncher, suddenly Game Mode works.
is there a fast walkthrough for this? i'm kind of a programming illiterate.
No worries, basically, right click Prism Launcher and click Show Package Contents, open the Contents folder, and open Info.plist in TextEdit or something of the sort. Find CFBundleIdentifier, and replace the one for Prism Launcher with com.mojang.minecraftlauncher (can’t remember the one for Prism at the moment and I’m away from my Mac). Save and close the file, then open Terminal and run the following (assuming you have Prism Launcher in /Applications):
sudo codesign -fs - "/Applications/Prism Launcher.app"
If you need further help just ask!
hey, I'm getting an error message that says resource fork, Finder information, or similar detritus not allowed . is there a fix for this?
Yeah, macOS likes doing that. Try running sudo xattr -cr "/Applications/Prism Launcher.app"; sudo codesign -fs - "/Applications/Prism Launcher.app". (That all goes on one line, it's two commands that will run in succession.)
Most likely, Apple's special handling applies to the entire process group unlike the
Info.plistsetting. If you change the official launcher's bundle id viaInfo.plist, Game Mode stops working. Likewise, if you change Prism Launcher's bundle id tocom.mojang.minecraftlauncher, suddenly Game Mode works.
I updated my MacBook to macOS Sequoia Beta and it seems as if this approach no longer works. Typical Apple move, but that means long-term there needs to be another way (though it seems like that was already a goal).
Most likely, Apple's special handling applies to the entire process group unlike the
Info.plistsetting. If you change the official launcher's bundle id viaInfo.plist, Game Mode stops working. Likewise, if you change Prism Launcher's bundle id tocom.mojang.minecraftlauncher, suddenly Game Mode works.I updated my MacBook to macOS Sequoia Beta and it seems as if this approach no longer works. Typical Apple move, but that means long-term there needs to be another way (though it seems like that was already a goal).
I'm on that beta too and the method works just fine for me.
I'm on that beta too and the method works just fine for me.
Since making that comment, I think there's some bug on here, game mode doesn't work with Moonlight Game Streaming either which officially supports it. It worked with the vanilla Minecraft launcher though so I'm not sure what's going on.
No worries, basically, right click Prism Launcher and click Show Package Contents, open the Contents folder, and open
Info.plistin TextEdit or something of the sort. FindCFBundleIdentifier, and replace the one for Prism Launcher withcom.mojang.minecraftlauncher(can’t remember the one for Prism at the moment and I’m away from my Mac). Save and close the file, then open Terminal and run the following (assuming you have Prism Launcher in/Applications):sudo codesign -fs - "/Applications/Prism Launcher.app"If you need further help just ask!
This worked for letting it use game mode but for some reason I have a lot of input lag? No clue where it comes from but other than that it runs perfectly and much faster than it does without game mode but the input lag makes it unplayable.
