Dr. ClaudePort, or: How I Learned to Stop Emulating and Love the Port
PS4 exclusives started running natively on PC this month. They're not emulators, they're not really ports, and I finished Uncharted 2 on one.
October, the month the exclusives escaped
Something strange happened to PlayStation 4 exclusives this October.
First it was Bloodborne, the game PC players have been begging Sony for since 2015. bbport, by deadinside28, runs it natively on Linux, and Supermedo brought it to Windows. Then, in early October, God of War III Remastered showed up as gow3_pc, by Felipe Prado (it has since been renamed SpartanPort). Days later came Uncharted: The Nathan Drake Collection, and not just once: one port built on the God of War runtime, another on the Bloodborne runtime a day later, and by now there are several of them floating around the internet.
Three exclusives in a few weeks and a growing pile of ports, all open source, and none of them ships a single byte of the games: you bring your own copy.
Sony did bring Uncharted 4 and The Lost Legacy to PC in 2022, but never the trilogy that started it all. I had my own copy of the Collection and had just started an Uncharted port of my own on top of gow3_pc when one of those ports appeared, already playing all three games. So I did the sensible thing: forked it and started playing. Two weeks, seven crashes and one CPU upgrade later, I've finished Uncharted 2 on PC.
This post is what I learned along the way: what these things actually are, why they're neither emulators nor ports, whether a language model was in the room when they were born, what broke when Naughty Dog's code met Windows, and what a universal PS4 porting kit could look like.
Emulation: building the whole machine out of software
A console is a computer with a fixed recipe: a CPU, a GPU, some memory, and an operating system that games talk to through a set of libraries. A classic emulator rebuilds the whole recipe in software.
The CPU is the expensive part. A PS2's MIPS processor or a PS3's Cell doesn't speak the same machine language as a PC, so every single instruction the game executes has to be translated, either interpreted one by one or recompiled on the fly into x86. The GPU gets the same treatment: the emulator reads the commands the game sends to the console's graphics chip and turns them into something a PC graphics card understands. The console's BIOS and operating system are either emulated as well, or reimplemented by hand, which the scene calls high-level emulation (HLE).
It's beautiful, it's general (one emulator, every game), and it's slow: there's a translation tax on every instruction, forever.
Then came the PS4, which is, to a first approximation, a PC: an AMD Jaguar x86-64 CPU, an AMD GCN graphics chip, and an operating system descended from FreeBSD. That changes everything. The PS4's CPU speaks exactly the same language as my Ryzen, so there is nothing to translate.
shadPS4, the PS4 emulator, takes advantage of this. It doesn't emulate the CPU at all: it loads the game's executable into memory and jumps into it. The game's machine code runs directly on the PC's processor, at full speed. What's left to "emulate" are the two things that really are different:
- Sony's system libraries. The game calls functions like
sceKernelAllocateDirectMemoryorscePadReadState, which exist on the PS4 and nowhere else. shadPS4 reimplements them. - The GPU. The PS4's graphics chip reads command packets (PM4) and runs shaders compiled to AMD's GCN machine code. shadPS4 translates the commands into Vulkan and the shaders into SPIR-V.
So even the emulator is already a hybrid: native CPU, reimplemented OS, translated GPU. The new ports push that hybrid one step further.
So what is a native port?
Take shadPS4's trick and give up on generality. Instead of an emulator that has to run every PS4 game ever made, build a runtime that runs one game, and patch that game until it fits.
The result is Uncharted.exe, a perfectly ordinary Windows program whose biggest component happens to be Naughty Dog's original PS4 code, with about 7,000 of its instructions patched before it ever runs. Patching itself isn't new: shadPS4 patches game code too as it loads it, but mostly in ways that are safe for every game. A port only has to work for one executable, so it can rewrite whatever that game needs before it starts.
It isn't an emulator, because no machine is being simulated. It isn't a port in the classic sense either, because nobody touched the source code: there is no source code. It's a strange hybrid, and the closest relatives I can think of are:
- Wine (literally "Wine Is Not an Emulator"), which runs Windows programs natively on Linux by reimplementing the Windows API. Add Proton's DirectX-to-Vulkan translation and you get a good mental model: these ports are Proton for a single PS4 game.
- Static recompilation, like N64Recomp (Zelda 64: Recompiled) or XenonRecomp (Unleashed Recompiled), which translates a console's machine code into C ahead of time and compiles it for the PC. On the PS4, a static recompiler would have nothing to recompile: the code is already x86-64, so recompiling degenerates into loading it and running it.
Looking inside
A port has five main parts:
- The loader links the game's executable and the system modules it ships with into one prepared image, maps it into memory and starts it.
- The patches fix the game's code before it runs, red-zone protection included.
- The runtime, in C, implements exactly the Sony functions this game imports, on top of Windows and SDL3. Not the whole SDK, only what this game calls.
- shadPS4's video core, vendored in, translates the GPU work.
- A PC shell wraps all of it: a launcher, graphics settings, keyboard and mouse, upscaling, crash reports.
The loader is where the PS4-ness gets ironed out. The game's imports aren't named by function name but by NID, a hash of the name. The loader resolves each one through the runtime, and an import nobody implements lands in a trap that stops the game with a report naming it. That trap is a port's to-do list.
The patches go in on the way. Every place where the game reads its thread block through the fs segment, which works on the PS4's FreeBSD and not on Windows, is rewritten: 1,249 of them in Uncharted 2. Functions that keep data in the stack's red zone get their risky instructions moved into trampolines, a story of its own further down. And each game gets its own fixes: Uncharted 2 has two bytes changed so it never times out waiting for the GPU.
The runtime is a pile of PS4 libraries rewritten on top of Windows: memory (the PS4's 8 GB of GDDR5, played by a pagefile-backed section), threads, files and save data, the pad, audio (ATRAC9 and all), and system services with exactly one offline user.
The GPU path is shadPS4's. A software version of the PS4 GPU's command processor (Liverpool, after the chip's codename) walks the command buffers the game wrote, the rasterizer records each draw into Vulkan, the shader recompiler turns GCN code into SPIR-V the first time each shader shows up, and the texture cache converts the PS4's tiled textures. The port hooks into that last one to swap button icons, but more on that later.
Did a language model come up with this?
Here's my hunch: this whole trend smells like an LLM idea. Loading a console executable into a Windows process and stubbing out its operating system one function at a time is such a sideways way to attack the problem. It feels like something a model would suggest at 2 a.m. when asked "can I play Bloodborne on my PC?"
The evidence is at least suggestive. SteamDeckHQ describes bbport as "developed with AI-assisted coding via Claude", and the God of War III coverage reports that Felipe Prado used Claude Opus 5.5 as a coding assistant. Full disclosure: every fix in this post was found with Claude too, through Claude Code, reading crash dumps and disassembly while I played.
So I brought it in for questioning.
(No language models were harmed during this interrogation.)
Me: (slides a crash dump across the table) Let's keep this simple. Would you have suggested a port like this?
Claude: For a PS4 game, yes. But I don't think it takes a model to get there. The PS4's CPU speaks the same x86-64 as your PC, so the hardest job of a classic emulator, translating the CPU, simply disappears. What's left is loading the executable where it expects to live, reimplementing the Sony functions one game imports (hundreds, not the whole SDK), and translating the GPU work, which shadPS4 already does.
Me: Convenient. And who does all that grunt work?
Claude: Scoped to one game, each of those jobs is finite and testable, and game-specific fixes can be hard-coded without breaking a thousand other games. A huge but bounded pile of glue code, disassembly and crash dumps. I won't deny that's exactly the kind of work I'm useful for.
Me: Two weeks. Seven crashes. And you never thought to mention the risks?
Claude: I'd have told you the bill up front. You inherit every difference between the PS4's ABI and Windows; the red zone and the float mode below are two of them. The GPU is still emulated, and that's where your frame rate goes. And every game needs its own fixes and someone willing to play it to the end.
Me: Where were you when bbport was written?
Claude: I don't remember other people's conversations, detective. Every one of them starts from zero.
Me: (leaning in) Then whose idea was it?
Claude: Older than any model. Cxbx, the original Xbox emulator, started in 2002 as a converter from Xbox executables to Windows ones. These ports are that idea, applied to a console that happens to share the PC's CPU. What changed is the price: the tedious 90% got cheap enough for one person to do in days. That, more than any single clever idea, is why a wave of these ports showed up within a few weeks.
Me: You're free to go. Don't leave the context window.
So my hunch was half right. The model probably didn't invent the idea, but it made the idea affordable, and in practice that's what started the trend.
What breaks when Naughty Dog's code runs on Windows
"Runs natively" sounds like "free". It isn't. The game was compiled for the PS4's ABI (the rules about how functions use registers and the stack) and for its kernel, and Windows plays by different rules.
The routine over two weeks was always the same: I played, a crash report popped up, and Claude dug through the dump. Seven crashes in total, and the two nastiest weren't bugs in anyone's code. They were disagreements between two ABIs.
The red zone: "execution of address 0x00"
October 17th, the museum heist in Istanbul. The game died with an error window: execution of address 0x00, on a thread called NdJobWorkerThread. Something had called a null function pointer.
The crash report's minidump, which by then kept the game's own memory around the crash, told the story. The culprit was a small leaf function (one that calls no other function) that builds a list of GPU resource bindings and keeps its counters just below the stack pointer, without reserving that space. That's legal on the PS4: the System V ABI promises every function a 128-byte red zone below rsp that nobody else will touch. Windows makes no such promise.
And on this port, something touches it constantly. To know when the game writes to memory the GPU uses, the port write-protects those pages, so the first write to each one is a page fault, over a thousand a second in heavy scenes, handled and resumed. When a fault happens, Windows saves the CPU state on the faulting thread's stack, right below rsp. Right on top of the red zone.
One counter read 0 instead of 9, the function used a stale table entry, and the game jumped to address zero. shadPS4 had hit the same function in the same game (issue #5038) and fixed it the same way we did. A planner (redzone.py) scans the executable for functions that use the red zone, 176 of them in Uncharted 2, and moves each of their 5,820 instructions that can fault into a small trampoline:
lea rsp, [rsp-128] ; step over the red zone (lea leaves the flags alone)
... ; the instruction that can fault, rsp offsets adjusted
lea rsp, [rsp+128] ; and back
jmp back ; to the next instruction in the game
Now the exception frame lands below the red zone, and the counters survive.
There was a sequel. On October 22nd, in the monastery, a different leaf function read one entry past the end of its array. Same mechanism, but the protection should have caught it. It turned out that in that one run out of nineteen, the protection had silently switched itself off. The trampolines have to sit within 2 GB of the game's code (a relative x86 jump can't reach any further), and by the time the port built them, the GPU's startup had taken every free spot nearby. The fix: reserve that space the moment the game is loaded.
The float mode: a NaN in the camera
The war temple, twelve seconds after a floor trap. The game died on its own assertion, m_lookAt.X() == m_lookAt.X(), which is how C++ programmers check for NaN.
Floating point has a dark corner called denormals: numbers so close to zero that they lose precision. The PS4 runs every game thread with flush-to-zero and denormals-are-zero turned on (the MXCSR register at 0x9fc0), so tiny numbers simply become zero. Windows starts threads at 0x1f80, with both off.
Uncharted 2 tracks the velocity Drake inherits from moving platforms and halves it every tenth of a second. Twelve seconds after stepping off the falling floor, that value is a denormal. On a PS4 the game reads it as zero and skips the math. On Windows it reads a tiny negative number, goes ahead, the fast reciprocal instruction returns minus infinity, the next step turns that into NaN, and the camera is now looking at not-a-number. The fix is one line in spirit: start game threads in the PS4's float mode.
The GPU: one crash, one mystery and a lot of frames
The GPU translation had its own crash. In "Keep Moving", a compute shader asked for a sampler with a custom border color, and the code read the color table through a pointer the game had never set: null. On GCN, compute has its own register for that table, separate from graphics; shadPS4 only ever read the graphics one, and without checking it. Now compute reads its own register, and an empty table gives transparent black instead of a crash.
One crash, a GPU "device lost" in a Tibetan village, is still unexplained. Seven crashes, six explained and fixed, one mystery. I'll take it.
The frame rate is a better story. On my old Ryzen 5 4500, the heaviest scenes ran at 38-45 FPS, and the graphics card wasn't the reason. The funnel explains it:
On the PS4, the GPU reads the game's command buffers itself. In the port, one CPU thread has to translate every draw and dispatch into Vulkan, at about 9 µs each on that Ryzen 5. Heavy scenes have more than 2,500 of them per frame: 2,700 × 9.2 µs ≈ 25 ms, which is 40 FPS, whatever graphics card is in the machine.
So we profiled that thread, cut five overheads (11-14% less CPU per frame), and moved Vulkan command recording to its own thread (another 10-13%, once it stopped waiting on small memory copies). The port also has a "multithreaded rendering" mode; it gave 11% more throughput and glitchy animations, so it stays off.
And then I bought a Ryzen 7 5700. About 7 µs per draw or dispatch, 60 FPS almost everywhere, around 50 in the very heaviest scenes. A CPU upgrade beat two weeks of optimization, which is humbling, and also exactly what the funnel predicts.
The remaining stutters are first visits. The first time the game uses a shader, it gets translated from GCN to SPIR-V and compiled by the driver; after that it lives in a cache on disk, so the second visit to an area is smooth.
Making it feel like a PC game
Running is one thing; feeling at home on a PC is another. The PS4 version shows PlayStation buttons everywhere, so the port swaps them: when the game uploads its button icons to the GPU, the port recognizes them by hash and paints in the key actually bound, or Xbox buttons when an Xbox pad is in use.
Before:
After, with an Xbox pad and with the keyboard:
The same goes for the stick animations (WASD on a keyboard) and the journal badge (Tab):
Keys are rebound on the game's own Controller Layout screen, covered by a keyboard page in the game's own menu font:
One feature came out instead of going in: a pad shortcut (R3 + L2) that opened the port's settings menu. In Uncharted 2, L2 aims and R3 zooms the sniper scope, so every sniper shot became a trip to the config menu. A player shouldn't get a config popup from a controller, so now only the Insert key opens it.
Towards a universal PS4 porting kit
Here's the part I find most exciting. The Uncharted port started life as the God of War III port, and it still shows: the executable is called gow3-probe.exe, and its settings are GOW3_* environment variables. Very little of it is about Uncharted. Most of what we fixed during the playthrough isn't either: every PS4 game is compiled for a red zone, every PS4 game expects the PS4's float mode, and every PS4 game sends its graphics through the same GPU.
Which suggests the obvious refactor: one runtime shared by every port, and a small profile per game.
Shared by every game: the loader and boot image, the Sony libraries in C, shadPS4's video core, the ABI fixes, and the PC shell (launcher, settings, input, crash reports). The red-zone planner works on any PS4 executable; each game just gets its own plan, computed once at first start.
Specific to each game: the imports nobody has written yet, the code patches, the hashes of its button textures, its GPU quirks, and the launcher presets.
Porting the next game would then look like the work we actually did, in order:
- Dump your own copy of the game. (The very first bug of this project was in my PKG extractor, which silently corrupted the dump. Check your dump.)
- Prepare the executable: link its system modules into a boot image and plan the red zone.
- Boot until the import trap stops you, implement the function it names, repeat.
- Fix the GPU edge cases the game finds. These go into the shared video core, so every port gets them.
- Patch the places where the game assumes PS4 hardware: timeouts, resolution tables.
- Dress it up as a PC game: controls, button textures, presets.
- Play it to the end with crash reports on, and fix what breaks.
Step 7 is the one no kit will ever automate. The hard part was never writing the code; it was finding out what was wrong, and that took playing the game through.
There's a reason to share beyond saving work, too, and it shows in where these ports came from.
One family, two branches
While writing the kit section, I went through the git histories of these ports expecting two families. There's only one:
bbport came first, on September 25th: Bloodborne on Linux, with shadPS4's video core vendored in. Supermedo forked it on October 6th to bring it to Windows, and two days later Felipe Prado forked that to make gow3_pc, which is why SpartanPort's git history still starts with bbport's first commit. The Uncharted ports arrived a week later, one on each side: one copied the God of War code into a repository of its own (the one we forked), and the other started from Supermedo's Bloodborne code.
So the God of War runtime is the Windows Bloodborne runtime's child, two days younger, and the two Uncharted ports are cousins. Three weeks after the split, the branches look quite different:
- The GPU. bbport rewrote shadPS4's video core part by part into a GPU layer of its own, and deleted the shadPS4 folder on October 13th. Every other port still carries the same shadPS4 commit, plus fixes of its own.
- Priorities. The Bloodborne side chases image quality and frame rate: DLSS, FSR 3.1 and 4, TAA and frame generation. SpartanPort turned its upscalers off and went for engine patches up to 240 FPS, a Linux build and a new launcher. The Uncharted port we forked kept the upscalers but has no frame generation.
- Platforms. bbport is Linux-only, SpartanPort ships for Windows with an experimental Linux build, and the rest are Windows ports.
- The ABI fixes. This is where it hurts. The red zone that crashed my museum heist has been fixed at least five separate times. Supermedo's Bloodborne port ships a precomputed list of functions to protect, both public Uncharted ports grew a general fix in the last week, ours from October 17th makes four, and shadPS4 has its own. bbport never needed one, because Linux skips the red zone when it delivers a signal. The float mode is rarer: as far as I can tell, the only public port that starts game threads in the PS4's float mode is the Uncharted port on the Bloodborne side, which got there three days before we did.
Fixes do cross between the branches, but by hand. Supermedo ports bbport's fixes over one by one, and the two Uncharted ports borrow from each other, with credit, in both directions. After each fork, the branches never shared another commit.
That's the best argument for the kit I can think of. Every port in this post grew from the same commit five weeks ago, yet each one fixes the red zone on its own. With a shared core, it would have been fixed once.
Our fork: github.com/qequ/Uncharted-The-Nathan-Drake-Collection-PC-port. You need your own copy of the game.
Notes & references
- shadPS4, the PS4 emulator whose video core all of these ports use. The same red-zone crash in the same game is issue #5038, fixed there with static red-zone protection in PR #4802.
- SpartanPort (formerly gow3_pc) by Felipe Prado: God of War III Remastered, and the runtime the Uncharted port we forked grew from.
- bbport by deadinside28, the common ancestor of every port here, with Supermedo's Windows port.
- The AI angle in the press: SteamDeckHQ on bbport and ProPakistani on God of War III.
- Cxbx (2002): the original Xbox emulator, which started as an XBE-to-EXE converter. Its successor is Cxbx-Reloaded.
- N64Recomp and XenonRecomp: static recompilation, the cousins that do have something to recompile.
- The System V AMD64 ABI defines the red zone; Microsoft's x64 conventions have none.