├── LICENSE ├── README.md └── protonhax /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2018, Xaryphon 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # protonhax 2 | 3 | Tool to help running other programs (i.e. Cheat Engine) inside Steam's proton. 4 | 5 | ## Usage 6 | Set the steam game launch options to `protonhax init %COMMAND%` 7 | 8 | On your Steam Library: 9 | - Right-click the game > Properties > General. 10 | - Set Launch Options as `protonhax init %COMMAND%`. 11 | 12 | Now, you can use your terminal to run the following commands: 13 | 14 | - To list all running appids use\ 15 | `protonhax ls` 16 | 17 | - To run a program with proton use\ 18 | `protonhax run [args...]`\ 19 | NOTE: The PATH variable is ignored 20 | 21 | - To run cmd.exe use\ 22 | `protonhax cmd ` 23 | 24 | - To run a program natively with the environment variables that were used to launch the game originally use\ 25 | `protonhax exec [args...]`\ 26 | NOTE: The PATH variable is ignored 27 | 28 | ## Installation 29 | 30 | **protonhax** is currently a single bash script, you just need to add it to your $PATH. 31 | 32 | 1. Either clone our repo `https://github.com/jcnils/protonhax.git`, or download the source from our [release page](https://github.com/jcnils/protonhax/releases) 33 | 2. Copy the **protonhax** file to where you preffer and give it permission to execute: 34 | - Example of locations `$HOME/.local/bin/protonhax`, `/usr/bin/protonhax`. They need to be on your $PATH 35 | - Permission `chmod 755 protonhax`. 36 | 37 | ### Arch Linux 38 | - https://aur.archlinux.org/packages/protonhax 39 | - https://aur.archlinux.org/packages/protonhax-git/ 40 | 41 | ## Debug and Troubleshoot 42 | 43 | ### Enable *protonhax* log 44 | 45 | Open the `protonhax` file and add to the second line 46 | ```sh 47 | set -x 48 | exec >/tmp/protonhax.$$.log 2>&1 49 | ``` 50 | It will save *protonhax* debug log into `/tmp/protonhax.*.log` 51 | 52 | ### $PATH 53 | 54 | Make sure *protonhax* is in your $PATH. 55 | 56 | Open a terminal and run `protonhax`, if you do not see instructions, go back to the installation process. 57 | 58 | If your game does not start, make sure Steam can see and access your **$PATH**. 59 | 60 | Depending on how you install and execute Steam, Steam will only have access to a few locations. Like using **distrobox** or **flatpak**. Please check the issues page for `flatpak` workaround. 61 | 62 | If your Steam is host installed, starting Steam from a terminal will make sure it can see your $PATH 63 | 64 | ### Steam 65 | 66 | You can check Steam's log - location will vary depending on how you installed it (check their docs). Or start Steam from a terminal and look for the messages. 67 | 68 | When you run *protonhax*, e.g. `protonhax cmd 12345*, you should see in the logs : 69 | 70 | ``` 71 | Adding process 44444 for gameID 12345 72 | Adding process 44445 for gameID 12345 73 | ``` 74 | 75 | The process number will vary, and gameID will match to your game. 76 | 77 | ### Proper file path - CMD 78 | 79 | You might be having indications that `protonhax` cannot find the program you are trying to execute. That can be an issue with file path solving. 80 | 81 | Try to run `protonhax cmd 12345`to confirm if it works. 82 | 83 | If it works, you might want to try to store your program in a path with no spaces and special characters, and pass the full path to `protonhax` to make sure. 84 | 85 | ### Issues page. 86 | 87 | You can check the issue pages for similar problems, and don't be shy to open one in case you need help troubleshooting. It always helps to make *protonhax* better. 88 | 89 | ## Contributing 90 | Contributions are always welcome! Especially if they are packages for other distributions. 91 | 92 | ## Running programs BEFORE the game. 93 | 94 | Protonhax is not necessary, you can set your launch options to switch paths. Example: 95 | 96 | `eval $(echo "protonhax init %command%" | sed "s|path/to/game.exe|path/to/your.exe|")` 97 | [More](https://github.com/jcnils/protonhax/issues/5#issuecomment-2053773221) 98 | 99 | ## TODO 100 | 101 | - [ ] Flatpak version for Steam Flatpak 102 | - [ ] Nix Packages 103 | - [ ] Packages for other Linux distributions. 104 | - [ ] New repo for *protonhax* GUI 105 | -------------------------------------------------------------------------------- /protonhax: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | phd=${XDG_RUNTIME_DIR:-/run/user/$UID}/protonhax 4 | 5 | usage() { 6 | echo "Usage:" 7 | echo "protonhax init " 8 | printf "\tShould only be called by Steam with \"protonhax init %%COMMAND%%\"\n" 9 | echo "protonhax ls" 10 | printf "\tLists all currently running games\n" 11 | echo "protonhax run " 12 | printf "\tRuns in the context of with proton\n" 13 | echo "protonhax cmd " 14 | printf "\tRuns cmd.exe in the context of \n" 15 | echo "protonhax exec " 16 | printf "\tRuns in the context of \n" 17 | } 18 | 19 | if [[ $# -lt 1 ]]; then 20 | usage 21 | exit 1 22 | fi 23 | 24 | c=$1 25 | shift 26 | 27 | if [[ "$c" == "init" ]]; then 28 | mkdir -p $phd/$SteamAppId 29 | printf "%s\n" "${@}" | grep -m 1 "/proton" > $phd/$SteamAppId/exe 30 | printf "%s" "$STEAM_COMPAT_DATA_PATH/pfx" > $phd/$SteamAppId/pfx 31 | declare -px > $phd/$SteamAppId/env 32 | "$@" 33 | ec=$? 34 | rm -r $phd/$SteamAppId 35 | exit $ec 36 | elif [[ "$c" == "ls" ]]; then 37 | if [[ -d $phd ]]; then 38 | ls -1 $phd 39 | fi 40 | elif [[ "$c" == "run" ]] || [[ "$c" == "cmd" ]] || [[ "$c" == "exec" ]]; then 41 | if [[ $# -lt 1 ]]; then 42 | usage 43 | exit 1 44 | fi 45 | if [[ ! -d $phd ]]; then 46 | printf "No app running with appid \"%s\"\n" "$1" 47 | exit 2 48 | fi 49 | if [[ ! -d $phd/$1 ]]; then 50 | printf "No app running with appid \"%s\"\n" "$1" 51 | exit 2 52 | fi 53 | SteamAppId=$1 54 | shift 55 | 56 | source $phd/$SteamAppId/env 57 | 58 | if [[ "$c" == "run" ]]; then 59 | if [[ $# -lt 1 ]]; then 60 | usage 61 | exit 1 62 | fi 63 | exec "$(cat $phd/$SteamAppId/exe)" run "$@" 64 | elif [[ "$c" == "cmd" ]]; then 65 | exec "$(cat $phd/$SteamAppId/exe)" run "$(cat $phd/$SteamAppId/pfx)/drive_c/windows/system32/cmd.exe" 66 | elif [[ "$c" == "exec" ]]; then 67 | if [[ $# -lt 1 ]]; then 68 | usage 69 | exit 1 70 | fi 71 | exec "$@" 72 | fi 73 | else 74 | printf "Unknown command %s\n" "$c" 75 | usage 76 | exit 1 77 | fi 78 | --------------------------------------------------------------------------------