sonic2kk / steamtinkerlaunch

Linux wrapper tool for use with the Steam client for custom launch options and 3rd party programs
GNU General Public License v3.0
2.06k stars 70 forks source link

Fresh Install of EOS - NXM Link Handling Not Working #594

Closed domglusk closed 1 year ago

domglusk commented 1 year ago

Trying to download a collection from Nexus and the nxm protocol doesn't show up, it brings up the kde system thing to ask you to pick an app to use. I used a fresh (flatpak) install of firefox to test. I believe the chaoitc aur version is borked as trying to install vortex from that made an empty vortex folder, so I'm using the aur steamtinkerlaunch-git package.

sonic2kk commented 1 year ago

Currently STL isn't able to add NXM link handling to Firefox Flatpak. If this is possible and you know how to fix this a PR would be appreciated.

Also, Vortex is broken on Linux at the moment. This isn't a SteamTinkerLaunch issue as far as I'm aware.

The vortex folder might be empty because there was a fix just yesterday for downloading MO2 and Vortex. Maybe the Chaotic AUR package is outdated.

I'd love this problem to be fixed but I'm not sure how - This would also fix link handling on Steam Deck!

sonic2kk commented 1 year ago

I might try and make some time to look into this again over the weekend. I'm not totally convinced Firefox Flatpak can do this but I'll find out more soon hopefully :)

sonic2kk commented 1 year ago

Currently investigating and I noticed that STL has a command line option: steamtinkerlauch mo2 url <your_url_here> which opens Nexus URLs with MO2. You could try using that and seeing what output you get

sonic2kk commented 1 year ago

I'm testing so far on my laptop with Arch Linux + KDE Plasma + Stable Firefox Flatpak. I was successfully able to link my Nexus mods account (the Flatpak browser opened no problem), now I just have to test for the NXM links. In the process of installing a game that should support NXM and that will run on my laptop.

frostworx commented 1 year ago

@sonic2kk โค @TheKarion, when opening a new issues there are several notes that the exact version and a log file should be added. $Impressive how many people simply ignore this.

sonic2kk commented 1 year ago

On my laptop: With Non-Flatpak Firefox and Flatpak Firefox I was able to link my Nexus account but I was not able to download any mods using the Mod Manager button on Nexus Mods. In the Firefox application associations list in preferences, both Flatpak and Non-Flatpak were set correctly for nxm but not for nxm-protocol.

On my desktop: I didn't try Flatpak but Non-Flatpak Firefox has link associations set correctly. I think the file associations for both kinds are set correctly there, though.

