Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Add support for HedgeModManager (Modding Tool) #624

Closed
KBouder opened this issue Oct 6, 2022 · 147 comments
Closed

Feature Request: Add support for HedgeModManager (Modding Tool) #624

KBouder opened this issue Oct 6, 2022 · 147 comments
Labels
enhancement New feature or request

Comments

@KBouder
Copy link

KBouder commented Oct 6, 2022

System Information

  • SteamTinkerLaunch version: 11.11
  • Distribution: Manjaro KDE

Feature Description

It would be neat if support could be added for HedgeModManager, which does not have a Linux port, but is possible to set up by jumping through a bunch of hoops. I did manage to get it working on the Steam Deck with Bottles, but having an easy way to set this up would be great.

Sonic Generations in particular has a very active modding community, as seen here, which only scratches the surface of what's available.

Supported Games (copied from their GitHub page)

Sonic Generations
Sonic Lost World
Sonic Forces
Puyo Puyo Tetris 2
Olympic Games Tokyo 2020
Sonic Colours: Ultimate
Sonic Origins (Steam, Epic Games Store)

Link to HedgeModManager GitHub

https://github.com/thesupersonic16/HedgeModManager

It would be neat to contribute in any way that I can. I know basics of software development (C and C++), but unfortunately know very little about Linux. Still learning the hard way.

@KBouder KBouder added the enhancement New feature or request label Oct 6, 2022
@frostworx
Copy link
Collaborator

Thanks for the suggestion.
Can't tell if or when I'd find the time to add this, but it seems pretty simple
(basically autodownload HedgeModManager.exe and run it when enabled)

On the other side, it should just work to download the exe and start it as custom program for the corresponding game.
would be nice if you'd try this and report if it works (and if you still think that it is worth to add an extra implementation anyway :))

@sonic2kk
Copy link
Owner

sonic2kk commented Oct 6, 2022

+1 on this, though I have the same idea as Frostworx. If it is simply able to be ran as a custom command there may not be any need to add explicit support as many games have dedicated mod managers, however since this supports several Sonic games (almost all of which are available on Steam) it might be an idea to include it.

What are the hoops needed to get this up and running? Does it need any specific Winetricks that Bottles provides or are the hoops just setting up the prefix etc? Does the mod manager need to be "installed" into the game's prefix or can it be ran from anywhere?

Perhaps a more ideal solution would be a way to setup "preset" custom applications and then have a drop-down in the game menu to let the user select to either run their game with that application, or just let them run the custom program with STL open (like MO2 standalone mode). Then a user can add their mod manager program like this one, or any other program and it'll be available for all games in a custom command drop-down or they can just generally launch it with STL still open. Not sure if I'm explaining it right though and of course may be a bit of work.

Just trying to think of a more general solution, not at all against this idea though and if this idea isn't great and it's preferred to have explicit support for each application, that's fine 😃 It does overlap a little with applications like Bottles but the advantage of STL is launching through Steam. And these mod managers could be added as a shortcut to Steam and launched with STL but having an approach where users can select from a preset list of custom programs could be handy for other mod managers, to prevent having to add support for XYZ mod managers while also making it a bit more convenient to manage custom programs.

EDIT: This would also be super convenient on Steam Deck. Configure your utility programs and then easily select them from your list!

@sonic2kk
Copy link
Owner

sonic2kk commented Oct 6, 2022

Actually just had a look at the guide you linked, super sorry for not noticing it. It seems like directory structure and DLL overrides might be important, however that seems to be on a per-game basis. STL does let you set that as a custom command but also with Winecfg per-game. But it's not automatic.

Having to do this sort of configuration does add credence imo to having HedgeModManager available and pre-configured. And by extension, other popular mod managers could be supported as well if they need this kind of workaround.

Having skimmed that linked setup guide I see merit in adding dedicated support personally, but I'm also a Sonic fan (could you guess? 😆) so I'm a bit biased. Being able to detect the Sonic games and set the DLL overrides for those games automatically and correctly configure the directories would be nice. Of course a way to do this generically like how I described earlier would be nice but frankly, that sounds complicated as hell. And maybe having built-in support for other popular mod managers that need similar things isn't such a bad idea. Though deciding which ones are "popular" enough is subjective.

After having dug a little deeper I think dedicated support might be the way to go.

@KBouder
Copy link
Author

KBouder commented Oct 6, 2022

I set this up on the Steam Deck that way, and adding these managers to Steam is an absolute chore. The mod manager lets you switch between games so it kinda works like Mod Organizers Global Instance, but the way I was able to set it up was to have 4 separate HedgeModManagers, one for each prefix, and then adding shortcuts to them in Steam. The only downside to doing that, with Bottles at least, is when you have multiple applications with the same name, it tends to get confused and will merge them, duplicate them, overwrite them, all sorts of annoying stuff. Not to mention there's only so much you can do with cover artwork to differentiate them from one another, but I'm rambling and getting off track. This would be a really cool feature to have, and you wouldn't have to clutter up the menus either, you could simply do a check for the SteamApp IDs of the games that are supported and replace the Mod Organizer button with HedgeModManager. Simple (hopefully) and clean!

And on that note as well, there is Mania Mod Manager (GitHub Page) which I believe is made using a very similar code base, so likely has similar requirements for getting it set up.

@KBouder
Copy link
Author

KBouder commented Oct 6, 2022

Thanks for the suggestion. Can't tell if or when I'd find the time to add this, but it seems pretty simple (basically autodownload HedgeModManager.exe and run it when enabled)

On the other side, it should just work to download the exe and start it as custom program for the corresponding game. would be nice if you'd try this and report if it works (and if you still think that it is worth to add an extra implementation anyway :))

I'll give this a shot to see if it's easier than using Bottles. I'll reply with what I did to get it to work (if I get it to work). I'm a Linux noob still.

@KBouder
Copy link
Author

KBouder commented Oct 6, 2022

