I figured out how to run one of my favorite games on the raspberry pi CM4 uConsole, and it took a lot of searching so I wanted to consolidate what I learned. This might be like sooo obvious to some but I am a windows guy learning linux so if there are others like me, this might help!
Also I keep forgetting how I did this so I want to write it down for myself
Tested on: Good Old Games Linux installer for Hammerwatch on a CM4.
Also works on: other games from GOG like FTL and Into The Breach
First barrier (broadly applicable): opening hammerwatch_1_41_23456.sh
Symptom: I try ./hamm*
and get Permission Denied
so I try sudo ./hamm*
and get command not found
Solution: instead run unzip hamm* -d /usr/games/hammerwatch
Explanation: honestly not sure exactly but I think this is just a zip file with a script tacked onto the beginning for extraction and install. Somehow raspian knows what to do, so we extract the files to our games folder. This works for basically EVERY linux gane from GOG and is almost the only required step
Second barrier: These games are for x86_64 type architectures and we are on an ARM processor.
Symptoms: I forget the exact error message but if you try to run any of the game files the console will be like "not compatible with your system " Or maybe it was ācommand not foundā instead. Iām leaning more toward it-was-a-really-vague-error. If someone goes through this and can tell me exactly Iāll edit it in.
Solution: Install Box64 which is a tool/emulator that converts x64 instructions to ARM instructions. I like box64 because the performance hit from using it seems pretty small and it kicks in on its own rather than you having to keep track of a separate emulator app. Itās still slower than native but itās better than nothing!
The following instructions build and install box64 from source on uConsole. I got the instructions from Run x64 Software on a Raspberry Pi using Box64 - Pi My Life Up however I will type up the TLDR version.
cd;
sudo apt install git build-essential cmake;
git clone https://github.com/pitSeb/box64.git;
cd ~/box64;
mkdir build;
cd build;
cmake .. -DRPI4ARM64=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo;
make -j$(nproc);
sudo make install;
sudo systemctl restart systemd-binfmt;
Boom you now should have Box64. Note that this process actually takes quite a while and it especially hangs at the 100% mark during the build. Be patient!
Third barrier: when I run /usr/games/hammerwatch/data/noarch/start.sh
it STILL says its not compatible with my system, even though box64 is kicking in!
The reason this happens is the bundled launch scripts are not expecting an aarch64 processor so they go to the default case and try to run the 32 bit (x86) version of the game! What!
Solution: modify the scripts to include aarch64. Now, I am lazy so I granted all the permissions on all the hammerwatch files first with sudo chmod -R 777 /usr/games/hammerwatch
but if you donāt do that youāll need to do these edits via command line with sudo.
Go into /usr/games/hammerwatch/data/noarch/game
and open the file RunHammerwarch
with your favorite text editor. Youāll see a line that says something like: if [ "$ARCH" == "x86_64" ]; then
Change it to
if ( [ "$ARCH" == "x86_64" ] || ["$ARCH" == "aarm64" ] ); then
And save that file.
Now the launch script will correctly use the 64 bit version of the game when it sees your processor type.
Fourth barrier: now when you try to run the game you get a bunch of console output but execution fails due to who knows which error. Well one especially useful tidbit in the log is Magic number is wrong: 542
Solution: this is apparently some bug with a thing called āmonoā? I donāt know the specifics but I do know that to fix it we go back into our RunHammerwatch file and change the last line to be
export 'TERM=xterm' && ./Hammerwatch.bin.${ext} $0
This has something to do with telling (mono?) What terminal to use to run the following script.
If you do all that successfully, and youāre working with a factory default image, and you didnāt make any mistakes, run
/usr/games/hammerwatch/data/noarch/start.sh
And you should be greeted with fanfare and something looking like this:
You will probably have to go in and turn off some of the lighting and blurs and shadow effects to get a decent frame rate but it runs really well once you zero in the graphics settings. I was even playing two-player local co-op with an attached xbox one controller.
You can run many of the linux games on GOG following this process except you only have to install Box64 once and I think most of the games donāt need that weird mono fix.
If anyone sees typos in my instructions feel free to let me know! I tried to be really REALLY verbose on this writeup so that I could include as many of the things I tried to google while figuring this stuff out. Ultimately most of this is online but you have to wade through a lot of search results and do a lot of fruitless google searching.