This repository has been archived by the owner on Jul 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
patch_bindings_spam.sh
executable file
·52 lines (45 loc) · 1.8 KB
/
patch_bindings_spam.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
echo "Latest known working version for patching: 2.3.5"
if [[ -z "$1" ]]; then
echo 'Enter absolute path to SteamVR (for example, /home/user/.local/share/Steam/steamapps/common/SteamVR)'
read STEAMVR_PATH
else
STEAMVR_PATH="$1"
fi
PATH_TO_PATCHING_FILE="$STEAMVR_PATH/resources/webinterface/dashboard/vrwebui_shared.js"
if [[ ! -f $PATH_TO_PATCHING_FILE ]]; then
echo "Couldn't find required file for patch, aborting"
exit 1
fi
echo 'In case of failed patching, please re-validate SteamVR files to make sure they stay unchanged'
echo Deleting SteamVR html cache
rm -r ~/.cache/SteamVR
CHANGED_OUT=$(sed -i 's/m=n(1380),g=n(9809);/m=n(1380),g=n(9809),refresh_counter=0,refresh_counter_max=75;/g w /dev/stdout' $PATH_TO_PATCHING_FILE)
if [[ -z $CHANGED_OUT ]]; then
echo "Couldn't patch, exiting"
exit 1
else
echo "patched 1"
fi
CHANGED_OUT=$(sed -i 's/case"action_bindings_reloaded":this.OnActionBindingsReloaded(n);break;/case"action_bindings_reloaded":if(refresh_counter%refresh_counter_max==0){this.OnActionBindingsReloaded(n);}refresh_counter++;break;/g w /dev/stdout' $PATH_TO_PATCHING_FILE)
if [[ -z $CHANGED_OUT ]]; then
echo "Couldn't patch, exiting"
exit 1
else
echo "patched 2"
fi
CHANGED_OUT=$(sed -i 's/l=n(3568),c=n(1569);/l=n(3568),c=n(1569),refresh_counter_v2=0,refresh_counter_max_v2=75;/g w /dev/stdout' $PATH_TO_PATCHING_FILE)
if [[ -z $CHANGED_OUT ]]; then
echo "Couldn't patch, exiting"
exit 1
else
echo "patched 3"
fi
CHANGED_OUT=$(sed -i 's/OnActionBindingsReloaded(){this.GetInputState()}/OnActionBindingsReloaded(){if(refresh_counter_v2%refresh_counter_max_v2==0){this.GetInputState();}refresh_counter_v2++;}/g w /dev/stdout' $PATH_TO_PATCHING_FILE)
if [[ -z $CHANGED_OUT ]]; then
echo "Couldn't patch, exiting"
exit 1
else
echo "patched 4"
fi
echo Successfully patched web file.