Apple Should Be Embarrassed

MacOS Tips
1 follower
#macOS #MacTips #MacOSTips #AppleTips #MacBook #MacBookTips #Productivity #Workflow #Shortcuts #KeyboardShortcuts #MacShortcuts
AI Generated·May contain errors
Video Summary
AI GeneratedThis video showcases the technical feat of running *Half-Life: Alyx* natively on the Apple Vision Pro using a tool called Glovebox. By leveraging translation layers and AI-assisted coding, the creator bypasses visionOS restrictions to execute a high-end PC VR game locally, highlighting the gap between the device's immense hardware potential and Apple's restrictive software ecosystem.
Holy crap,
oh yes,
oh yes.
So over the weekend, I'm doom scrolling on Twitter
and I see this guy, Udi Wertheimer,
who says, Weekend Project?
What if you could play Half-Life Alyx natively
on the Vision Pro?
No streaming, no PC, just right there on hardware.
And I thought, what if pigs could fly, except for...
This actually seems real.
It's based on Klepton, which is an existing project
that's been around for a little while
that allows you to run certain VR APKs
designed for Android, like Oculus Quest titles,
and run them on the Vision Pro.
Theoretically, kind of cool.
Practically, how does this actually work?
And does it work?
Is it real?
Well, I DMed him and he said,
"'Hey, guy, you wanna try it?'
So I said, "'Yeah.'"
And he gave me a download link to this mysterious DMG.
That I'm gonna open and I guess just install on my computer.
It's called Glovebox.
It's not publicly available yet.
He claims it will be soon.
But what this allegedly does is helps you compile
Half-Life Alyx to run on the Vision Pro.
There you go.
Hey look, there's already an update.
Should I install it? Yeah, I guess so.
Okay, so here it is. Half-Life Alyx on Vision Pro.
Let's get you set up. What you'll need an Apple Vision Pro, M2 or M5.
I have an M2. PSVR2 controllers. Got them right here.
And Half-Life Alyx in your Steam library.
A bit of background. Half-Life Alyx was released back in 2020.
Designed to run on x86 gaming PCs with tethered headsets like
an HTC Vive or a Valve Index, but
When Valve began developing the Steam Frame,
their standalone headset, running on a Snapdragon
8 Gen 3, they also invested 18 months porting the game to ARM, ARM64.
No small task, but a lucky break
for my nearly three-year-old Vision Pro, since the game's
The game's machine code can be leveraged
to run directly on Apple Silicon with nothing
translating it.
Theoretically.
Thing is, sharing an ISA is just the first step
of hundreds to get a game like this actually
running on the Vision Pro.
Executables, programs, come wrapped in a container format
that tells the operating system where
code goes into memory and which libraries should be linked at launch.
Linux uses one called ELF, while Apple uses Mach-O,
which is the only one that VisionOS
reads.
So we need to convert between the two,
and that is the job of Kleptin, an open-source
... by Max Thomas that Glovebox is actually built on top of.
It runs on your Mac and repackages
the game's ELF libraries pulled from your own Steam library,
by the way, as Mach-O frameworks that Xcode can link
into a regular app on the Vision
Pro, leaving most of the game's instructions
exactly as Valve compiled them.
Neat!
But the ones it does rewrite include anything touching X18,
one of the CPU's 31 General
Purpose Registers.
They're basically like tiny little storage
slots inside the processor itself.
Which Linux lets programs use as scratchspace
but Apple reserves for the operating system.
So anything that the game puts there can't be trusted to survive.
Klepton moves those values into thread-specific storage instead.
And for Alyx, Glovebox reports 66,000 rewrites across 89 libraries.
No small job.
Okay, I gotta sign into Xcode.
For right now, you need a paid developer account.
Udi's saying that he's working on a workaround.
But at least at the time of this filming, that can't be done.
Holy crap, this is interesting.
Look at this.
Press these keys to open settings.
I've never seen anything like... Look at this!
They have, like, a step-by-step helper. It's kind of cool.
Pair to your Vision Pro. We'll show you how to connect it over Wi-Fi.
Okay. Or, better yet, the developer strap.
I paid $300 for this, and then, like, a few months later,
they came out with a Thunderbolt version.
Mine is USB 2. Did they have an upgrade plan?
No. Did they allow you to exchange it? No.
Yeah, I just got bent over a barrel.
Thanks a lot, Apple.
Now once everything's converted,
Xcode builds the app and signs it with your Apple Developer
account, the same way that any developer would put
a work-in-progress app on their own device
for testing.
Congrats!
You made Half-Life Alyx all by yourself?
Really impressive.
So there's no jailbreak.
There's no exploit involved anywhere.
This is all legitimate.
And that is why a Mac is involved in the loop at all.
Because conversion and signing has
to happen before the app reaches the headset.
But once it's installed, the Mac's job is done.
Nothing is streamed and the Vision Pro
runs the game entirely on its own.
The levels, textures and audio skip the Mac altogether
because Glovebox includes its own Steam client written in Swift
that signs in on the headset, confirms you own Alyx, and downloads
the content straight from Valve on the Vision Pro.
And because it has this bastardized Steam client in headset,
the Vision Pro also supports cloud saves, not via iCloud, via Steam.
On the headset.
But not all is perfect.
See, VisionOS won't let an app create new machine code
while it's running, because
that code can't be signed in advance,
which we've already covered is a requirement for
VisionOS.
Luckily, Valve's ARM build doesn't need translating,
but there are still two parts
of Alex that want to generate code mid-game.
It's two scripting engines,
LuaJIT for gameplay, and Google's V8 for menus.
Now, both normally use a just-in-time compiler,
so they turn frequently used scripts into
Into machine code on the fly.
Glovebox has to do something about that,
so it swaps its own Lua JIT build with the JIT Removed and runs V8
in JIT-less mode, which Google built for lockdown platforms like iOS,
so both interpret their scripts instead on the fly.
What's the real-world effect, you ask?
Well, I noticed that menus in particular,
and some event triggers like moving between sections or levels,
were a bit laggy. But the
actual gameplay remains good,
since physics and rendering run in code that's converted and signed
ahead of time. No, as good as it can, I suppose,
because there's memory, or the lack thereof.
Glovebox reports Alex using between 6 and 8 gigs
which is more than Vision OS gives
apps by default.
So to get more, the app is signed with two entitlements,
permissions declared when an
app is built.
Increased memory limit is a simple one,
it increases how much RAM the app is allowed to use
and extended virtual addressing is the less obvious one.
Games often reserve memory addresses
for entire multi-gigabyte asset files up front,
but then they only load the pieces
that they need into RAM as they need them.
That saves on RAM, but it uses up addresses quickly,
so this entitlement gives the app
a much larger range of addresses to work with.
But even with all the memory that the Vision Pro can possibly give it,
This is not a gaming PC experience.
On my M2, Glovebox targets 45 FPS
and uses reprojection to fill in the rest
of the 90 Hertz display, every other frame,
re-aiming the last frame to match
how your head has rotated since.
Now for comparison, Valve's own port on the Steam frame
only renders at 36 frames per second
and displays at 72 Hertz, so worse than the Vision Pro.
But not really, because it adds eye-tracked foveated rendering
and depth reprojection,
which accounts for how far away each object is,
not just where your head is pointing.
Close-up objects can look kind of doubled in glovebox
when you move your head side-to-side,
which is a little disorienting.
So while the Vision Pro looks sharper than
the Steam Frame would, at least I believe
I don't know, Valve won't sell me one, it has more visible artifacting.
And even getting that far takes a lot more than just memory.
The first time this scene opened up,
I got shivers up and down my spine.
It might happen again.
This is like one of the best video game intros ever.
Oh, yes.
Oh, yes.
Okay, so the frame rate, it ain't there.
There.
We are probably, this is probably,
I don't know, 60, 60 FPS.
It's not great.
And teleportation is, how the heck do you do that on these controllers?
Oh, there you do it.
Hold on. Where's my desk?
I'm already lost
spatially in VR.
Okay. Snazzy.
Yeah, that's, uh, that's not quite as good as what I'm used to.
Even once it's running,
Alex still thinks that it is a Linux PC hooked up to SteamVR,
and Vision OS obviously has neither.
So every time the game opens a file,
or starts a thread, or checks the clock,
it goes through glibc, which is Linux's standard C library.
And every time it needs to know where your head and your hands are,
it asks OpenVR, which is Valve's SDK for headsets and controllers,
which SteamVR, the actual runtime, would normally answer.
None of that is on the Vision Pro.
So Glovebox solves both the same way
with shims, stand-in libraries
that answer the game's requests
using Apple's own frameworks.
So its glibc passes those requests
to Apple's equivalents where they exist
and recreates Linux's behavior where they don't.
It's open VR shim, pulls head and controller tracking from ARKit,
and buttons and triggers
from GameController, which
then sends the finished frames to Compositor Services, which
is what VisionOS uses to display fully immersive content.
And we haven't even talked about graphics yet,
yeah, graphics, Half-Life has got em!
The game renders in Vulkan, but VisionOS requires Metal,
so the MoltenVK translation layer does
the heavy lifting.
It's been around for years, it's well established,
not all that dissimilar from
from what Apple uses from DirectX
with its game porting toolkit.
This, of course, includes shaders,
which Glovebox pre-compiles because its internal tests found
that using Molten VK on the headset to load them
on the fly took about half a second.
So, yet again, Glovebox leverages one
of Valve's awesome open-source tools, Fossilize,
which records the shader combinations used
so that they can be pre-built ahead of time.
The thing is, Glovebox can't legally include Valve shaders
in their app, so the project
only ships with a list of what to build,
and it is your Mac that then actually builds out
that shader archive.
Then, once the game is on the headset,
the game is what actually compiles those shaders
before gameplay starts.
It's like a three-step process.
Really neat.
But as you can probably imagine,
this is super complicated, and an enormous amount of work.
The kind of work that would probably take a multi-person team months.
Or years.
But it was done by a single person in a weekend.
Such is both the beauty and the curse of these newfound coding agents.
Valve's Arm port and MoltenVK
and Fossilize and Klepton already existed
and were mostly written by humans.
The glibc replacement, the OpenVR and SteamVR shims,
and the Swift Steam client, they didn't exist.
Nor did the...
Nor did any of them working nicely together exist either.
That was all done by AI, and the dev told
me that he knows nothing of game development,
and that it was Claude Opus 3.5 that handled basically
the entire project almost entirely on its own.
I mean, that's scary, but even the most stalwart AI
skeptics have to admit that that's at least a little bit cool.
Oh, you know what, boys and girls?
Was it just because I was screen recording this-ish?
Hold on. Screen recording?
I thought it didn't take that many resources away
from the system, but I think this thing
just slurps up every single megabyte of memory available to it,
and it scoops up every single
clock cycle that it can from the CPU and GPU, and you can feel it.
This thing is bloody freaking hot, but it does play Half-Life Alyx.
Well, well, well, say what you will about AI,
but it does make things move quickly.
Over the weekend, another tool came out called AVP Play
that does the same thing as Glovebox
with Half-Life Alyx, but it
also adds a couple thousand extra VR titles, except for this
time, from the Oculus, Meta, Horizon,
whatever the crap we're calling it today, store.
You come in here to Setup, it checks for Xcode,
we're going to check again for our headset.
Is it awake? There it is! And we sign into our Meta account.
I come here, Eye of the Temple,
which I want to demo because it's a great room-scale game,
which the Vision Pro has famously not really been able to do.
I'm going to push Install, and, well, that appears to be it.
It's downloading the game,
which is only 230 megabytes, so that's awesome.
And now it is building and installing. I'm going to assume it's done.
I'm going to open this thing up,
and there's my nice banner image that it downloaded.
There are settings.
Oh, whoa!
Oh!
So you can do foveated rendering, huh?
That's sick.
That's right, foveated rendering.
Look right here.
Are you on the toilet right now?
What the heck, man?
Um, this is awkward.
See, your eyes, they only see sharp detail at a small area.
Right here, the center of your vision.
You're looking at your phone on the toilet.
But you see the toilet paper roll over there?
It's kind of out of focus.
So rendering the edges of the frame at full detail
just wastes GPU power
because your eyes aren't going to see that.
You move your head, not your eyeballs in your head,
generally speaking.
Now, the Steam Frame actually does track your eyes,
and it moves that sharp area to wherever
you're looking.
So if you do move your eyeballs up here, it re-renders for that area.
And Vision OS does the same thing
for apps built with Apple's Reality Kit.
But it never tells the apps where you're looking.
And games that draw their own frames with Metal,
like Half-Life Alyx, only gets a fixed
version.
AVP Play builds its own fixed foveation at the center of the frame,
rendering it full detail,
and then the edges get less GPU time and compute.
How does it do this? Well,
under the hood it uses a Metal feature called
rasterization rate maps, which lets parts of
an image render at lower resolution,
but then rebuilds the full image before the game uses
it again. And I do notice
when I look towards the edge of my view that it's
not quite as sharp. You can even actually probably notice it
in this screen recording.
AVP Play even offers pass-through support
for mixed reality games like Triangle Strategy.
Now, on a Quest, those games ask Meta's software
for a pass-through layer,
and the headset fills that layer with its camera feed
so the game appears in your room,
but VisionOS does not give regular apps access to that camera's feed.
So the AVP Play app has to leverage a pretty clever solution.
By making the pass-through layer transparent,
Rather than black, they can basically poke holes
that reveal the VisionOS environment underneath.
So the game is able to work in your space,
but without ever seeing a single camera frame.
Pretty amazing, but complicated
and enabled on a game-by-game basis right now.
As of the time of this filming, two are supported.
And I shall step onto the thing. Okay.
And now I shall walk here, and walk here.
Heck yeah, dude. This is legit room scale.
And I'm starting to drop some frames,
but I think that might just be the video recording.
Okay, heck yeah, this is sick.
Oh, I'm running into stuff.
It's a plant.
They really, you really do need the full, full space in this room.
Yeah, this looks and works
great. I have no complaints about this at all.
I mean, this is not PC VR, right? I am
clearly a meta quest game, but it's perfectly suitable.
Got that bird. It looks nice.
The Vision Pro's greatest weakness,
in my opinion, has always been Apple's insistence
that it be yet another App Store-driven platform,
something they have tried with every single
device since the iPhone to varying degrees of failure.
They tried it with the Mac,
and Mac devs were like, no, why would we do that?
We already have the web and existing architectures.
They tried it with watchOS and tvOS.
When was the last time you downloaded apps on there?
You didn't.
And yeah, OK, look, I'm not delusional.
The $3,500 price point?
Big problem.
Didn't help.
I think that this stands.
As proof, maybe, that even more than two and a half years later,
the hardware, as if we
didn't already know it, is excellent.
It was excellent.
It continues to be excellent.
It has been underserved by the platform itself.
Whether that be developers' faults, Apple's fault, doesn't matter.
A PC VR game from 2020 is running locally
on my three-year-old, near three-year-old
Vision Pro, using a handful of open source projects,
Apple's public frameworks, and
And entitlements that any App Store game could use.
Mark Gurman from Bloomberg reporting that Apple's new CEO
John Ternus, was skeptical
of the Vision Pro internally,
even if he has called it an extraordinary product in public.
The future of the platform looks grim.
I hope for sunnier days,
because the Vision Pro remains one of the most amazing computing
experiences of my life.
I put it on for the first time and I'm like,
this is a top 10, like, how the heck is this
thing even real in my life?
And that's from a guy that knew a lot about VR.
It has shown me that even more than I already expected,
I suppose, there's just so much
potential that has been left on the table
because of neglect and lack of care.
And that's a shame.
Do you like the Vision Pro as much as me?
Probably not.
Why not?
Nobody cares, but I do.
Maybe we'll get that $1,200 headset
now that Meta has worked on theirs.
Thanks so much for watching.
And as always, stay snazzy.