Strangely when I add HedgeModManager.exe as a custom command, then hit save, it just reverts back to SonicGenerations.exe. (This is for Sonic Generations specifically, in case that wasn't clear). Not sure if I'm doing something wrong, or misunderstanding the wiki. Maybe it just doesn't like me.

@sonic2kk
Copy link
Owner

sonic2kk commented Oct 6, 2022

but the way I was able to set it up was to have 4 separate HedgeModManagers, one for each prefix, and then adding shortcuts to them in Steam

Hmm, I have no idea how we'd handle this with STL. Maybe symlink each Sonic game's prefix or something? The way games on Linux work is each Sonic game runs in its own prefix, which each game seems as a separate "Windows install" so to speak.

The way MO2 works with STL afaik currently is there's standalone mode, which runs in its own prefix, and Game Mode, which runs in the current game's prefix. Ofc, STL could install HMM to each game's prefix but this is less than idea.

And on that note as well, there is Mania Mod Manager (GitHub Page) which I believe is made using a very similar code base, so likely has similar requirements for getting it set up.

I think it also shares code with SA2ModManager (made by mainmemory iirc?), I was able to get this working on Linux a while ago and I think it also required some DLL overrides. But this is a little off topic :-) These are game-specific so could work as a custom command most likely with some manual DLL overriding - This is a common enough step and just something to get used to when gaming on Linux for the most part (STL makes it easier to get to Winetricks/pass these DLL overrides as a command line parameter to Wine).

Back to the main point, HMM might need to be set up to work similar to MO2. Switching between different games and then launching them from the same instance is probably not gonna work when playing from Steam, since it'll be trying to run Sonic Generations from Sonic Forces' prefix and that could cause a bunch of problems. Modding them might work fine though, so we can keep this in mind. Running from the command line might work better if it just passes something like steam steam://run/gameappid or whatever, but no clue :-)

So if this is implemented you'll probably have to switch between your games and launch the right one when playing from the same installation, likely you don't be able to hot-swap and go between playing Generations and Forces in the same session (ofc you can just launch Forces with STL and run with HMM that way :-))

@sonic2kk
Copy link
Owner

sonic2kk commented Oct 6, 2022

Strangely when I add HedgeModManager.exe as a custom command, then hit save, it just reverts back to SonicGenerations.exe.

The most common problem here is that you didn't enable the custom command checkbox :-) But if you did and it still doesn't work, please upload a log (you can find it in /dev/shm/steamtinkerlaunch). Not sure how exactly it all got setup with Bottles but if the Generations prefix needs a DLL override and you only did it for the HMM prefix you might need to set these overrides yourself

Maybe some kind of auto-enable here would be a good idea if the custom command file exists... but that's a separate thing :-)

As for being easier than Bottles, STL is an entirely different tool aimed at more advanced tinkering. At the very least if STL does add support for HMM it'll mean only needing one installation instead of 4.

@KBouder
Copy link
Author

KBouder commented Oct 6, 2022

Honestly having multiple HedgeModManagers set up wouldn't be that bad, it's a 17MB .exe file and that's it. They each reference the Mods folder within the games directory anyways (I tend to throw them in the game directory even though they say not to), bad habit.

I actually checked Use Custom Command as well as Only Custom Command, but it still won't take it.

I don't think I even did the DLL overrides the last time I tried this. It must be a new step in their guide.

Here's the log...it seems like it's saying the value wasn't changed because nothing was selected. Weird.
steamtinkerlaunch.log

@sonic2kk
Copy link
Owner

sonic2kk commented Oct 6, 2022

They each reference the Mods folder within the games directory anyways (I tend to throw them in the game directory even though they say not to), bad habit.

This + no DLL overrides make it sound like it could be very straightforward to get working. So it has no installer or anything? How does it know exactly where each game is? If it's just an executable and you point it to your game's EXE, running it in the current game's prefix and then just launching the relevant game sounds a lot more straightforward than I thought and may not require dedicated STL support. If it's just an application that loads mods in a given game's Mod folder (with the game files and not in the game's prefix) that sounds very easy 😮

I actually checked Use Custom Command as well as Only Custom Command, but it still won't take it.

Upload a log and I can take a look :-) Thanks!

@sonic2kk
Copy link
Owner

sonic2kk commented Oct 6, 2022

Thu Oct  6 11:58:02 AM EDT 2022 INFO - updateConfigEntry - Option 'CUSTOMCMD' is updated with the new value '/mnt/games/HedgeModManager/HedgeModManager.exe' in config '71340.conf'

Looks like it finds it. But I also see what you mentioned:

Thu Oct  6 12:11:46 PM EDT 2022 INFO - setGuiCategoryMenuSel - Nothing selected - going to the Settings Menu

Did you forget to press "Save" or "Save and Play" by any chance? Maybe not because updateConfigEntry was called but still, just making sure

@KBouder
Copy link
Author

KBouder commented Oct 6, 2022

I'm going to be honest I'm not really sure how it tells. Sometimes, at least using Bottles, it just took a little bit of luck. There is no installation by the way, just launch the .exe, download the custom codes, select your mods, and hit play. There were a couple times I would launch it and it would find the wrong game, but I don't have my Deck to see how it was configured. (On it's way to Valve for repair).

Every time I would hit Save it would reset to the default value.

Also now it crashes when I load it.

Edit: That's because it did in fact save, just a little UI bug. It tried to run the mod loader without the per-requisites!

@sonic2kk
Copy link
Owner

sonic2kk commented Oct 6, 2022

I can't see in your log where the game launch is. It looks like you just closed STL without pressing play in that log. Try running STL, checking the custom command open, checking "only custom command", then selecting your HMM executable, then pressing "save and play". Then upload that log (I'm interesting to see what the launch command is specifically).

It tried to run the mod loader without the per-requisites!

Could you elaborate?

@KBouder
Copy link
Author

KBouder commented Oct 6, 2022

Apologies, I set it to run the ModManager instead of the game, but the mod manager requires a few things to be done with Protontricks/Winetricks. I just tried to boot the game afterwards to see what would happen, which is how I found out that it actually did work, the UI just wasn't updating for me for some reason.

