|
1 | 1 | #!/bin/bash |
| 2 | +# WINE / Proton setup env |
2 | 3 | export WINEPREFIX="$HOME/.wine64" |
3 | 4 | export WINEARCH="win64" |
4 | 5 | export WINEDEBUG="-all" |
5 | 6 |
|
6 | | -export VPROJECT="/mnt/500GB/source1/0xdecompiled" |
7 | | -export SteamLibrary="/mnt/500GB/SteamLibrary/steamapps/common" |
| 7 | +# default compile flags, and yeah I use all of then |
8 | 8 | export CompileFlags="-verbose -printbones -fastbuild -fullcollide -collapsereport -dumpmaterials -nop4 -nox360 -n -h -parsecompletion $@" |
9 | 9 |
|
10 | | -export SFM="Z:$SteamLibrary/SourceFilmmaker/game/usermod" |
11 | | -export SFMbin="$SteamLibrary/SourceFilmmaker/game/bin" |
| 10 | +# nix paths |
| 11 | +export SteamLibrary="/mnt/500GB/SteamLibrary/steamapps/common" |
12 | 12 |
|
13 | | -export GMod="Z:$SteamLibrary/GarrysMod/garrysmod" |
14 | | -export GModbin="$SteamLibrary/GarrysMod/bin" |
| 13 | +# this will be used as prefix for every QCProject |
| 14 | +export VPROJECT0="/mnt/500GB/source1/0xdecompiled" |
| 15 | +export qcprefix="Z:$VPROJECT0" |
15 | 16 |
|
| 17 | +# This set the StudioMDL -game flag |
| 18 | +export GMod="Z:$SteamLibrary/GarrysMod/garrysmod" |
| 19 | +export SFM="Z:$SteamLibrary/SourceFilmmaker/game/usermod" |
16 | 20 | export L4D2="Z:$SteamLibrary/Left 4 Dead 2/left4dead2" |
| 21 | + |
| 22 | +# here the *nix path to the bin filder |
| 23 | +export GModbin="$SteamLibrary/GarrysMod/bin" |
17 | 24 | export L4D2bin="$SteamLibrary/Left 4 Dead 2/bin" |
18 | | -export proton4="/home/loverenamon/.steam/steam/steamapps/common/Proton 4.11/dist/bin/wine" # para l4d2 que tem DRM |
| 25 | +export SFMbin="$SteamLibrary/SourceFilmmaker/game/bin" |
| 26 | + |
| 27 | +# here a special path for the l4d2 WINEPREFIX and avoid mess with our above WINEPREFIX |
| 28 | +export L4D2pfx="/mnt/500GB/SteamLibrary/steamapps/compatdata/563/pfx" |
| 29 | + |
| 30 | +# l4d2 had a throublesome authoring way, so we need set proton to enforce steam can see can use this StudioMDL. the "$@" is necessary to accept arguments |
| 31 | +proton4() { |
| 32 | + $HOME/.steam/steam/steamapps/common/Proton\ 4.11/dist/bin/wine "$@" |
| 33 | +} |
| 34 | + |
| 35 | +# Uncomment if you have a special WINE environment, or even use Proton instaed, like we did with above Proton 4.11 |
| 36 | +#wine() { |
| 37 | +# put here your custom wine path is you wanna use a specific version, example: |
| 38 | +# /usr/bin/wine "$@" |
| 39 | +# $HOME/.steam/steam/steamapps/common/Proton\ 5.0/dist/bin/wine "$@" |
| 40 | +#} |
| 41 | + |
| 42 | +print_env() { |
| 43 | + gamemsg="\nO Jogo selecionado é: \e[1;49;97m${1}\e[0m\n\nEnvironment modified to:\n\t\e[1;49;97mGAMEINFO:\e[0m $GAME\n\t\e[1;49;97mGAMEBIN:\e[0m $(pwd)\n\t\e[1;49;97mWINEPREFIX:\e[0m $WINEPREFIX\n\t\e[1;49;97mWINEARCH:\e[0m $WINEARCH\n" |
| 44 | + compilemsg="Compiling for the previously selected gamemod at:\n\e[1;49;97m\"$GAME/models\"\e[0m\n" |
| 45 | + echo -e ${gamemsg} |
| 46 | +} |
| 47 | + |
| 48 | +set_wine_prefix() { |
| 49 | + case "$1" in |
| 50 | + w64) export WINEPREFIX=$WINE64;; |
| 51 | + 563) export WINEPREFIX="$L4D2pfx";; |
| 52 | + help) echo -e "valid options: w64 | 563 | Any SteamID";; |
| 53 | + *) export WINEPREFIX="${SteamLibrary::-7}/compatdata/$1/pfx";; |
| 54 | + esac |
| 55 | +} |
19 | 56 |
|
20 | | -export GAME=$GMod # Opção default |
| 57 | +set_custom_mod() { |
| 58 | + read -e -p "WINEPREFIX: " pfx |
| 59 | + read -e -p "GAMEBIN: " gamebin |
| 60 | + read -e -p "GAMEINFO (where is your gameinfo.txt): " gameinfo |
| 61 | + set_wine_prefix $pfx |
| 62 | + cd "$gamebin" |
| 63 | + export GAME="Z:$gameinfo" |
| 64 | + print_env |
| 65 | +} |
21 | 66 |
|
22 | | -cd $SFMbin |
23 | | -title="\n\e[0;38;5;220mStudioMDL script para Source Engine. por: Davi (Debiddo) Gooz\e[0m\n" |
24 | | -prompt="Selecione uma opção: jogo ou compilar: " |
25 | | -options=("GMod" "SFM" "L4D2" "Compile") |
26 | | -gamemsg="\nO jogo selecionado é agora é" |
27 | | -compilemsg="Compilando para o relativo jogo em:\n\e[1;49;97m\"$GAME/models\"\e[0m\n" |
| 67 | +# Default Option |
| 68 | +set_default() { |
| 69 | + GAME=$GMod |
| 70 | + cd $SFMbin |
| 71 | + set_wine_prefix w64 |
| 72 | + print_env "Garry's Mod" |
| 73 | +} |
28 | 74 |
|
29 | | -echo -e "\nStudioMDL rodando em \e[1;49;97m\"$WINEARCH\"\e[0m dentro do prefixo \e[1;49;97m\"$WINEPREFIX\"\e[0m\n |
| 75 | +# gmod bin folder is a mess and their StudioMDL cant deal with higher density $lod, so we'll mix with SFM by default, change if you think it should be |
| 76 | +set_gmod() { |
| 77 | + GAME=$GMod |
| 78 | + set_wine_prefix w64 |
| 79 | + cd $GModbin |
| 80 | + print_env "Garry's Mod" |
| 81 | +} |
30 | 82 |
|
31 | | - Observações: |
32 | | - - Use arquivos de texto em .qc |
33 | | - - Não há necessidade de inserir a extensão do arquivo |
34 | | - - Evite usar espaços nos diretórios |
35 | | - - Insira o diretório relativo à: |
36 | | - \e[1;49;97m$VPROJECT0\e[0m |
| 83 | +set_sfm() { |
| 84 | + GAME=$SFM |
| 85 | + set_wine_prefix w64 |
| 86 | + cd $SFMbin |
| 87 | + print_env "Source Filmmaker" |
| 88 | +} |
37 | 89 |
|
38 | | - Esse script roda em loop então poderá compilar inúmeros arquivos em sequência\n" |
| 90 | +set_l4d2() { |
| 91 | + GAME="$L4D2" |
| 92 | + set_wine_prefix 563 |
| 93 | + cd "$L4D2bin" |
| 94 | + print_env "Left 4 Dead 2" |
| 95 | +} |
| 96 | + |
| 97 | +do_compile() { |
| 98 | + echo -e "$compilemsg" |
| 99 | + read -p "QC: " qcfile |
| 100 | + wine studiomdl $CompileFlags -game "$GAME" "$qcprefix/$qcfile" |
| 101 | + echo -e $title |
| 102 | +} |
| 103 | + |
| 104 | +do_l4d2() { |
| 105 | + cd "$L4D2bin" |
| 106 | + echo -e "\nCompiling for \e[1;49;97mLeft 4 Dead 2\e[0m at:\n\e[1;49;97m\"$L4D2/models\"\e[0m\n" |
| 107 | + print_env "Left 4 Dead 2" |
| 108 | + read -e -p "QC: " qcfile |
| 109 | + WINEPREFIX="$L4D2pfx" proton4 ./studiomdl.exe '-checklenghts -n -h -printbones -printgraph -nox360 -fastbuild -dumpmaterials -nop4 -verbose' "$@" -game "$L4D2" "$qcprefix/$qcfile" |
| 110 | + echo -e "\n$title\n" |
| 111 | +} |
| 112 | + |
| 113 | +ajuda_ai_meu() { |
| 114 | + echo -e "\n\tsorry I'm still working at this option\n" |
| 115 | +} |
| 116 | + |
| 117 | +title="\n\e[0;38;5;220mStudioMDL-helper para Source Engine.\n por: Davi (Debiddo) Gooz\e[0m\n" |
| 118 | +options=("Set Garry's Mod" "Set Source Filmmaker" "Set Left 4 Dead 2" "Compile a QC" "L4D2 Compile (dev)" "Reset Defaults" "Set Custom Environment" "Help") |
| 119 | +prompt=" |
| 120 | +Select one of above options: |
| 121 | +" |
| 122 | +## Start the shit |
| 123 | +echo -e "\nStudioMDL running at \e[1;49;97m\"$WINEARCH\"\e[0m arch inside the \e[1;49;97m\"$WINEPREFIX\"\e[0m\n Wine Prefix |
| 124 | +
|
| 125 | + TIPs: |
| 126 | + - Insert bellow a .qc file |
| 127 | + - You don't need to write their extension |
| 128 | + - Avoid \"space\" usage |
| 129 | + - Insert your QC project relative to: \e[1;49;97m$VPROJECT0\e[0m |
| 130 | +
|
| 131 | + This script run in loop so you'll be able to compile sequentially many files\n" |
39 | 132 | echo -e "$title" |
40 | 133 |
|
| 134 | +set_default |
| 135 | + |
| 136 | +# Ask what should be done |
41 | 137 | PS3="$prompt" |
42 | 138 | select opt in "${options[@]}" "Quit"; do |
43 | 139 | case "$REPLY" in |
44 | | - 1) echo -e "$gamemsg \e[1;49;97m\Garry's Mod\e[0m" |
45 | | - export GAME=$GMod |
46 | | - cd $GModbin;echo;; |
47 | | - g*) echo -e "$gamemsg \e[1;49;97m\Garry's Mod" |
48 | | - export GAME=$GMod |
49 | | - cd $GModbin;echo;; |
50 | | - |
51 | | - 2) echo -e "$gamemsg \e[1;49;97m\Source Filmmaker\e[0m" |
52 | | - export GAME=$SFM |
53 | | - cd $SFMbin;echo;; |
54 | | - s*) echo -e "$gamemsg \e[1;49;97m\Source Filmmaker\e[0m" |
55 | | - export GAME=$SFM |
56 | | - cd $SFMbin;echo;; |
57 | | - |
58 | | - 3) echo -e "$gamemsg \e[1;49;97m\Left 4 Dead 2\e[0m" |
59 | | - export GAME="$L4D2" |
60 | | - cd "$L4D2bin"; |
61 | | - echo -e "\npara compilar, digite \e[1;49;97m\"lc\"\e[0m";; |
62 | | - l) echo -e "$gamemsg \e[1;49;97m\Left 4 Dead 2\e[0m" |
63 | | - export GAME="$L4D2" |
64 | | - cd "$L4D2bin"; |
65 | | - echo -e "\npara compilar, digite \e[1;49;97m\"lc\"\e[0m";; |
66 | | - l4d*) echo -e "$gamemsg \e[1;49;97m\Left 4 Dead 2\e[0m" |
67 | | - export GAME="$L4D2" |
68 | | - cd "$L4D2bin"; |
69 | | - echo -e "\npara compilar, digite \e[1;49;97m\"lc\"\e[0m";; |
70 | | - |
71 | | - # Compile part: |
72 | | - 4) echo -e "$compilemsg" |
73 | | - read -p "QC: " qcfile |
74 | | - env wine studiomdl $CompileFlags -game "$GAME" "V:/0xdecompiled/$qcfile" |
75 | | - echo -e $title;; |
76 | | - c*) echo -e "$compilemsg" |
77 | | - read -p "QC: " qcfile |
78 | | - env wine studiomdl $CompileFlags -game "$GAME" "V:/0xdecompiled/$qcfile" |
79 | | - echo -e $title;; |
80 | | - m*) echo -e "$compilemsg" |
81 | | - read -p "QC: " qcfile |
82 | | - env wine studiomdl $CompileFlags -game "$GAME" "V:/0xdecompiled/$qcfile" |
83 | | - echo -e $title;; |
84 | | - |
85 | | - # Especial para l4d2 |
86 | | - lc*) echo -e "\nCompilando especialmente para \e[1;49;97mLeft 4 Dead 2\e[0m em:\n\e[1;49;97m\"$GAME/models\"\e[0m\n" |
87 | | - read -e -p "QC: " qcfile |
88 | | - cd "$L4D2bin" |
89 | | - env WINEPREFIX=/mnt/500GB/SteamLibrary/steamapps/compatdata/563/pfx "$proton4" ./studiomdl.exe '-checklenghts -n -h -printbones -printgraph -nox360 -fastbuild -dumpmaterials -nop4 -verbose' "$@" -game "$L4D2" "V:/0xdecompiled/$qcfile" |
90 | | - echo -e "\n$title\n";; |
91 | | - |
92 | | - $((${#options[@]}+1))) break;; |
93 | | - e*) break;; |
94 | | - q*) break;; |
95 | | - *) echo -e "\e[0;38;5;160mOpção inválida. Tente outra.\e[0m\n"; |
96 | | - continue;; |
| 140 | + # Environments Setup |
| 141 | + 1*) set_gmod;; |
| 142 | + g*) set_gmod;; |
| 143 | + |
| 144 | + 2*) set_sfm;; |
| 145 | + sf*) set_sfm;; |
| 146 | + |
| 147 | + 3*) set_l4d2;; |
| 148 | + l) set_l4d2;; |
| 149 | + l4d2) set_l4d2;; |
| 150 | + |
| 151 | + # Compile part: |
| 152 | + 4*) do_compile;; |
| 153 | + c*) do_compile;; |
| 154 | + m*) do_compile;; |
| 155 | + |
| 156 | + # L4D2 Special |
| 157 | + 5*) do_l4d2;; |
| 158 | + lc*) do_l4d2;; |
| 159 | + l4d2c*) do_l4d2;; |
| 160 | + |
| 161 | + # reset to Default Env |
| 162 | + 6*) set_default;; |
| 163 | + def*) set_default;; |
| 164 | + |
| 165 | + # set custom Env |
| 166 | + 7*) set_custom_mod;; |
| 167 | + set) set_custom_mod;; |
| 168 | + |
| 169 | + 8*) ajuda_ai_meu;; |
| 170 | + help) ajuda_ai_meu;; |
| 171 | + ajuda) ajuda_ai_meu;; |
| 172 | + |
| 173 | + $((${#options[@]}+1))) break;; |
| 174 | + e*) break;; |
| 175 | + q*) break;; |
| 176 | + |
| 177 | + *) echo -e "\e[0;38;5;160mInvalid Option. Try again.\e[0m\n"; |
| 178 | + continue;; |
97 | 179 | esac |
98 | 180 | done |
0 commit comments