sharkwouter / minigalaxy

A simple GOG client for Linux
https://sharkwouter.github.io/minigalaxy/
GNU General Public License v3.0
1.1k stars 71 forks source link

Regression: Wine launcher from current master no longer finds the correct executable for some games #532

Open LeXofLeviafan opened 2 years ago

LeXofLeviafan commented 2 years ago

After 571eeb6 and 44510f4 were applied, executables for some of my currently installed games are no longer detected correctly (though I'm pretty sure the changes from 44510f4 didn't really affect anything as it only affects games with no primary tasks… which probably don't actually exist). I believe most of them are some of the older GOG installers, as their tasks don't have a category field; due to which the app no longer can find the main executable, and tries to run whatever (which has no chance of working if the file it should run is in a subfolder… which is always the case for DOSBox/ScummVM games running via Wine). Other games have a launcher as the only primary task, which is rejected by this check and thus fallback logic is employed.

Affected games (in my current install list):

These are also affected but still work due to fallback logic stumbling upon the correct executable (either because it's the only one in game folder or purely by chance):


.info-file for AvP (no category) ```json { "clientId": "47282734206214863", "gameId": "1207665883", "language": "English", "name": "Aliens vs Predator Classic 2000", "playTasks": [ { "isPrimary": true, "name": "Aliens vs Predator Classic 2000", "path": "AvP_Classic.exe", "type": "FileTask" }, { "name": "Language Setup", "path": "language_setup.exe", "type": "FileTask" }, { "link": "http://www.gog.com/support/aliens_versus_predator_classic_2000", "name": "Support", "type": "URLTask" }, { "link": "http://www.gog.com/forum/aliens_versus_predator_classic_2000", "name": "Send multiplayer or launcher feedback", "type": "URLTask" } ], "rootGameId": "1207665883", "version": 1 } ```
.info-file for Hob (launcher as the primary task) Note: in many cases the game entry(-ies) included `"isHidden": true`. ```json { "buildId": "50707556912620595", "clientId": "49842418730375899", "gameId": "1300281766", "language": "English", "languages": [ "en" ], "name": "Hob", "playTasks": [ { "arguments": "skip_file_check", "category": "launcher", "isPrimary": true, "languages": [ "*" ], "name": "Play Hob", "path": "hoblauncher.exe", "type": "FileTask" }, { "arguments": "skip_file_check", "category": "game", "languages": [ "*" ], "name": "Play Hob (no launcher)", "path": "hob.exe", "type": "FileTask" }, { "languages": [ "*" ], "link": "https://support.runicgames.com", "name": "Support", "type": "URLTask" } ], "rootGameId": "1300281766", "version": 1 } ```

Suggested fix (for games without category): either use task.get('category', 'game') in the loop check instead of skipping primary tasks without a category, or do a second run if the first one doesn't find anything.

In case of games that have a launcher as their primary task, you can opt to either detect it as well, or search for games among non-primary tasks (which is different from what was removed in 44510f4 as there are primary tasks in the list but none of them are games).

Also (or instead), there should probably be a task/executable selector, because for instance Diablo is a 2-game pack (with a launcher)… and I'd say being able to pick/set temporarily secondary executables like external video settings tool would be nice as well.

P.S. Incidentally… This: ```python if "playTasks" in info: for task in info["playTasks"]: if "isPrimary" not in task or not task["isPrimary"]: continue … ``` can be simplified like this: ```python primary_tasks = [task for task in info.get('playTasks', []) if task.get('isPrimary')] for task in primary_tasks: … ``` (and the logic removed in 44510f4 would be `for task in primary_tasks or info.get('playTasks', []):`)
sharkwouter commented 2 years ago

Oh wow, thanks for this really detailed bug report. That will help a lot with fixing this issue. I honestly think all playtasks should be shown to the user.