amakvana / SwitchEmuModDownloader

SwitchEmuModDownloader - A Cross-Platform One-Click Games Mod Downloader for Switch emulators. Formerly YuzuModDownloader.
GNU General Public License v3.0
567 stars 35 forks source link

Linux/SteamOS support #19

Closed ssorgatem closed 1 year ago

ssorgatem commented 1 year ago

Does this run on Mono or .Net core for Linux?

It'd be nice to be able to use this in SteamOS, especially with EmuDeck's yuzu installation

amakvana commented 1 year ago

It doesn't as of now, however, I do have plans to rewrite this in .NET Core instead for Cross Platform support.

In the meantime, are you able to provide the filepaths Yuzu uses within SteamOS?

mwmeyers03 commented 1 year ago

@amakvana In my Steam Deck, the file path is (root)/Home/.local/share/yuzu which has the dump, keys, load, log ,nand ,screenshots, sdmc, shader and tas folders.

ssorgatem commented 1 year ago

@mwmeyers03 that path is wrong, the right one is:

/home/deck/.local/share/yuzu

Where /home/deck is the the $USER 's $HOME directory, and $HOME/.local/share is the standard XDG directory for app configs (the first and default option in the variable XDG_DATA_DIRS). And capitalization is important (well, the SteamOS root partition is case-insensitive, but that's uncommon on Linux)

But that would change for the flatpak version of yuzu, as flatpaks use their own config directory...

MGThePro commented 1 year ago

But that would change for the flatpak version of yuzu, as flatpaks use their own config directory...

according to this yuzu should at least have read access to the home directory and therefore also ~/.local/share/yuzu. I dont use flatpak personally but maybe someone is available to test and see if it can read mods from that directory.

Redhawk18 commented 1 year ago

hows the progress? This project is awesome I'm just cursed of having a amd card.

amakvana commented 1 year ago

hows the progress? This project is awesome I'm just cursed of having a amd card.

Apologies for the late reply! Life has taken over and things are just crazy!

I am still adding support for SteamOS, but waiting to get my hands on an AMD GPU so I can test thoroughly

ssorgatem commented 1 year ago

Great! I'm curious though, why do you need an AMD GPU to test a mod downloader on Linux?

I can help with testing if needed (I have both a Steam Deck and several Linux PCs with AMD GPUs)

amakvana commented 1 year ago

Great! I'm curious though, why do you need an AMD GPU to test a mod downloader on Linux?

I can help with testing if needed (I have both a Steam Deck and several Linux PCs with AMD GPUs)

I don't have a Steam Deck to test with, so I was going to grab a copy of HoloISO and use that, as it's pretty much the exact same as SteamOS, however, HoloISO isn't compatible with NVIDIA.

I'm not a Linux pro by any means, so if there are other alternative Distro's that also support NVIDIA, let me know!

ssorgatem commented 1 year ago

I suggest you try Manjaro (with KDE/Plasma desktop, the same as in SteamOS, though that should be irrelevant). It supports NVIDIA and it's Arch-based like SteamOS/HoloISO, but easy to install unlike Arch.

Most importantly, you can install Yuzu in exactly the same way you would do it in SteamOS: with a flatpak

amakvana commented 1 year ago

I suggest you try Manjaro (with KDE/Plasma desktop, the same as in SteamOS, though that should be irrelevant). It supports NVIDIA and it's Arch-based like SteamOS/HoloISO, but easy to install unlike Arch.

Most importantly, you can install Yuzu in exactly the same way you would do it in SteamOS: with a flatpak

Thanks for this, that's thoroughly appreciated!

Last thing, I assume Manjaro supports Proton? So that way there's a platform for me to run exe's

If it does, I'll download a copy of the distro and begin testing, etc.

ssorgatem commented 1 year ago

Proton works the same in any Linux distro. You just need to install Steam (which is in the Manjaro repos, you can find it with the graphical package manager or just do a sudo pacman -S steam) and Steam will install Proton just as it does in the Steam Deck.

You can even install ProtonUp-Qt from Discover (as a flatpak) and add custom versions of Proton exactly as in the Steam Deck.

amakvana commented 1 year ago

