DavidoTek / ProtonUp-Qt

Install and manage GE-Proton, Luxtorpeda & more for Steam and Wine-GE & more for Lutris with this graphical user interface.
https://davidotek.github.io/protonup-qt
GNU General Public License v3.0
1.22k stars 40 forks source link

The "Show game list" button does nothing #202

Closed theskyover closed 1 year ago

theskyover commented 1 year ago

Please fill out following when reporting a new bug:

Describe the bug
Clicking the "Show game list" button in the main menu does nothing, and produces an error in the command line.

Desktop (please complete the following information):

Additional context
I am working with a fresh install of Nobara. Steam is not flatpak-based, nor is ProtonUp-Qt.

Terminal output
This is the terminal output upon clicking the button:

qt.pysideplugin: No instance of QPyDesignerCustomWidgetCollection was found.
Error: Could not get a list of all Steam apps: 'NoneType' object has no attribute 'get'
Error: Could not get a list of all Steam apps: 'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/usr/lib64/python3.11/site-packages/pupgui2/pupgui2.py", line 288, in btn_show_game_list_clicked
    gl_dialog = PupguiGameListDialog(install_directory(), self.ui)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/site-packages/pupgui2/pupgui2gamelistdialog.py", line 34, in __init__
    self.setup_ui()
  File "/usr/lib64/python3.11/site-packages/pupgui2/pupgui2gamelistdialog.py", line 47, in setup_ui
    self.update_game_list_steam()
  File "/usr/lib64/python3.11/site-packages/pupgui2/pupgui2gamelistdialog.py", line 68, in update_game_list_steam
    for t in get_steam_ctool_list(steam_config_folder=self.install_loc.get('vdf_dir')):
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/site-packages/pupgui2/steamutil.py", line 88, in get_steam_ctool_list
    ctool_map = _get_steam_ctool_info(steam_config_folder)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/site-packages/pupgui2/steamutil.py", line 144, in _get_steam_ctool_info
    for t in compat_tools:
TypeError: 'NoneType' object is not iterable
sonic2kk commented 1 year ago

tl;dr - After investigation this seems to happen when the ~/.local/share/Steam/appcache/appinfo.vdf file is blank or when it does not exist, but only on 2.7.7. I can reproduce with Flatpak 2.7.7 and from source when checking out the 2.7.7 release commit (dbb21d3dfe6a57ddbd9370d70ff9c731023b3bee) if I rename/move my appinfo.vdf file with Steam closed, and then open ProtonUp-Qt. I cannot reproduce on master, the games list dialog is just empty (and all compat tools show up as unused ofc).

It seems to have been fixed following #171 (d3dfd1f5746c5f49408f06015162e52094f1ac93) as the error does not happen for me when checking out that commit, but does occur when checking out the commit prior (60c0048987b81b3d6cf23f671c2e5ac5673eb306).

So this should be fixed in the next release it seems.


2.7.6 doesn't seem like its the latest version, I believe 2.7.7 is the latest. There was a fix for the steam library in 2.7.7 (added in https://github.com/DavidoTek/ProtonUp-Qt/commit/b3afaac4a4108ff46c11fe48a628e2e4a64cf048) I believe, which could explain the issue you're seeing here.

If you were using the Flatpak I'm not sure how it was out of date though. Not seeing the error myself.

The initial error seems to be coming from the steamutil.get_steam_app_list helper method. It has a try/except block when it tries to parse libraryfolders.vdf and config.vdf (internal Steam files). It is possible that somehow these files do not exist, which would mean that it's falling over when ProtonUp-Qt tries to get data from them.

I tried removing these two files and ProtonUp-Qt fell over right away because they didn't exist (shouldn't happen with a proper Steam install). I tried emptying these files each, and then emptying both of them, and ProtonUp-Qt just showed a blank dialog. In the case of both files existing but being blank, I also got the Error: Could not get a list of all Steam apps: 'NoneType' object is not iterable error. Maybe we can put aside the first error then as it seems relatively harmless(?).


Next I'll turn my attention to the steamutil#_get_steam_ctool_info function. This tries to get a map for all compat tools used by Steam. By default this compat_tools is None, but it tries to get the compat tools using a for loop:

    try:
        with open(appinfo_file, 'rb') as f:
            header, apps = parse_appinfo(f)
            for steam_app in apps:
                if steam_app.get('appid') == 891390:
                    compat_tools = steam_app.get('data').get('appinfo').get('extended').get('compat_tools')
                    break
    except:
        pass
    finally:
        for t in compat_tools:
            ctool_map[compat_tools.get(t).get('appid')] = {'name': t, 'from_oslist': compat_tools.get(t).get('from_oslist')}