image

This alone might work once I install the dependencies. We will see.

@sonic2kk
Copy link
Owner

sonic2kk commented Oct 6, 2022

I don't think I've ever seen that menu you're showing before 😮 That's really nice though. Just Fyi it's also in the Game Menu. It looks like that menu might even be missing a few of the newer custom command options...

Actually I can't find this menu, out of pure curiosity where did you find it? 😅

This alone might work once I install the dependencies. We will see.

Ah, if it needs dotnet or anything I would first recommend trying without, and if it does need dotnet48, I would recommend trying to install it with STL (it does some thing under the hood to make it install with Proton). If anything messes up with your game/mod manager you'll need to delete the game's prefix, you can open the WINEPREFIX from the SteamTinkerLaunch "Game Files" menu.

@KBouder
Copy link
Author

KBouder commented Oct 6, 2022

The only problem with that is, for some reason, the bug I'm experiencing causes it so that if I click on a drop down menu, the UI doesn't update based off my selection. I'm going to try a reboot to see if that fixes it. I didn't realize you could do that with stl. That's convenient.

Random thought: HedgeModManager will likely be used for Sonic Frontiers when it comes out next month. It runs off a similar engine if I remember correctly.

@sonic2kk
Copy link
Owner

sonic2kk commented Oct 6, 2022

The only problem with that is, for some reason, the bug I'm experiencing causes it so that if I click on a drop down menu, the UI doesn't update based off my selection

In that case I'd recommend launching Sonic Generations with STL, going to the Game Menu and tinkering with your custom commands that way 😄 That menu should work, I've used it a few times.

I didn't realize you could do that with stl. That's convenient.

This is something I find myself saying quite often, when looking through the code, or the menus or the wiki I come across something it can do and think exactly that to myself. It's got a ton of features and if you don't mind getting your hands dirty (which is the kind of people it feels most well suited for) it's one of the most powerful customisation tools available for gaming, period.

@sonic2kk
Copy link
Owner

sonic2kk commented Oct 6, 2022

Random thought: HedgeModManager will likely be used for Sonic Frontiers when it comes out next month. It runs off a similar engine if I remember correctly.

It will most likely yes, unless Denuvo gets in the way. Iirc Frontiers is going to use Hedgehog Engine 3 (Forces uses 2, Generations uses I think 1 or something similar, it actually started with Sonic Unleashed!). But we don't even know how or if Frontiers will work on Linux (I'm hoping and humbly expecting it will). So no need to worry about that just yet.

Honestly if HMM works and the dependencies you're installing get it working, we could just contribute a guide on running it with STL to the wiki (and maybe request that a link to those steps be added to the HMM wiki too). If it's just a case of installing a few winetricks and setting the custom command, there shouldn't be any need to add "dedicated" support. Not to devalue your request! It's just that if we can document how to get it working and if it's as straightforward as this, sure it requires some manual steps but it isn't as "important" as having support for MO2 and Vortex I guess.

The only "problem" is that these steps would be needed for each game. You'd need to install the winetricks for each game which could be a pain for users. Maybe adding support for HMM and simply running it in a dedicated prefix running with the game's Proton version would be fine - The game would then be running in an STL-created HMM prefix with a Proton version selected by the user.

@KBouder
Copy link
Author

KBouder commented Oct 6, 2022

Did you mean checking Winetricks and selecting dotnet4 quartz xact? Because if so, that did not work.

@KBouder
Copy link
Author

KBouder commented Oct 6, 2022

The game would then be running in an STL-created HMM prefix with a Proton version selected by the user.

That could work actually.

@sonic2kk
Copy link
Owner

sonic2kk commented Oct 6, 2022

Did you mean checking Winetricks and selecting dotnet4 quartz xact? Because if so, that did not work.

I'm not sure why it wouldn't work but if it needs dotnet4, you might be able to get away with Wine's dotnet implementation.

But more than that, could you explain what you mean by "did not work"? Did they install at all? Or did nothing happen? The interface might be a little cumbersome but you press "select" then seleect your dependencies, then press "install". The Proton version is likely less important but setting it to match the version of Proton you want to run the game with couldn't hurt.

You should get a dialog that pops up telling you that it's installing those Protontricks. You could always install dotnet4 after the fact, as I think only dotnet48 is what most games require.

@KBouder
Copy link
Author

KBouder commented Oct 6, 2022

Nothing happened, unfortunately, completely failed to boot.

Requirements

dotnet48
d3dx9
vcrun2019
d3dcompiler_47

I believe these are hard requirements because of the way they do code injection.

@sonic2kk
Copy link
Owner

sonic2kk commented Oct 6, 2022

Oh, if it needs dotnet48 then hmm. I would still skip it for now and just see if it works with Wine's dotnet implementation (called wine-mono, and it conflicts with dotnet48. STL removes Wine's mono and then installs dotnet48. It can also take a while to install)

As for the requirements you listed, I would agree they're probably needed for code injection (d3dx9 is fairly common for that, and Generation is a dx9 game afaik). The rest I'm not sure but d3dcompiler_47 could be used for however they draw certain things on the UI maybe.

Did you get a notification saying those packages were installing, and a notification saying that they finished?

@sonic2kk
Copy link
Owner

sonic2kk commented Oct 6, 2022

I do actually have Sonic Generations (and Forces) installed so if we don't get anywhere I can always give this a go myself and see if I can figure anything out.

@KBouder
Copy link
Author

KBouder commented Oct 6, 2022

image

Um...

@sonic2kk
Copy link
Owner

sonic2kk commented Oct 6, 2022

That appears for me but it loads after a while (about 1 second)

