forked from sonic2kk/steamtinkerlaunch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstl
executable file
·7143 lines (6246 loc) · 255 KB
/
stl
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
# shellcheck source=/dev/null
### project ###
PROGNAME="SteamTinkerLaunch"
PROGVERS="v2.6.0"
PROGCMD="$(basename "$0")"
PROJECTPAGE="https://github.com/frostworx/steamtinkerlaunch"
### internal dependencies ###
#STARTINTDEPS
GIT="git"
PGREP="pgrep"
PIDOF="pidof"
PKILL="pkill"
TAR="tar"
UNZIP="unzip"
WGET="wget"
WHICH="which"
WMCTRL="wmctrl"
XDO="xdotool"
XPROP="xprop"
XRANDR="xrandr"
XWININFO="xwininfo"
YAD="yad"
ZENITY="zenity"
#ENDINTDEPS
### (optionally) used programs ###
GAMEMODERUN="gamemoderun"
GAMESCOPE="gamescope"
NYRNA="nyrna"
STEAM="steam"
STRACE="strace"
WINECFG="winecfg"
WINETRICKS="winetricks"
REPLAY="replay-sorcery"
CABEXTRACT="cabextract"
LSUSB="lsusb"
JQ="jq"
ZENBIN=""
CHECKHMD=1 # will be set to 0 if $LSUSB is not found. Then the hmd presence check is skipped
# autotweak platforms
LU="lutris"
PF="protonfixes"
AUTOTWEAKPLATFORMS="$PF $LU"
LUATDEBUG=0
FORCEOVERRIDEPROTON=0
# this variable is filled with the last Auto Tweak variable accepted and is the only Auto Tweak config which is finally loaded
LOADAUTOCFG=""
DSHM="/dev/shm"
STLSHM="$DSHM/$PROGCMD"
STLICON="$STLSHM/stl-steam-checked.png"
NOICON="$STLSHM/empty.png"
DFDIR="$STLSHM/desktopfiles"
CLOSETMP="$STLSHM/${PROGCMD}-closing.tmp"
TEMPLOG="$STLSHM/${PROGCMD}.log"
GWIDFILE="$STLSHM/${PROGCMD}-sbsgwid"
### default vars ###
if [ -z "$XDG_CONFIG_HOME" ]; then
STLCFGDIR="$HOME/.config/$PROGCMD" # either hardcoded config dir
else
STLCFGDIR="$XDG_CONFIG_HOME/$PROGCMD" # or in XDG_CONFIG_HOME if the user set the variable
fi
SYSTEMSTLCFGDIR="/usr/share/$PROGCMD" # systemwide config dir
LOGDIR="$STLCFGDIR/logs" # default logfile dir
STLGAMEDIR="$STLCFGDIR/gamecfgs" # default basedir for game the gamespecific configs
STLCATEGORYDIR="$STLCFGDIR/categories" # the directory holding config files with preconfigured settings for games in specific steamcategories
STLREGDIR="$STLCFGDIR/regs" # the directory holding registry files
STLDLDIR="$STLCFGDIR/downloads" # the directory holding optional downloads
TWEAKDIR="$STLCFGDIR/tweaks" # the parent directory for all user tweakfiles
USERTWEAKDIR="$TWEAKDIR/user" # the place for the users own main tweakfiles - tweaks in here override all other ones!
AUTOTWEAKDIR="$TWEAKDIR/auto" # parent dir for all (upcoming) autoimport tweak files. every source will have an own subdirectory
PFTWEAKDIR="$AUTOTWEAKDIR/$PF" # $PF tweakdir
LUTWEAKDIR="$AUTOTWEAKDIR/$LU" # $LU tweakdir
TWEAKCMDDIR="$TWEAKDIR/cmd" # dir for scriptfiles used by tweakfiles
TWEAKTEMPLATEDIR="$TWEAKDIR/templates" # dir where template tweakfiles are stored when CREATETWEAKS is enabled
SBSTWEAKDIR="$TWEAKDIR/sbs" # directory for optional config overrides for easier side-by-side VR gaming
ATDLDIR="$STLDLDIR/autotweak" # main autotweak download dir
STLVORTEXDIR="$STLCFGDIR/vortex" # stl vortex dir
PLACEHOLDERAID="31337"
PLACEHOLDERGN="Placeholder"
GHURL="https://github.com"
STLGAMES="$STLCFGDIR/games"
STLGDESKD="$STLGAMES/desktop"
STLGHEADD="$STLGAMES/header"
#STLGSCPTD="$STLGAMES/scripts"
NOGAMES=",70_2260196511,228980,858280,961940,1054830,1070560,1113280,1245040,1391110,1420170,"
#PROTON37="858280"
#PROTON316="961940"
#PROTON42="1054830"
#PROTON411="1113280"
#PROTON50="1245040"
#PROTON513="1420170"
function setAID {
# shellcheck disable=SC2154 # SteamAppId comes from Steam
if [ -z "$SteamAppId" ];then
AID="$PLACEHOLDERAID"
else
AID="$SteamAppId"
fi
}
setAID
#STARTEDITORCFGLIST
STLDEFGLOBALCFG="$STLCFGDIR/global.conf" # global config
STLDEFGAMECFG="$STLCFGDIR/default_template.conf" # the default config template used to create new per game configs - will be auto created if not found
function setAIDCfgs {
STLGAMECFG="$STLGAMEDIR/$AID.conf" # the game specific config file which is used by the launched game - created from $STLDEFGAMECFG if not found
TWEAKCFG="$USERTWEAKDIR/$AID.conf" # the game specific shareable config tweak overrides
SBSTWEAKCFG="$SBSTWEAKDIR/$AID.conf" # the game specific shareable config sbs tweak overrides
LOGFILE="$LOGDIR/$AID.log"
TWEAKTEMPLATECFG="$TWEAKTEMPLATEDIR/$AID.conf" # Tweak Template autowritten when CREATETWEAKS is set
PFTWEAKCFG="$PFTWEAKDIR/$AID.conf"
LUTWEAKCFG="$LUTWEAKDIR/$AID.conf"
}
STLVORTEXCFG="$STLVORTEXDIR/vortex.conf" # vortex config
STLURLCFG="$STLCFGDIR/url.conf" # url config
CUSTOMPROTONLIST="$STLCFGDIR/protonlist.txt" # plain textfile with additional user proton versions
VORTEXSTAGELIST="$STLVORTEXDIR/stages.txt" # plain textfile with Vortex Stage directories - one per Steam Library partition
#ENDEDITORCFGLIST
STLGUICFG="$STLCFGDIR/gui.conf" # gui config
setAIDCfgs
# optional global config replacement dirs, which can be pulled using DLGLOBAL:
GLDLSTLDIR="$STLDLDIR/$PROGNAME"
GLDLSTLTXT="${GLDLSTLDIR}.txt"
GLDLTWEAKDIR="$GLDLSTLDIR/tweaks"
GLDLUSERTWEAKDIR="$GLDLTWEAKDIR/user"
GLDLSBSTWEAKDIR="$GLDLTWEAKDIR/sbs"
GLDLTWEAKCMDDIR="$GLDLTWEAKDIR/cmd"
GLDLCATEGORYDIR="$GLDLSTLDIR/categories"
GLDLMISCDIR="$GLDLSTLDIR/misc"
GLDLREGDIR="$GLDLSTLDIR/regs"
GLDLSTLLANGDIR="$GLDLSTLDIR/lang"
STLLANGDIR="$STLCFGDIR/lang"
STLDEFLANG="english"
HSR="$HOME/.steam/root"
HSS="$HOME/.steam/steam"
HSRU="$HSR/userdata"
HSRCC="$HSR/config/config.vdf"
if [ ! -f "$HSRCC" ];then
HSRCC="$HSS/config/config.vdf"
fi
USS="/usr/share/steam"
STEAMCOMPATOOLS="$HSR/compatibilitytools.d"
SYSSTEAMCOMPATOOLS="$USS/compatibilitytools.d"
STLDXVKDIR="$STLCFGDIR/dxvk" # base dxvk config dir from where default per game configs are automatically parsed
ISGAME=0 # 1=game was launched, 2=windows game, 3=linux game
WFEAR="waitforexitandrun"
SA="steamapps"
SAC="$SA/common"
SLR="SteamLinuxRuntime"
DBW="dist/bin/wine"
PROCU="proton/custom"
CTVDF="compatibilitytool.vdf"
SCV="sharedconfig.vdf"
SRSCV="7/remote/$SCV"
LASTRUN="$LOGDIR/lastrun.txt" # some variables from the last run which might be reused
RS_D3D47_DEST="d3dcompiler_47.dll"
RS_DX_DEST="dxgi.dll"
RS_D9_DEST="d3d9.dll"
RSENABLED="ReShade-${PROGCMD}-enabled.txt"
RSDISABLED="ReShade-${PROGCMD}-disabled.txt"
YADKEY="$PLACEHOLDERAID"
# currently hardcoded borders used in yad:
YADSETBORD=8
YADBORDER=34
################
function GetGamePic {
if [ "$DLGAMEDATA" -eq 1 ]; then
DLPIC="$1"
if [ ! -f "$DLPIC" ]; then
writelog "INFO" "${FUNCNAME[0]} - Downloading picture for game '$(basename "${1//.jpg/}")'"
"$WGET" -q "$2" -O "$DLPIC"
fi
fi
}
function getGameName {
if [ -n "$GN" ]; then
writelog "INFO" "${FUNCNAME[0]} - using 'GN' as Game Name: '$GN'"
GNRAW="$GN"
elif [ -f "$STLGAMEDIR/$1.conf" ]; then
GNRAW="$(grep "#GAMENAME" "$STLGAMEDIR/$1.conf" | cut -d '=' -f2)"
writelog "INFO" "${FUNCNAME[0]} - found Game Name '$GNRAW' in '$STLGAMEDIR/$1.conf'"
elif grep -q "_${1}\." <<< "$(listAppManifests)" ; then
APPMA="$(grep "_${1}\." <<< "$(listAppManifests)")"
if [ -n "$APPMA" ]; then
GNRAW1="$(grep "\"name\"" "$APPMA" | awk -F '"name"' '{print $NF}')"
GNRAW="$(awk '{$1=$1};1' <<< "$GNRAW1")"
writelog "INFO" "${FUNCNAME[0]} - found Game Name '$GNRAW' in '$APPMA'"
fi
else
if [ "$DLGAMEDATA" -eq 1 ]; then
APIURL="https://api.steampowered.com/ISteamApps/GetAppList/v2"
APIDL="$STLDLDIR/SteamApps.json"
MAXAGE=1440
if [ ! -f "$APIDL" ] || test "$(find "$APIDL" -mmin +"$MAXAGE")"; then
writelog "INFO" "${FUNCNAME[0]} - downloading $APIDL"
"$WGET" -q "$APIURL" -O "$APIDL"
fi
fi
if [ -f "$APIDL" ]; then
if [ ! -x "$(command -v "$("$WHICH" "$JQ" 2>/dev/null)" 2>/dev/null)" ]; then
writelog "WARN" "${FUNCNAME[0]} - can't get data from '$APIDL' because '$JQ' is not installed"
else
writelog "INFO" "${FUNCNAME[0]} - searching Game Name for '$1' in $APIDL"
GNRAW="$("$JQ" ".applist.apps[] | select (.appid==$1) | .name" "$APIDL")"
if [ -n "$GNRAW" ]; then
writelog "INFO" "${FUNCNAME[0]} - found Game Name '$GNRAW' in $APIDL"
fi
fi
fi
fi
GAMENAME="${GNRAW//\"/}"
}
function writeDesktopFile {
if [ -f "$STLGDESKD/$1.desktop" ]; then
writelog "SKIP" "${FUNCNAME[0]} - $STLGDESKD/$1.desktop already exists"
else
getGameName "$1"
if [ -n "$GAMENAME" ]; then
writelog "INFO" "${FUNCNAME[0]} - creating $STLGDESKD/$1.desktop" "E"
{
echo "[Desktop Entry]"
echo "Name=${GAMENAME//\"/}"
echo "Comment=$DF_COMMENT"
echo "Exec=steam steam://rungameid/$1"
echo "Icon=$STLGHEADD/$1.jpg"
echo "Terminal=false"
echo "Type=Application"
echo "Categories=Game;"
} >> "$STLGDESKD/$1.desktop"
fi
fi
}
function getGameData {
if ! grep -q ",${1}," <<< "$NOGAMES" ; then
GetGamePic "$STLGHEADD/$1.jpg" "$STASSURL/$1/header.jpg"
writeDesktopFile "$1"
fi
}
function getParsableGameList {
STEAMUSERID="$(find "$HSRU" -maxdepth 1 -type d -name "[1-9]*")"
SC="$STEAMUSERID/$SRSCV"
APPI="Apps"
APPO="StartMenuShortcutCheck"
awk "/$APPI/,/$APPO/" "$SC" | grep -v "$APPI\|$APPO" | awk '{printf "%s+",$0} END {print ""}' | sed 's/"[0-9][0-9]/\n&/g'
}
function getInstalledGamesFromCategory {
if [ -n "$1" ]; then
CAT="$1"
else
CAT="installed"
fi
if [ -n "$CAT" ]; then
while read -r CATAID; do
echo "$CATAID"
done <<< "$(getParsableGameList | grep "\"installed\"" | grep "\"$CAT\"" | sed "s:\"::g" | sort -n | cut -d '+' -f1)"
fi
}
function getGameDataForInstalledGames {
while read -r CATAID; do
getGameData "$CATAID"
done < <(getInstalledGamesFromCategory "installed")
}
function getDataForAllGamesinSharedConfig {
while read -r CATAID; do
getGameData "$CATAID"
done <<< "$(getParsableGameList | cut -d '+' -f1 | sed "s:\"::g" | grep "[0-9]" | sort -n)"
}
function getActiveSteamCategories {
getParsableGameList | grep "\"installed\"" | grep "\"tags\"" | awk -F '"tags"+' '{print $NF}' | sed 's/\t/\n/g' | grep -v "^\"[0-9]\"\|^+\|^{+\|^}+" | sed "s:\"+$::g" | sed "s:^\"::g" | sort -u | sed '/^[[:space:]]*$/d'
}
function createCategoryMenus {
mkdir -p "$DFDIR" 2>/dev/null
if [ -n "$1" ] && [ "$1" == "update" ] && [ "$(find "$DFDIR" -name "*.desktop" | wc -l)" -gt 0 ]; then
find "$DFDIR" -name "*.desktop" -exec rm {} \;
fi
if [ "$(find "$DFDIR" -name "*.desktop" | wc -l)" -eq 0 ]; then
while read -r CAT; do
DFCDIR="$DFDIR/$CAT"
mkdir -p "$DFCDIR" 2>/dev/null
while read -r CATGAME; do
if [ -f "$STLGDESKD/$CATGAME.desktop" ]; then
if [ ! -h "$DFCDIR/$CATGAME.desktop" ]; then
ln -s "$STLGDESKD/$CATGAME.desktop" "$DFCDIR"
fi
fi
done <<< "$(getInstalledGamesFromCategory "$CAT")"
done < <(getActiveSteamCategories)
fi
}
function listAppManifests {
function findAppMa {
find "$1" -mindepth 1 -maxdepth 1 -type f -name "appmanifest_*.acf"
}
findAppMa "$HSR/$SA"
while read -r BIF; do
findAppMa "${BIF//\"/}/$SA"
done <<< "$(grep "BaseInstallFolder" "$HSRCC" | awk '{print $2}')"
}
function openGameLauncher {
function GLgui {
"$YAD" --icons --read-dir="$DFDIR/$1" "$WINDECO" --title="$TITLE" --single-click --keep-icon-size --center --compact --sort-by-name --geometry="$LAUNCHERWIDTH"x"$LAUNCHERHEIGHT"+0+0
}
if grep -q "update" <<< "$@"; then
createCategoryMenus "update"
else
createCategoryMenus "dummy"
fi
if [ "$(find "$DFDIR" -name "*.desktop" | wc -l)" -eq 0 ]; then
writelog "INFO" "${FUNCNAME[0]} - no desktop file found in '$DFDIR'" "E"
if [ "$1" == "auto" ]; then
writelog "INFO" "${FUNCNAME[0]} - found arument 'auto'. Automatically creating/downloading required data for all installed games found" "E"
getGameDataForInstalledGames
if [ -n "$2" ] && [ "$2" == "update" ]; then
createCategoryMenus "$2"
else
createCategoryMenus "dummy"
fi
else
writelog "INFO" "${FUNCNAME[0]} - either add argument 'auto' to automatically create/download required data or check '$PROGCMD --help'" "E"
exit
fi
fi
TITLE="${PROGNAME}-Launcher"
loadCfg "$STLGUICFG" X
updateWinRes "$TITLE" "$STLGUICFG" "LAUNCHERWIDTH" "LAUNCHERHEIGHT" &
if [ -z "$1" ] || [ "$1" == "auto" ] || [ "$1" == "update" ]; then
GLgui "installed"
else
if [ "$1" == "menu" ]; then
while read -r CATMENU; do
mapfile -t -O "${#CATCSV[@]}" CATCSV <<< "$CATMENU"
done <<< "$(printf "%s\n" "$(ls "$DFDIR")")"
CATLIST="$(printf "!%s\n" "${CATCSV[@]//\"/}" | sort -u | cut -d ';' -f1 | tr -d '\n' ;printf "\n")"
CATMENU="$(LC_ALL="" "$YAD" --window-icon="$STLICON" --borders="$YADBORDER" --center "$WINDECO" --form --scroll --separator="\n" --quoted-output \
--text="<span font_weight='bold'>$GUI_CHOOSECAT</span>" \
--field="$GUI_CHOOSECATS":CB "installed!$CATLIST" \
--title="$TITLE" \
--geometry="$LAUNCHERWIDTH"x"$LAUNCHERHEIGHT"+0+0)"
if [ -n "${CATMENU//\'}" ]; then
GLgui "${CATMENU//\'}"
fi
elif [ "$1" == "last" ]; then
if [ -f "$LASTRUN" ]; then
PREVAID="$(grep "^PREVAID" "$LASTRUN" | cut -d '=' -f2)"
if [ -n "$PREVAID" ]; then
AID="${PREVAID//\"}"
if [ -f "$STLGDESKD/$AID.desktop" ]; then
writelog "INFO" "${FUNCNAME[0]} - '$1' selected, so opening splash for '$STLGDESKD/$AID.desktop'" "E"
DFCDIR="$DFDIR/last"
mkdir -p "$DFCDIR" 2>/dev/null
cp "$STLGDESKD/$AID.desktop" "$DFCDIR"
GLgui "$1"
else
writelog "SKIP" "${FUNCNAME[0]} - '$1' selected, but file '$STLGDESKD/$AID.desktop' not found" "E"
fi
fi
fi
elif [ -d "$DFDIR/$1" ]; then
GLgui "$1"
else
writelog "SKIP" "${FUNCNAME[0]} - Steam Category '$1' not found in '$DFDIR'" "E"
writelog "SKIP" "${FUNCNAME[0]} - only found '$(ls "$DFDIR")'" "E"
fi
fi
}
function DBGMS {
echo "$(date) - $1" >> "$STLSHM/DBGMS.txt"
}
function resetAID {
if [ -n "$1" ]; then
if [ -n "${1##*[!0-9]*}" ]; then
AID="$1"
else
if [ "$1" == "last" ]; then
if [ -f "$LASTRUN" ]; then
PREVAID="$(grep "^PREVAID" "$LASTRUN" | cut -d '=' -f2)"
if [ -n "$PREVAID" ]; then
AID="${PREVAID//\"}"
PREVGAME="$(grep "^PREVGAME" "$LASTRUN" | cut -d '=' -f2)"
if [ -n "$PREVGAME" ]; then
GN="(last game started) ${PREVGAME//\"}"
fi
fi
else
AID="$PLACEHOLDERAID"
fi
fi
fi
fi
# should not happen, but just in case it still is empty, set the placeholders
if [ -z "$AID" ]; then
AID="$PLACEHOLDERAID"
fi
if [ "$AID" == "$PLACEHOLDERAID" ]; then
GN="$PLACEHOLDERGN"
fi
setAIDCfgs
}
function setGlobalAIDCfgs {
if [ "$(USEDLGLOBAL)" -ge 1 ]; then
GLOBALSBSTWEAKCFG="$GLDLSBSTWEAKDIR/$AID.conf"
GLOBALTWEAKCFG="$GLDLUSERTWEAKDIR/$AID.conf"
AIDREG="$GLDLREGDIR/$AID.reg"
else
GLOBALSBSTWEAKCFG="$GLOBALSBSTWEAKDIR/$AID.conf"
GLOBALTWEAKCFG="$GLOBALUSERTWEAKDIR/$AID.conf" #X
AIDREG="$GLOBALREGDIR/$AID.reg"
fi
}
function setGameVars {
if [ -n "$STEAM_COMPAT_DATA_PATH" ]; then
# win game
GPFX="$STEAM_COMPAT_DATA_PATH/pfx" # currently used WINEPREFIX
GP="$(printf "%s\n" "$@" | grep -v "proton\|$SLR" | grep -m1 "$SAC")" # the absolute game path of the windows game exe
GE="$(basename "$GP" | awk -F '.exe' '{print $1}')" # just the windows game exe name
EFD="$(dirname "$GP")" # the absolute directory where the game exe lives - for optional custom program
else
# linux game
GPRAW="$(printf "%s\n" "$@" | grep -m1 "$SAC")" # the absolute game path of the game exe
if grep -q "/./" <<< "$GPRAW"; then
GP="${GPRAW//\/.\//\/}"
else
GP="$GPRAW"
fi
GE="$(basename "$GP")" # the game executable
# EFD="${GP//$GE/}" # the absolute directory where the game exe lives - for optional custom program # dirname fails at least with 206420
EFD="$(dirname "$GP")"
fi
# common
GFD="$(awk -F 'common' '{print $1}' <<< "$EFD")common/$(awk -F 'common' '{print $NF}' <<< "$EFD" | cut -d'/' -f2)" # f.e. used for vortex symlinks
GN="$(grep -oE 'common/[^\/]+' <<< "$EFD" | awk -F 'common/' '{print $NF}')" # THIS is hopefully the proper game name
# SLR
if grep -q "$SLR" <<< "$@"; then
FOUNDSLR=0
while read -r ORGARG; do
if [ "$FOUNDSLR" -eq 0 ]; then
mapfile -t -O "${#RUNSLR[@]}" RUNSLR <<< "$ORGARG"
if [ "$ORGARG" == "--" ]; then
FOUNDSLR=1
fi
else
mapfile -t -O "${#ORGGCMD[@]}" ORGGCMD <<< "$ORGARG"
fi
done <<< "$(printf "%s\n" "$@")"
else
while read -r ORGARG; do
mapfile -t -O "${#ORGGCMD[@]}" ORGGCMD <<< "$ORGARG"
done <<< "$(printf "%s\n" "$@")"
fi
}
function checkZenity {
if [ "$USEGUI" == "$ZENITY" ]; then
if [ -x "$(command -v "$("$WHICH" "$ZENITY" 2>/dev/null)" 2>/dev/null)" ]; then
ZENBIN="$("$WHICH" "$ZENITY" 2>/dev/null)"
writelog "INFO" "${FUNCNAME[0]} - using '$ZENBIN' for the GUI"
elif [ -x "$(command -v "$("$WHICH" "$YAD" 2>/dev/null)" 2>/dev/null)" ]; then
writelog "WARN" "${FUNCNAME[0]} - '$USEGUI' is set to '$ZENITY', but it is not available - falling back to '$YAD'"
ZENBIN="$("$WHICH" "$YAD" 2>/dev/null)"
fi
if [ -z "$ZENBIN" ]; then
writelog "ERROR" "${FUNCNAME[0]} - no usable binary found for '$ZENITY' - this should not happen! Either install '$ZENITY' or '$YAD'"
exit
fi
fi
}
function prepareGUI {
if [ -n "$USEGUI" ]; then
if [ "$USEGUI" == "$YAD" ]; then
if [ -x "$(command -v "$YAD" 2>/dev/null)" ]; then
writelog "INFO" "${FUNCNAME[0]} - using '$YAD' for the GUI"
else
writelog "WARN" "${FUNCNAME[0]} - USEGUI is set to '$USEGUI' but '$YAD' was not found - retrying with using '$ZENITY' instead - you should update your config"
USEGUI="$ZENITY"
"${FUNCNAME[0]}"
fi
elif [ "$USEGUI" == "$ZENITY" ]; then
checkZenity
writelog "INFO" "${FUNCNAME[0]} - using '$ZENBIN' for '$ZENITY'"
else
writelog "WARN" "${FUNCNAME[0]} - USEGUI '$USEGUI' is neither '$YAD' nor '$ZENITY' - make sure your config is correct"
USEGUI="$YAD"
"${FUNCNAME[0]}"
fi
fi
WINDECO="--undecorated"
if [ -n "$USEWINDECO" ]; then
if [ "$USEWINDECO" -eq 1 ]; then
WINDECO="--decorated"
else
WINDECO="--undecorated"
fi
fi
}
function createLanguageList {
if [ "$(USEDLGLOBAL)" -ge 1 ]; then
GLOBLANG="$GLDLSTLLANGDIR"
else
GLOBLANG="$GLOBALSTLLANGDIR"
fi
while read -r LANGPATH; do
LANGFILE="$(basename "$LANGPATH")"
mapfile -t -O "${#LangList[@]}" LangList <<< "$LANGFILE"
done < <(find "$STLLANGDIR" -name "*.txt")
if [ -d "$GLOBLANG" ]; then
while read -r LANGPATH; do
LANGFILE="$(basename "$LANGPATH")"
mapfile -t -O "${#LangList[@]}" LangList <<< "$LANGFILE"
done < <(find "$GLOBLANG" -name "*.txt")
fi
LANGYADLIST="$(printf "!%s\n" "${LangList[@]//.txt/}" | sort -u | tr -d '\n' ;printf "\n")"
}
function loadLangFile {
if [ -n "$1" ]; then
LANGFILENAME="$1"
if [ "$(USEDLGLOBAL)" -ge 1 ]; then
GLOBLANG="$GLDLSTLLANGDIR"
else
if [ -z "$GLOBALSTLLANGDIR" ]; then
GLOBLANG="$SYSTEMSTLCFGDIR/lang/"
else
GLOBLANG="$GLOBALSTLLANGDIR"
fi
fi
if [ -f "$LANGFILENAME" ]; then
writelog "INFO" "${FUNCNAME[0]} - loading commandline langfile"
source "$LANGFILENAME"
STLLANG="$(basename "$LANGFILENAME" | cut -d '.' -f1)"
LAFI="$STLLANGDIR/${STLLANG}.txt"
if [ ! -f "$LAFI" ]; then
mkProjDir "$STLLANGDIR" 1
cp "$LANGFILENAME" "$LAFI"
fi
else
LAFI="$STLLANGDIR/${LANGFILENAME}.txt"
if [ -f "$LAFI" ]; then
writelog "INFO" "${FUNCNAME[0]} - loading user-installed $LAFI"
source "$LAFI"
else
LAFI="$GLOBLANG/${LANGFILENAME}.txt"
if [ -f "$LAFI" ]; then
writelog "INFO" "${FUNCNAME[0]} - loading system wide $LAFI"
source "$LAFI"
else
writelog "ERROR" "${FUNCNAME[0]} - language file '$LAFI' missing"
echo "ERROR" "${FUNCNAME[0]} - language file '$LAFI' missing - downloading ' $PROJECTPAGE' and trying again"
gitUpdate "$GLDLSTLDIR" "$PROJECTPAGE"
${FUNCNAME[0]}
fi
fi
fi
fi
}
function loadLanguage {
writelog "INFO" "${FUNCNAME[0]} - first load the default language to make sure all variables are filled"
loadLangFile "$STLDEFLANG"
if [ -f "$STLDEFGLOBALCFG" ]; then
STLLRAW="$(grep "^STLLANG" "$STLDEFGLOBALCFG" | cut -d '=' -f2)"
STLLANG="${STLLRAW//\"/}"
else
ARGSLANG="$(awk -F 'lang=' '{print $2}' <<< "$@" | cut -d ' ' -f1)"
if [ -n "$ARGSLANG" ]; then
STLLANG="$ARGSLANG"
fi
fi
if [ -n "$STLLANG" ]; then
if [ "$STLDEFLANG" != "$STLLANG" ]; then
writelog "INFO" "${FUNCNAME[0]} - now load the language defined by the user"
loadLangFile "$STLLANG"
else
writelog "SKIP" "${FUNCNAME[0]} - user defined language is the same as the default language - no need to load it again"
fi
fi
if [ -z "$DESC_STLLANG" ]; then
echo "###############################"
echo "ERROR - no language file could be loaded! For the initial setup at least one file (default english) is required"
echo "ERROR - You can ether copy a valid file to '$STLLANGDIR' or '$SYSTEMSTLCFGDIR/lang' or provide an absolute path via command line using the lang= option"
echo "###############################"
exit
fi
}
function OVPROT {
if [ -n "$OVERRIDEPROTON" ] && [ "$OVERRIDEPROTON" -eq 1 ]; then
echo 1
elif [ -n "$FORCEOVERRIDEPROTON" ] && [ "$FORCEOVERRIDEPROTON" -eq 1 ]; then
echo 1
else
echo 0
fi
}
function setProtonPathVersion {
if [ -n "$1" ]; then
PROTPATH="$1"
CTVDF="$(dirname "$PROTPATH")/$CTVDF"
PPV="$(dirname "$PROTPATH")/version"
if [ -f "$CTVDF" ]; then
PROTVOUT="$(grep "display_name" "$CTVDF" | grep -v "e.g." | sed "s:\" \":\";\":g" | cut -d ';' -f2)"
elif [ -f "$PPV" ]; then
PROTVOUT="$(awk '{print $2}' < "$PPV")"
fi
if [ -z "$PROTVOUT" ]; then
# if no useful version was provided - hardcode it here:
if grep -q "Proton 3.7" <<<"$PROTPATH"; then
PROTVOUT="proton-3.7-8"
else
# fallback if everything fails - in the rare cases where this unknown proton version is used this might cause problems
# if you need it open an issue and it will get a hardcoded entry as well
PROTVOUT="proton-unknown-$((900 + RANDOM % 100))"
fi
fi
writelog "INFO" "${FUNCNAME[0]} Setting the Proton Version for '$1' to '$PROTVOUT'"
echo "$PROTVOUT"
fi
}
function fillProtonCSV {
if [ -n "$1" ];then
protonfileV="$1"
else
protonfileV="$(setProtonPathVersion "$PROTBIN")"
fi
if [ -n "$protonfileV" ];then
PCSV="\"${protonfileV//\"/}\";\"$PROTBIN\""
mapfile -t -O "${#ProtonCSV[@]}" ProtonCSV <<< "$PCSV"
fi
}
function getAvailableProtonVersions {
PROTONCSV="$STLSHM/ProtonCSV.txt"
unset ProtonList
if [ ! -f "$PROTONCSV" ] || { [ -n "$1" ] && [ "$1" = "up" ]; }; then
# user installed compatibilitytool:
while read -r PROTBIN; do
fillProtonCSV
done <<< "$(find "$STEAMCOMPATOOLS" -type f -name "proton")"
while read -r PROTBIN; do
fillProtonCSV
done <<< "$(find "$SYSSTEAMCOMPATOOLS" -type f -name "proton")"
# official proton versions installed via Steam in default SteamLibrary
while read -r protondir; do
PROTBIN="$protondir/proton"
if [ -f "$PROTBIN" ]; then
fillProtonCSV
fi
done <<< "$(find "$HSR/$SAC" -maxdepth 1 -maxdepth 1 -type d -name "Proton*")"
# official proton versions installed via Steam in additional SteamLibrary Paths
if [ -f "$HSRCC" ]; then
while read -r protondir; do
PROTBIN="$protondir/proton"
if [ -f "$PROTBIN" ]; then
fillProtonCSV
fi
done <<< "$(while read -r SLP; do find "${SLP//\"/}/$SAC" -maxdepth 1 -maxdepth 1 -type d -name "Proton*"; done <<< "$(grep "BaseInstallFolder" "$HSRCC" | awk '{print $2}')")"
fi
# custom Proton List:
if [ -f "$CUSTOMPROTONLIST" ]; then
awk -i inplace '!visited[$0]++' "$CUSTOMPROTONLIST"
while read -r PROTLINE; do
writelog "INFO" "${FUNCNAME[0]} - checking line '$PROTLINE' in '$CUSTOMPROTONLIST'"
if grep -q ";" <<< "$PROTLINE"; then
PROTBIN="$(cut -d ';' -f2 <<< "$PROTLINE")"
PROTVERS="$(cut -d ';' -f1 <<< "$PROTLINE")"
writelog "INFO" "${FUNCNAME[0]} - adding '$PROTVERS' to the list"
fillProtonCSV "$PROTVERS"
elif [ -f "$PROTLINE" ]; then
writelog "INFO" "${FUNCNAME[0]} - file '$PROTLINE' exists - adding it to the list"
PROTBIN="$PROTLINE"
fillProtonCSV
else
writelog "INFO" "${FUNCNAME[0]} - removing invalid line '$PROTLINE' from '$CUSTOMPROTONLIST'"
mapfile -t -O "${#ProtonMissing[@]}" ProtonMissing <<< "$PROTLINE"
fi
done <<< "$(grep -v "^#" "$CUSTOMPROTONLIST")"
# remove files from custom list which do not exist (anymore)
if [ -n "${ProtonMissing[0]}" ]; then
while read -r NOPROT; do
sed "/${NOPROT//\//\\/}/d" -i "$CUSTOMPROTONLIST"
done <<< "$(printf "%s\n" "${ProtonMissing[@]}")"
unset ProtonMissing
fi
fi
else
mapfile -t -O "${#ProtonCSV[@]}" ProtonCSV < "$PROTONCSV"
fi
printf "%s\n" "${ProtonCSV[@]//\"/}" > "$PROTONCSV"
awk -i inplace '!visited[$0]++' "$PROTONCSV"
}
function calculateDefaultResolutions {
function useFallBackResolution {
DUMMYSCREENWIDTH=1920
DUMMYSCREENHEIGHT=1080
writelog "WARN" "${FUNCNAME[0]} - calculating with fallback screenresolution '${DUMMYSCREENWIDTH}x${DUMMYSCREENHEIGHT}' for default values"
SCREENWIDTH="$DUMMYSCREENWIDTH"
SCREENHEIGHT="$DUMMYSCREENHEIGHT"
}
SCREENRES="$("$XRANDR" --current | grep "\*" | awk '{print $1}' | sort -gur | head -n1)"
writelog "INFO" "${FUNCNAME[0]} - '$XRANDR' found screenresolution '$SCREENRES'" "X"
SCREENWIDTH="${SCREENRES%x*}"
SCREENHEIGHT="${SCREENRES#*x}"
if [ -n "${SCREENWIDTH##*[!0-9]*}" ] && [ -n "${SCREENHEIGHT##*[!0-9]*}" ]; then
writelog "INFO" "${FUNCNAME[0]} - found Screen Width '$SCREENWIDTH' and Screen Height '$SCREENHEIGHT'" "X"
else
writelog "WARN" "${FUNCNAME[0]} - '$SCREENRES' is invalid - calculating with fallback screenresolution for default values"
useFallBackResolution
fi
# Scaling factors in percentage, used to calculate the initial gui sizes depending on the screen resolution:
SETSCALE=80
EDREQSCALE=20
ASKSETREQSCALE=15
AETREQSCALE=40
ALTREQSCALE=40
AVSREQSCALE=15
CATREQSCALE=30
CUSTPROGREQSCALE=30
CUSTPROTREQSCALE=15
SEREQSCALE=40
LAUNCHERSCALE=30
# Calculated initial gui sizes:
DEFSETWIDTH=$(( SCREENWIDTH * SETSCALE / 100 ));
DEFSETHEIGHT=$(( SCREENHEIGHT * SETSCALE / 100 ));
DEFEDREQWIDTH=$(( SCREENWIDTH * EDREQSCALE / 100 ));
DEFEDREQHEIGHT=$(( SCREENHEIGHT * EDREQSCALE / 100 ));
DEFASKSETREQWIDTH=$(( SCREENWIDTH * ASKSETREQSCALE / 100 ));
DEFASKSETREQHEIGHT=$(( SCREENHEIGHT * ASKSETREQSCALE / 100 ));
DEFAETREQWIDTH=$(( SCREENWIDTH * AETREQSCALE / 100 ));
DEFAETREQHEIGHT=$(( SCREENHEIGHT * AETREQSCALE / 100 ));
DEFALTREQWIDTH=$(( SCREENWIDTH * ALTREQSCALE / 100 ));
DEFALTREQHEIGHT=$(( SCREENHEIGHT * ALTREQSCALE / 100 ));
DEFCATREQWIDTH=$(( SCREENWIDTH * CATREQSCALE / 100 ));
DEFCATREQHEIGHT=$(( SCREENHEIGHT * CATREQSCALE / 100 ));
DEFCUSTPROGREQWIDTH=$(( SCREENWIDTH * CUSTPROGREQSCALE / 100 ));
DEFCUSTPROGREQHEIGHT=$(( SCREENHEIGHT * CUSTPROGREQSCALE / 100 ));
DEFCUSTPROTREQWIDTH=$(( SCREENWIDTH * CUSTPROTREQSCALE / 100 ));
DEFCUSTPROTREQHEIGHT=$(( SCREENHEIGHT * CUSTPROTREQSCALE / 100 ));
DEFAVSREQWIDTH=$(( SCREENWIDTH * AVSREQSCALE / 100 ));
DEFAVSREQHEIGHT=$(( SCREENHEIGHT * AVSREQSCALE / 100 ));
DEFSEREQWIDTH=$(( SCREENWIDTH * SEREQSCALE / 100 ));
DEFSEREQHEIGHT=$(( SCREENHEIGHT * SEREQSCALE / 100 ));
DEFLAUNCHERWIDTH=$(( SCREENWIDTH * LAUNCHERSCALE / 100 ));
DEFLAUNCHERHEIGHT=$(( SCREENHEIGHT * LAUNCHERSCALE / 100 ));
}
function setDefaultCfgValues {
function setDefaultCfgValuesurl {
if [ -z "$PROJECTPAGE" ] ; then PROJECTPAGE="https://github.com/frostworx/steamtinkerlaunch"; fi
if [ -z "$CP_PROTOLAURL" ] ; then CP_PROTOLAURL="https://github.com/Patola/wine/releases"; fi
if [ -z "$CP_PROTONTKG" ] ; then CP_PROTONTKG="https://github.com/Frogging-Family/wine-tkg-git/releases"; fi
if [ -z "$CP_PROTONGE" ] ; then CP_PROTONGE="https://github.com/GloriousEggroll/proton-ge-custom/releases"; fi
if [ -z "$DL_D3D47_64" ] ; then DL_D3D47_64="https://lutris.net/files/tools/dll/d3dcompiler_47.dll"; fi
if [ -z "$DL_D3D47_32" ] ; then DL_D3D47_32="http://dege.freeweb.hu/dgVoodoo2/D3DCompiler_47.zip"; fi
if [ -z "$RESHADEDLURL" ] ; then RESHADEDLURL="https://reshade.me/downloads"; fi
if [ -z "$EDITORURL" ] ; then EDITORURL="https://steamdb.info/app/AID/info"; fi
if [ -z "$DEPTH3DURL" ] ; then DEPTH3DURL="https://github.com/BlueSkyDefender/Depth3D.git"; fi
if [ -z "$VORTEXURL" ] ; then VORTEXURL="https://github.com/Nexus-Mods/Vortex/releases/download/v"; fi
if [ -z "$DXVKURL" ] ; then DXVKURL="https://github.com/doitsujin/dxvk"; fi
if [ -z "$XLIVEURL" ] ; then XLIVEURL="https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/v4.52/Ultimate-ASI-Loader.zip"; fi
if [ -z "$PFDURL" ] ; then PFDURL="https://github.com/simons-public/$PF.git"; fi
if [ -z "$LUDURL" ] ; then LUDURL="https://lutris.net/api/installers"; fi
if [ -z "$PROTONISSUES" ] ; then PROTONISSUES="https://github.com/ValveSoftware/Proton/issues"; fi
if [ -z "$PIAPI" ] ; then PIAPI="https://api.github.com/repos/ValveSoftware/Proton/issues"; fi
if [ -z "$WMP10URL" ] ; then WMP10URL="https://web.archive.org/web/20050303001123/http://download.microsoft.com/download/1/2/A/12A31F29-2FA9-4F50-B95D-E45EF7013F87"; fi
if [ -z "$STASSURL" ] ; then STASSURL="https://steamcdn-a.akamaihd.net/steam/apps"; fi
}
function setDefaultCfgValuesgui {
if [ ! -f "$STLGUICFG" ] ; then
calculateDefaultResolutions
fi
if [ -z "$SETWIDTH" ] ; then SETWIDTH="$DEFSETWIDTH"; fi
if [ -z "$SETHEIGHT" ] ; then SETHEIGHT="$DEFSETHEIGHT"; fi
if [ -z "$EDREQWIDTH" ] ; then EDREQWIDTH="$DEFEDREQWIDTH"; fi
if [ -z "$EDREQHEIGHT" ] ; then EDREQHEIGHT="$DEFEDREQHEIGHT"; fi
if [ -z "$ASKSETREQWIDTH" ] ; then ASKSETREQWIDTH="$DEFASKSETREQWIDTH"; fi
if [ -z "$ASKSETREQHEIGHT" ] ; then ASKSETREQHEIGHT="$DEFASKSETREQHEIGHT"; fi
if [ -z "$AETREQWIDTH" ] ; then AETREQWIDTH="$DEFAETREQWIDTH"; fi
if [ -z "$AETREQHEIGHT" ] ; then AETREQHEIGHT="$DEFAETREQHEIGHT"; fi
if [ -z "$ALTREQWIDTH" ] ; then ALTREQWIDTH="$DEFALTREQWIDTH"; fi
if [ -z "$ALTREQHEIGHT" ] ; then ALTREQHEIGHT="$DEFALTREQHEIGHT"; fi
if [ -z "$AVSREQWIDTH" ] ; then AVSREQWIDTH="$DEFAVSREQWIDTH"; fi
if [ -z "$AVSREQHEIGHT" ] ; then AVSREQHEIGHT="$DEFAVSREQHEIGHT"; fi
if [ -z "$CATREQWIDTH" ] ; then CATREQWIDTH="$DEFCATREQWIDTH"; fi
if [ -z "$CATREQHEIGHT" ] ; then CATREQHEIGHT="$DEFCATREQHEIGHT"; fi
if [ -z "$CUSTPROGREQWIDTH" ] ; then CUSTPROGREQWIDTH="$DEFCUSTPROGREQWIDTH"; fi
if [ -z "$CUSTPROGREQHEIGHT" ] ; then CUSTPROGREQHEIGHT="$DEFCUSTPROGREQHEIGHT"; fi
if [ -z "$CUSTPROTREQWIDTH" ] ; then CUSTPROTREQWIDTH="$DEFCUSTPROTREQWIDTH"; fi
if [ -z "$CUSTPROTREQHEIGHT" ] ; then CUSTPROTREQHEIGHT="$DEFCUSTPROTREQHEIGHT"; fi
if [ -z "$SEREQWIDTH" ] ; then SEREQWIDTH="$DEFSEREQWIDTH"; fi
if [ -z "$SEREQHEIGHT" ] ; then SEREQHEIGHT="$DEFSEREQHEIGHT"; fi
if [ -z "$LAUNCHERWIDTH" ] ; then LAUNCHERWIDTH="$DEFLAUNCHERWIDTH"; fi
if [ -z "$LAUNCHERHEIGHT" ] ; then LAUNCHERHEIGHT="$DEFLAUNCHERHEIGHT"; fi
}
function setDefaultCfgValuesglobal {
if [ -z "$DLGLOBAL" ] ; then DLGLOBAL="1"; fi
if [ -z "$STLLANG" ] ; then STLLANG="$STLDEFLANG"; fi
if [ -z "$USESTLCSS" ] ; then USESTLCSS="0"; fi
if [ -z "$AUTOTWEAKS" ] ; then AUTOTWEAKS="$AUTOTWEAKPLATFORMS"; fi
if [ -z "$STRACEDIR" ] ; then STRACEDIR="$LOGDIR"; fi
if [ -z "$LOGDIR" ] ; then LOGDIR="$LOGDIR"; fi
if [ -z "$LOGLEVEL" ] ; then LOGLEVEL="2"; fi
if [ -z "$STLEDITOR" ] ; then STLEDITOR="$("$WHICH" geany 2>/dev/null)"; fi
if [ -z "$MAXASK" ] ; then MAXASK="3"; fi
if [ -z "$BROWSER" ] ; then BROWSER="$("$WHICH" firefox 2>/dev/null)"; fi
if [ -z "$NOTY" ] ; then NOTY="$("$WHICH" notify-send 2>/dev/null)"; fi
if [ -z "$USENOTIFIER" ] ; then USENOTIFIER="1"; fi
if [ -z "$NETMON" ] ; then NETMON="$("$WHICH" netstat 2>/dev/null)"; fi
if [ -z "$NETOPTS" ] ; then NETOPTS="-taucp -W"; fi
if [ -z "$NETMONDIR" ] ; then NETMONDIR="$LOGDIR"; fi
if [ -z "$VRVIDEOPLAYER" ] ; then VRVIDEOPLAYER="$("$WHICH" vr-video-player 2>/dev/null)"; fi
if [ -z "$CREATETWEAKS" ] ; then CREATETWEAKS="1"; fi
if [ -z "$GAMCON" ] ; then GAMCON="/usr/share/gameconqueror/GameConqueror.py"; fi
if [ -z "$ATVALIDATE" ] ; then ATVALIDATE="2"; fi
if [ -z "$GLOBALREGDIR" ] ; then GLOBALREGDIR="$SYSTEMSTLCFGDIR/regs"; fi
if [ -z "$GLOBALTWEAKDIR" ] ; then GLOBALTWEAKDIR="$SYSTEMSTLCFGDIR/tweaks"; fi
if [ -z "$GLOBALSBSTWEAKDIR" ] ; then GLOBALSBSTWEAKDIR="$SYSTEMSTLCFGDIR/tweaks/sbs"; fi
if [ -z "$GLOBALUSERTWEAKDIR" ] ; then GLOBALUSERTWEAKDIR="$SYSTEMSTLCFGDIR/tweaks/user"; fi
if [ -z "$GLOBALTWEAKCMDDIR" ] ; then GLOBALTWEAKCMDDIR="$SYSTEMSTLCFGDIR/tweaks/cmd"; fi
if [ -z "$GLOBALCATEGORYDIR" ] ; then GLOBALCATEGORYDIR="$SYSTEMSTLCFGDIR/categories"; fi
if [ -z "$GLOBALMISCDIR" ] ; then GLOBALMISCDIR="$SYSTEMSTLCFGDIR/misc"; fi
if [ -z "$GLOBALSTLLANGDIR" ] ; then GLOBALSTLLANGDIR="$SYSTEMSTLCFGDIR/lang"; fi
if [ -z "$BOXTRONCMD" ] ; then BOXTRONCMD="/usr/share/boxtron/run-dosbox"; fi
if [ -z "$BOXTRONARGS" ] ; then BOXTRONARGS="--wait-before-run"; fi
if [ -z "$ROBERTACMD" ] ; then ROBERTACMD="$STEAMCOMPATOOLS/roberta/run-vm"; fi
if [ -z "$ROBERTAARGS" ] ; then ROBERTAARGS="--wait-before-run"; fi
if [ -z "$LUXTORPEDACMD" ] ; then LUXTORPEDACMD="$STEAMCOMPATOOLS/luxtorpeda/luxtorpeda"; fi
if [ -z "$LUXTORPEDAARGS" ] ; then LUXTORPEDAARGS="wait-before-run"; fi
if [ -z "$CLONE_DEPTH3D" ] ; then CLONE_DEPTH3D="1"; fi
if [ -z "$DEPTH3DSRCDIR" ] ; then DEPTH3DSRCDIR="$STLDLDIR/Depth3D"; fi
if [ -z "$RSVERS" ] ; then RSVERS="4.7.0"; fi
if [ -z "$DOWNLOAD_RESHADE" ] ; then DOWNLOAD_RESHADE="1"; fi
if [ -z "$RESHADESRCDIR" ] ; then RESHADESRCDIR="$STLDLDIR/reshade"; fi
if [ -z "$RS_D3D47_64" ] ; then RS_D3D47_64="d3dcompiler_47_64.dll"; fi
if [ -z "$RS_D3D47_32" ] ; then RS_D3D47_32="d3dcompiler_47_32.dll"; fi
if [ -z "$RS_64" ] ; then RS_64="ReShade64.dll"; fi
if [ -z "$RS_32" ] ; then RS_32="ReShade32.dll"; fi
if [ -z "$SAVESETSIZE" ] ; then SAVESETSIZE="1"; fi
if [ -z "$GAMETABCOLS" ] ; then GAMETABCOLS="3"; fi
if [ -z "$GLOBTABCOLS" ] ; then GLOBTABCOLS="3"; fi
if [ -z "$RESHTABCOLS" ] ; then RESHTABCOLS="1"; fi
if [ -z "$VORTTABCOLS" ] ; then VORTTABCOLS="1"; fi
if [ -z "$USEGUI" ] ; then USEGUI="$YAD"; fi
if [ -z "$USEWINDECO" ] ; then USEWINDECO="0"; fi
if [ -z "$USETRAYICON" ] ; then USETRAYICON="1"; fi
if [ -z "$USEGAMEPICS" ] ; then USEGAMEPICS="1"; fi
if [ -z "$USEGAMEPICINMENU" ] ; then USEGAMEPICINMENU="1"; fi
if [ -z "$DLGAMEDATA" ] ; then DLGAMEDATA="1"; fi
if [ -z "$AUTOLASTPROTON" ] ; then AUTOLASTPROTON="1"; fi
if [ -z "$AUTOPULLPROTON" ] ; then AUTOPULLPROTON="1"; fi
if [ -z "$CUSTPROTDLDIR" ] ; then CUSTPROTDLDIR="$STLDLDIR/$PROCU"; fi
if [ -z "$CUSTPROTEXTDIR" ] ; then CUSTPROTEXTDIR="$STLCFGDIR/$PROCU"; fi
}
function setDefaultCfgValuesdefault_template {
if [ -z "$USESLR" ] ; then USESLR="1"; fi
if [ -z "$USEPROTON" ] ; then USEPROTON="$(getDefaultProton)"; fi
if [ -z "$OVERRIDEPROTON" ] ; then OVERRIDEPROTON="0"; fi
if [ -z "$RUN_CUSTOMCMD" ] ; then RUN_CUSTOMCMD="0"; fi
if [ -z "$CUSTOMCMD" ] ; then CUSTOMCMD="$("$WHICH" echo 2>/dev/null)"; fi
if [ -z "$CUSTOMCMD_ARGS" ] ; then CUSTOMCMD_ARGS="none"; fi
if [ -z "$ONLY_CUSTOMCMD" ] ; then ONLY_CUSTOMCMD="0"; fi
if [ -z "$FORK_CUSTOMCMD" ] ; then FORK_CUSTOMCMD="0"; fi
if [ -z "$GAMEARGS" ] ; then GAMEARGS="none"; fi
if [ -z "$USEGAMEMODERUN" ] ; then USEGAMEMODERUN="0"; fi
if [ -z "$USEGAMESCOPE" ] ; then USEGAMESCOPE="0"; fi
if [ -z "$GAMESCOPE_ARGS" ] ; then GAMESCOPE_ARGS="--"; fi
if [ -z "$MANGOHUD" ] ; then MANGOHUD="0"; fi
if [ -z "$ENABLE_VKBASALT" ] ; then ENABLE_VKBASALT="0"; fi
if [ -z "$RUN_NYRNA" ] ; then RUN_NYRNA="0"; fi
if [ -z "$RUN_REPLAY" ] ; then RUN_REPLAY="0"; fi
if [ -z "$RUN_GAMCON" ] ; then RUN_GAMCON="0"; fi
if [ -z "$GAMCONWAITEXE" ] ; then GAMCONWAITEXE="$("$WHICH" echo 2>/dev/null)"; fi
if [ -z "$VORTEXMODE" ] ; then VORTEXMODE="disabled"; fi
if [ -z "$CHANGE_PULSE_LATENCY" ] ; then CHANGE_PULSE_LATENCY="0"; fi
if [ -z "$STL_PULSE_LATENCY_MSEC" ] ; then STL_PULSE_LATENCY_MSEC="60"; fi
if [ -z "$TOGGLEWINDOWS" ] ; then TOGGLEWINDOWS="0"; fi
if [ -z "$RUN_WINETRICKS" ] ; then RUN_WINETRICKS="0"; fi
if [ -z "$WINETRICKSPAKS" ] ; then WINETRICKSPAKS="none"; fi
if [ -z "$RUN_WINECFG" ] ; then RUN_WINECFG="0"; fi
if [ -z "$VIRTUALDESKTOP" ] ; then VIRTUALDESKTOP="0"; fi
if [ -z "$USEBOXTRON" ] ; then USEBOXTRON="0"; fi
if [ -z "$USEROBERTA" ] ; then USEROBERTA="0"; fi
if [ -z "$USELUXTORPEDA" ] ; then USELUXTORPEDA="0"; fi
if [ -z "$REGEDIT" ] ; then REGEDIT="0"; fi
if [ -z "$INSTALL_RESHADE" ] ; then INSTALL_RESHADE="0"; fi
if [ -z "$RESHADE_DEPTH3D" ] ; then RESHADE_DEPTH3D="0"; fi
if [ -z "$USERESHADE" ] ; then USERESHADE="0"; fi
if [ -z "$RUNSBSVR" ] ; then RUNSBSVR="0"; fi
if [ -z "$VRVIDEOPLAYERARGS" ] ; then VRVIDEOPLAYERARGS="--flat"; fi
if [ -z "$SBSZOOM" ] ; then SBSZOOM="1.0"; fi