simplify and improve
This commit is contained in:
1 parent
b731e643c4
commit
d1bf3e78e0
5 files changed
+46
-94
No files matched your search
@@ -29,7 +29,6 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install -r requirements.txt
|
|
||||||
pip install pyinstaller
|
pip install pyinstaller
|
||||||
|
|
||||||
- name: Build with PyInstaller
|
- name: Build with PyInstaller
|
||||||
|
|||||||
@@ -1,32 +1,26 @@
|
|||||||
# Trials-Rising-Steam-Deck-Patch
|
# Trials-Rising-Steam-Deck-Patch
|
||||||
Disabling Easy Anti-Cheat in trialsrising.exe so that the game works on Linux + Steam Deck
|
Disabling Easy Anti-Cheat in trialsrising.exe so that the game works on Linux + Steam Deck
|
||||||
|
|
||||||
**Updated 2025-07-10**: This patcher now works differently.
|
|
||||||
### Easy method:
|
|
||||||
Download the latest release [from the releases tab](https://github.com/kylefmohr/Trials-Rising-Steam-Deck-Patch/releases), and run it on your Steam Deck.
|
|
||||||
|
|
||||||
For example (or if you'd just like to copy and paste), ssh into your Steam Deck or open a terminal and use these commands:
|
## Usage:
|
||||||
|
Run this script on the Linux device that Trials: Rising is installed on with:
|
||||||
|
|
||||||
```
|
`python3 patch.py`
|
||||||
wget https://github.com/kylefmohr/Trials-Rising-Steam-Deck-Patch/releases/download/v1.2/trials_patcher-linux
|
|
||||||
chmod +x trials_patcher-linux
|
|
||||||
./trials_patcher-linux
|
|
||||||
```
|
|
||||||
It will patch the game for you. If you've previously patched the game, go to the game's properties in Steam > Installed Files > Verify Integrity of Game Files to restore the original file, then run this patcher.
|
|
||||||
|
|
||||||
### Run from source:
|
If the patcher says it couldn't find the file, you can specify the path to `trialsrising.exe` as a command line argument, like so:
|
||||||
via the command line on your Steam Deck/Linux machine:
|
|
||||||
```git clone https://github.com/kylemohr/Trials-Rising-Steam-Deck-Patch.git
|
|
||||||
cd Trials-Rising-Steam-Deck-Patch
|
|
||||||
python3 -m venv .venv
|
|
||||||
source .venv/bin/activate
|
|
||||||
pip install -r requirements.txt
|
|
||||||
python patcher.py
|
|
||||||
```
|
|
||||||
|
|
||||||
if this fails at the `pip install` step, you may need to install `python3-pip` via `pacman`. This will likely require you to run `sudo steamos-devmode enable` first, then `sudo pacman -Syu python3-pip`. **You don't need to do this if you're using the easy method above.**
|
`python3 patch.py /path/to/trialsrising.exe`
|
||||||
|
|
||||||
### I highly recommend using GE-Proton-9-1 for this game
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Updated 2026-03-03**: Simplified and improved the process! It should now work for both Steam and Uplay versions of the game.
|
||||||
|
|
||||||
|
The patching process no longer relies on checksums, so it should continue to work even if the game is updated.
|
||||||
|
|
||||||
|
Fun fact: as a byproduct of disabling EasyAntiCheat, this patch allows you to play the game on macOS! I use [Crossover](https://www.codeweavers.com/crossover), but other Wine-based solutions should work as well.
|
||||||
|
|
||||||
|
### I highly recommend using GE-Proton-9-1 for this game if you're on Steam Deck
|
||||||
You can find instructions for how to do this [here](https://www.rockpapershotgun.com/how-to-install-proton-ge-on-the-steam-deck)
|
You can find instructions for how to do this [here](https://www.rockpapershotgun.com/how-to-install-proton-ge-on-the-steam-deck)
|
||||||
|
|
||||||
I tried a ton of different flavors and versions of Proton, and lots of them crash, some of them are capped at 30fps, and the controller doesn't work on others. GE-Proton-9-1 had none of these issues.
|
I tried a ton of different flavors and versions of Proton, and lots of them crash, some of them are capped at 30fps, and the controller doesn't work on others. GE-Proton-9-1 had none of these issues.
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
import sys
|
||||||
|
import getpass
|
||||||
|
|
||||||
|
# Check if user specified a path
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
path = sys.argv[1]
|
||||||
|
else:
|
||||||
|
path = '/home/' + getpass.getuser() + '/.local/share/Steam/steamapps/common/Trials Rising/datapack/trialsrising.exe'
|
||||||
|
|
||||||
|
original_bytes = b'\x48\x89\x54\x24\x10\x55\x56\x57\x48\x81\xEC\xF0\x00\x00\x00\x48\xC7\x44\x24\x78'
|
||||||
|
new_and_improved_bytes = b'\xB0\x01\xC3\x24\x10\x55\x56\x57\x48\x81\xEC\xF0\x00\x00\x00\x48\xC7\x44\x24\x78'
|
||||||
|
|
||||||
|
try:
|
||||||
|
with open(path, 'rb') as file:
|
||||||
|
data = file.read()
|
||||||
|
except FileNotFoundError:
|
||||||
|
print(f"Error: The file '{path}' was not found.")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Perform the replacement, limited to 1 occurrence
|
||||||
|
patched_data = data.replace(original_bytes, new_and_improved_bytes, 1)
|
||||||
|
|
||||||
|
# Check if anything was actually changed
|
||||||
|
if patched_data != data:
|
||||||
|
# Write the modified data back to the file
|
||||||
|
with open(path, 'wb') as file:
|
||||||
|
file.write(patched_data)
|
||||||
|
print(f"Success: Byte sequence found and replaced in {path}.")
|
||||||
|
else:
|
||||||
|
print("Notice: The search sequence was not found in the binary, no changes were made.")
|
||||||
|
|
||||||
-71
@@ -1,71 +0,0 @@
|
|||||||
import bsdiff4
|
|
||||||
import zlib
|
|
||||||
import getpass
|
|
||||||
import shutil
|
|
||||||
from sys import exit
|
|
||||||
|
|
||||||
def verify_checksum(file_path, expected_checksum):
|
|
||||||
"""
|
|
||||||
Verify the checksum of a file against an expected checksum.
|
|
||||||
|
|
||||||
:param file_path: Path to the file to verify.
|
|
||||||
:param expected_checksum: Expected checksum value.
|
|
||||||
:return: True if the checksum matches, False otherwise.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
actual_checksum = zlib.crc32(open(file_path, 'rb').read())
|
|
||||||
print(f"Expected checksum: {expected_checksum}, Actual checksum: {actual_checksum}")
|
|
||||||
return actual_checksum == expected_checksum
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error verifying checksum: {e}")
|
|
||||||
return False
|
|
||||||
|
|
||||||
def apply_patch(old_file_path, new_file_path, patch_bytes):
|
|
||||||
"""
|
|
||||||
Apply a binary patch to an old file to create a new file.
|
|
||||||
|
|
||||||
:param old_file_path: Path to the old file.
|
|
||||||
:param new_file_path: Path where the new file will be saved.
|
|
||||||
:param patch_bytes: The binary patch data.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
with open(old_file_path, 'rb') as old_file:
|
|
||||||
old_data = old_file.read()
|
|
||||||
|
|
||||||
new_data = bsdiff4.patch(old_data, patch_bytes)
|
|
||||||
|
|
||||||
with open(new_file_path, 'wb') as new_file:
|
|
||||||
new_file.write(new_data)
|
|
||||||
|
|
||||||
print(f"Patch applied successfully. New file created at {new_file_path}")
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error applying patch: {e}")
|
|
||||||
|
|
||||||
patch_bytes = b"\x42\x53\x44\x49\x46\x46\x34\x30\x3E\x00\x00\x00\x00\x00\x00\x00\x2E\x01\x00\x00\x00\x00\x00\x00\xA8\x0C\x6E\x14\x00\x00\x00\x00\x42\x5A\x68\x39\x31\x41\x59\x26\x53\x59\xED\xED\xC0\x27\x00\x00\x07\x63\x51\xC0\x44\x14\x00\x20\x00\x00\x01\x40\x00\x00\x40\x10\x00\x02\x00\x20\x00\x31\x00\xD3\x4D\x04\x34\x06\x9A\x50\xA0\xEC\x51\x46\xD7\x2F\x17\x72\x45\x38\x50\x90\xED\xED\xC0\x27\x42\x5A\x68\x39\x31\x41\x59\x26\x53\x59\xD5\x2F\x49\xC5\x00\xBD\x1A\xC9\x89\xC0\x20\x00\x10\x00\x40\x80\x40\x20\x00\x10\x00\x20\x18\x20\x00\x50\x80\x69\xA6\x81\x35\x54\x1A\x1B\x53\x28\xD7\x08\x08\x12\xEF\xA9\x49\x20\xAA\xB3\x7F\x7D\x9A\xDE\x72\xA2\xA0\x25\xF9\x8A\x0A\xC9\x32\x9A\xC8\x70\x4F\x16\xF8\x0A\xFC\x72\x00\x06\x00\x00\x00\x41\x00\x01\x84\x02\x6A\x32\x15\x01\x2D\x48\x54\x04\xB9\x8A\x0A\xC9\x32\x9A\xC8\x70\x4F\x16\xF8\x0A\xFC\x72\x00\x06\x00\x00\x00\x41\x00\x01\x84\x02\x6A\x32\x15\x01\x2D\x48\x54\x04\xB9\x8A\x0A\xC9\x32\x9A\xC8\x70\x4F\x16\xF8\x0A\xFC\x72\x00\x06\x00\x00\x00\x41\x00\x01\x84\x02\x6A\x32\x15\x01\x2D\x48\x54\x04\xB9\x8A\x0A\xC9\x32\x9A\xC8\x70\x4F\x16\xF8\x0A\xFC\x72\x00\x06\x00\x00\x00\x41\x00\x01\x84\x02\x6A\x32\x15\x01\x2D\x48\x54\x04\xB9\x8A\x0A\xC9\x32\x9A\xC8\x70\x4F\x16\xF8\x0A\xFC\x72\x00\x06\x00\x00\x00\x41\x00\x01\x84\x02\x6A\x32\x15\x01\x2D\x48\x54\x04\xB9\x8A\x0A\xC9\x32\x9A\xC8\x70\x4F\x16\xF8\x0A\xFC\x72\x00\x06\x00\x00\x00\x41\x00\x01\x84\x02\x6A\x32\x15\x01\x2D\x48\x54\x04\xB9\x8A\x0A\xC9\x32\x9A\xCB\xF2\xD1\x6B\xA0\x05\x23\x1E\x40\x06\x00\x00\x02\x00\x00\x41\x00\x01\x86\x60\x29\x4D\x35\x42\x84\x4D\x81\x14\x22\x78\xBB\x92\x29\xC2\x84\x80\xF2\xFA\xB3\xB0\x42\x5A\x68\x39\x17\x72\x45\x38\x50\x90\x00\x00\x00\x00"
|
|
||||||
expected_path = '/home/' + getpass.getuser() + '/.local/share/Steam/steamapps/common/Trials Rising/datapack/trialsrising.exe'
|
|
||||||
new_path = expected_path + '.new'
|
|
||||||
expected_checksum_before = 0xF197E04E
|
|
||||||
expected_checksum_after = 0x883925BD
|
|
||||||
|
|
||||||
if verify_checksum(expected_path, expected_checksum_before):
|
|
||||||
apply_patch(expected_path, new_path, patch_bytes)
|
|
||||||
|
|
||||||
if verify_checksum(new_path, expected_checksum_after):
|
|
||||||
print("Patch applied successfully.")
|
|
||||||
else:
|
|
||||||
print("Patch failed: checksum mismatch after patching. Please open an issue on GitHub.")
|
|
||||||
exit(1)
|
|
||||||
|
|
||||||
try:
|
|
||||||
shutil.move(new_path, expected_path)
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error replacing old file with new file: {e}")
|
|
||||||
exit(1)
|
|
||||||
else:
|
|
||||||
if(verify_checksum(expected_path, expected_checksum_after)):
|
|
||||||
print("Patch has already been applied, no changes made.")
|
|
||||||
exit(0)
|
|
||||||
print("Patch failed: checksum mismatch before patching. Go to the game's properties in Steam > Installed Files > Verify integrity of game files, then try again")
|
|
||||||
print("If that doesn't work, please open an issue on GitHub.")
|
|
||||||
exit(1)
|
|
||||||
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
bsdiff4
|
|
||||||
Reference in new issue
Block a user