Try closing STL completely and deleting /dev/shm/steamtinkerlaunch (the files here will re-generate, they're mostly temp storage files). Then try installing the winetricks again.

If you have STL closed try opening and navigating to this menu again, then attaching a log as before so we can see what's going on.

@sonic2kk
Copy link
Owner

sonic2kk commented Oct 6, 2022

Attempting to install those winetricks and run HMM with Sonic Generations now...

First problem I ran into - Never launched the game before on this install so the Winetricks had nowhere to install the verbs to!

@KBouder
Copy link
Author

KBouder commented Oct 6, 2022

Run the configuration tool first, the game won't boot without that.
Sega makes good ports, I swear.

steamtinkerlaunch.log
I don't see anything in here that jumps out at me

@sonic2kk
Copy link
Owner

sonic2kk commented Oct 6, 2022

Sega makes good ports, I swear.

All too familiar with Sega's ports, hah. But yes that was a good catch!

@thesupersonic16
Copy link

thesupersonic16 commented Nov 2, 2022

I personally don't use HMM on Linux, but I would like to clarify some things

  • HMM is a manager which basically configures the mod loaders to load certain mods and compiles some codes.
  • Mod loaders are injected automatically into the game as it's DLL are the same name as one of the imports in each game. d3d9.dll/d3d11.dll. This means launching the game using Steam will still load mods.
  • dotnet48 is needed for all x64 games due to mono crashing in CommonLoader. I am unsure why this happens.
  • The play button only executes open-xdg using WINE's start /unix command when WINE is detected.

I have been messing with some ideas like with the url handlers, but I am not very familar with desktop Linux, so if you believe my approach is not good, please let me know and I will see if I can make any improvements.

Anyways, I have not used STL, but from reading this issue, it does sound interesting.

@sonic2kk
Copy link
Owner

sonic2kk commented Nov 2, 2022

Ah hello and welcome! Thanks for the response!

HMM is a manager which basically configures the mod loaders to load certain mods and compiles some codes.

Yes from my earlier very limited understanding that's what I thought, though there was a mod that worked when a user installed it with HMM running through STL, and I thought maybe it worked specifically because HMM was running in the same prefix as the game in that case (whereas with Bottles, it would be running in a separate prefix). By the sounds of this though there shouldn't be a compatibility difference no matter what prefix HMM is started from.

Mod loaders are injected automatically into the game as it's DLL are the same name as one of the imports in each game. d3d9.dll/d3d11.dll. This means launching the game using Steam will still load mods

Aha! Very cool. If the game will already load those mods then it'll probably also still work on Linux without any extra configuration too. Thanks

dotnet48 is needed for all x64 games due to mono crashing in CommonLoader. I am unsure why this happens.

I'm not too familiar with the internals of what Wine's mono has and how development on it is progressing, but a number of things still depend on dotnet48 (Vortex, there's a Mass Effect mod manager that needs it, there's an American Truck Simulator program that needs it too, just off the top of my head) so I think this is just a case of Wine needing some work - That's my armchair, limited understanding guess anyway 😅

I have been messing with some ideas like with the url handlers, but I am not very familar with desktop Linux, so if you believe my approach is not good, please let me know and I will see if I can make any improvements.

I appreciate this and the thought that's gone into accommodating Linux users, I'm sorry to say that at the moment I am just not knowledgeable enough on what might need improving. But if I come across anything I will let you know!


I will fully admit here, I haven't used HMM before because I haven't really modded any of the modern Sonic games I own, but once I get an implementation going I'll be giving it a try :-)

Just quickly while you're around, I'd like to confirm that it's okay to include support for HMM with SteamTinkerLaunch. It won't bundle the executable, it'll fetch it from the GitHub releases (or if you have a different, preferred link feel free to share that). My current plan then is to have it run in a separate prefix with dotnet48 installed (STL's Winetricks function will remove Wine Mono before installing dotnet48 iirc) where a user will run HMM here to mod their games, then close it and run their game normally. This also means dotnet48 won't need to be installed on each game's wine prefix, so the same dedicated HMM prefix can be used for each game. It also means that on Steam Deck Game Mode they don't have to use the HMM UI at all.

There will also be documentation on the wiki which will link back out to the GitHub page, pretty much every wiki project page follows the same format in that regard but here is MangoHud as an example. If you have any preferred ways of linking back out to the main project feel free to mention as well. STL does not try or set out to claim ownership of the projects it offers integration with and I wouldn't want it to come across that way :-)

Of course like the MO2 and Vortex there would be a couple of disclaimers on the wiki, pointing users to the dedicated HMM Linux/Steam Deck issue, noting that HMM is not a Linux tool, and that some mods may just not work on Linux.

Thanks for getting involved here and clarifying, it's awesome to see 😄 I took over from the previous SteamTinkerLaunch maintainer a couple of weeks ago but he also expressed interest in adding support for HMM. I think it would make a nice addition to STL 😃

@thesupersonic16
Copy link

This also means dotnet48 won't need to be installed on each game's wine prefix

All the x64 games needs this unfortunately as I mentioned before, maybe you could symlink it? This is one of the big hurdles when setting up mods on Linux. Would it be possible to have STL handle that? Or am I mistaken?

Just quickly while you're around, I'd like to confirm that it's okay to include support for HMM with SteamTinkerLaunch.

I was talking to the other HMM developer (Sajid) and we both think it's fine to include support aslong as you ensure HMM is always kept up to date.

@sonic2kk
Copy link
Owner

sonic2kk commented Nov 2, 2022

All the x64 games needs this unfortunately as I mentioned before, maybe you could symlink it? This is one of the big hurdles when setting up mods on Linux. Would it be possible to have STL handle that? Or am I mistaken?

Ooh sorry I think I misunderstood. So for mods installed with HMM to load at all each game needs dotnet48, is that right? Otherwise if dotnet48 is only used for the HMM GUI then only having it in the prefix should be ok. But if it's needed for each game, I can just add a checkbox in the Game Menu with "Use HedgeModManager" and then when the user clicks STL's "Play" button it'll install dotnet48 for that game. It'll add a bit of time before playing but if it's necessary there's no way around it for now.

