[Feat] macOS: Check if Rosetta is available on Startup#4402
Conversation
…cGamesLauncher into feat/check_rosetta
…r repository selection
|
|
||
| const isMac = process.platform === 'darwin' | ||
| const isIntelMac = isMac && cpus()[0].model.includes('Intel') // so we can have different behavior for Intel Mac | ||
| const isIntelMac: boolean = isMac && cpus()[0].model.includes('Intel') // so we can have different behavior for Intel Mac |
There was a problem hiding this comment.
weird, shouldn't this be inferred as boolean? isMac is boolean and includes returns a boolean
| } | ||
|
|
||
| export async function checkRosettaInstall() { | ||
| if (!isMac) { |
There was a problem hiding this comment.
this is only called inside an if (isMac) check, so we don't need to check again (or we don't need the other check)
|
|
||
| // check if on arm64 macOS | ||
| const { stdout: archCheck } = await execAsync('arch') | ||
| const isArm64 = archCheck.trim() === 'arm64' |
There was a problem hiding this comment.
why not use the isIntelMac constant here? then we don't need to execute a process
if it's not intel mac then it's arm
| } else if (isMac) { | ||
| if (isIntelMac) { | ||
| const isMacOSUpToDate = await isMacSonomaOrHigher() | ||
| if (isIntelMac && isMacOSUpToDate) { |
There was a problem hiding this comment.
is this check correct? because this means that we'd set wine-crossover only if intel mac and new OS version, when I think we want to only set game porting toolkit if NOT intel mac and up-to-date os
we actually want wine-crossover always for intel macs
There was a problem hiding this comment.
TRue, should be !isMacOsUpToDate then. good catch.
|
|
||
| export async function isMacSonomaOrHigher() { | ||
| if (!isMac) { | ||
| return false |
There was a problem hiding this comment.
I think it's better to return null here because it's not even a macos at this point, it's not that it's not sonoma or higher, and then we can be more explicit on how we handle this
There was a problem hiding this comment.
We dont need this though, same case as you pointed above, it is only called inside isMac checks
| Winetricks.download() | ||
| if (!availableWine.length) { | ||
| downloadDefaultWine() | ||
| if (isMac) { |
There was a problem hiding this comment.
I don't know if this is the right place to check this though, cause the first time a user opens heroic, it will download a wine and run this check, but the second time it won't run this cause availableWine.length will be more than 0
I think this should be done somewhere else so we can show it if the user doesn't install rosetta the first time
Co-authored-by: Mathis Dröge <mathis.droege@ewe.net>
Co-authored-by: Mathis Dröge <mathis.droege@ewe.net>
…Launcher/HeroicGamesLauncher into feat/check_rosetta
This will check if Rosetta is available on Macs with Apple Silicon and show a warning with a message on how to install it.
Also checks if macOS is update to Sonoma or Higher for better GPTK support..
AI Summary
This pull request includes several important changes to improve compatibility and functionality on macOS systems, particularly for Apple Silicon chips. The changes involve adding checks for macOS version and Rosetta installation, as well as updating the logic for selecting the appropriate Wine version based on the system architecture.
Improvements for macOS compatibility:
src/backend/constants.ts: Added type annotation forisIntelMacto ensure type safety.src/backend/launcher.ts: Added checks to ensure compatibility with macOS Sonoma or higher and to verify if Rosetta is installed on Apple Silicon Macs. [1] [2]src/backend/main.ts: Integrated Rosetta installation check during the initialization process for macOS systems. [1] [2]src/backend/utils.ts: Added functionscheckRosettaInstallandisMacSonomaOrHigherto handle Rosetta installation verification and macOS version checks. [1] [2]src/frontend/screens/WineManager/index.tsx: Refactored logic for setting the default Wine repository based on the system's architecture, simplifying the code and improving readability.Version update:
package.json: Updated the version from2.16.0to2.16.1.Use the following Checklist if you have changed something on the Backend or Frontend: