Posted October 11, 2020
Initially Charterstone did not start on my up-to-date Debian GNU/Linux (version 10.6 / Buster) with a Core i7-920 processor in a notebook from 2010.
When trying to start from the console I got the following output:
~/GOG Games/Charterstone Digital Edition$ ./start.sh
Running Charterstone: Digital Edition
Set current directory to /home/myuser/GOG Games/Charterstone Digital Edition/game
Found path: /home/myuser/GOG Games/Charterstone Digital Edition/game/Charterstone.x86_64
./start.sh: line 16: 3263 Aborted ./"Charterstone.x86_64"
I then found the logfile "~/.config/unity3d/Acram Digital/Charterstone/Player.log" with the following contents:
...
FATAL ERROR: This binary was compiled with aes enabled, but this feature is not available on this processor (go/sigill-fail-fast).
...
=================================================================
Got a SIGILL while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
Caught fatal signal - signo:4 code:-6 errno:0 addr:0x3e800007195
Obtained 15 stack frames.
#0 0x007fa9dd7155cb in raise
#1 0x007fa9d43d41bb in (anonymous namespace)::cpu_feature_fail_fast()
...
Then I grepped in the game's installation directory for cpu_feature_fail_fast and found:
~/GOG Games/Charterstone Digital Edition$ grep cpu_feature_fail_fast -ris .
Binary file ./game/Charterstone_Data/Plugins/FirebaseCppApp-6_15_2.so matches
A little internet research showed that Firebase is a library for mobile and web development aquired by Google in 2014. According to https://en.wikipedia.org/wiki/Firebase there are some controversies about user privacy. But this should be no problem if you plan to play offline only as I do. The reference to AES makes absolutely sense in that context because AES is an encryption standard used when transfering data via the internet. For people that do not have a problem with transfering data to Google the developer maybe can compile the Firebase library without intrinsic AES operations for older CPUs not supporting these instructions directly. But since I do neither want nor need this cloud functionality I thought maybe I can remove the check for these operations when they never get called anyways when playing the game solely offline.
So I disassembled the found library file:
~/GOG Games/Charterstone Digital Edition$ objdump -d ./game/Charterstone_Data/Plugins/FirebaseCppApp-6_15_2.so > FirebaseCppApp-6_15_2.asm
and opened the just created disassembly file FirebaseCppApp-6_15_2.asm in a text editor where I searched for cpu_feature_fail_fast and found this:
00000000017f2180 <_ZN12_GLOBAL__N_121cpu_feature_fail_fastEv>:
17f2180: 55 push %rbp
17f2181: 48 89 e5 mov %rsp,%rbp
17f2184: 53 push %rbx
17f2185: 50 push %rax
17f2186: e8 55 87 e5 ff callq 164a8e0 <__cpu_indicator_init>
...
17f2333: c3 retq
...
Now I knew that the failing function starts with the bytes 554889e55350e85587e5ff.
I backuped and opened ./game/Charterstone_Data/Plugins/FirebaseCppApp-6_15_2.so in a hex editor (e.g. okteta) and searched for that byte sequence and found exactly one match.
From the above disassembly I also knew that the opcode to return from a function is c3 (for the retq CPU instruction).
So I replaced the 55 from the beginning of the byte sequence by c3 to skip all CPU feature checks by returning immediately. Then I saved the file.
After that I could start the game.
Not quite sure yet if this is the right game for me after playing the first two rounds of the game's campaign but at least fiddling this out was great fun. ;-)
In the hope that this is helpful for others.
I also hope the developer can fix this since it would be a pity to exclude older PCs although otherwise the game is not really demanding for the system.
By the way: I really like to be asked before phoning home, so some privacy settings would be great to switch that off, also for Unity's build in telemetry!
When trying to start from the console I got the following output:
~/GOG Games/Charterstone Digital Edition$ ./start.sh
Running Charterstone: Digital Edition
Set current directory to /home/myuser/GOG Games/Charterstone Digital Edition/game
Found path: /home/myuser/GOG Games/Charterstone Digital Edition/game/Charterstone.x86_64
./start.sh: line 16: 3263 Aborted ./"Charterstone.x86_64"
I then found the logfile "~/.config/unity3d/Acram Digital/Charterstone/Player.log" with the following contents:
...
FATAL ERROR: This binary was compiled with aes enabled, but this feature is not available on this processor (go/sigill-fail-fast).
...
=================================================================
Got a SIGILL while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
Caught fatal signal - signo:4 code:-6 errno:0 addr:0x3e800007195
Obtained 15 stack frames.
#0 0x007fa9dd7155cb in raise
#1 0x007fa9d43d41bb in (anonymous namespace)::cpu_feature_fail_fast()
...
Then I grepped in the game's installation directory for cpu_feature_fail_fast and found:
~/GOG Games/Charterstone Digital Edition$ grep cpu_feature_fail_fast -ris .
Binary file ./game/Charterstone_Data/Plugins/FirebaseCppApp-6_15_2.so matches
A little internet research showed that Firebase is a library for mobile and web development aquired by Google in 2014. According to https://en.wikipedia.org/wiki/Firebase there are some controversies about user privacy. But this should be no problem if you plan to play offline only as I do. The reference to AES makes absolutely sense in that context because AES is an encryption standard used when transfering data via the internet. For people that do not have a problem with transfering data to Google the developer maybe can compile the Firebase library without intrinsic AES operations for older CPUs not supporting these instructions directly. But since I do neither want nor need this cloud functionality I thought maybe I can remove the check for these operations when they never get called anyways when playing the game solely offline.
So I disassembled the found library file:
~/GOG Games/Charterstone Digital Edition$ objdump -d ./game/Charterstone_Data/Plugins/FirebaseCppApp-6_15_2.so > FirebaseCppApp-6_15_2.asm
and opened the just created disassembly file FirebaseCppApp-6_15_2.asm in a text editor where I searched for cpu_feature_fail_fast and found this:
00000000017f2180 <_ZN12_GLOBAL__N_121cpu_feature_fail_fastEv>:
17f2180: 55 push %rbp
17f2181: 48 89 e5 mov %rsp,%rbp
17f2184: 53 push %rbx
17f2185: 50 push %rax
17f2186: e8 55 87 e5 ff callq 164a8e0 <__cpu_indicator_init>
...
17f2333: c3 retq
...
Now I knew that the failing function starts with the bytes 554889e55350e85587e5ff.
I backuped and opened ./game/Charterstone_Data/Plugins/FirebaseCppApp-6_15_2.so in a hex editor (e.g. okteta) and searched for that byte sequence and found exactly one match.
From the above disassembly I also knew that the opcode to return from a function is c3 (for the retq CPU instruction).
So I replaced the 55 from the beginning of the byte sequence by c3 to skip all CPU feature checks by returning immediately. Then I saved the file.
After that I could start the game.
Not quite sure yet if this is the right game for me after playing the first two rounds of the game's campaign but at least fiddling this out was great fun. ;-)
In the hope that this is helpful for others.
I also hope the developer can fix this since it would be a pity to exclude older PCs although otherwise the game is not really demanding for the system.
By the way: I really like to be asked before phoning home, so some privacy settings would be great to switch that off, also for Unity's build in telemetry!