But do games running without HMM's UI really need dotnet48? I haven't heard of that before, but I am not overly familiar with modding. My plan was to have HMM only run in one dedicated wine prefix (in STL's ~/.confiig/steamtinkerlaunch folder there would be a dedicated prefix created), so that prefix would be the only one that HMM's UI would run from. But if that is not enough I'll install dotnet48 in each game's prefix too.

There could be a way to symlink the dotnet48 installation but it might just be simpler to install it separately. There might also be a way to symlink the prefix so that each game uses the one HMM prefix (and then I could hardcode any game file symlinks e.g. for save files if necessary) but I'm not sure if that's worth it either.

I was talking to the other HMM developer (Sajid) and we both think it's fine to include support aslong as you ensure HMM is always kept up to date.

Awesome, thank you for the green light! I would also want to keep HMM up-to-date as well. The way the version fetching works is that when a user goes to install HMM (or MO2 or Vortex) it'll pull the latest version from the release tags and then fire that into a url like this: https://github.com/thesupersonic16/HedgeModManager/releases/expanded_assets/<version>. Then it'll fetch the matching (hardcoded) exe name, in this case it'll look for HedgeModManage.exe.

Demo Bash snippet for fetching HMM version

This is the function that STL uses to fetch the latest MO2 and Vortex exe's, and I plan to re-use it for HMM as well. I extracted it and wrote a small demo of how it works so you can run this yourself on a Linux machine/VM if you would like :-)


#!/usr/bin/env bash

GHURL="https://github.com"
WGET="wget"

function getLatestGitHubExeVer {
    SETUPNAME="$1"
    PROJURL="$2"

    RELEASESURL="${PROJURL}/releases"
    EXPANDEDASSETSURL="${RELEASESURL}/expanded_assets"
    TAGSURL="${PROJURL}/tags"

    TAGSGREP="${RELEASESURL#"$GHURL"}/tag"

    LATESTTAG="$("$WGET" -q "${TAGSURL}" -O - 2> >(grep -v "SSL_INIT") | grep -m1 "$TAGSGREP" | grep -oE "${TAGSGREP}[^\"]+")"
    LATESTVER="${LATESTTAG##*/}"

    LATESTRELEASEURL="${EXPANDEDASSETSURL}/${LATESTVER}"

    SETUPFILE="$("$WGET" -q "${LATESTRELEASEURL}" -O - 2> >(grep -v "SSL_INIT") | grep "exe" | grep -m1 "$SETUPNAME" | grep -oE "${SETUPNAME}[^\"]+")"
    echo "${SETUPFILE}"
}

HMM="$( getLatestGitHubExeVer "HedgeModManager" "https://github.com/thesupersonic16/HedgeModManager" )"
HMMBASE="$( basename "$HMM" )"
echo "$HMMBASE"

I believe HMM has an updater built in from my very brief testing in this issue a month or so ago, but if this is not enough I can specifically add a function that will check for a HMM update and fetch the latest version to overwrite the existing EXE when a user tries to launch HMM with STL.

Thanks for the feedback! :-)

@sonic2kk
Copy link
Owner

sonic2kk commented Nov 2, 2022

Got a branch up with some initial logic to initally download the latest HMM exe from the latest release: https://github.com/sonic2kk/steamtinkerlaunch/tree/hmm-support

Doesn't run HMM yet or anything, this just downloads it to $HOME/.config/steamtinkerlaunch/downloads/hedgemodmanager/HedgeModManager.exe, with some initial logging for download success/fail.

@sonic2kk sonic2kk removed the Non-Steam Game Issues relating to Non-Steam Games launched through the Steam Client label Nov 2, 2022
@sonic2kk
Copy link
Owner

sonic2kk commented Nov 2, 2022

I read through the comment on the HMM Linux issue thesupersonic16/HedgeModManager#219 (comment) and I believe I understand now, sorry for my confusion. Basically, 64bit games need dotnet48 as well to run, but HMM itself also needs dotnet48.

STL has a function I believe to fetch whether a game's executable is 32bit or 64bit. So if a game is 64bit and has been modded with HMM, we can install dotnet48. into the game's prefix automatically. This will add an extra load time, but a user would have to do this step manually (i.e. with Protontricks as outlined in that comment). STL can automate this part.

So that brings me to another question: Is there a way to know if a game has been modded with HMM? Is there any kind of files it creates that STL could check the presence of and go "okay, this 64bit game has some mods, we need to install dotnet48"? If not, STL could store a list of HMM game AppIDs (we do something similar for MO2), and if we're running a "HMM compatible game", when they run HMM while that game is open we'll install dotnet48 into the game's prefix.

But if there's a way to know if a game has been modded with HMM, we could then just install dotnet48 when a user clicks the STL "Play" button.

@sonic2kk
Copy link
Owner

sonic2kk commented Nov 2, 2022

Also just realised there is a GitHub Actions build available for HMM. I think this requires the use of the GitHub API to download, and it has a rate limit, but I could potentially look into adding an option to pull from the latest dev release there (since it could have the latest Linux-specific fixes). Not sure if that's okay to do, and even if it is no promises yet :-) Trying not to get too ahead of myself (though I am a bit excited to be working on this)

@thesupersonic16
Copy link

Basically, 64bit games need dotnet48 as well to run, but HMM itself also needs dotnet48.

Yes, that is right.

Is there a way to know if a game has been modded with HMM? Is there any kind of files it creates that STL could check the presence of and go "okay, this 64bit game has some mods, we need to install dotnet48"?

You can check for d3d11.dll in the game directory if the modloader is installed or check if Codes.dll exist in the mods directory (mods directory can be found by reading cpkredir.ini from the game directory).

I believe HMM has an updater built in from my very brief testing in this issue a month or so ago

It does, but we want to be sure that it is working, if not, you can replace the exe.

Also just realised there is a GitHub Actions build available for HMM. I think this requires the use of the GitHub API to download, and it has a rate limit

HMM uses an external website to allow downloading without using the API directly and authentication. Not sure if you can use it.