So perhaps compat_tools is never being set to anything other than None. I don't think this should ever happen. It would mean the steam_app.get('appid') == 891390 condition is never true.

Just out of curiosity, have you launched Steam and installed any games that use any compatibility tools? Maybe that's the issue here?

Looking at SteamDB, that AppID appears to represent some various game configs that automatically apply workarounds to various games in order to improve support? For example I can see this as an entry in the parsed steam_app coming back from the VDF parser: '3590': {'appid': 3590, 'config': 'cmdlineappend:-changedir', 'comment': 'Plants vs. Zombies GOTY Edition' - This -changedir is a known workaround needed for various PopCap games, I remember having to set this to play various g ames including Plants vs. Zombies.

I don't know why this data wouldn't exist. Can you check if you have an AppInfo file at ~/.local/share/Steam/appcache/appinfo.vdf and that it is a reasonable size (i.e. not empty, a few MBs probably).

With an empty appinfo.vdf file I can reproduce the error on Flatpak and going back to the 2.7.7 release commit from source (dbb21d3dfe6a57ddbd9370d70ff9c731023b3bee) but not from the latest master (643d611b23e284449f4fddf3de12a6aab25f3065).

Traceback (most recent call last):
  File "/app/lib/python3.10/site-packages/pupgui2/pupgui2.py", line 304, in btn_show_game_list_clicked
    gl_dialog = PupguiGameListDialog(install_directory(), self.ui)
  File "/app/lib/python3.10/site-packages/pupgui2/pupgui2gamelistdialog.py", line 34, in __init__
    self.setup_ui()
  File "/app/lib/python3.10/site-packages/pupgui2/pupgui2gamelistdialog.py", line 48, in setup_ui
    self.update_game_list_steam()
  File "/app/lib/python3.10/site-packages/pupgui2/pupgui2gamelistdialog.py", line 70, in update_game_list_steam
    ctools.extend(t.ctool_name for t in get_steam_ctool_list(steam_config_folder=self.install_loc.get('vdf_dir')))
  File "/app/lib/python3.10/site-packages/pupgui2/steamutil.py", line 85, in get_steam_ctool_list
    ctool_map = _get_steam_ctool_info(steam_config_folder)
  File "/app/lib/python3.10/site-packages/pupgui2/steamutil.py", line 140, in _get_steam_ctool_info
    for t in compat_tools:
TypeError: 'NoneType' object is not iterable
theskyover commented 1 year ago

Hey, thanks for answering. You were completely correct prior to your edit. As per the initial post, I did not have ProtonUp-Qt installed as a flatpak, I had it installed via dnf. It seems the problem is that the Nobara repository does not have the lastest version of ProtonUp-Qt. The latest version listed in the repo is indeed 2.7.6. Not sure why... I'll raise an issue over on the Nobara gitlab, I suppose.

For your curiousity, my appinfo.vdf does exist, and is 3.5 MB.

I can install the flatpak, and the flatpak is 2.7.7... but the games list is totally empty.

sonic2kk commented 1 year ago

That's strange for sure that the package is out of date, but good to know that's why the version was behind.

With the Flatpak, can you run it from the terminal and see if it outputs any errors? net.davidotek.pupgui2 should be the command to run the Flatpak. Since the games list is opening I would suspect there would be an error more along the lines of what you saw before opening the games list in the initial output you posted:

Error: Could not get a list of all Steam apps: 'NoneType' object has no attribute 'get'

From what I recall earlier I was able to reproduce that error when my libraryfolders.vdf and config.vdf files were blank (ProtonUp-Qt didn't work at all when they weren't present, so it only happened when they are empty at least in my tests).

But that's just speculation. If you get any errors coming back in the terminal we can take it from there :-)

theskyover commented 1 year ago

Sure! Here's the stdout upon opening the flatpak version:

ProtonUp-Qt 2.7.6 by DavidoTek. Build Info: built from source.
Python 3.11.2 (main, Feb  8 2023, 00:00:00) [GCC 12.2.1 20221121 (Red Hat 12.2.1-4)], PySide 6.4.2
Platform: Linux-6.1.14-201.fsync.fc37.x86_64-x86_64-with-glibc2.36
Loading locale en / en_US
Loaded ctmod GE-Proton
Loaded ctmod Wine-GE
Loaded ctmod Boxtron
Loaded ctmod Kron4ek Wine-Builds Vanilla
Loaded ctmod Lutris-Wine
Loaded ctmod Luxtorpeda
Loaded ctmod Proton Tkg
Loaded ctmod Roberta
cat: /etc/lsb-release: No such file or directory
Loaded ctmod SteamTinkerLaunch
cat: /etc/lsb-release: No such file or directory
Loaded ctmod SteamTinkerLaunch-git
Loaded ctmod DXVK
Loaded ctmod DXVK Async
Loaded ctmod DXVK (nightly)
qt.pysideplugin: Environment variable PYSIDE_DESIGNER_PLUGINS is not set, bailing out.
qt.pysideplugin: No instance of QPyDesignerCustomWidgetCollection was found.
Gamepad error: No gamepad found.

And I was going to paste the stdout upon successfully opening the games list, but (I noticed at the time of writing) now the flatpak version seems to no longer do that. It is now just doing nothing, like with the dnf version, and this is appearing in stdout instead:

qt.pysideplugin: No instance of QPyDesignerCustomWidgetCollection was found.
Traceback (most recent call last):
  File "/usr/lib64/python3.11/site-packages/pupgui2/pupgui2.py", line 288, in btn_show_game_list_clicked
    gl_dialog = PupguiGameListDialog(install_directory(), self.ui)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/site-packages/pupgui2/pupgui2gamelistdialog.py", line 34, in __init__
    self.setup_ui()
  File "/usr/lib64/python3.11/site-packages/pupgui2/pupgui2gamelistdialog.py", line 47, in setup_ui
    self.update_game_list_steam()
  File "/usr/lib64/python3.11/site-packages/pupgui2/pupgui2gamelistdialog.py", line 68, in update_game_list_steam
    for t in get_steam_ctool_list(steam_config_folder=self.install_loc.get('vdf_dir')):
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/site-packages/pupgui2/steamutil.py", line 88, in get_steam_ctool_list
    ctool_map = _get_steam_ctool_info(steam_config_folder)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/site-packages/pupgui2/steamutil.py", line 144, in _get_steam_ctool_info
    for t in compat_tools:
TypeError: 'NoneType' object is not iterable
sonic2kk commented 1 year ago

Thanks for testing that, I guess this is the same issue across 2.7.6 and 2.7.7. I'm not sure why it's affecting you since your appinfo seems like it exists and has data.

I think the crash is probably fixed on main following https://github.com/DavidoTek/ProtonUp-Qt/commit/d3dfd1f5746c5f49408f06015162e52094f1ac93, but it is possible that your games list would just appear empty, which is not ideal behaviour either 😅

It's possible to inspect the VDF file using the Python vdf library, but I'm not at my PC right now and don't remember what to put in off the top of my head exactly. As a compromise it would be interesting if you're able to run ProtonUp-Qt from git. If you have Python installed, you can clone the repo and install the pip dependencies from the cloned repo with pip install -r requirements.txt and then running python3 -m pupgui2. That's a lot to ask though so no worries if you don't want to :-)

