Skip to content

Command prefix for a game #393

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

Open
Mikaka27 opened this issue Feb 17, 2025 · 7 comments
Open

Command prefix for a game #393

Mikaka27 opened this issue Feb 17, 2025 · 7 comments
Labels
enhancement New feature or request

Comments

@Mikaka27
Copy link

Hi,
I would like to run a game offline with umu (from lutris but maybe that's beside the point).

Since umu requires internet to function, I'm looking for a way to add a command prefix just before game is executed, I've tried to set PROTON_VERB to custom command, but it's validated and only few possibilities are allowed.
I'm looking for a way to inject something here:

umu-launcher/umu/umu_run.py

Lines 342 to 352 in cbe41c9

return (
entry_point,
"--verb",
env["PROTON_VERB"],
"--",
shim,
proton,
env["PROTON_VERB"],
env["EXE"],
*opts,
)

Preferably this would be a program installed on a host that is accessible to umu.
Is there a way to do such a thing? Or changes in the code are required for this?

@R1kaB3rN
Copy link
Member

Since this issue stems from the basis of umu-launcher requiring an internet connection and not being able to launch offline, I'll need to clarify that having an internet connection is only a requirement in that umu-launcher needs to fetch a 200MB+ archive at first launch. Afterwards, having an internet connection becomes not strictly required. In umu-launcher v1.2.0+, the program will not hang indefinitely when the network suddenly drops and will proceed to launch the executable. In fact, we have a test for this in our CI where it's proven launching offline is possible. Therefore, you should not need to add a command prefix.

Other than that, the only other case that I'm aware of where an internet can feel like a requirement is in a network configuration where the system's wlan or eth interface are non-operational, while WireGuard interfaces are operational. In this case, umu-launcher will hang indefinitely.

@R1kaB3rN R1kaB3rN added invalid This doesn't seem right question Further information is requested labels Feb 18, 2025
@R1kaB3rN
Copy link
Member

Closing as invalid and as duplicate on the basis of not being able to launch offline. Launching offline is possible other than the above exception. If you can disprove that, you'll need to list the steps to reproduce it.

To launch offline and skip the update checks, you can set UMU_RUNTIME_UPDATE=0 and assign the absolute path to Proton directory to PROTONPATH which has been specified in umu(1). Since you stated you use Lutris, I suggest you make a request where the client sets UMU_RUNTIME_UPDATE=0 when the system's network becomes unreachable.

@Mikaka27
Copy link
Author

That's not exactly the same issue, since I wouldn't require umu to work offline, only the game it launches. Setting UMU_RUNTIME_UPDATE would also disable runtime updates in the future (I guess that's what's it's doing besides skipping initial download).

This option would be useful for convenience, since you wouldn't need to run it once with internet than again without it. And you still would get runtime updates. Would a change like this be accepted as a PR in the future?

@loathingKernel
Copy link
Contributor

loathingKernel commented Feb 18, 2025

I do not like this, for a couple of reasons. First of all it sounds like an XY problem, you have not explained why you want to do it, or given an example, thus far. Second is that programs on the host are not visible in the runtime in their usual paths. They also won't necessarily work in the runtime, simple scripts will, things that link to system libraries have a moderate chance of failing.

For now you could achieve this by using UMU_NO_PROTON=1 to disable proton, and then construct an appropriate command that will run whatever you want it to run, even something using proton. Another option would be a custom local proton version that will run your program before launching the proton script.

That being said, without a concrete example I don't see how this is something that umu should implement, since it complicates things unnecessarily to accommodate for limited edge-cases. I think given the alternatives, they should be explored first on a per-case basis.

@Mikaka27
Copy link
Author

Sure I will explain my use case. I would like to prevent game's ability to 'phone home' for privacy reasons. For example games downloaded from gog.com should work offline, but you can still find cases that they try to 'phone home'.
One example on the forums: https://www.gog.com/forum/general/game_keeps_trying_to_phone_home/page1

Checking every game manually would be too cumbersome, so I would like some automated way to do it.
Before umu I could achieve this in lutris using command prefix, which is a script I put on host.
These are the contents of that script:

~ >>> cat /usr/local/bin/no-internet                                                           
#!/bin/bash

exec firejail --env=LD_PRELOAD=$LD_PRELOAD --ignore=noroot --noprofile --net=none --dbus-user=filter --dbus-user.talk=com.feralinteractive.GameMode "$@"

So I'm allowing the game to only talk to gamemode over dbus and that's it.
But it turns out to be problematic since umu itself needs internet connection to function.
I'm not sure if firejail would even work in the container, what kind of container is that?
Do you have control over what is mounted where in the container or not?

Another alternative to be implemented besides things you mentioned, would be a way to run umu-run twice (with pre-launch script in lutris or similar option), once for setting up the runtime, and second time (without internet) for launching the actual game.
I don't know if currently there is a possibility to execute umu-run and make it do everything besides launching actual game.
I'm asking because I think (but I may be wrong) that correct executable must be set, for it to prepare quirks for the specific game, or maybe this part can run without internet as well.

@R1kaB3rN R1kaB3rN reopened this Feb 18, 2025
@R1kaB3rN
Copy link
Member

That makes sense. I would have appreciated though if you had clearly detailed your use case in your first post.

While not intended for this use case specifically, I already have something that‘ll support this as a consequence and more.

@R1kaB3rN R1kaB3rN added enhancement New feature or request and removed invalid This doesn't seem right question Further information is requested labels Feb 18, 2025
@Mikaka27
Copy link
Author

Thank you for reopening, I will remember to more clearly explain use cases in the future :)

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

3 participants