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

Shorthand code for launching an exe file inside a running game #238

Open
free-storage opened this issue Jul 14, 2023 · 15 comments
Open

Shorthand code for launching an exe file inside a running game #238

free-storage opened this issue Jul 14, 2023 · 15 comments

Comments

@free-storage
Copy link

I need to run the game trainer. How to do it with as little code as possible. To not install the entire library. I only need the functionality of launching an exe file.

protontricks <steam_appid> shell
path/to/your/proton ~/Downloads/trainer.exe

Is it possible to get a short script that can do this?

@Matoking
Copy link
Owner

Matoking commented Jul 18, 2023

If you can install Protontricks and your distro is new enough, protontricks-launch --no-bwrap --appid <appid> <exe path> should do the trick.

But going by "not install the entire library" I guess you want to avoid installing Protontricks unless necessary. In this case, you could look into Steam Runtime docs here for running commands inside a container. This requires more fiddling and you have to change the app startup parameters, though, and I have tested it only briefly.

After changing the launch options to STEAM_COMPAT_LAUNCHER_SERVICE=proton %command%, you could try running the following:

/path/to/steamapps/common/SteamLinuxRuntime_sniper/pressure-vessel/bin/steam-runtime-launch-client --bus-name=com.steampowered.App<APP_ID_HERE> -- wine /path/to/exe

Launching a Wine application that can interact with a running Proton app has also been discussed in this thread:

#233 (comment)

@free-storage
Copy link
Author

@Matoking I start the game in the usual way. And I want to run a game trainer inside the game. What command should be run for this? Right now I'm using SteamTinkerLaunch. But I don't like this solution, because it makes its settings and games run worse than on normal launch. All I need is to start the game in the usual way and run the game trainer (exe file) inside the game.

Something like this:

  1. Launching the game in the usual way from the steam client
  2. Run .sh script: launch-inside <steam_appid> ~/Downloads/trainer.exe
  3. Inside the game, the trainer will start in the second window

@Matoking
Copy link
Owner

Matoking commented Jul 19, 2023

I listed the two options in the previous comment.

I updated the first one since it was missing the --appid parameter. protontricks-launch --no-bwrap --appid <appid> <exe path> should be enough if you're using a non-Flatpak installation and your distro is new enough. Flatpak version of Protontricks works in its own sandbox, so this likely doesn't work.

The second option is:

  1. Change the launch options to STEAM_COMPAT_LAUNCHER_SERVICE=proton %command% for the game you want to run a trainer for.
  2. Launch the game, and keep it running.
  3. Run /path/to/steamapps/common/SteamLinuxRuntime_sniper/pressure-vessel/bin/steam-runtime-launch-client --bus-name=com.steampowered.App<APP_ID_HERE> -- wine /path/to/trainer.exe using a script or something else. The app should run inside the same container as the game, and should have access to game memory (required for trainers and similar tools).

You can find Steam Linux Runtime - Sniper in the Tools section of your Steam library. Open its installation directory under Properties -> Installed Files -> Browse and adjust the path in the second command accordingly.

For comparison, a complete command would look something like this:

/home/matoking/.steam/steam/steamapps/common/SteamLinuxRuntime_sniper/pressure-vessel/bin/steam-runtime-launch-client --bus-name=com.steampowered.App1160220 -- wine /home/matoking/Downloads/trainer.exe

Hope this helps!

@free-storage
Copy link
Author

free-storage commented Jul 19, 2023

@Matoking Thank you! I will test.

Can I manually install Protontricks to the directory I need? For example:

/myproject/lib/protontricks-launch
/myproject/bin/trainer.exe
/myproject/run.sh

run.sh contains lib/protontricks-launch --no-bwrap --appid <appid> bin/trainer.exe

And what if the game is not a Steam game? If the game does not have a Steam App ID.

@free-storage
Copy link
Author

free-storage commented Jul 19, 2023

The second option is:

  1. Change the launch options to STEAM_COMPAT_LAUNCHER_SERVICE=proton %command% for the game you want to run a trainer for.
  2. Launch the game, and keep it running.
  3. Run /path/to/steamapps/common/SteamLinuxRuntime_sniper/pressure-vessel/bin/steam-runtime-launch-client --bus-name=com.steampowered.App<APP_ID_HERE> -- wine /path/to/trainer.exe using a script or something else. The app should run inside the same container as the game, and should have access to game memory (required for trainers and similar tools).

Not working:

(125)(deck@steamdeck ~)$ sudo /home/deck/.steam/steam/steamapps/common/SteamLinuxRuntime_sniper/pressure-vessel/bin/steam-runtime-launch-client --bus-name=com.steampowered.App465200 -- wine /home/deck/Desktop/trainer/trainer.exe

steam-runtime-launch-client[11597]: E: Can't find session bus: Command line `dbus-launch --autolaunch=43edbcd8b22c4fd78a3929799c67f53f --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch requested, but X11 support not compiled in.\nCannot continue.\n

And if it is executed without SUDO, then it complains that --bus-name is not correct

@Matoking
Copy link
Owner

Try running the following command without sudo while the Steam app is running:

