How to get game tracking V0.1
online members
There are no members online
 
How to get game tracking V0.1
KenaiPhoenix @ 2026-06-17 00:50:40
This new is about how to get gametracking on Linux for Xf1re.

As you are probably aware, at the time of writing this even making Xf1re run on Linux can be a headache. For this guide I will use Bottles (with flatseal to make it work system wide) with Proton GE 10.38.

Me advice, this guide is a really crude form of a proper solution is mostly how to set the start of the time tracking as easy as possible. Im not a program my self, so besides copying and pasty it should be absolutely doable to anyone to be honest

To archive this, we will use a 'dummie window' program that will share the expected .exe name that Xf1re is waiting and this way it will easy track the time. If using Bottles, you can add the 'shortcut' to easy start this dummie and by just closing the window you stop the timer. Not really fancy, but it works perfectly. Now to the code.

Create a folder anywhere (be sure to have flatseal let Bottles have access to the .exes) and create a simple empty file 'main.cpp'. In it you will paste the following code:

---------------CODE TO COPY--------------------------

#include <windows.h>

LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch (uMsg) {
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
const char CLASS_NAME[] = "BF1942Class";//<----EDIT CLASS

WNDCLASS wc = {0};
wc.lpfnWndProc = WindowProc;
wc.hInstance = hInstance;
wc.lpszClassName = CLASS_NAME;

RegisterClass(&wc);

HWND hwnd = CreateWindowEx(
0,
CLASS_NAME,
"BF1942",// <---------------------EDIT WINDOW NAME
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 300, 200,
NULL,
NULL,
hInstance,
NULL
);

if (hwnd == NULL) return 0;

ShowWindow(hwnd, nCmdShow);

MSG msg = {0};
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}

return 0;
}

---------------END OF CODE TO COPY --------------------------

I already marked it but there are just 2 lines to edit (it should be number 13 and number 25). These is the CLASS_NAME and the name of the window.

This is the only part where you need to dig a little, search for the proper executable name and update the copied text. In this case, this was made for Battlefield 1942, but if I wanted to addapt this to, lets say StarCraft, I would only need to change:

- The class name to "StarCraftClass" (number 13)
- The window name to "StarCraft" (number 25)

Save and you are done!

Now for this case we will need a compiler, we will need a compiler for the exe, since we are on Linux, we shouldnt have one. So go get "mingw-w64-gcc", it should be really easily available on all distros.

If you are on Arch (like me btw), just run:

sudo pacman -S mingw-w64-gcc

And you should be done.

Once you are all ready up. Open a terminal on the folder (alt + shift + F4, on KDE) and build the .exe like this:

$ x86_64-w64-mingw32-gcc main.cpp -o BF1942.exe -mwindows

The only part that you need to modify is the .exe. Following my example, for StarCraft I would just need to run:

$ x86_64-w64-mingw32-gcc main.cpp -o StarCraft.exe -mwindows

Pretty easy, it shouldnt take more than a couple of seconds.


Now for the final part of this trick: deceive Xf1re into registering our game time:

For this just open Xf1re, go to Tools > Options. On this new window go to 'Games', it shouldnt detect anything, no expand the 'Not Installed' and search for the game that you want to track. Then just change 'Automatically detect' to 'Manual', then click Browse, and pick the dummie exe we just created. It doesnt need to be inside your prefix, but you need to set flatseal on bottles to let the software had access to it.

Now, for a more easy way to use this, I would open Bottles, then prefix/bottle of Xf1re and then "Add shortcuts..." to select the dummie .exe we just create. You can then easily start them from there, be aware sometimes Proton like to troll you so it wont launch at first time, so just click 'play' again. If you are not using Bottles, remember to launch the dummie exe IN THE SAME PREFIX so Xf1re can see it.

And thats pretty much it: Once Xf1re is open, just hit 'play' or launch the dummie exe, and it will start to register your game time. Close it anytime to stop tracking.


SHORTCOMINGS:

This is even less than a bandit. I searched for days for other alternatives or how to make Xf1re work in a more open way and didnt succeed (Im not switching to windows tho). So this is just a really simple idea I got on the supermarket and it actually worked. Regardless it is not the best way, having to start or end a program is not the best way.

Other shortcoming is that, since you are not targeting the actual .exe anything that Xfire should do with it wont work. On the plus side it is actually nothing what you lost: XIG (Xfire in game) doesnt work, and Xfire cant launch games either on Linux, but you can still see the server lists.

TO DO:

Make this more than a proof of concept: maybe a bigger program to make it run these exes when the game opens, or register dummie process inside the prefix imitating the opened game. The way ahead has its endless possibilities, and I know more smart people will plan better ways.

As for the time being, Im happy I can just stop smashing my head against the keyboard to get game tracking working, without too overcomplicated ways to do it. Just 3 or 4 clicks.
Comments

No comments yet. Be the first to comment!

 

Members

1

Online

0

Playing Games

0
Games played
This cult doesn't have any favorite games yet
Events
August 2026
S M T W T F S
           
         
No upcoming events.
Servers
Latest Forum Posts
This cult has no forum posts.