@sonic2kk
Copy link
Owner

sonic2kk commented Nov 7, 2022

Been a bit busy lately but I got around to working some more on the implementation. Currently, locally and not pushed to my branch yet, I actually got HMM to run on my laptop!!! No mods tested yet but it installs and opens totally unattended! Take a look:

image

The UI glitches slightly when dragging the window the first time, but it seems to work mostly okay.

It says there are no games found, but this is to be expected I think - I don't have any Sonic games installed on my laptop 😅 In fact I have very few at the moment, but I'll get a couple downloaded.

This is running standalone, in a dedicated Wine prefix. It's the latest stable 7.8-2, but I tested the latest development artifact and it works too. As the official HMM Linux instructions and @KBouder stated, but I totally forgot about, I needed the Winetricks d3dcompiler_47 d3dx9 vcrun2019. Once I installed those, it seems to be working! Though it seems a bit inconsistent right now, but I will test again.

But once I get this consistently working, STL will be able to download and launch HMM without any fiddling with switching Proton versions or using Protontricks. It'll be a simple steamtinkerlaunch hmm start - which will check for updates, download and install HMM (including all the needed Winetricks). On each launch it will then check for any updates.

Been fighting with this since I finished work a few hours ago and I am just very relieved that I actually got it work.


The next steps are:

  1. Testing to ensure HMM can detect games, since it's running in its own dedicated prefix - I think it'll be able to, and if not I could probably do some symlinking to wherever it expects to find game data and make it see games that way.
  2. Install dotnet48 for each 64bit game - My current plan here is that on each launch of HMM, it'll check if any 64bit HMM games are installed (the list is hardcoded in a new STL file called hmmgames.txt) and then install dotnet48 to its compatdata. My thinking here is, a user using HMM through STL isn't going to need to load mods if they've never loaded HMM through STL before playing. They could've loaded it through Bottles or something, sure, but I'll just add a note saying that they should run HMM before running their game. Plus if they're running externally from STL too and have mods, they should've install dotnet48 manually anyway.
  3. Add StatusWindow dialogs to let the user know what's going on (dotnet48 can take a while to install, so letting the user know that it's installing and letting them know when its installing dotnet48 for each game and what game is probably a good idea)
  4. Logging improvements and general cleanup
  5. Find somewhere to put the HMM button on the UI
  6. Steam Deck testing (not sure how STL's managing of Winetricks works on Deck just yet - Given how Vortex works I think it should be fine)

I don't expect a merged implementation to be ready for Sonic Frontiers' launch tomorrow as I had been shooting for (though it's marked as Unsupported on Steam Deck, I have hope), but hopefully in the coming weeks it'll be ready!

@thesupersonic16
Copy link

Oh nice, sounds like it's coming along. Btw do you have any idea how to fix the font?

@sonic2kk
Copy link
Owner

sonic2kk commented Nov 7, 2022

I am not sure how to fix the font, it looks mostly ok to me. There might be a winetrick to get or a way to fix it with Winecfg.

Maybe the corefonts winetrick could fix it or something, I remember historically that could fix some font issues. Maybe as well setting the locale before launching could help, I think Frostworx implemented something like that for Vortex.

I can add that to the list of things to look into 😃

@sonic2kk
Copy link
Owner

sonic2kk commented Nov 7, 2022

Update: I changed where the Winetricks were installed (couldn't get HMM to install again, realised I was installing the Winetricks before the Proton run - which I remembered from other tests didn't work so good with some winetricks) and the fonts are looking better.

image

Does this look """normal""" to you? Keeping in mind that fonts with Wine will rarely look exactly line Windows :-) In other words, is this acceptable or is more investigation needed to improve the fonts? Proton may well come with corefonts or other such font magic (i.e. for game launchers and so on) so maybe this is as good as one can expect. Not sure though 😅


Also, HMM doesn't see Sonic Origins as installed, but it was installed onto my other internal SSD. There's probably other trickery I can do to get HMM to see installed games, but for now it launches and I am happy. I'll do some cleanup and then investigate getting HMM to see other games.

@sonic2kk
Copy link
Owner

sonic2kk commented Nov 8, 2022

So the current state seems to be:

  1. The Z: drive needs to be set to $HOME for the fonts to load correctly - Not sure why this is, but that seems to be the case (corefonts doesn't seem to be required...)
  2. HMM doesn't detect any games currently, tested with Sonic Generations and Sonic Origins. Not sure why yet, still looking into why that is. HMM is running from $HOME/.config/steamtinkerlaunch/downloads/hedgemodmanager/HedgeModManager.exe - Tested with latest stable and latest development
  3. It seems on the initial boots, it shows a run32 error (probably caused by dotnet48) but this is harmless it seems

Since I can't get HMM to detect any games, I haven't been able to test mod support yet. I didn't anticipate this problem, since I think Bottles just runs HMM In its own isolated prefix too? Basically the exact same as what STL is currently doing (it sets up a prefix in $HOME/.config/steamtinkerlaunch/hedgemodmanager/compatdata/pfx).

I'm not very knowledgeable on the inner workings of the framework that HMM uses, but I had a look through the code and how HMM tries to detect if it runs on Linux. The %WINEHOMEDIR% variable seems to be set correctly, I checked in wine cmd. Is there some kind of WIne drive mapping that is set in Bottles that might not be set in a regular Wine/Proton environment? Or is there any kind of symlinking in the prefix that STL could do to help HMM see the games?

@sonic2kk
Copy link
Owner

sonic2kk commented Nov 8, 2022

I had a look in regedit and I had a look at the HMM code, and this section stood out to me: https://github.com/thesupersonic16/HedgeModManager/blob/rewrite/HedgeModManager/Steam.cs#L18-L47

There is an initial check to set the Linux Steam path, which looks correct. But I thought maybe this check was overwriting the path, since those registry keys did exist for me. However I tried removing them and no dice.

@sonic2kk
Copy link
Owner

sonic2kk commented Nov 8, 2022

Not sure what I did but HMM seems to see my games now. It's getting late so I'm not sure what I did to fix it (I downloaded and tried to use the Debug build, that crashed so I switched to stable and it crashed, so I reset my Wine prefix drive mappings and it saw the games - No idea). Stable and latest dev build see the games just fine, though now setting Z:/home/<username> consistently makes HMM crash.

It's too late for me to delve any deeper, I'll try again over the course of the week (with more time so I can create fresh prefixes) and see if I can narrow down the issue and solutions. Seems like it's a configuration issue on my end though.

And once I figure that out, then I can get onto actually trying to mod my games 😎

@thesupersonic16
Copy link

HMM is hardcoded to assume Z is /. Is there another drive that is available? I think E was an option? Mind checking that?

@sonic2kk
Copy link
Owner

sonic2kk commented Nov 8, 2022

Thanks, I think you're correct but I think it's fine now. Not sure what's causing the font issues on my laptop -again, probably configuration problems on my part, because it looks fine on my PC.

I did a fresh STL HMM install on my PC (for the first time, all the prefix work was done on my laptop) and HMM installed fine + had all the right fonts.

Games were still not detected, but after manually removing the Valve registry keys it set up fine and it can see my games!

image

The only game it seems to be missing is Sonic Frontiers, but that isn't in a stable release yet afaik (might check a dev build later just out of curiosity 🙂) - The rest it seems to have found just fine. All games including Sonic Frontiers were detected with 7.8-2-0450a68. There was also a prompt to update the Hedge Mod Loader (?) and that worked fine too. Closing and re-opening HMM seems to work as well, so it should be consistently working.


I am 99% sure there is a command to remove these registry keys, however is the issue something that you feel should be resolved on the HMM side? Once again referring to this block: https://github.com/thesupersonic16/HedgeModManager/blob/rewrite/HedgeModManager/Steam.cs#L18-L47 It seems that when HMM sees these keys, it disregards any Linux paths. Since it assumes Steam is on the home drive first and then goes on to change that to take the keys from the registry. Since these registry keys can be set with Wine/Proton, it overwrites the Linux SteamPath with that of the registry and so then can't find the steamapps folder and the libraryfolders.vdf file to get the library paths. Maybe just wrapping those registry SteamPath checks in an else block would work? That's just my armchair (and coffee-deprived) analysis.

If this is something you would prefer not solve on the HMM side that's fine, maybe there's a technical reason I'm unaware of that means this can't be solved on that end. I can look into a command to remove these keys manually from the registry (since this prefix is only used for HMM that should be fine).


I haven't tested modding any games just yet (and I haven't done any Steam Deck testing yet), but HMM seems my games now and it seems to be in a really good place functionally right now 🥳

@thesupersonic16
Copy link

It seems that when HMM sees these keys, it disregards any Linux paths.

Might be a better idea to add a return after L25 so it does not check the registry keys. None of the guides thats public uses those registry keys from my knowledge. Worst case, we can have an override environment variable.

@sonic2kk
Copy link
Owner

sonic2kk commented Nov 8, 2022

I got automatic installation of dotnet48 into 64bit game prefixes working, now I'm gonna test some mods for Generations and Forces.

This is likely irrespective of using STL, but when you install dotnet48 into a wineprefix, on first launch of an application it'll give a run32 dialog box saying the application could not be started. and if you want to view more information Clicking "No" or clicking the "X" button starts the game like normal and it doesn't show up again on subsequent runs.

Mods Tested So Far

  • Sonic Generations
    • Double Jump
    • Better FxPipeline
    • Soft Shadows
    • Direct3D 11 renderer (needed d3dcompiler_47 - May install this automatically to make it easier for users)
    • Frontiers Sonic

@sonic2kk
Copy link
Owner

sonic2kk commented Nov 9, 2022

Save for some UI integration and downloading the latest dev release, the Hedge Mod Manager implementation in SteamTinkerLaunch is fully functional on the Linux desktop! Here's what it does when a user runs steamtinkerlaunch hmm install:

  1. Downloads latest stable HMM if not installed before (if installed, check for and download an updated exe)
  2. Install dotnet48 d3dx9 vcrun2019 d3dcompiler_47 winetricks into the HMM prefix
  3. Remove Steam registry keys so that HMM can find installed games on the correct path
  4. Check if any 64bit Sonic games are installed from a hardcoded list, and install dotnet48 into those games' prefixes automatically
  5. Set up any other Winetricks that popular mods might need - Currently this only installs d3dcompiler_47 for Sonic Generations, but if any other mods need any Winetricks, I can add those easily (the function I made was designed with adding Winetricks for any HMM game that might need them)
  6. Profit! HMM runs!

This work is still on my hmm-support branch, but once I add dialog windows letting the user know what's going on with installation, I'll get it merged in and deal with Steam Deck testing, adding a UI button somewhere and other customization options later, sometime before STL v12.

Woohoo, I'm very happy with how this turned out and I hope once it's merged in, Sonic fans find it useful 🙂

@thesupersonic16
Copy link

If you want I could make it read the Steam path from an environment variable ignoring the rest if it exists. You want me to make this change? You would have to use the GitHub Actions build until when 7.9 gets released if we do.

Anyways all this is sounding pretty good, and would be amazing to have it all automated.

@sonic2kk
Copy link
Owner

sonic2kk commented Nov 9, 2022

If you want I could make it read the Steam path from an environment variable ignoring the rest if it exists. You want me to make this change? You would have to use the GitHub Actions build until when 7.9 gets released if we do.

It isn't necessary for SteamTinkerLaunch to work with HMM anymore, I automated the removal of the registry keys 😄 So I don't think it's a needed change.

Anyways all this is sounding pretty good, and would be amazing to have it all automated.

Thank you! It's been a lot of fun too 😃 Though it's still not ready for prime time user testing yet: if you'd like to test yourself you can clone the STL repo, checkout the hmm-support branch, install with sudo make install and then run steamtinkerlaunch hmm start. It might take a while since it has to install a bunch of winetricks (all the winetricks for HMM to run + dotnet48 for any installed 64bit games) but HMM should start. I've tested on my laptop and PC. When you're done you can fully uninstall STL from your system with sudo make uninstall from the cloned STL folder, and delete ~/.config/steamtinkerlaunch.

You can also check /dev/shm/steamtinkerlaunch to see the logging and more detail about what exactly the installation is doing - The notifier messages are intentionally kept "brief" (i.e. Downloading/Installing HMM , etc). The logs give more detail about the wine version being used, the download URL and location and all that.

You absolutely don't have to, I'm just letting you know if you'd like to test it that the option is there, though the "User Experience" is not totally finalised yet and there's no implementation of fetching the latest Actions build yet :-) I'm hoping in the next few days to finish off the last parts of the implementation and finish off my own testing, and then merge it to master to get some broader user testing.