/home/deck/.steam/steam/steamapps/common/SteamLinuxRuntime_sniper/pressure-vessel/bin/steam-runtime-launch-client --list

This should print a list of bus names you can use with --bus-name. You can then try running the previous command again without sudo using one of the bus names. Even if it did work using sudo, running the command as root could cause file permissions to get messed up and we don't want that.

Also, there's a chance the Soldier version of Steam Runtime is being used for your Steam app depending on the Proton version; in this case, try substituting SteamLinuxRuntime_soldier for SteamLinuxRuntime_sniper and check if that works.

@free-storage
Copy link
Author

I launched the game and entered the command but the game is not in this list. Why is that?

(deck@steamdeck ~)$ /home/deck/.steam/steam/steamapps/common/SteamLinuxRuntime_soldier/pressure-vessel/bin/steam-runtime-launch-client --list
--bus-name=org.freedesktop.portal.Flatpak
--bus-name=org.freedesktop.Flatpak

(deck@steamdeck ~)$ /home/deck/.steam/steam/steamapps/common/SteamLinuxRuntime_sniper/pressure-vessel/bin/steam-runtime-launch-client --list
--bus-name=org.freedesktop.portal.Flatpak
--bus-name=org.freedesktop.Flatpak

@Matoking
Copy link
Owner

How have you installed Steam? Is it a native package or the Flatpak version? The method likely won't work with the latter.

Also, are you using Steam's own Proton for the game in question, or is it a third-party release of Proton such as Proton-GE?

@free-storage
Copy link
Author

@Matoking I have Steam Deck. I didn't install Steam. It is installed automatically.

@Matoking
Copy link
Owner

I don't have a Steam Deck, so I can't check what could be happening here. One thing you could double-check here is that the launch options are set to STEAM_COMPAT_LAUNCHER_SERVICE=proton %command%., otherwise the game-specific bus won't show up.

@free-storage
Copy link
Author

free-storage commented Oct 30, 2023

If you can install Protontricks and your distro is new enough, protontricks-launch --no-bwrap --appid <appid> <exe path> should do the trick.

How to download only the protontricks-launch cli file? For example, I want to place it in the /home/deck/Desktop/test directory and run /home/deck/Desktop/test/protontricks-launch --no-bwrap --appid <appid> <exe path>

@Matoking
Copy link
Owner

If you can install Protontricks and your distro is new enough, protontricks-launch --no-bwrap --appid <appid> <exe path> should do the trick.

How to download only the protontricks-launch cli file? For example, I want to place it in the /home/deck/Desktop/test directory and run /home/deck/Desktop/test/protontricks-launch --no-bwrap --appid <appid> <exe path>

protontricks-launch is installed alongside protontricks and uses it behind the scenes; you can't install just protontricks-launch.

As covered earlier, Flatpak version of Protontricks works in its own sandbox and cannot access game memory.

Instead, since you're on a Steam Deck, you could try unlocking the file system; see here under "What if I want to do more than what's available by flatpak?". This is an option more intended for power users and you can potentially mess up your Deck badly enough that you'll have to use the recovery instructions to fix it. If you're OK with that, see here for the commands to run.

$ sudo pacman -S python-pip python-pipx python-setuptools python-virtualenv winetricks
$ pipx install protontricks

After that, protontricks and protontricks-launch should be available as-is, or in ~/.local/bin (eg. /home/deck/.local/bin/protontricks) if you need to use an absolute path.

If you want to have protontricks-launch at /home/deck/Desktop specifically (though this should be unnecessary), you can create a symlink:

ln -s /home/deck/.local/bin/protontricks-launch /home/deck/Desktop/protontricks-launch

Just remember that you will have to repeat this whenever the SteamOS image is updated.

@free-storage
Copy link
Author

free-storage commented Oct 30, 2023

@Matoking Thank you.

Is there a way to launch the game via console with this STEAM_COMPAT_LAUNCHER_SERVICE=proton %command% parameter? To not enter this parameter in the game properties.

Example: steam -applaunch <appID> "STEAM_COMPAT_LAUNCHER_SERVICE=proton %command%"
Or: steam steam://rungameid/<appID>/STEAM_COMPAT_LAUNCHER_SERVICE=proton %command%/

But it doesn't work.


Or is there some kind of API to change the Launch Options via the console?

Example: steam -appconfig <appID> -launchOptions "STEAM_COMPAT_LAUNCHER_SERVICE=proton %command%"

@free-storage
Copy link
Author

free-storage commented Nov 1, 2023

@Matoking How to reproduce this command protontricks-launch --no-bwrap --appid <appid> <exe path> via Sirmentio/protontricks? protontricks APPID COMMAND<-??? or winetricks COMMAND<-???

@free-storage
Copy link
Author

@Matoking I ran this command protontricks-launch --no-bwrap --appid <appid> <exe path>. But it opened the exe file in its own container and not in the game container. I need to open the exe in the container with the game as this command does it /home/deck/.steam/steam/steamapps/common/SteamLinuxRuntime_sniper/pressure-vessel/bin/steam-runtime-launch-client --bus-name=com.steampowered.App<appid> -- wine <exe path>

Help me please

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

No branches or pull requests

2 participants