-
-
Notifications
You must be signed in to change notification settings - Fork 449
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: Command-line Arguments when Launching Games via Protocol #4182
Comments
Hey there, I've just opened a PR to resolve this issue. Please check it out, feel free to ask (either here or on Discord) if there are any questions. I should note that if you want to pass multiple arguments, you will need multiple |
Acknowledged. Thank you. I may have a quick look afterwards around Saturday or late Friday. But it sounds good to me 👍 |
Oh, no rush at all! Have a good one |
Hello again. Since it was Christmas and all, I decided in the end to wait a while to report back. I figured the folks here most likely develop the launcher at the own time out of fun and passion; in the same way, a bunch of us (myself included) do mod stuff, after hours. I didn't want anyone to feel pressured (as there's a slightly bigger entity behind me), so I decided to wait till everyone's had their fun and are well rested. In any case, I had a quick go with the PR yesterday afternoon; here's some quick impressions. Works Like a CharmPassing the actual parameters works like a charm, pretty much solid there. Integration against the PR took around 10 minutes, I had to change the signature of an API if (install.Store == GameStore.GOG
&& install.LocatorResultMetadata is HeroicGOGLocatorResultMetadata gogLocatorResultMetadata)
{
// Assemble the new format Heroic launch string.
// TODO: Support non-GOG stores, currently GameFinder doesn't detect these, so we have
// no way to write the code with alternate runner.
var idAsNeutralString = gogLocatorResultMetadata.Id.ToString(CultureInfo.InvariantCulture);
var baseString = new StringBuilder($"heroic://launch?&appName={idAsNeutralString}&runner=gog");
foreach (var argument in arguments)
{
baseString.Append("&arg=");
baseString.Append(argument);
}
// Note(sewer):
// We must not canonicalize else Uri injects a backslash after `launch` in string, breaking the command.
var uri = new Uri(baseString.ToString(), new UriCreationOptions()
{
DangerousDisablePathAndQueryCanonicalization = true,
});
// runs `uri` with `xdg-open`
var process = await _osInterop.OpenUrl(uri, fireAndForget: false, cancellationToken: cancellationToken, logOutput: true);
} C# for reference. This was fairly simple. In C# I had to specifically set Heroic GUI SpawnLaunching through the protocol spawns the GUI, with no proper way to currently suppress this (I also reviewed the code in the PR, as another set of eyes). It's a very minor, low priority convenience thing but I imagine some end users down the road may want to suppress the GUI from popping up in front. I haven't looked how difficult it would be to do currently. Say you're on a tiling WM, clicking 'launch' in an external application may bring up 2 windows instead of 1, which is a problem in the case that a launched game does not go fullscreen. Only a very minor thing. AppImage Didn't Register
|
Ah, I see what has gone wrong here. I did actually remove GUI hiding code in that PR, thinking it was unused.
That's (I believe) one of the reasons Heroic doesn't use the protocol. HeroicGamesLauncher/src/backend/main.ts Lines 415 to 423 in 74d64b6
I'll look into why that's not working. For now, honestly, most people don't use the AppImage (at least as their main Heroic installation), so it's gonna work fine for most users.
I see, that shouldn't be too hard (good thing someone made the new protocol format easily expandable). Might end up doing that in another PR though |
Yeah, chances are user will get it from their package manager, but there's always that edge case that'll show up. Worst case scenario, we can always just manually write it to You normally can get the path to the non-mounted AppImage file via the APPIMAGE Environment Variable. |
I don't think it's possible to register an app image as a url handler because the url handler executable is meant to be something more permanent (and not something that can be easily removed like an app image) |
Many years ago, I shipped (and still do ship) a piece of software with a similar problem on Windows. A user can place it anywhere, move it at any time, and (in some rare cases) even have multiple copies. In my case, I simply opted to update the path to the handler on every boot, if necessary. The main problem really is cleaning up after the user removes the AppImage; but that's also true with config files in any piece of software in general. Removing a handler would just be part of any existing cleanup logic. Note: Delayed response by 1h because GitHub was having site issues stopping me from commenting. |
Windows works differently than Linux :p |
The problem is the same however:
People will always have different opinions for everything, but in my personal opinion at least, when a user installs an application like Heroic they should expect it to 'just work'. Should a user be one of the rare few that decides to install the AppImage, be it because:
Or for any other reason, their experience as a user should be comparable. If (as an alternative example), someone made a browser extension that allows you to start downloads from GOG within a browser, and Heroic had a protocol call to support this, it should be expected that this works out of the box after install, regardless of the user's install method. It is unreasonable to ask that users manually have to write There are obviously some minor caveats, e.g. |
I guess the actual issue then is that electron doesn't know how to create the desktop file, and i think it's actually generated beforehand by electron-builder, so this should be fixed electron side in that case |
Hey there, Heroic team! 👋
Some of you are familiar already; but for the others. I'm one of the folks working on
the Nexus Mods app (a Cross Platform, GPLv3 Mod Manager) funded by Nexus Mods.
And, a while back we've added support for GOG games by integrating with Heroic;
in the hopes to make modding on Linux more accessible to a typical user.
That said, thank you for all your work.
What's missing?
It seems there's currently no way to pass command line arguments when launching
games through Heroic.
Looking at src/backend/protocol.ts#L104,
which I believe is the entry point, it seems the heroic protocol doesn't support this yet.
Why we need this
When we launch games from within the App, we actually request the store / user's installation method to start the process
whenever possible. People hitting 'launch game' via the App actually request Heroic itself to launch it (
heroic://launch/
).Launching via Heroic ensures the end user's preferences for things like WINEPREFIX, Wine/Proton version etc. are respected.
Some games however may need specific command line arguments to work properly with mods.
Some good examples:
Mount & Blade II: Bannerlord
: We need to specify the mods to be loaded via commandline args; and whether to boot singleplayer/multiplayer./forcenetcore
to be able to boot the game at all!!Cyberpunk 2077
: If the user is using REDmod (CDPR's 1st party mod loader/tool), we need to pass the set of mods to 'deploy' (compile) to their CLI.What we're thinking
It would be helpful if it were possible to pass additional launch arguments when starting games through Heroic's protocol.
Currently the protocol uses the following form:
It could be extended to something like:
With the
commandLineArgs
section being optional.Or alternatively:
We're happy to help out with this if you need any support from us - just let us know!
And of course, thanks for your time 🤞
The text was updated successfully, but these errors were encountered: