The goal is to also port galgames on Mac~~
Background or TLDR?#
Am I using this article to prove that I am slightly more technology-oriented rather than ACG-oriented? After all, the previous two articles were just filled with reviews of past anime games.
This is actually quite simple, just install the game porting toolkit and run it, which is pretty much the same as the tutorials online. (Yes, you don't need to look further, the click count has been tricked 🐶) However, this technology is still not mature, and the timeliness of articles at night is quite strong; things change a bit every week. As a result, I encountered some pitfalls. It took me about 6 hours to get this working. The actual time needed is not more than 2 hours (including homebrew build
).
The reason I am messing with this is that I randomly do some things I am interested in every month. (Of course, outside of my 996 job,) I estimate that I will write a separate article about this random stuff in the future.
So, researching wine-related technology was the random topic I got last month. But in the end, I got sidetracked and only did this little bit~~ Moreover, this topic is time-sensitive, so I decided to publish it first.
⚠️⚠️⚠️Note the timeliness⚠️⚠️⚠️
If there are issues with the methods in the article, please don't just run away. Please comment more, and I will gradually supplement and modify it. After all, I only have one computer and can't predict so many situations~~
- Time: 2023-07-20
- Device: MacBook Air with M1 chip
- Version: macOS Sonoma Public Beta
Let's talk about the differences from other articles online#
Mainly the issues I encountered during this process that other articles online did not mention, or were very vague about how to solve.
- You need to use x64 homebrew: I initially uninstalled brew on my computer (burning the boats). I later realized that uninstalling homebrew was a very foolish action; it was actually unnecessary. You just need to remove the
/opt/homebrew/
related directories from the PATH. They can coexist~~ - The game porting toolkit currently fails to build with XCode 15 beta 3/4/5: You need to reinstall XCode beta 2 to use it. Each build took me over an hour before it told me it failed~~
Let's get started#
Preparation - Download and install Command Line Tools + Game Porting Toolkit#
First, make sure we are using macOS Sonoma, which can be updated directly in Settings. I updated to the Public Beta version.
Then download the following two (click here to download), log in to a free Apple developer account. Use your usual details to log in, agree to the terms and conditions, and then we can continue.
- Command Line Tools for Xcode 15 beta 2 (Note to download beta 2; 15 beta 3/4/5 will fail to build, this is the first pitfall)
- Game porting toolkit beta 1.0.2
After installing the Game Porting Toolkit, a window will pop up; please ignore it, as no files will perform any operations now.
Homebrew installation of Apple Game Porting Toolkit#
Because the current game porting toolkit does not actually support running on native arm64, there will be errors during the build process of the current homebrew arm64.
(There was an error, haha. This is the second pitfall; I initially deleted the arm64 brew and then installed the x64 brew using rosetta)
But you actually do not need to uninstall the arm64 brew, because the installation directory for brew x64 is /usr/local/bin/
, while the installation directory for brew arm64 is /opt/homebrew/bin
.
Then, if you haven't installed rosetta, you should run the following command to install it:
softwareupdate –install-rosetta
Once you ensure your system has rosetta, enter the x64 version of zsh and remove the brew directory from the current PATH. This is the key to allowing x64 and arm64 homebrew to coexist; removing the /opt/homebrew/bin
directory from the PATH
environment variable is equivalent to removing arm64 brew.
This way, you can install x64 brew without deleting the arm64 version of brew ( only effective for the current shell session)
arch -x86_64 zsh
dir="/opt/homebrew/bin"
PATH="${PATH//"${dir}:"/}"
Now let's start installing x64 homebrew, and then use eval to load it into the current session (if there are access issues, you may need to open a terminal proxy)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/usr/local/bin/brew shellenv)"
At this point, which brew
should output /usr/local/bin/brew
.
Next, we will actually install the Game Porting Toolkit:
brew tap apple/apple http://github.com/apple/homebrew-apple
brew -v install apple/apple/game-porting-toolkit
Then? Then you can take a break; it took me over an hour to install. Then run the following two commands. (TODO: I actually still haven't figured out the relationship between the game-porting-toolkit downloaded from the official website and the one installed via brew)
ditto /Volumes/Game\ Porting\ Toolkit-1.0/lib/ /usr/local/opt/game-porting-toolkit/lib/
cp /Volumes/Game\ Porting\ Toolkit*/gameportingtoolkit* /usr/local/bin
Setting up the Game Porting Toolkit#
Our first goal here is to initialize a wine prefix environment for steam, where WINEPREFIX
specifies a folder to store the wine runtime environment,
WINEPREFIX=~/steam /usr/local/opt/game-porting-toolkit/bin/wine64 winecfg
This environment will prepare some directories and dlls for running Windows files (as shown below).
After running, a window will pop up to initialize the environment. Select Windows 10 from the dropdown list. Click "Apply" and then click "OK" to close the window.
Next, we go to the official Steam website to download the x64 version of Steam, click here to download.
First, install it:
gameportingtoolkit ~/steam ~/Downloads/SteamSetup.exe
After installation, you can start running it. The path C:\Program Files (x86)/Steam/steam.exe
is the path of Steam in wine after installation.
gameportingtoolkit ~/steam 'C:\Program Files (x86)/Steam/steam.exe'
(Successful, cheers 🍻)
Finally - I recorded a video#
By the way, testing the video effect of xLog
Using Apple Game Porting Toolkit to run Windows x64 games on M1 Air, one is "Take Me to the Dungeon," and the other is "Octopath Traveler 2."
3A game demonstration "NieR: Automata"
Collapsed image used for the cover
Postscript - About why I am interested in this technology#
Why am I interested in this technology? To be able to port galgames on Mac? Although as a Mac user, I haven't been able to touch galgames for a long time.
Mainly because I bought a Steam Deck recently. First of all, I really like Arch Linux, then I really like Steam, and additionally, I really like handhelds and don't particularly like using Windows. And Steam Deck = Arch Linux + Steam + Handheld - Windows, it was Proton/Wine that made this possible, so I had wine research on my TODO list.
Then coincidentally, there was that shocking Apple Vision Pro launch event, along with the accessory Game Porting Toolkit. I believe that the Game Porting Toolkit is Apple's Proton moment. It gave me confidence in Apple creating a gaming platform, especially the gaming platform on Vision Pro.
Finally, I feel that because xLog's UI layout is quite nice, it gave me the illusion that my writing skills have improved~~ I don't particularly like writing dry technical articles. However, overall, I still feel that I lack the ability to write articles. For example, there are many details and concepts in this article that are not clearly explained. But this article is time-sensitive, and after multiple debugging, I decided to publish it first and will revise it later.
Modifications#
- 2023-08-02 23:33 v0.2 Modified tags and some descriptions
- 2023-08-03 07:35 v0.3 Updated the video recording with sound, recorded using CleanShot, which is quite good.
- 2023-08-03 22:06 v0.4 XCode 15 beta 5 also failed, no need to look further, see reference link 2 for details
- 2023-08-04 19:43 v0.5 After being criticized for clickbait, I changed the title from "How to use Apple GPT to play Win X64 games on M1 Air" to "How to use Apple Game Porting Toolkit to play Windows games on M1 Air"
- 2023-08-06 14:56 v1.0 Updated 3A game demonstration "NieR: Automata"
- 2023-08-06 22:04 v1.1 Moved the paragraph on the differences between this article and others to the front. Also updated reference materials
References#
- Yes, I wrote this article based on this one: How to use Apple Game Porting Toolkit: Play Diablo IV on macOS - Dexerto
- Game porting toolkit build error | Apple Developer Forums
- Those who don't know shell can supplement this, Bash script tutorial - Wangdao
- apple gaming wiki: This website shows which games are playable
- How Wine works 101 | Hacker News: About the "translation" principles of wine
- Apple's Game Porting Toolkit lets Windows games run on macOS (but it's not meant for end users... yet) - Liliputing: The current goal is to facilitate developers' porting rather than targeting end users