Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS ARM #4

Open
boolean-false opened this issue Dec 9, 2023 · 8 comments
Open

MacOS ARM #4

boolean-false opened this issue Dec 9, 2023 · 8 comments

Comments

@boolean-false
Copy link

boolean-false commented Dec 9, 2023

Is it possible for macos architecture to support ARM?

@chayleaf
Copy link
Owner

chayleaf commented Dec 9, 2023

You can try compiling it yourself! Download rustup (https://rustup.rs) and run cargo build --release in the root of this project, then copy the files from target/release

Though I haven't actually tested this on Mac or Windows, sorry

@boolean-false
Copy link
Author

I took your repository and compiled aarch64-apple-darwin. It compiled fine, but unfortunately I get a lot of errors when I run the game

@boolean-false
Copy link
Author

Process:               SnowRunner [81129]
Path:                  /Volumes/VOLUME/*/SnowRunner.app/Contents/MacOS/SnowRunner
Identifier:            games.saber.snowrunner
Version:               27.1 (3)
Code Type:             ARM-64 (Native)
Parent Process:        launchd [1]
User ID:               501

Date/Time:             2023-12-09 20:31:22.1530 +0300
OS Version:            macOS 14.0 (23A344)
Report Version:        12
Anonymous UUID:        57A79A78-1413-3D75-90A8-542CE2337590

Sleep/Wake UUID:       DFA8A108-CDE2-4D8C-8AE9-DA960696C8DE

Time Awake Since Boot: 140000 seconds
Time Since Wake:       27420 seconds

System Integrity Protection: enabled

Crashed Thread:        0  MainThrd  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000

Termination Reason:    Namespace SIGNAL, Code 6 Abort trap: 6
Terminating Process:   SnowRunner [81129]

Application Specific Information:
abort() called


Thread 0 Crashed:: MainThrd Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	       0x183c2f11c __pthread_kill + 8
1   libsystem_pthread.dylib       	       0x183c66cc0 pthread_kill + 288
2   libsystem_c.dylib             	       0x183b76a50 abort + 180
3   libsteam_api.dylib            	       0x102a5ddc4 std::sys::unix::abort_internal::hbc09310be918e1bb + 12
4   libsteam_api.dylib            	       0x102a5c494 rust_panic + 88
5   libsteam_api.dylib            	       0x102a5c3d4 std::panicking::rust_panic_with_hook::h221a0baf52ecd48a + 604
6   libsteam_api.dylib            	       0x102a5c160 std::panicking::begin_panic_handler::_$u7b$$u7b$closure$u7d$$u7d$::h18b661cf0f97a414 + 212
7   libsteam_api.dylib            	       0x102a5b100 std::sys_common::backtrace::__rust_end_short_backtrace::h4f4b2ffab2311217 + 12
8   libsteam_api.dylib            	       0x102a5becc rust_begin_unwind + 108
9   libsteam_api.dylib            	       0x102a8ca30 core::panicking::panic_fmt::hd6070cd222575be5 + 52
10  libsteam_api.dylib            	       0x102a8cd18 core::result::unwrap_failed::h54ffffcb65858936 + 92
11  libsteam_api.dylib            	       0x102a3f320 konigsberg::patch::heb4da5d5fb4bc4b1 + 544
12  libsteam_api.dylib            	       0x102a3f48c konigsberg::patch_ptr::h11017b6a9e9b2aed + 284
13  lib_MR2_SpinTires.dylib       	       0x10db79bc4 SteamInternal_Init_SteamApps(ISteamApps**) + 32
14  libsteam_api.orig.dylib       	       0x1054f1798 SteamInternal_ContextInit + 80
15  lib_MR2_SpinTires.dylib       	       0x10dba71f0 steamAPI_INITIALIZER::InitSteamAPI() + 268
16  lib_MR2_SpinTires.dylib       	       0x10dbdb61c MR2DxutInit(apAPP_DATA_STORAGE&) + 96
17  lib_MR2_SpinTires.dylib       	       0x10e2e9cbc Mr2SpintiresInitComponents(apAPP_DATA_STORAGE&) + 164
18  lib_MR2_SpinTires.dylib       	       0x10e3482b8 MudRunnerRun(apCMD_LINE_PARAMS const&) + 3408
19  lib_MR2_SpinTires.dylib       	       0x10e41ecfc ds::impl::FUNCTION_OBJ_INVOKER<main::$_10, int, apCMD_LINE_PARAMS const&>::Invoke(ds::impl::FUNCTION_BUFFER&, apCMD_LINE_PARAMS const&) + 16
20  lib_MR2_SpinTires.dylib       	       0x10e349198 PlatformRunApp(dsFUNCTION<int (apCMD_LINE_PARAMS const&)>, apCMD_LINE_PARAMS const&) + 128
21  lib_MR2_SpinTires.dylib       	       0x10e348fec main + 184
22  dyld                          	       0x1838ed058 start + 2224

Thread 1:: SDLTimer
0   libsystem_kernel.dylib        	       0x183c2a0ac __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x183c675fc _pthread_cond_wait + 1228
2   lib_MR2_SpinTires.dylib       	       0x10f57eef8 SDL_CondWaitTimeout_REAL + 148
3   lib_MR2_SpinTires.dylib       	       0x10f4df294 SDL_SemWaitTimeout_REAL + 80
4   lib_MR2_SpinTires.dylib       	       0x10f4d5818 0x10d640000 + 32069656
5   lib_MR2_SpinTires.dylib       	       0x10f4c6b60 SDL_RunThread + 48
6   lib_MR2_SpinTires.dylib       	       0x10f4d2344 0x10d640000 + 32056132
7   libsystem_pthread.dylib       	       0x183c67034 _pthread_start + 136
8   libsystem_pthread.dylib       	       0x183c61e3c thread_start + 8

Thread 2:
0   libsystem_pthread.dylib       	       0x183c61e28 start_wqthread + 0

Thread 3:
0   libsystem_pthread.dylib       	       0x183c61e28 start_wqthread + 0

Thread 4:
0   libsystem_pthread.dylib       	       0x183c61e28 start_wqthread + 0

Thread 5:: caulk.messenger.shared:17
0   libsystem_kernel.dylib        	       0x183c26830 semaphore_wait_trap + 8
1   caulk                         	       0x18df9b690 caulk::semaphore::timed_wait(double) + 212
2   caulk                         	       0x18df9b544 caulk::concurrent::details::worker_thread::run() + 36
3   caulk                         	       0x18df9b244 void* caulk::thread_proxy<std::__1::tuple<caulk::thread::attributes, void (caulk::concurrent::details::worker_thread::*)(), std::__1::tuple<caulk::concurrent::details::worker_thread*>>>(void*) + 96
4   libsystem_pthread.dylib       	       0x183c67034 _pthread_start + 136
5   libsystem_pthread.dylib       	       0x183c61e3c thread_start + 8

Thread 6:: caulk.messenger.shared:high
0   libsystem_kernel.dylib        	       0x183c26830 semaphore_wait_trap + 8
1   caulk                         	       0x18df9b690 caulk::semaphore::timed_wait(double) + 212
2   caulk                         	       0x18df9b544 caulk::concurrent::details::worker_thread::run() + 36
3   caulk                         	       0x18df9b244 void* caulk::thread_proxy<std::__1::tuple<caulk::thread::attributes, void (caulk::concurrent::details::worker_thread::*)(), std::__1::tuple<caulk::concurrent::details::worker_thread*>>>(void*) + 96
4   libsystem_pthread.dylib       	       0x183c67034 _pthread_start + 136
5   libsystem_pthread.dylib       	       0x183c61e3c thread_start + 8

Thread 7:: load_async_cb_p
0   libsystem_kernel.dylib        	       0x183c2a0ac __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x183c675fc _pthread_cond_wait + 1228
2   lib_MR2_SpinTires.dylib       	       0x10e1e308c osCONDITION::Wait(unsigned int) + 148
3   lib_MR2_SpinTires.dylib       	       0x10e158348 resASYNC_CALLBACK_MANAGER::ProcessOne(bool) + 276
4   lib_MR2_SpinTires.dylib       	       0x10e157f40 resASYNC_ProcessCbsThreadProc(void*) + 36
5   lib_MR2_SpinTires.dylib       	       0x10e1e14cc osThreadHelper(void*) + 76
6   libsystem_pthread.dylib       	       0x183c67034 _pthread_start + 136
7   libsystem_pthread.dylib       	       0x183c61e3c thread_start + 8

Thread 8:: loading_queue_t
0   libsystem_kernel.dylib        	       0x183c2a0ac __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x183c675fc _pthread_cond_wait + 1228
2   lib_MR2_SpinTires.dylib       	       0x10e1e308c osCONDITION::Wait(unsigned int) + 148
3   lib_MR2_SpinTires.dylib       	       0x10e1620ec resLOADING_DISK_QUEUE::WaitForRequests(int) + 108
4   lib_MR2_SpinTires.dylib       	       0x10e1587f4 resASYNC_UpdateLoadingQueueThreadProc(void*) + 52
5   lib_MR2_SpinTires.dylib       	       0x10e1e14cc osThreadHelper(void*) + 76
6   libsystem_pthread.dylib       	       0x183c67034 _pthread_start + 136
7   libsystem_pthread.dylib       	       0x183c61e3c thread_start + 8

Thread 9:: engMiscMng0
0   libsystem_kernel.dylib        	       0x183c2a0ac __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x183c675fc _pthread_cond_wait + 1228
2   lib_MR2_SpinTires.dylib       	       0x10e1e05e8 osWAITABLE_EVENT::TimedWait(unsigned int) + 352
3   lib_MR2_SpinTires.dylib       	       0x10e1dbd14 osWORKER_THREAD::Proc(void*) + 148
4   lib_MR2_SpinTires.dylib       	       0x10e1e14cc osThreadHelper(void*) + 76
5   libsystem_pthread.dylib       	       0x183c67034 _pthread_start + 136
6   libsystem_pthread.dylib       	       0x183c61e3c thread_start + 8

Thread 10:: engMiscMng1
0   libsystem_kernel.dylib        	       0x183c2a0ac __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x183c675fc _pthread_cond_wait + 1228
2   lib_MR2_SpinTires.dylib       	       0x10e1e05e8 osWAITABLE_EVENT::TimedWait(unsigned int) + 352
3   lib_MR2_SpinTires.dylib       	       0x10e1dbd14 osWORKER_THREAD::Proc(void*) + 148
4   lib_MR2_SpinTires.dylib       	       0x10e1e14cc osThreadHelper(void*) + 76
5   libsystem_pthread.dylib       	       0x183c67034 _pthread_start + 136
6   libsystem_pthread.dylib       	       0x183c61e3c thread_start + 8

Thread 11:: engMiscMng2
0   libsystem_kernel.dylib        	       0x183c2a0ac __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x183c675fc _pthread_cond_wait + 1228
2   lib_MR2_SpinTires.dylib       	       0x10e1e05e8 osWAITABLE_EVENT::TimedWait(unsigned int) + 352
3   lib_MR2_SpinTires.dylib       	       0x10e1dbd14 osWORKER_THREAD::Proc(void*) + 148
4   lib_MR2_SpinTires.dylib       	       0x10e1e14cc osThreadHelper(void*) + 76
5   libsystem_pthread.dylib       	       0x183c67034 _pthread_start + 136
6   libsystem_pthread.dylib       	       0x183c61e3c thread_start + 8

Thread 12:: engMiscMng3
0   libsystem_kernel.dylib        	       0x183c2a0ac __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x183c675fc _pthread_cond_wait + 1228
2   lib_MR2_SpinTires.dylib       	       0x10e1e05e8 osWAITABLE_EVENT::TimedWait(unsigned int) + 352
3   lib_MR2_SpinTires.dylib       	       0x10e1dbd14 osWORKER_THREAD::Proc(void*) + 148
4   lib_MR2_SpinTires.dylib       	       0x10e1e14cc osThreadHelper(void*) + 76
5   libsystem_pthread.dylib       	       0x183c67034 _pthread_start + 136
6   libsystem_pthread.dylib       	       0x183c61e3c thread_start + 8


Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000000   x1: 0x0000000000000000   x2: 0x0000000000000000   x3: 0x0000000000000000
    x4: 0x0000000000000000   x5: 0x0000000000000001   x6: 0x6f666e695f656761   x7: 0x0000000000000c20
    x8: 0x2c98889a4173b58c   x9: 0x2c98889b9b81668c  x10: 0x0000000000110000  x11: 0x0000000102b26ab0
   x12: 0x0000000183934158  x13: 0x00000001838ec77c  x14: 0x0000000000000000  x15: 0x000000018397a3f8
   x16: 0x0000000000000148  x17: 0x00000001e415cdb8  x18: 0x0000000000000000  x19: 0x0000000000000006
   x20: 0x00000001daf2d300  x21: 0x0000000000000103  x22: 0x00000001daf2d3e0  x23: 0x0000000102b28360
   x24: 0x0000000183c6ec70  x25: 0x0000000102abd4a8  x26: 0x0000600003304060  x27: 0x000000016dbf1538
   x28: 0x0000000102a3ec2c   fp: 0x000000016dbf1250   lr: 0x0000000183c66cc0
    sp: 0x000000016dbf1230   pc: 0x0000000183c2f11c cpsr: 0x40001000
   far: 0x0000000102a4563c  esr: 0x56000080  Address size fault

Binary Images:
       0x10b3cc000 -        0x10c857fff steamclient.dylib (*) <54680164-a5b8-3c7a-993d-6f8b55e6bb8a> /Users/USER/Library/Application Support/Steam/*/steamclient.dylib
       0x102938000 -        0x10294ffff libtier0_s.dylib (*) <042d3b3c-9e45-3881-b31e-f3a77a456a83> /Users/USER/Library/Application Support/Steam/*/libtier0_s.dylib
       0x1055e8000 -        0x105613fff libvstdlib_s.dylib (*) <5e16a499-72ba-3186-8d52-829a06c78458> /Users/USER/Library/Application Support/Steam/*/libvstdlib_s.dylib
       0x10296c000 -        0x10297bfff libaudio.dylib (*) <4a1ae650-96b4-3b26-96fe-ede3ce1fbaa7> /Users/USER/Library/Application Support/Steam/*/libaudio.dylib
       0x105598000 -        0x1055affff crashhandler.dylib (*) <fcb1e93c-6bdf-31af-8c2f-30fa1f2b97af> /Users/USER/Library/Application Support/Steam/*/crashhandler.dylib
       0x105670000 -        0x105677fff com.googlecode.google-breakpad (*) <eb859872-955a-315d-9ce1-87fb57f7c4cd> /Users/USER/Library/Application Support/Steam/*/Breakpad.framework/Versions/A/Breakpad
       0x105698000 -        0x1056a7fff breakpadUtilities.dylib (*) <f81b68a1-e8e8-3f7c-8e42-be3c57699fc9> /Users/USER/Library/Application Support/Steam/*/Breakpad.framework/Versions/A/Resources/breakpadUtilities.dylib
       0x1054ec000 -        0x1054f7fff libsteam_api.orig.dylib (*) <99b16acf-04cf-3fc6-80a6-9bc69fb1d440> /Volumes/VOLUME/*/SnowRunner.app/Contents/Frameworks/libsteam_api.orig.dylib
       0x102474000 -        0x10247ffff libobjc-trampolines.dylib (*) <562f95b3-8118-3d61-a13f-34e819dd863d> /usr/lib/libobjc-trampolines.dylib
       0x10d640000 -        0x10fd5ffff lib_MR2_SpinTires.dylib (*) <57961cf9-cf9d-3d93-acb3-f7f2153af542> /Volumes/VOLUME/*/SnowRunner.app/Contents/Frameworks/lib_MR2_SpinTires.dylib
       0x1056d0000 -        0x106c4ffff libEOSSDK-Mac-Shipping.dylib (*) <ae357ce0-90e9-351b-8f9c-315aeec3a630> /Volumes/VOLUME/*/SnowRunner.app/Contents/Frameworks/libEOSSDK-Mac-Shipping.dylib
       0x1029a8000 -        0x102b13fff libsteam_api.dylib (*) <53dfce58-bc8f-3dd4-93bd-1bbc72448b09> /Volumes/VOLUME/*/SnowRunner.app/Contents/Frameworks/libsteam_api.dylib
       0x10220c000 -        0x10220ffff games.saber.snowrunner (27.1) <b91f0374-9fa2-3ff5-8396-cfa6875a0670> /Volumes/VOLUME/*/SnowRunner.app/Contents/MacOS/SnowRunner
       0x183c25000 -        0x183c5ffef libsystem_kernel.dylib (*) <a7d3c07d-0a1e-3c4c-8fba-66905e16bf99> /usr/lib/system/libsystem_kernel.dylib
       0x183c60000 -        0x183c6cff3 libsystem_pthread.dylib (*) <e4debb6e-421d-33d0-9e17-77ae0e0fe4dc> /usr/lib/system/libsystem_pthread.dylib
       0x183b00000 -        0x183b7eff3 libsystem_c.dylib (*) <1b84a7e4-8958-330c-98b8-27d491dff69e> /usr/lib/system/libsystem_c.dylib
       0x1838e7000 -        0x18397a873 dyld (*) <ffd8ab66-c9ab-31df-ab80-3a3dff367ddd> /usr/lib/dyld
               0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???
       0x183c6d000 -        0x183c91fff libdyld.dylib (*) <4bb77515-dba8-3edf-9af7-3c9eae959ea6> /usr/lib/system/libdyld.dylib
       0x18df99000 -        0x18dfc2fff com.apple.audio.caulk (1.0) <3863bf77-fb9e-3c5f-8790-d879a2bb092a> /System/Library/PrivateFrameworks/caulk.framework/Versions/A/caulk

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
``

@chayleaf
Copy link
Owner

chayleaf commented Dec 9, 2023

this most likely means mprotect is failing - the .text segment is not writable. You can try printf '\x07' | dd of=<game executable> bs=1 seek=160 count=1 conv=notrunc which I took from stackoverflow (backup the game exe beforehand)

if that doesn't work and you can't find anything online, I can try switching to a different approach that doesn't require mprotect later... a lot later

@sandlotie
Copy link

I'm a little confused about how this works
I moved libsteam_api.dylib to the path common/Game/Game.app/Contents/Frameworks/libsteam_api.dylib
I renamed the old libsteam_api.dylib to libsteam_api.orig.dylib.
It doesn't work and gives this when run through the terminal

thread '<unnamed>' panicked at 'failed to load steam api lib: DlOpen { desc: "dlopen(steam_api_orig, 0x0005): tried: \'steam_api_orig\' (no such file), \'/System/Volumes/Preboot/Cryptexes/OSsteam_api_orig\' (no such file), \'/usr/lib/steam_api_orig\' (no such file, not in dyld cache), \'steam_api_orig\' (no such file), \'/usr/local/lib/steam_api_orig\' (no such file), \'/usr/lib/steam_api_orig\' (no such file, not in dyld cache)'" }'', src/ffi.rs:101:10

But even if I remove libsteam_api.dylib and libsteam_api.orig.dylib and run the game, I get the same error.

@chayleaf
Copy link
Owner

you may have to move libsteam_api.orig.dylib to the game's current directory, and I'm not sure which directory that is

@sandlotie
Copy link

sandlotie commented Mar 20, 2024

Well, as I understand it, that's where it should be. I mean in all games that have libsteam_api.dylib it was in the path I specified in the Frameworks folder for example:
~/Library/Application\ Support/Steam/steamapps/common/Euro\ Truck\ Simulator\ 2/Euro\ Truck\ Simulator\ 2.app/Contents/Frameworks/libsteam_api.dylib

I would like to clarify if I understand correctly that the error text I sent earlier is the error text of your modification?
Because, why if I delete libsteam_api.dylib
Or add your modification I get the same error, I can not quite understand it

I just thought I could modify something and if the modified libsteam_api.dylib doesn't see libsteam_api.orig.dylib then I could hardcode the direct path to it, but even after I did that I still get the same error.

I even tried changing the error text in src/ffi.rs to see if anything changes or not, but it still gave the unchanged error
https://github.com/chayleaf/konigsberg/blob/d75bcf7ff21503b530c6b23cd3039397aa96cd04/src/ffi.rs#L101C9-L101C48

@chayleaf
Copy link
Owner

the error is indeed coming from konigsberg, you probably haven't fully removed it, it's still there somewhere the game sees and loads it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants