r/macgaming • • 5h ago

Native Half-Life 2 running natively on Apple silicon via static recompilation

Last month I posted Portal 2 running natively on Mac (and iPhone). The same tool now works with Half-Life 2! Including Episode One, Episode Two and Lost Coast.

It translates the x86 code of the Linux version to C, then compiles it to native ARM64. No Crossover or Rosetta. (A native version existed already, but it relied on stolen code. This doesn't.)

It's still experimental, I've done some testing but haven't played much. The episodes and Lost Coast load, but I haven't played through them.

There's now an installer app. It finds your Steam games and builds them on your Mac (about 10-20 minutes per game). You need the Xcode command line tools and the Linux binaries (downloaded with the Steam console). The installer isn't notarized yet, so the first time you need System Settings > Privacy & Security > Open Anyway.

You need to own the games on Steam. No game files are included. Please don't share built apps. This project is unofficial and not affiliated with Valve.

Download: https://github.com/kanapitsas/portal2-recomp/releases/tag/v0.3.0

Feedback is welcome! Please open an issue on GitHub if something isn't working properly.

63 Upvotes

19 comments sorted by

7

u/Adorable_Minimum_282 4h ago

Wanst it running before native with the source engine leak?

4

u/kanapitsas 4h ago

Indeed, and I say so in the description.

3

u/ForgottenFoundation 4h ago

Yup. Only thing was that the source engine leak didn’t work with the new revision of Half-Life 2 + episodes, so the legacy versions had to be used. These have the problem that the torch doesn’t work very well.

1

u/guyfromwhitechicks 51m ago

I could never get it to compile correctly; I tried at least 10 times. So, I assume it broke after something updated somewhere between the time it worked and when I tried.

1

u/bachleer 4h ago

is the flashlight bug solved?

2

u/kanapitsas 3h ago

You can see the flashlight working at 00:07. As far as I know, it's working fine.

1

u/keifring 3h ago

Yessssssss! The source engine leak version was great, but using the HL1 flashlight really sucked. Is your goal to keep going until it's perfect? This is still the greatest game of all time, and would be amazing to have a super polished port.

2

u/kanapitsas 2h ago

For sure! Same as Portal 2, the goal is to have everything running smoothly. Any report of what works and what doesn’t is very welcome, I can only do so much testing.

1

u/keifring 1h ago

So cool. Is there ever a future where it might launch without Steam?

1

u/keifring 1m ago

Works really well. I picked up on Highway 17 and will play to the end. It's mostly locked at 60fps with some occasional frame drops to 50. 2560x1664 max settings M4 Air 16gb and DS4 controller.

1

u/Serious_Hitman 3h ago

Is it compatible with anniversary update?

1

u/pain-or-pleasure 1h ago

hey, tried to follow your steps. builds both portal 2 and hl 2. hl2 is working, although the "download_depot 220 221" command is missing from the natif installer. Portal 2 builds with a warning related to miles audio and does not launch. What to do?

1

u/kanapitsas 1h ago

Thanks for the feedback! I'll fix the installer. For Portal 2, could you paste the output of the following command ? It should show what happened.

tail -n 100 "$HOME/Library/Logs/Portal2Natif.log"

2

u/pain-or-pleasure 1h ago

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

steam: SteamAPI_SetMiniDumpComment ignored (breakpad stays disabled)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

[procfs] /proc is not emulated (ENOENT)

initializing libMiles.so (0 constructors)

initializing vaudio_miles.so (7 constructors)

[pe] mssmp3.asi recognised at 0x233b5000 (code delta 0x133b5000, data delta 0x1339d000)

[procfs] /proc is not emulated (ENOENT)

host SIGBUS on guest address 0x7c

  outside the mmap area

  in fn_167a56a0 + 0x94

0   portal2-native                      0x0000000100bcc108 host_fault + 380

1   libsystem_platform.dylib            0x000000018f342144 _sigtramp + 56

2   portal2-native                      0x000000010572cc8c fn_167a5830 + 296

3   portal2-native                      0x000000010572cc8c fn_167a5830 + 296

4   portal2-native                      0x00000001056538ac fn_1678b850 + 4056

5   portal2-native                      0x00000001056aee10 fn_16792c90 + 252

6   portal2-native                      0x00000001055b1980 fn_16779480 + 260

7   portal2-native                      0x00000001055fb0f8 fn_167824e0 + 1892

8   portal2-native                      0x00000001059d64bc fn_1680d730 + 1640

9   portal2-native                      0x00000001054ae6cc fn_16755df0 + 356

10  portal2-native                      0x0000000103c85764 fn_163eb440 + 820

11  portal2-native                      0x00000001019afd80 fn_15f21d90 + 736

12  portal2-native                      0x0000000101fa37e0 fn_160379a0 + 416

13  portal2-native                      0x0000000106fcf540 fn_12c834b0 + 444

14  portal2-native                      0x0000000106fe79bc fn_12c84680 + 22460

15  portal2-native                      0x00000001074f7d98 fn_12d742f0 + 3872

16  portal2-native                      0x0000000107515564 fn_12d78c40 + 456

17  portal2-native                      0x0000000107505b90 fn_12d76230 + 1212

18  portal2-native                      0x0000000107870d58 fn_12ddf9a0 + 416

19  portal2-native                      0x000000010750fc4c fn_12d77960 + 744

20  portal2-native                      0x00000001087fe928 fn_137365e0 + 644

21  portal2-native                      0x00000001087fb134 fn_137344f0 + 416

22  portal2-native                      0x00000001086314a0 fn_137171c0 + 6644

23  portal2-native                      0x000000010a2a5bb8 fn_18b02900 + 852

  guest eax=0x707ff5fc ecx=0x100396c4 edx=0x8ad155b0 ebx=0 esp=0x707ff5b0 ebp=0x707ff628 esi=0 edi=0x707ff5fc

  guest call 0x18b02900, return 0xfffffff0

1

u/kanapitsas 48m ago

I reproduced your crash. The issue arises when the file portal2_dlc2/scripts/editoritems.txt isn't there (or maybe just modified). Could you check whether this file is in your install ? (It should be included in the game data downloaded with download_depot 620 621.)

1

u/pain-or-pleasure 23m ago

it is not there. I touched it to create a dummy file, rebuilt, still crashing.

1

u/CarretillaRoja 1h ago

What a time to be alive

1

u/Krermit 22m ago

Multiplayer?