DavidoTek commented 1 year ago

For your curiousity, my appinfo.vdf does exist, and is 3.5 MB.

Have you tried deleting the file and letting Steam re-create it (restart Steam and maybe install a game) @OneBlueGlove? It is possible that there is a problem with the file, so either corrupted or app id 891390 is missing


Thanks for looking that up, sonic2kk.

steamutil#_get_steam_ctool_info

I will modify the try-except to show an error message and also change the default value of compat_tools as the finally statement should ideally not crash if an exception occurs :smile:

Looking at SteamDB, that AppID appears to represent some various game configs that automatically apply workarounds to various games in order to improve support?

App id 891390 contains information about the individual Steam compatibility tools (e.g. from_oslist is the os the game is supposed to run on)

theskyover commented 1 year ago

Well, after coming back to my workstation after a couple hours, my flatpak of protonup-qt now just shows the game list. I'm not sure how and I'm not sure what I changed to cause that, but it seems to be perfectly functional now. I feel like a moron not having found exactly the problem at hand, but I'm glad that my issue has led to someone who is much better than me at programming to do something about the issue I was having before, so thanks for that!

P.S. I noticed that the nobara-baseos repo in the menu for selecting different versions of the same app in the GNOME Software manager has a url going to copr (See image attached). Does this imply that the 1-version-behind is because the upstream copr repo is also one version behind? Either way, here's the gitlab issue I raised concerning the version.

screenshot

DavidoTek commented 1 year ago

Great. Probably was caused by a corrupted file then that got re-created after restarting team.

P.S. I noticed that the nobara-baseos repo in the menu for selecting different versions of the same app in the GNOME Software manager has a url going to copr (See image attached).

I recommend using the Flathub version as it is officially tested and always the latest release.