kulvind3r / GamingGaiden

Gameplay Time Tracker for PC and Emulator games
GNU Affero General Public License v3.0
85 stars 3 forks source link

[feature] Allow games to have more than one .exe file #22

Open analogued opened 1 week ago

analogued commented 1 week ago

It would be useful to be able to define more than one executable per game for two reasons: 1) Some games (possibly very few, but still) can be launched in more than one way. Slay the Spire, for example, has a SlayTheSpire.exe executable in the game directory that can be used to launch the game. I configured that for tracking in GamingGaiden but it was not registering the game. It seems that is because it is not how Steam launches the game. The game is written in a framework that uses Java, so Steam launches it by running javaw.exe from the ./jre/bin/ subdirectory with a bunch of parameters. After changing the executable, it was tracked correctly. However, now I can't launch it via SlayTheSpire.exe if I choose to do so.

2) I have some games in more than one launcher (Steam, Gog or Epic Games). If I choose to play the game from a different launcher, for whatever reason, I would be able to track it under the same game entry, without having to constantly change the .exe location in the app.

kulvind3r commented 1 week ago

Thanks for bringing this to attention...

  1. This is very interesting.. i have finished over 108 games since last 2-3 years and never encountered such a case. But i have Slay the Spire in my steam library as well, i am planning to get to it at some point in time. So when i pick it up i will look into implementing this feature. I am currently playing Poly Bridge 2 , but i can pick up Slay the Spire as my next game.

However, game exe is the unique attribute that distinctly identifies two separate PC Games. if multiple games use Javaw.exe e.g. Minecraft could be another one, then it will become an issue, program will fail to differentiate between which game to add the recorded time to.

I would have to think of some clean way to implement this without breaking things, might not be done very soon. So please don't hold your breath.... but i will implement this feature, if i can figure out a good way to do so.

p.s. can you try the following and report back?

if you launch the game using SlayTheSpire.exe , the Javaw.exe process should be launched by it... and game should start. Once the game starts, can you open taskmanager and check if SlayTheSpire.exe is still running? because if it is running and only shuts down after the game is closed, then Gaiden should be able to track the time correctly using SlayTheSpire.exe. Let me know.

  1. On the multiple launchers, as long as the name of the final exe that runs is the same since all launchers are installing basically the same game, then no matter which launcher you launch the game from finally exe will be the same and time will be tracked against the same exe. Are the game exes different between different launchers? ( I have not tested the same game across multiple launchers, if i own the same game on Epic and Steam / GOG, i just play on one of them )

Let me know for both.

I understand that solution for both is to just allow multiple exes for a single game, but as of now if two games have the same exe (java exe in minecraft and slay the spire) time cannot be tracked and program will not allow you to have the same exe registered against different games. So the feature will have to be thought through carefully before implementing.

analogued commented 1 week ago

Point 1

However, game exe is the unique attribute that distinctly identifies two separate PC Games. if multiple games use Javaw.exe e.g. Minecraft could be another one, then it will become an issue, program will fail to differentiate between which game to add the recorded time to.

I thought that GamingGaiden made the distinction based on the whole path of the executable. If it only uses the executable name, then that would indeed be a problem. Other similar cases that come to mind would be games that use ScummVM or DosBox for example, or other such engines/interpreters

If I launch the game using SlayTheSpire.exe, Javaw.exe does not appear as a process in Task Manager and GamingGaiden does not detect it (it remains blue). SlayTheSpire exe

If I launch the game using Steam, then Javaw.exe appears as a process and GamingGaiden is able to detect it (orange). Javaw exe

Point 2 I initially suggested this second case as an example because I thought GamingGaiden monitored the whole executable path, not just the name. However, there are still cases where the name of the executable differs between launchers. A couple of examples I managed to find: Game Steam GOG
The Dig The Dig.exe Uses ScummVM[^1]
Amerzone: The Explorer’s Legacy (1999) Amerzone.exe Game.exe[^2]

[^1]: So it's similar to the Java case [^2]: There is also an Amerzone.exe in the game directory which is launched first, but then it seems to relinquish control to Game.exe. I have tried to see what GamingGaiden detects and it detects the Game.exe executable.

I haven't done a very extensive search but I haven't found other examples where the executable name differs between launchers but I'm sure there are at least a few more. However, I found quite a lot of cases where ScummVM or DosBox are used, so we have the same issue as the Java situation above: the same executable name.

kulvind3r commented 6 days ago

Thank you for your extensive research

  1. Gaming Gaiden doesn't use the full path of exe because of the way windows provides the list of currently running processes. It only provides the name of the exe and not the full path. So at first level of detection only thing that gaming gaiden can find is the exe name. To get the full path would require a 2nd step, which should be doable but has not been necessary until now. I will need to check the best way to use exe path as a second level of filtering if duplicate exes are found, It will require changing the structure of the Database. We will have to somehow make sure the existing 2000 users are not affected by the database changes that need to be done for this.

  2. In case of systems where DosBox, ScummVM are used, i think the best option would be to use the emulation tracking feature of Gaming Gaiden. Register Dosbox / ScummVM as the emulators and then identify the game file that is passed to the dosbox /scummvm and use it as a kind of a game rom. But i can't be sure if this will work until i test it.

  3. Regarding Slay the Spire. I think it should be possible to detect it using SlayTheSpire.exe itself as it is appearing in the task manager, it must be appearing in the process list that Gaming Gaiden requests from windows. Allow me some time i will check and report back.

will share an update once i have made some changes.