@sonic2kk
Copy link
Owner

Just tested Sonic Origins (which afaik is 64bit) and the Origins Blur fix mod and the auto-save icon code worked on my laptop and my desktop. It did warn me on first launch that "the application could not be started" - This appears to be caused when dotnet48 is installed into a prefix. It happens with pretty much every application the first time you launch it after installing that Winetrick. I don't know yet if there's a way to solve this problem but to me it's very minor, I can just add a note somewhere on the wiki saying that this is a non-issue.


I tested writing some code to install the latest development artifact of HedgeModManager and it kind of works - It gets the URL correctly but it can't download it. Maybe if it has an GitHub Personal Access Token in the request header it'll work, but I'd need to add a part in the UI to accept a GitHub auth token. I'll need to experiment to make sure that definitely works though. If it doesn't work, I may not be able to have automatic installation of a HMM dev release.


The last two things I need to do then are add some UI config options for the HMM Proton version/prefix location (defaults are fine for 99% of users), and the big one: test on Steam Deck. I don't foresee any major problems on Steam Deck - The biggest concern is that STL won't automatically set up Winetricks. No big deal if it doesn't, STL has an option to install it locally and it should just be a case of writing that in. The rest of the logic should all work fine.


Once HMM support is merged into master I'll look more into setting up support for using the latest dev version (and a UI option to switch between them) and then figure out some way to put HMM on the UI. Right now adding an extra main menu button creates an uneven number of buttons so the UI is off-centered. I have an idea for another button I want to add, so maybe I'll add both of those at the same time.