Proton works the same in any Linux distro. You just need to install Steam (which is in the Manjaro repos, you can find it with the graphical package manager or just do a sudo pacman -S steam) and Steam will install Proton just as it does in the Steam Deck.

You can even install ProtonUp-Qt from Discover (as a flatpak) and add custom versions of Proton exactly as in the Steam Deck.

Thanks for all the advice and help! I'll begin testing shortly and will keep you posted upon any changes

ProNoob135 commented 1 year ago

Glad to hear you're working on this, just tried running it through wine (partly as a joke) but it appears to hang in the download process. Best of luck!

Rikj000 commented 1 year ago

I'd be happy to test a .NET core build on my Manjaro machine as soon as it's available!

Running under Wine indeed does not work correctly, the program opens, but it doesn't download anything.

@mwmeyers03 that path is wrong, the right one is:

/home/deck/.local/share/yuzu

Where /home/deck is the the $USER 's $HOME directory, and $HOME/.local/share is the standard XDG directory for app configs (the first and default option in the variable XDG_DATA_DIRS). And capitalization is important (well, the SteamOS root partition is case-insensitive, but that's uncommon on Linux)

I'd like to add that ~ could also be used instead of $HOME. Following paths should all be correct:

/home/<username>/.local/share/yuzu
$HOME/.local/share/yuzu
~/.local/share/yuzu

With deck being the default username on a steam-deck.

Rikj000 commented 1 year ago

Some guidance for migrating:

amakvana commented 1 year ago

I've migrated most of the code to .NET 7. A fair amount of refactoring required as plenty has changed under the hood from .NET Framework 4.8.X, however, the progress is coming along nicely. Plenty of performance improvements have been made along the way!

Tested in Manjaro using Proton and it does pull some Mods down (not all), but crashes/hangs occasionally, so I am continuing testing.

Once I feel the build is "stable" enough, I will release it in here for you guys to test

ssorgatem commented 1 year ago

Why using Proton? It doesn't work at all with Linux .Net 7?

.Net and wine/Proton have historically not played very well together.

amakvana commented 1 year ago

Why using Proton? It doesn't work at all with Linux .Net 7?

.Net and wine/Proton have historically not played very well together.

I assumed the only way to get .exe files running was via Proton? Could be wrong though

MGThePro commented 1 year ago

The GUI is based on winforms which doesn't work on linux natively, and even through wine it creates some issues.

To have a full linux port the GUI would have to be rewritten or some functionality has to be cut (maybe a terminal version for linux while windows keeps its gui?)

cimba007 commented 1 year ago

Maybe I am doing someting wrong but running YuzoModDownloader via "GE-Proton7-55" kinda .. works. Only thing to figure out is how to tell it to use the correct paths - but no idea on that. (1.3.1.0).

ssorgatem commented 1 year ago

Why using Proton? It doesn't work at all with Linux .Net 7? .Net and wine/Proton have historically not played very well together.

I assumed the only way to get .exe files running was via Proton? Could be wrong though

There are different types of .exe files, and how to run them on Linux depends on what kind they are:

Rikj000 commented 1 year ago

Proton/Wine would be better then nothing, but true native Linux support without em, would be even better.

cimba007 commented 1 year ago

There are 2 issues I found with current baseline which can be all worked around by ModDownloader.cs. I am no expert with github and maybe some1 else finds this useful to make their own build or make a proper pull-request.

Issue 1: After every mod download "client.DownloadFileCompleted += (s, e) =>" fires and extracts ALL downloaded mods ... recursion incoming.

Fix: Move "using (var client = new WebClient())" within "foreach (var url in game.ModDownloadUrls)"

Issue 2:

Moving YuzoModDownloader closer to the same directory the "load" folder resides and using an updated ModDownloader makes it run and work with proton GE 7.55

protected ModDownloader()
{
    //UserDirPath = Directory.Exists("user") ?
    //    Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "user") :
    //    Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "yuzu");
    //ModDirectoryPath = GetModPath(UserDirPath);
    ModDirectoryPath = Path.GetDirectoryName(Application.ExecutablePath)+@"\load\";
    _sevenZipExePath = "";
}

https://gist.github.com/cimba007/76a24d754a49b0544247ad613d8b1d29

Use at your own risk and if you are unsure compile it yourself with the changes noted here and/or the gist-link