An obseration: @TheKarion please make sure Firefox Flatpak is your default browser and if it is not, set it (in KDE's "Default Applications" menu), then in MO2's settings Disconnect and Reconnect to Nexus, then try to set the link association again.

After this, restart Firefox and go to about:preferences, scroll until you see "Applications" and see if there is an nxm in the listing, which should point to something with "ModOrganizer 2" in the name.

From looking at STL's code, it looks like MO2 and Vortex links are set using xdg-mime, so there actually shouldn't be a reason that this doesn't work save for a bug on Mozilla's side. But given that I'm also having trouble with Non-Flatpak Firefox now there might be something that's changed with Nexus' side where we have to change how the associations are set? Though that'd be weird, since MO2 hasn't had a version bump in a while...

sonic2kk commented 1 year ago

When passing a Nexus URL to STL from the command line with

Thu Sep 22 16:09:44 BST 2022 SKIP - dlMod2nexurl - Download Url is for game 'https://', which does not have an instance in '/home/user/.config/steamtinkerlaunch/mo2/compatdata/pfx/drive_c/users/steamuser/AppData/Local/ModOrganizer'

Removing https:// gives this:

Thu Sep 22 16:09:44 BST 2022 SKIP - dlMod2nexurl - Download Url is for game 'www.nexusmods.com', which does not have an instance in '/home/user/.config/steamtinkerlaunch/mo2/compatdata/pfx/drive_c/users/steamuser/AppData/Local/ModOrganizer'

Removing https://www. gives this:

Thu Sep 22 16:11:40 BST 2022 SKIP - dlMod2nexurl - Download Url is for game 'nexusmods.com', which does not have an instance in '/home/user/.config/steamtinkerlaunch/mo2/compatdata/pfx/drive_c/users/steamuser/AppData/Local/ModOrganizer'

Maybe something similar is going wrong when trying to download files from Nexus with the button, since the .desktop STL uses just calls steamtinkerlaunch mo2 u %u?

Maybe I'm just using the command wrong, maybe it needs to start with nxm or something. Not too sure how this works honestly Using nxm:// didn't work either. Though I hesitate to place all the blame on STL's command here.

frostworx commented 1 year ago

As already said above we need a log here. It also might be useful to check grep nxm ~/.local/share/applications/* and the content of the desktop file currently used in mimeapps.list (likely vortex-steamtinkerlaunch-dl.desktop)

sonic2kk commented 1 year ago

Here is my log, I started STL with Stardew Valley, pressed the MO2 button on the Main Menu, and tried to download a mod with STL and MO2. The URL passed is different from what I was passing, so no errors that I can see but MO2 doesn't download anything.

mo2 download log

Running grep nxm ~/.local/share/applications returned:

/home/username/.local/share/applications/ModOrganizer-steamtinkerlaunch-dl.desktop:MimeType=x-scheme-handler/nxm;x-scheme-handler/nxm-protocol
grep: /home/username/.local/share/applications/wine: Is a directory

I couldn't find mimeapps.list, but I did find mimeinfo.cache if that's useful:

[MIME Cache]
application/pdf=wine-extension-pdf.desktop;
application/rtf=wine-extension-rtf.desktop;
application/vnd.ms-htmlhelp=wine-extension-chm.desktop;
application/winhlp=wine-extension-hlp.desktop;
application/x-mswrite=wine-extension-wri.desktop;
application/x-wine-extension-ini=wine-extension-ini.desktop;
application/x-wine-extension-msp=wine-extension-msp.desktop;
application/xml=wine-extension-xml.desktop;
text/html=wine-extension-htm.desktop;
text/plain=wine-extension-txt.desktop;
text/vbscript=wine-extension-vbs.desktop;
x-scheme-handler/steam=steam.desktop;
x-scheme-handler/steamlink=steam.desktop;
frostworx commented 1 year ago

I appreciate your help, but an initial log from OP would have been better.

While you're at it please also post ModOrganizer-steamtinkerlaunch-dl.desktop I would have expected this in mimeapps.list and mimeinfo.cache as in:

/home/username/.local/share/applications/mimeapps.list:x-scheme-handler/nxm=vortex-steamtinkerlaunch-dl.desktop
/home/username/.local/share/applications/mimeapps.list:x-scheme-handler/nxm-protocol=vortex-steamtinkerlaunch-dl.desktop
/home/username/.local/share/applications/mimeinfo.cache:x-scheme-handler/nxm=ModOrganizer-steamtinkerlaunch-dl.desktop;
/home/username/.local/share/applications/mimeinfo.cache:x-scheme-handler/nxm-protocol=ModOrganizer-steamtinkerlaunch-dl.desktop;
/home/username/.local/share/applications/vortex-steamtinkerlaunch-dl.desktop:MimeType=x-scheme-handler/nxm;x-scheme-handler/nxm-protocol
sonic2kk commented 1 year ago

Oh, sorry! Didn't mean to pollute the thread or anything. Got a bit caught up in trying to figure out the problem. Uploaded the desktop file as a txt because GitHub wasn't happy with the .desktop file format :sweat_smile:

ModOrganizer-steamtinkerlaunch-dl.txt

I'm not sure where to find mimeapps.list, I'll see if I can find it and post its contents though!


Just to clarify, MO2 mods work correctly, it's just the automatic downloading of them with the Nexus website's "Mod Manager" button that doesn't work. It seems like on my laptop it doesn't matter if I try with Firefox Flatpak or Firefox from my package manager. Afaik this will also be a problem with Vortex but I haven't tested Vortex and don't use it. I don't know if the problem and hopefully eventual solution will be different for MO2 and Vortex though, since they way the desktop files and mime associations are setup seem to be fairly similar.

It works on my desktop, but I set that up months ago with Fallout New Vegas and Skyrim SE. If there are any logs and other files specifically you would like to see compared between my laptop and PC please let me know :smile:

frostworx commented 1 year ago

Thanks for the log! ๐Ÿ‘ (you didn't pollute anything, but I expect the users to at least try to provide useful issues and sometimes it can be annoying to spend time on asking for logs again and again. I doubt that it is a secret that I don't have patience for stuff like this ๐Ÿคจ)

Your desktop file looks perfectly fine and the code generating it hasn't changed for a long time, so if the mime handler is broken generally I'd suspect something has changed somewhere outside steamtinkerlaunch. There is still the possibility left though, that it simply doesn't work within flatpak, right?

sonic2kk commented 1 year ago

There is a possibility for that yes, I'm not sure how Flatpak handles calls out to other applications even if that's how the file association is set up. I remember reading a long time ago, for example, that the steam:// links don't work in Firefox Flatpak. That could be a Flatpak limitation, that could've been a Firefox (or Steam) bug that's been fixed. I wouldn't know how to begin testing something like this.

It's possible the link handling has changed, but the association worked fine on my desktop as of about 2 months ago or so when I was modding New Vegas with MO2 on my PC, and I don't use Firefox Flatpak there (I use developer edition on my laptop and PC from the Arch repos). Users have reported issues with this on Steam Deck with this same issue as Steam Deck uses Firefox Flatpak.

The NXM handler does show up in Firefox Flatpak on my laptop, identically to Firefox Developer edition. But no mods are downloaded when I press the "Mod Manager" button (with MO2 running) on my desktop no matter if my default browser is Firefox Flatpak or Firefox from the Arch repos.

sonic2kk commented 1 year ago

Oh! I might be onto something, just replying now because I think there might be discrepancy between downloading mods in MO2 GUI mode and from the Main Menu button...

sonic2kk commented 1 year ago

Okay! So I was able to successfully download several mods with Firefox Flatpak when running MO2 in MO2 Game Mode. It seems like the issue here is with Standalone Mode, when running in Standalone Mode (with the main menu button) I can't seem to download mods using the "Mod Manager" button. I tested this with "The Binding of Isaac: Rebirth" and "Stardew Valley" (yes, these are native Linux games, but for the purposes of testing this issue I wanted light games and MO2 only supports modding Windows versions of games as far as I can see).

@TheKarion Can you try running MO2 by enabling MO2 in the Game Menu (under "ModOrganizer 2" options, I believe it's set to Disabled by default). and then pressing STL's "Play" button and starting the MO2 GUI that way? See if that resolves your issue.

If it does, I'll see about testing on Steam Deck and seeing how I go. Maybe something needs to be changed with how MO2 runs in standalone mode? I'm not sure honestly... Maybe the problem is to do with the ~/.config/steamtinkerlaunch/mo2/compatdata/. I think that's used for standalone mode, but in GUI mode the Steam compatdata prefix is used.

frostworx commented 1 year ago

Thanks for testing! Interesting, I'm sure this worked once, but I haven't touched MO2 for a long time. I once removed the automatic dotnet installation for mo2 as it seemed to be no longer be required for modding. unfortunately that was never confirmed by the OP of the corresponding issue. iirc dotnet was the main reason for even using a seperate compatdata (so the game compatdata are not polluted with dotnet automatically everywhere). If this is the case it would make sense to drop the separate compatdata and simplify the whole MO2 structure (quick auto install mo2 into the game compatdata, autosetup the one game it is started for and done). should be far less complicated and much easier to maintain. won't happen anytime soon, but probably shouldn't be such a huge task (guessing, forgot what I did there in detail ๐Ÿ˜€)

sonic2kk commented 1 year ago

The problem with installing in the game prefix is that MO2 would have to be installed separately for every game. Keeping MO2 installed in a separate prefix is probably better.

Also, I vaguely remember this issue but MO2 has worked for me without dotnet for quite a while, so it should be fine :)

Maybe however STL does the URL command needs to be updated. Not sure what it does that doesn't work in game mode, maybe in standalone mode wherever MO2 is looking for mods is wrong? Honestly no idea, I'll have to compare the MO2 prefix and game prefix I think.

I don't know if it'll work or have any other unintended side effects but I wonder if we can do any of these:

  1. run MO2 from its STL installation compatdata but run it using the current game's compatdata? No idea if thisll work but it could have some unintended side effects.
  2. Symlink the MO2 installation files into the current game's prefix. Might not do anything different than the above.

Maybe none of this is required and some kind of fix can be implemented for the URL download function. I think investigating that function and how MO2 downloads and looks for mods is a good place to start (in my opinion, not an expert ๐Ÿ˜…)

frostworx commented 1 year ago

iirc the mo2 gui started to work without mo2, but it was never resolved if modding itself works as well without it. it probably is not even necessary to install mo2 into every compatdata, but instead just reuse one extracted installation dir for example via symlinks.

edit: fyi: I'll focus on fixing createDLProtList (see 555) for now, as it probably affects multiple functions.

sonic2kk commented 1 year ago

I tried to open one of my downloaded files with MO2's "Open File" option, this of course failed but it did come up with the path to the file: C:\users\USERNAME\AppData\Local\ModOrganizer\Stardew Valley\downloads.

I'm not sure where this path is, I can't find a USERNAME user, but this is interesting. Perhaps however MO2 is being started in standalone mode means it can't find this path and so it can't download?

EDIT: So the MO2 Paths config was my friend here. It downloads in the MO2 installation compatdata (the one in ~/.config/steamtinkerlaunch/mo2) to drive_c/users/steamuser/AppData/Local/ModOrganizer/Stardew Valley/downloads. Gonna investigate why this only works for Game Mode and why it doesn't work for Standalone Mode.

sonic2kk commented 1 year ago

So the logs look very different when you try to download a mod with MO2 in Standalone Mode (main menu button) and Game Mode.

In Standalone Mode, where downloading a mod does not work, here are the last few lines:

Thu Sep 22 19:10:41 BST 2022 INFO - main - Checking command line: incoming arguments 'mo2 u nxm://stardewvalley/mods/4/files/59053?key=jhjhjhj-X0RwtrA&expires=kjkjhh&user_id=hjjhjh'
Thu Sep 22 19:10:41 BST 2022 INFO - setMO2Vars - Using GE-Proton7-30 for ModOrganizer
Thu Sep 22 19:10:41 BST 2022 SKIP - setSteamPath - 'SROOT' already defined as '/home/username/.local/share/Steam'
Thu Sep 22 19:10:41 BST 2022 INFO - dlMod2nexurl - Download Url 'nxm://stardewvalley/mods/4/files/59053?key=jkjkjhuhu-X0RwtrA&expires=hjhjh&user_id=hjhjhj' for game 'stardewvalley'
Thu Sep 22 19:10:41 BST 2022 INFO - dlMod2nexurl - STEAM_COMPAT_CLIENT_INSTALL_PATH="/home/username/.local/share/Steam" STEAM_COMPAT_DATA_PATH="/home/username/.config/steamtinkerlaunch/mo2/compatdata" "/home/username/.local/share/Steam/compatibilitytools.d/GE-Proton7-30/proton" "run" "ModOrganizer.exe" "$1"

With MO2 in Game Mode, it ends with this:

Thu Sep 22 19:14:20 BST 2022 INFO - main - Checking command line: incoming arguments 'mo2 u nxm://stardewvalley/mods/4/files/59053?key=lkjjhjhk-X0RwtrA&expires=hjhkj&user_id=hjkhjkh'
Thu Sep 22 19:14:20 BST 2022 INFO - setMO2Vars - Using GE-Proton7-30 for ModOrganizer
Thu Sep 22 19:14:20 BST 2022 INFO - dlMod2nexurl - Download Url 'nxm://stardewvalley/mods/4/files/59053?key=hjhjkh-hj&expires=hjkhkh&user_id=hjkhjkh' for game 'stardewvalley' using currently running MO session via '/dev/shm/steamtinkerlaunch/dlNexMod-stardewvalley'

Not sure of the relevancy in the difference in these longs but it's strange to me that we only get this line of logging when using Standalone Mode: dlMod2nexurl - STEAM_COMPAT_CLIENT_INSTALL_PATH="/home/username/.local/share/Steam" STEAM_COMPAT_DATA_PATH="/home/username/.config/steamtinkerlaunch/mo2/compatdata" "/home/username/.local/share/Steam/compatibilitytools.d/GE-Proton7-30/proton" "run" "ModOrganizer.exe" "$1" - Especially since they seem to be using the same function!

Full logs below, marked as "working" for the log where the mod does successfully download, and "broken" for the log where it doesn't.

mo2 game mode (working).log stl standalone mode (broken).log

domglusk commented 1 year ago

@sonic2kk heart @TheKarion, when opening a new issues there are several notes that the exact version and a log file should be added. $Impressive how many people simply ignore this. The only log I know how to get is running it from the terminal which says this. /usr/bin/steamtinkerlaunch: line 12025: /home/domglusk/.local/share/applications/vortex-steamtinkerlaunch-dl.desktop: No such file or directory sed: -e expression #1, char 0: no previous regular expression Thu Sep 22 01:18:16 PM CDT 2022 INFO - startVortex - Starting Vortex without options

domglusk commented 1 year ago

So my firefox (the one from pacman) has been working with nxm links for a long time, and I did have an issue in the past where it was using an old install so I deleted all the cache files and configs from my computer, but this time there isn't even an associated link to it in the settings, nothing pops up if I click download with vortex. Sorry for not being much help, mimetypes are something I don't really know anything about. I went back to my old bug report and tried to fix it on my own but to no avail. Just let me know what you need and I'll share

domglusk commented 1 year ago

Okay! So I was able to successfully download several mods with Firefox Flatpak when running MO2 in MO2 Game Mode. It seems like the issue here is with Standalone Mode, when running in Standalone Mode (with the main menu button) I can't seem to download mods using the "Mod Manager" button. I tested this with "The Binding of Isaac: Rebirth" and "Stardew Valley" (yes, these are native Linux games, but for the purposes of testing this issue I wanted light games and MO2 only supports modding Windows versions of games as far as I can see).

@TheKarion Can you try running MO2 by enabling MO2 in the Game Menu (under "ModOrganizer 2" options, I believe it's set to Disabled by default). and then pressing STL's "Play" button and starting the MO2 GUI that way? See if that resolves your issue.

If it does, I'll see about testing on Steam Deck and seeing how I go. Maybe something needs to be changed with how MO2 runs in standalone mode? I'm not sure honestly... Maybe the problem is to do with the ~/.config/steamtinkerlaunch/mo2/compatdata/. I think that's used for standalone mode, but in GUI mode the Steam compatdata prefix is used.

Yea I can do that, trying to mod Bannerlord if that helps.

domglusk commented 1 year ago

Oh wait I fixed it, so stl never downloaded the vortex-steamtinkerlaunch-dl.desktop, luckily I had a backup in a timeshift from my old install so I moved it over and now it works.

domglusk commented 1 year ago

I see that thumbs down frost I'm trying my best

frostworx commented 1 year ago

I see that thumbs down frost I'm trying my best

https://github.com/frostworx/steamtinkerlaunch#logs 2022-09-22_20-50 2022-09-22_20-51

domglusk commented 1 year ago

Ah ok 31337.log

sonic2kk commented 1 year ago

Oh wait I fixed it, so stl never downloaded the vortex-steamtinkerlaunch-dl.desktop

That's kind of strange, STL is meant to generate this file I believe.

frostworx commented 1 year ago

Oh wait I fixed it, so stl never downloaded the vortex-steamtinkerlaunch-dl.desktop

That's kind of strange, STL is meant to generate this file I believe.

it does...

domglusk commented 1 year ago

Don't know what to tell you but it didn't. I had to create a applications folder so maybe that was it? Idk but I'll close this since its fixed

sonic2kk commented 1 year ago

If you were missing ~/.local/share/applications, that would explain it, but that would be a strange folder to be missing.