UI stuff will be added before a full STL release, but once it's in master a user can just run steamtinkerlaunch hmm start and it'll do all the legwork for them. They don't even need to use STL as a compatibility tool, thanks to the logic in HMM it can just start the game through Steam with its Play button! And of course not using HMM at all works, meaning in Steam Deck Game Mode a user should be able to just press play 😄

Nearly there, aside from Steam Deck testing there's just some minor things left.

@thesupersonic16
Copy link

You could look into using nightly.link for downloading artifacts, this is what HMM uses in its built in updater.

@sonic2kk
Copy link
Owner

That worked like a charm, thank you so much! As of 6175dd0, STL can now download the latest development artifact and a user can use the STL UI to switch between the Stable and Nightly channel - and once a new release or development artifact is down it'll know to download the latest.

If a user is on the stable channel it'll check for an updated release tag (it stores the last successfully downloaded release's tag). If it's on the nightly channel, it'll store the commit SHA that the artifact was built from.


Really all that's left now is Steam Deck testing, and then getting a button on the UI somewhere for a user to start HMM (starting will automatically check if the latest version is downloaded and manage fetching it + all the required setup). I had a look at the logic STL uses and it should automatically fetch and setup Winetricks locally on Steam Deck - Users haven't reported any problems getting Vortex installed on Steam Deck this way so I assume it would work for HMM.

There is still an outstanding annoyance that 64bit games will show a run32dll error dialog before each start if HMM was started before the game, because of weirdness with the Proton version switching (the HMM Proton version and the game's Proton version) and the dotnet48 Winetrick. I'm looking into potential ways to either not show this dialog or fix the problem - I can't find a fix but I'm wondering if there's a way to not show a dialog like this on start.

So if HMM starts up on my Steam Deck I'm gonna say this is ready to merge in! It probably won't have a button on the UI in master for a while but it will in the next major release, but users can install and run it with steamtinkerlaunch hmm start from the command line.

Once it's merged, would it be alright if I made a post on the HMM Linux + Steam Deck issue mentioning that STL now has support? I wouldn't want to come in and "advertise" or anything, but getting the word out could be nice. I'm planning to add some documentation to the STL wiki once merged too, the HMM wiki's Linux page could have a note saying that SteamTinkerLaunch supports fully automated installation of HMM with additional tweaks to improve mod support for specific games (like automatically installing d3d_compiler47 for Generations to support the D3D11 mod).


Thanks a ton for all the input here and of course the permission to include HMM. It was a lot of fun to work on and I know personally I'm going to get a lot of use out of a one-click install :-)

@thesupersonic16
Copy link

Feel free to mention it on the issue and the wiki.

@sonic2kk
Copy link
Owner

sonic2kk commented Nov 11, 2022

As of ce9b196, SteamTinkerLaunch now has Hedge Mod Manager support for Linux Desktop and Steam Deck! 🎉

Closing this issue as this has now been solved. Thanks @KBouder for the feature suggestion, and a huge thank you @thesupersonic16 + the rest of the HMM folks for the mod manager, permission to include HMM, and all the collaboration here. You guys rock!

I'll make a post on the issue tracker shortly and update the HMM wiki + the STL wiki. Currently on Steam Deck, STL automatically updates to the latest git, so any STL Steam Deck users should have access to this immediately :-)

@KBouder
Copy link
Author

KBouder commented Jan 1, 2023

I've been caught up with work and life, but I'm happy to see that this feature made it's way in to STL. Thank you @sonic2kk and @thesupersonic16 for helping make this happen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants