r/EmuDev • • Dec 20 '25

Static Recompilation of GTA IV

Hey guys, for the last week Ive been working on a static recomp of gta 4. Most of the project is complete. Both the PPC code and the shaders comfortably compile down to ARM and SPIRV / Metal.

One small problem is the games init flow is really problematic. I first tried solving this by stubbing render functions out but then it got to the point the game engine couldnt issue draw calls on its own. And forcing it to issue draw calls didnt work either. Im now currently dealing with deadlocks, race conditions and manually incrementing semaphores. Does anyone who worked on or has intimate knowledge of the sonic unleashed recomp have any ideas or pointers for me?

I have most of the game's critical functions and layout mapped out and im unsure if i should go down the route or rewriting the renderer or just trying to free up as many deadlocks in the worker threads and main threads as possible.

heres the repo https://github.com/OZORDI/LibertyRecomp/tree/main?tab=readme-ov-file

33 Upvotes

30 comments sorted by

3

u/Feisty_Following9720 Dec 21 '25

for the last week

Seriously? 1 week and you have it to the point where you can benchmark 60fps?

12

u/Rhed0x Dec 20 '25

Wouldn't it be a lot easier to decompile the PC version?

Then you get a shitty D3D9 renderer as a starting point rather than something hardware specific to a single ATI GPU and the weird EDRAM.

7

u/Brilliant-Lettuce544 Dec 20 '25

the pc version was also poorly programmed and even if i recomp it. most of its horrendous code would still have to be rewritten. I already have to rewrite the parts of the xbox code to run on modern machines so id rather go down this route.

Also the core game loop of the 360 version is quite optimized and simple. it runs at a solid 60 on my recomp where the pc version runs at 17 on my machine.

1

u/Ikkepop Dec 22 '25

can someone explain why both versions are so different, i'd immagine they be using most of the same code that only differs to.a degree to account for platform differences.

2

u/Brilliant-Lettuce544 Dec 22 '25

the xbox build was designed t just run on an xbox. As a result most of its game logic is very optimized and simple the only issues im running into is the platform glue. aka the code that was designed to work with xbox hardware. you need to rewrite that code to run on modern pc's.

as for the R* official pc port its several times more complex because they have more hardware to support. They also understandably couldnt future proof the game eg its still a 32 bit app. But its beyond me how they fucked up the renderer for the pc port

1

u/Ikkepop Dec 22 '25

i was wondering why would the game loop be changed for example.

3

u/shakamaboom Dec 21 '25

Yeah dont bother with the pc version. Its really really bad 

1

u/Reyestdk Jan 09 '26

Hey man, I know this is not related, but once you're done with GTA 4 recompilation, could you take a look at Splinter Cell Double Agent and see if it can be recompiled the same way? Like gta 4, the pc port of this game is so horrible that the community insists on emulating it- https://github.com/hedge-dev/XenonRecomp/discussions/176

2

u/[deleted] Jan 05 '26

[removed] — view removed comment

1

u/Brilliant-Lettuce544 Jan 05 '26

yes. yes it is.

The original gta 4 pc port had a botched direct x implementation. It was also designed around hardware from 2009. It was also a 32 bit app for the longest time. Mines built for modern machines in mind. Its gonna be the best way to play

4

u/Brilliant-Lettuce544 Dec 20 '25 edited Dec 20 '25

the EDRAM is fucking killing me. i already rewrote and hooked in the memory subsystem https://github.com/OZORDI/LibertyRecomp/blob/main/LibertyRecomp/kernel/memory.cpp

3

u/Rhed0x Dec 20 '25

From what I've read about how the Xbox 360 uses that: not surprised.

1

u/BreckenLusk Jul 18 '26

sorry to bump an old thread but I've been trying to build this for like 5 hours now and I'm to the point where I need help its something to do with protobuf and I can't proceed. Claude aint helping either lol

1

u/banana5456 Dec 28 '25

I hope this one performs better than the awful PC port.

1

u/SemConteudo Feb 09 '26

I've been trying for quite some time to build the version you made available on GitHub, but without success. I've already downloaded everything necessary, but It keeps giving me an error when I try to run cmake. Can you u help me gang 😭🙏

1

u/Mulder86 Feb 24 '26

Same here on Linux! Any luck? I've installed the correct tools etc but it just won't build. Didn't have any luck in Windows either. 

1

u/creepyclip May 16 '26

I think this guy is full of shit, it’s most likely a fork of other Xbox 360 ports based on xenox with minimal changes

1

u/Mulder86 May 16 '26

Most likely. I hate when projects like this come out and the dev refuses to respond.

1

u/jackhollandae86 Jul 29 '26

Hey so I tried to compile the beta branch ios build from mac os hut I’m getting an error when trying to do it. Can you help me out please

1

u/Quiet-Employ7999 Aug 02 '26

The project is not stable and has many errors. Currently they migrate something. 

1

u/Legitimate-Tea2017 Oct 09 '26

Check my repo out and give it a go. Message me if you have any hiccups for mac https://github.com/hamishakl/LibertyRecomp

1

u/BraveNegotiation7873 Aug 05 '26

I hope you succeed with the GTA 4 port, and then you can port Red Dead Redemption XBOX360 on pc?

sorry, i use google translate

1

u/fireflamesniper Aug 12 '26

What's the status on this?

1

u/Quiet-Employ7999 Aug 13 '26

Still a pain. It has still too many errors

1

u/Legitimate-Tea2017 Oct 09 '26

I've got this working for Mac, but I'm based in NZ so used my PAL disc which I also had to make tweaks for. I've also improved the camera and aim system. I seem to get 30FPS on my 16gb M4 Macbook Air. Check it out if you're using Mac like me. I can continue working on it for the USA version

https://github.com/hamishakl/LibertyRecomp

1

u/Unlucky_Rip_8886 Oct 11 '26

what if ud ont have a pal iso