YuzuModDownloader_Proton_Emustation_Steamdeck.zip

amakvana commented 1 year ago

Another update... I have rewritten the entire app using NET 7 + Avalonia, completely moving away from WinForms. So all the UI works natively. Mods are downloading into their respective directories but there are a couple of crashes that are randomly happening

Once I iron these out, I shall put both the Windows builds and Linux builds into here for further testing

Apologies it's taking so long, life isn't being kind at the minute

amakvana commented 1 year ago

There are 2 issues I found with current baseline which can be all worked around by ModDownloader.cs. I am no expert with github and maybe some1 else finds this useful to make their own build or make a proper pull-request.

Issue 1: After every mod download "client.DownloadFileCompleted += (s, e) =>" fires and extracts ALL downloaded mods ... recursion incoming.

Fix: Move "using (var client = new WebClient())" within "foreach (var url in game.ModDownloadUrls)"

Issue 2:

Moving YuzoModDownloader closer to the same directory the "load" folder resides and using an updated ModDownloader makes it run and work with proton GE 7.55

  • SteamOS 3.47
  • Emustation
  • All Emulators on external SD-Card (not tested with installation in SSD but as long as both files are placed releative to "load" Folder it should work also.
  • Place here: D:\Emulation\storage\yuzo\YuzoModDownloader.exe + HtmlAgilityPack.dll <-- This is the path YuzuModDownloader will see from running under proton /run/media/mmcblk0p1/Emulation/storage/yuzu/YuzoModDownloader.exe + HtmlAgilityPack.dll <-- This is the path where the actual files are placed on the Steamdeck
protected ModDownloader()
{
  //UserDirPath = Directory.Exists("user") ?
  //    Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "user") :
  //    Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "yuzu");
  //ModDirectoryPath = GetModPath(UserDirPath);
  ModDirectoryPath = Path.GetDirectoryName(Application.ExecutablePath)+@"\load\";
  _sevenZipExePath = "";
}

https://gist.github.com/cimba007/76a24d754a49b0544247ad613d8b1d29

Use at your own risk and if you are unsure compile it yourself with the changes noted here and/or the gist-link

YuzuModDownloader_Proton_Emustation_Steamdeck.zip

Thanks for this! In my rewrite, I have moved away from WebClient as it's deprecated and moved over to using IHttpClientFactory which resolves the Issue 1. Issue 2 has been resolved (partially) too, without needing to be more specific on the paths, but as stated above, just need to do a bit more testing before giving you all a copy

Thanks for the upload though, it's thoroughly appreciated!

cimba007 commented 1 year ago

For the Issue 2 I needed to bypass the existing code as the path that can be extracted from the ini-file is a native linux path and thus not compatible with proton. Still glad to see that there is an update incoming (even if its slowly). Appreciate the work as everbody is putting their free time in this wonderful community projects. Keep the good work up!

amakvana commented 1 year ago

Hello all,

Another update... I have successfully rewritten YuzuModDownloader, using .NET 7 and Avalonia, it now works on Linux and the issues I had been facing previously have now been ironed out.

In addition to this, I have also integrated the HolographicWings TOTK Mods GitHub repo so YuzuModDownloader will now pull and import all of the mods compatible with your dumped copy of TOTK.

Please find attached both win-x64 and linux-x64 releases for testing - @ssorgatem, @cimba007, @ProNoob135, @MGThePro, @Rikj000

YuzuModDownloader_win-x64.zip YuzuModDownloader_linux-x64.zip

Dependencies

.NET 7 Desktop Runtime is now required, see Windows and Linux for installation instructions. You can also install .NET 7 using package managers such as Pacman, Flatpak or Snapd

Windows

Once downloaded, extract and move YuzuModDownloader.exe into the same folder where yuzu.exe resides on your system.

Linux

Once downloaded, extract and move the YuzuModDownloader file to your desktop. Afterwards, run the following commands from Terminal

cd ~/Desktop
chmod +x YuzuModDownloader
./YuzuModDownloader

You can double click on YuzuModDownloader to execute it, once the first two commands above have been ran (3rd is to run it from Terminal)

ymd-linux

amakvana commented 1 year ago

Closed - Added in v1.4.0.0 https://github.com/amakvana/YuzuModDownloader/releases/latest