"Demicrosoftizing" FiveM

Optional Introduction

I have a sort of love-hate relationship with FiveM platform…

This project’s goals and how it empowers customization and freedom in modifying GTA V is very appealing to me, but I really detest Microsoft products’ enormous complexity, bulkiness and freedom-constricting, anti-consumer licenses.

I can’t stand such amazing project being so tightly coupled with something so loathsome. It is another of those things in the world that cause me a great deal of mental anguish. (hey, surprise surprise, my username has real meaning)

I’ve read authoritative posts and participated in some discussions on these forums, some felt really good to be a part of, some gave me hope, some slightly demoralized and some completely crushed me to the point I just wanted to quit forever and forget this platform exists.

But no matter how hard I tried to forget and move on, I came back, because this post:

is just like a splinter in my mind, driving me mad…

Actually, it has driven me to starting exploration of FiveM’s source and figuring out if I can maybe try to do what I care about myself…

Ideally, the end goal for me is to try and remove/replace all Microsoft-specific cruft in the codebase (powershell, cmd/bat, Visual Studio, windows-specific headers, maybe .net/cs too), then compile (with gcc or llvm), run and debug FiveM client on Linux

NOTE: This will probably take crazy long time (if ever) to be completed, but what I’m getting from reading these forums is that this kind of port is very much possible, but very low priority for the FiveM team at best and never going to happen at worst.

Since FiveM team refused to make this easier for me (if curious, see ‘completely crushed’ link in the introduction above), I have to start from scratch, that is, by trying to understand Windows client build process.

So far, I’ve partially converted fxd utility (the fxd gen command to try and generate unix makefiles instead of VS project) into bash scripts, but I’ve run into a bit of a snag:

“What do I do about seemingly Windows-specific (but not really?) dependecies like minhook?”

Since a native (ELF executable) build of GTA V does not (and probably will not ever) exist, some form of loading PE format is going to be mandatory and I think some mechanism that allows hooking Windows functions is going to be mandatory as well (minhook?).

I’ve noticed that launcher/bootstrapper is very heavily “microsoftized” and will probably require a full rewrite, so I’m guessing this is not the best part to start porting from and (unfortunately) it’s the first thing that “goes off” when going top-to-bottom through the build process.

Perhaps someone has an idea or knows how to (done it before?) isolate just the ‘game’ (RAGE engine) part (part that executes when you successfully run a connect command from client console) from the rest of the FiveM client?

I’d appreciate any input/interest/help in exploring this.

2 Likes

Sigh. I’ll try to write a reply while ignoring some of the ideological concerns raised in this post since that leads nowhere: functional goal of running on non-Win32/desktop platforms should be irrespective of ‘using any MSFT tech’.

Anyway, first to head for a misconception here:

There’s no different ‘part that executes when you run a connect command’. The game is initialized the moment ExecutableLoader invokes the game entry point, which is after all the early bootstrap/update work.

The main menu is rendered using game code and the game is already long initialized by then.

Odd assumption, a lot of the code here can be #if 0'd as it’s not important for initializing execution, the other parts are relatively trivial to get to work as seen in the Android port of CitiLaunch.

ExecutableLoader already does this and can be trivially made to either use mmap, be wrapped in the Rotor PAL, or have some ‘independent’ platform abstraction library used (I couldn’t find any).

‘Hooking’ is an odd claim here, Clang/LLVM have support for attribute((ms_abi)) which gets you 99% of the way for a compatible calling convention from game code on x86-64.

Any other part can again be trivially done with a generic PAL (or even Microsoft’s own, which works fine, albeit seems to mismatch in whatever ideological perspective here).

A lot of this makes no sense when you start to think of a functional goal: .NET/C# stuff is required to remain for functional compatibility with servers and already works on non-Windows platforms, PowerShell is cross-platform ever since .NET is, removing ‘Windows-specific headers’ would make for something not working on Windows at all, and ‘cmd/bat’ is also going to make your fork entirely useless on Windows and also lead to an entirely different functional goal.

Curious choice of starting point, especially as a) it only wraps a few lines of manual command and b) it’d be perfectly viable to make these helpers work on PSCore, even if it’s not very necessary for initial functional portability.


If you want a porting effort to succeed, it’s a good start to try to hit one goal at a time, and that wouldn’t be the ideological concerns: rather trying to get ExecutableLoader or similar working without any components loaded, so the game itself can run in a compatibility layer of whatever sorts (whether it be Winelib, Rotor, a custom layer, or whatnot), and then slowly porting the usual dependency tree of game-dependent components upwards (rage:allocator, rage:device, rage:graphics, etc.).

As before, there’s no ‘FiveM client itself’ that runs ‘independently’ from the game, it forms an integrated whole after the game is ‘consumed’ by the launching logic, so running the game is generally a starting point.

5 Likes

