Claims to work (GUI 'OK' box appears) but no games appear in GameFiles
Closed this issue · 7 comments
This is the traceback
Traceback (most recent call last): File "/home/mikec/HeroicBashLauncher/HeroicBashLauncher.py", line 353, in <module> launchfile(game) # Call the main function File "/home/mikec/HeroicBashLauncher/HeroicBashLauncher.py", line 93, in launchfile if game[gamename]["autoSyncSaves"] == True: KeyError: 'autoSyncSaves'
Well that's strange. This error means it can't find the autoSyncSaves key.
Does your game(s) support Cloud Save Sync?
I may have found the solution. Would you mind implementing it by yourself?
You just need to delete the code from line 92 to 105 in HeroicBashLauncher.py.
Then add the following code right under the ifpresent function that should be around line 188.
#Auto-Cloud Save Sync
if ifpresent("autoSyncSaves") == True:
if game[gamename]["autoSyncSaves"] == True:
#print("Auto_Sync True") Delete this
if game[gamename]["savesPath"] == "":
cloudsync = ""
else:
cloudsync = heroic + 'sync-saves --save-path "' + game[gamename]["savesPath"] + '" ' + gamename + ' -y '
else:
cloudsync = ""
Let me know if this works.
Here is the next traceback that shows up
Traceback (most recent call last): File "/opt/mikec/HeroicBashLauncher/HeroicBashLauncher.py", line 353, in <module> launchfile(game) # Call the main function File "/opt/mikec/HeroicBashLauncher/HeroicBashLauncher.py", line 113, in launchfile if game[gamename]["enableFSR"] == True: KeyError: 'enableFSR'
I'll cut out some of the work for you on this one, I have already got it working on my machine (although with a solution that is quite a bit uglier that what you will likely do). What seems to be happening is that for every key, if that key doesn't exist then it crashes. What I did to fix it was just run down the line, setting the variable before the if statement (ex: cloudsync = "" before the if/else block), and the wrapping the if block in a try statement and replacing the else block with an except KeyError: pass. Now my guess on what you would need to do to fix the underlying problem is check that each key exists before settings it. How you go about doing that is up to you, but here is my modified version of the script in case it gives you anymore insight.
HeroicBashLauncher.txt (Its a txt because Github won't let me upload it as a .py)
The exception handling used here looks to be quite helpful.
I don't know whether this has anything to do with Heroic Games Launcher, but I think those parameters with a toggle don't get included in the .json file of the game unless you enable them. My program actually reads from each game's .json file.
Can you verify this? Just open any game's .json (in the .config/heroic/GamesConfig folder). Check if all the parameters listed in the code (those under CONFIGURING BOOLEAN PARAMETERS and CONFIGURING OTHER PARAMETERS ) and compare them with those present in the .json file.
In my case, all of the parameters are listed in the code are included in all of the games' .json file.
Based on the assumption above, can you check if this code works - HeroicBashLauncher_Changes.txt
I've used a simple and straightforward approach here. This applies to all keys (parameters) functions.
So I've set the variable like enableFSR before the if statement just like you did. Then the key is checked if it exists.
If it does not, it means the user hasn't enabled the parameter in the setting (The game's setting in Heroic Games Launcher). If it exists, well, it means the user has enabled it and will be included in the launch file.
How does this sound?
That worked perfectly! I can also verify that your assumption was sort of true. Some games have (for example) the FSR key yet its set to false, while others do not have it at all. I assume the same could be the case for any other key
I guess we're done then. I'll make the necessary changes. Thanks!
Closing the issue.