What I meant by removing/replacing was actually adding native, functional equivalents so MSFT tech (like Powershell) does not have to be installed.

Ideally, I’d see platform-agnostic project definition (which seems to be there already in form of premake) and a separate set of build scripts (for every supported platform) written in whatever shell scripting language is native to that platform (sh/bash for Linux, batch/PS for Windows) that makes use of that definition to generate project files for a toolchain native to that platform (unix makefiles for Linux, VS solution/MSBuild for Windows).

This is a massive project developed over several years. For anyone who did not take part in it’s development and does not know it inside out (or almost at all for that matter), the only logical course of action would be to start “at the beginning” and that’s where the entry point seems to be.

As seen is a rather unfortunate choice of words here, since I have asked to see and was denied.

It is somewhat difficult for me to discern which parts aren’t important and can be safely #if 0'd without immediate replacement and which can’t.

Now this is definitely very useful, clear and actionable advice. Thank you.

Is this just an ideological goal because you hate Microsoft? I really don’t see why this would be a goal of anyone. .net is the kind of fundamental to the whole system in the form of managed++ and c# but it runs everywhere so what is the benefit of getting “demicrosoftizing”?

It’s not purely ideological goal as it has practical benefit of giving people freedom of choice in what software they want to use with the platform. Currently no such freedom exists (at least for the client side), it boils down to: “Want to run FiveM? You have to use Microsoft Windows.”

I do personally harbor a deep hatred towards Microsoft for what they are doing and done for decades, but that is besides the point and I don’t want to discuss that here as this discussion “leads nowhere”.

I am not a crusader and don’t want to “convert” anyone. I think that trying to forcibly free someone from “The Matrix” is wrong too, because you can’t really be sure if they wanted it to happen in the first place and there is no truly going back. Let’s just not talk about this anymore here.

.NET is not really important to get decoupled from and probably it’s not practical to do so either, as it does run across multiple platforms and has free (as in freedom) implementations available.

It could be a performance gain if all the components were natively compiled for every supported platform with nothing managed or virtualized, but from a practial standpoint the extra effort needed in order for that to happen would not be worth it.

Decoupling FiveM from software like Microsoft Windows (for client runtime) or Microsoft Visual Studio (for development and debugging) is, in my opinion, critical. It is always better (and more practical) to be flexible and have more options. As it stands now, FiveM users really have only one option.

Oh yeah I guess the game client is a different thing. I was thinking about fxserver.

You’re mistaking the current Microsoft for the harbinger it was under the reign of Bill Gates. Whilst they’re still a juggernaut they actually do great things for the development community in the broader sense. I just don’t see what there is to hate about them anymore.

I’m not sure why FiveM should be a candidate for separating from windows exclusively.
Most games target one platform and given GTA is windows only then it’s kind of a moot point really. Why bother?

I don’t want to talk about Microsoft, but I would be wary about anything they do even if it seems like a benevolent act of good will on the surface. They did not reach their power and status by being honest, good or pure.

You should always keep in mind that it can be another attempt of using Embrace, extend and extinguish.

FiveM project has something that has drawn me to it, for a lack of better words, I’ll call it some “element of greater good”. It empowers user’s freedom in customization and creativity. I feel like FiveM project’s goals are very much compatible and in line with free software goals which I also feel greatly drawn to for what I think is the same “element”.

Irrespective of whether it’s Windows or anything else, exclusivity leads to monopoly and is usually very bad for the end-user in the long term. Nobody should have total, utter and absolute control. It is dangerous.

FiveM platform in itself is a very good example. Try comparing it to other platforms that attempt to do similar thing, you will almost immediately see that opening their source, allowing community to contribute and having a freedom-respecting license enabled FiveM to grow much faster and offer more and better features in less time.

I’d say this makes FiveM one of the PRIME candidates for separation from Windows.

Most games target that one platform (the biggest one), because of purely materialistic reason of cost-effectiveness. This in turn makes it harder for people playing games to think about switching platforms (even with something as invasive in play as ‘forced updates’ that were present in Windows 10 not that long ago). It’s a vicious cycle.

Modding frameworks like FiveM are free of this kind of constraints, because they don’t do what they do for profit.

“Why bother?” is exactly the wrong attitude and the reason this vicious cycle continues for such a long time.

Please, stop asking about this. You are risking getting this thread closed and stopping anyone able from contributing valuable information which could make this effort easier. :cold_sweat:

2 Likes

A very interesting thread, I wish more non windows users would see this and participate.

I don’t know how FiveM works under the hood (I just understand that it’s requiring MS libs), I don’t really know where to start and seems to be very confusing

And yes, let’s not make this an ideology thread about anti-windows/FSF… People just want to be able to play and mod FiveM on their OS without having to dual boot.
Software can be upgraded/changed later in time after every user is able to enjoy FiveM