Last active
October 12, 2024 17:12
-
-
Save cadr10/46bf332885d8701cf793812c7feedc4a to your computer and use it in GitHub Desktop.
The Sims 4 LINUX LUTRIS installer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
##TESTED WITH: FITGIRL REPACK LIVING ISLAND (NEED TO RUN TROUBLESHOOTING AFTER INSTALL) and CODEX. | |
##TESTADO COM: FITGIRL REPACK LIVING ISLAND (PRECISA RODAR O CONSERTAR DEPOIS DE INSTALAR) e CODEX. | |
#This can fix: executable not found error; game opens then closes after a sec; games opens with wrong language | |
#A seção consertar vai arrumar: problema de 'executable not found', o jogo abre e fecha depois de 1 segundo e o jogo abre em inglês. | |
trouble1() { | |
pgrep lutris | xargs kill 2>/dev/null | |
lutriscfg=$(find $HOME/.config/lutris/games/ -name "The Sims 4*") | |
ts4arch=$(grep -oP '(?<=arch\:\ ).*' "$lutriscfg") | |
workdir="$(grep -oP '(?<=working_dir\:\ ).*' "$lutriscfg")" | |
foundexe=$(find $workdir -name "TS4.exe" | grep -oP "drive_c\/.*Program Files.*?/.*?\/") | |
if [[ $ts4arch = "win64" ]]; then | |
sed -i "s|exe\:.*|exe: $foundexe\Game\/Bin\/TS4_x64.exe|g" "$lutriscfg" | |
else | |
sed -i "s|exe\:.*|exe: $foundexe\Game\/Bin\/TS4.exe|g" "$lutriscfg" | |
fi | |
} | |
trouble2() { | |
pgrep lutris | xargs kill 2>/dev/null | |
lutriscfg=$(find $HOME/.config/lutris/games/ -name "The Sims 4*") | |
sed -i "s/dxvk:.*/dxvk: false/g" "$lutriscfg" | |
} | |
trouble3() { | |
pgrep lutris | xargs kill 2>/dev/null | |
lutriscfg=$(find $HOME/.config/lutris/games/ -name "The Sims 4*") | |
ts4prefix="$(grep -oP '(?<=prefix\:\ ).*' "$lutriscfg")" | |
export WINEPREFIX="$ts4prefix" | |
echo "$trouble31" && sleep 2 | |
echo " | |
cs_CZ | Czech | |
da_DK | Danish | |
de_DE | German | |
en_US | English | |
es_ES | Spanish | |
fi_FI | Finnish | |
fr_FR | French | |
it_IT | Italian | |
ja_JP | Japanese | |
ko_KR | Korean | |
nl_NL | Dutch | |
no_NO | Norwegian | |
pl_PL | Polish | |
pt_BR | Portuguese Brazil | |
ru_RU | Russian | |
sv_SE | Swedish | |
zh_TW | Chinese Traditional" | |
printf "\n" | |
read -p "$trouble3p: " selectedlang | |
echo 'REGEDIT4 | |
[HKEY_LOCAL_MACHINE\SOFTWARE\Maxis\The Sims 4] | |
"Locale"="'$selectedlang'"' > "$(pwd)/ts4lang.reg" | |
wine regedit /S foo.reg | |
rm "$(pwd)/ts4lang.reg" | |
} | |
varen() { | |
export menu1="Install or troubleshooting" | |
export menu1_2=""Install" "Troubleshoot"" | |
export menu2="Select what you want to fix in The Sims 4: " | |
export menu2_2=""Executable_not_found" "Game_opens_for_a_sec then closes" "Game_opens_without_proper_language"" | |
export trouble31="This will create a registry in case your games opens in a unwanted language. You still need language strings" | |
export trouble3p="Type your language as shown in the first column" | |
CONTINUEKEY="(press any key to continue)" | |
export fileprompt="Is this the correct file? (y/n)" | |
export filepromptwarn="If you are not installing with CODEX, press N then Y" | |
export fileprompt2="Put the script in a folder separate with only the thesims iso file." | |
export fileprompt2_1="Do you have a setup file?" | |
export ileprompt2_2="Get an installer!!" | |
export fileprompt3="Too many iso files. I can't identify the correct one." | |
export fileprompt4="Move the script and the right iso to a separate folder" | |
export fileprompt5="There is not a .iso file in the script dir" | |
export fileprompt6="Assuming you already have a setup file elsewhere" | |
export lutrisprompt1="Lutris not Installed" | |
export lutrisprompt2="Trying to install it" | |
export lutrisprompt3="Install Lutris clicking here" | |
export lutrisprompt4="Lutris installed" | |
export yamlnot="Creating YAML file" | |
export installinstruction="Change the installation directory from The Sims 4 Get Famous to The Sims 4. INSTALL IT IN THE DEFAULT FOLDER. Example: c:/Program Files (x86)/The Sims 4 Get Famous to c:/Program Files (x86)/The Sims 4. Otherwise the script wont work." | |
export installinstruction2="Choose the games language: NOTE** Depending on your selected language, youll need to download its files. I cant automate that." | |
} | |
installen() { | |
echo -e "\n" | |
read -n 1 -s -r -p "(1/8)This script is the semi-automatic way to install test The Sims 4 on Linux. $CONTINUEKEY" | |
echo -e "\n" | |
read -n 1 -s -r -p "(2/8)You need a the sims 4 .iso file. I recommend CODEX. Search and download on your own (sorry) $CONTINUEKEY" | |
echo -e "\n" | |
read -n 1 -s -r -p "(3/8)Before going forward, make sure this file is in a separate folder with only the iso file beside it $CONTINUEKEY" | |
echo -e "\n" | |
read -n 1 -s -r -p "(4/8)Now that we made sure of it, just wait till Lutris open and read instructions there before clicking the install button $CONTINUEKEY" | |
echo -e "\n" | |
read -n 1 -s -r -p "(5/8)When prompt, don't install Gecko or Mono $CONTINUEKEY" | |
echo -e "\n" | |
read -n 1 -s -r -p "(6/8)Don't press the Run button in the CODEX or whatever repack you're using. Don't install DirectX or other programs with your repack $CONTINUEKEY" | |
echo -e "\n" | |
read -n 1 -s -r -p "(7/8)Install language files from here: https://www.games4theworld.club/t32948-latest-available-the-sims-4-language-strings-for-users-of-origin-zlorigin-version-1-52-100-1020# .If you select anything other than english and don't download, your game will fail to start $CONTINUEKEY" | |
echo -e "\n" | |
read -n 1 -s -r -p "(8/8)You may close this window after Lutris says that Installation is finished. Doing prematurely, will corrupt your install and you'll need to do it again. $CONTINUEKEY" | |
echo -e "\n" | |
} | |
varptbr() { | |
export menu1="Instalar ou Consertar" | |
export menu1_2=""Instalar" "Consertar"" | |
export menu2="Selecione o que você quer consertar no The Sims 4:" | |
export menu2_2=""Executable_not_found" "Jogo_aparece_na_barra_de_tarefas_e_fecha" "Jogo_abre_sem_tradução"" | |
export trouble31="Isso vai criar um registro para seu jogo entrar na linguagem correta. Você ainda vai precisar dos arquivos de linguagem" | |
export trouble3p="Digite a linguagem no formato mostrado na primeira coluna" | |
export CONTINUEKEY="(pressione qualquer tecla para continuar)" | |
export fileprompt="Esse é o arquivo correto? (s/n)" | |
export filepromptwarn="Se não estiver instalando com CODEX (FitGirl), aperte N e depois S" | |
export fileprompt2="Coloque o script em uma pasta separada com o arquivo iso." | |
export fileprompt2_1="Tem outro setup.exe em outro lugar?" | |
export ileprompt2_2="Arrume um instalador" | |
export fileprompt3="Muitos arquivos iso. Não consigo identificar o correto." | |
export fileprompt4="Mova o script e o arquivo iso para uma pasta separada." | |
export fileprompt5="Não há um arquivo iso na pasta." | |
export fileprompt6="Assumindo que você já tenha um setup.exe em algum lugar." | |
export lutrisprompt1="Lutris não está instalado." | |
export lutrisprompt2="Tentando instalar" | |
export lutrisprompt3="Instale o Lutris clicando aqui" | |
export lutrisprompt4="Lutris instalado" | |
export yamlnot="Criando arquivo YAML" | |
export installinstruction="Troque o directório de instalação de The Sims 4 Get Famous para The Sims 4. Instale na pasta padrão. Exemplo: c:/Program Files (x86)/The Sims 4 Get Famous para c:/Program Files (x86)/The Sims 4. Caso contrário, o jogo não iniciará **Você pode alterar mas vai ter que configurar o Lutris depois." | |
export installinstruction2="Escolha o idioma do jogo: NOTA** Dependendo no idioma selecionado, você precisará baixar outros arquivos." | |
} | |
installptbr() { | |
echo -e "\n" | |
read -n 1 -s -r -p "(1/8)Esse script instala semi-automaticamente The Sims 4 no linux. $CONTINUEKEY" | |
echo -e "\n" | |
read -n 1 -s -r -p "(2/8)Você precisa de um arquivo .iso do The Sims 4. Eu recomendo CODEX. Procure e baixe por conta propria $CONTINUEKEY" | |
echo -e "\n" | |
read -n 1 -s -r -p "(3/8)Antes de prosseguir, certifique que esse arquivo script está em uma pasta separada com apenas o arquivo iso junto a ele. $CONTINUEKEY" | |
echo -e "\n" | |
read -n 1 -s -r -p "(4/8)Depois disso, espere o Lutris abrir e leia as instruções lá antes de clicar no botão Install $CONTINUEKEY" | |
echo -e "\n" | |
read -n 1 -s -r -p "(5/8)Quando perguntado, não instale Gecko ou Mono $CONTINUEKEY" | |
echo -e "\n" | |
read -n 1 -s -r -p "(6/8)Não aperte para rodar o The Sims 4 (botão RUN) no instalador do CODEX ou repack que você estiver usando. Não instale directX os outros programas com o instalador. $CONTINUEKEY" | |
echo -e "\n" | |
read -n 1 -s -r -p "(7/8)Instale outros idiomas daqui: https://www.games4theworld.club/t32948-latest-available-the-sims-4-language-strings-for-users-of-origin-zlorigin-version-1-52-100-1020# .Se você selecionar um idioma que não seja o inglês na instalação e não baixar o arquivos de idioma, seu jogo não iniciará $CONTINUEKEY" | |
echo -e "\n" | |
read -n 1 -s -r -p "(8/8)Você só poderá fechar essa janela após que o Lutris terminar a instalação. Fechar antes irá corromper a instalação e você precisará faze-la de novo. $CONTINUEKEY" | |
echo -e "\n" | |
} | |
printf "\n" | |
PS3='Select your language / Selecione seu idioma: ' | |
options=("English" "Português Brasileiro") | |
select opt in "${options[@]}" | |
do | |
case $opt in | |
"English") export locales=en; var$locales; break ;; | |
"Português Brasileiro") export locales=ptbr; var$locales; break ;; | |
*) echo "invalid option $REPLY";; | |
esac | |
done | |
printf "\n" | |
PS3="$menu1: " | |
options=($menu1_2) | |
select opt1 in "${options[@]}" | |
do | |
case $opt1 in | |
"$(echo "$menu1_2" | awk '{print $1}')") install$locales; break;; | |
"$(echo "$menu1_2" | awk '{print $2}')") | |
printf "\n" | |
PS3="$menu2 " | |
options=($menu2_2) | |
select opt2 in "${options[@]}" | |
do | |
case $opt2 in | |
"$(echo "$menu2_2" | awk '{print $1}')") | |
echo -e "\n" | |
trouble1 | |
echo "Try to open your game again" | |
break ;; | |
"$(echo "$menu2_2" | awk '{print $2}')") | |
echo -e "\n" | |
trouble2 | |
echo "Try to open your game again" | |
echo -e "\n" | |
break ;; | |
"$(echo "$menu2_2" | awk '{print $3}')") | |
echo -e "\n" | |
trouble3 | |
echo "Try to open your game again" | |
echo -e "\n" | |
break ;; | |
*) echo "invalid option $REPLY" ;; | |
esac | |
done | |
exit | |
;; | |
*) echo "invalid option $REPLY" | |
;; | |
esac | |
done | |
#ISO CHECK | |
if [[ "$(ls $pwd -l)" =~ .*\.iso.* ]]; then | |
if [[ "$(ls $pwd -p | grep -v '/$' | grep '.iso' | wc -l)" = 1 ]]; then | |
read -p "$(ls $pwd -p | grep '.iso') $fileprompt $filepromptwarn " ANS | |
echo -e "\n" | |
case $ANS in | |
*n*) | |
read -p "$fileprompt2_1 " ANS2 | |
case $ANS2 in | |
*n*) | |
echo "$fileprompt2_2"; sleep 5; exit | |
esac | |
esac | |
else | |
echo "$fileprompt3"; sleep 2 | |
echo "$fileprompt4"; sleep 5 | |
exit | |
fi | |
else | |
echo "$fileprompt5"; sleep 2 | |
echo "$fileprompt6"; sleep 2 | |
fi | |
#Check systemarch | |
case $(uname --machine) in | |
i386) export winem=32 | |
export tsdir="drive_c/Program Files/The Sims 4/Game/Bin/TS4.exe" | |
;; | |
x86_64) export winem=64 | |
export tsdir="drive_c/Program Files (x86)/The Sims 4/Game/Bin/TS4_x64.exe" | |
;; | |
esac | |
#LUTRIS CHECK | |
pgrep lutris | xargs kill 2>/dev/null | |
while [ -z $(lutris -v) ] ; do | |
echo "$lutrisprompt1" | |
sleep 1 | |
echo "$lutrisprompt2" | |
sleep 1 | |
shopt -s nocasematch | |
case "$(cat /etc/*-release)" in | |
*ubuntu*|*elementary*|*mint*) | |
sudo add-apt-repository ppa:lutris-team/lutris -y | |
sudo apt-get update -y | |
sudo apt-get install lutris -y | |
echo "matched ubuntu" ;; | |
*debian*) | |
echo "deb http://download.opensuse.org/repositories/home:/strycore/Debian_10/ ./" | sudo tee /etc/apt/sources.list.d/lutris.list | |
wget -q https://download.opensuse.org/repositories/home:/strycore/Debian_10/Release.key -O- | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get install lutris ;; | |
*Solus*) sudo eopkg it lutris ;; | |
*Fedora*) sudo dnf install lutris ;; | |
*OpenSUSE*) sudo zypper in lutris ;; | |
*Arch*|*Antergos*|*Manjaro*) sudo pacman -S lutris ;; | |
*Pop\!OS*) echo -e "$lutrisprompt3 appstream://net.lutris.Lutris" ;; | |
*Mageia*) echo -e "$lutrisprompt3 https://madb.mageia.org/package/show/name/lutris" ;; | |
*Gentoo*) echo -e "$lutrisprompt3 https://packages.gentoo.org/packages/games-util/lutris" ;; | |
*CentOS*) echo -e "$lutrisprompt3 https://slackbuilds.org/apps/lutris/" ;; | |
esac | |
done | |
echo "$lutrisprompt4" ; sleep 3 | |
echo -e "\n" | |
#ISOMOUNTING | |
DIR="$(pwd)/iso/setup.exe" ##variavel para o instalador, assim não precisa selecionar. | |
mkdir "$(pwd)/iso/" 2>/dev/null #fazendo a pasta iso no diretorio atual(pwd) | |
ISOTS=$(find "$(pwd)" -name "*.iso") | |
! [ -z $ISOTS ] && sudo mount -t auto "$ISOTS" "$(pwd)/iso" -o loop 2>/dev/null #sabendo o que é o mount e o pwd, esses comandos são bem simples. | |
echo "$yamlnot" | |
echo 'name: The Sims 4 | |
game_slug: the-sims-4 | |
version: The Sims 4 Get Famous | |
slug: The Sims 4 | |
runner: wine | |
notes: "'$installinstruction'" | |
script: | |
game: | |
exe: '$tsdir' | |
prefix: $GAMEDIR | |
arch: win'$winem' | |
working_dir: $GAMEDIR | |
files: | |
- file1: N/A:Please select the Sims 4 setup file | |
installer: | |
- task: | |
arch: win'$winem' | |
description: Creating Wine Prefix... | |
name: create_prefix | |
prefix: $GAMEDIR | |
- task: | |
app: dotnet20sp2 | |
description: Installing .Net | |
name: winetricks | |
prefix: $GAMEDIR | |
silent: true | |
- task: | |
app: vcrun2010 | |
name: winetricks | |
prefix: $GAMEDIR | |
silent: true | |
- task: | |
app: vcrun2012 | |
name: winetricks | |
prefix: $GAMEDIR | |
silent: true | |
- task: | |
app: vcrun2013 | |
name: winetricks | |
prefix: $GAMEDIR | |
silent: true | |
- task: | |
executable: file1 | |
name: wineexec | |
prefix: $GAMEDIR | |
- input_menu: | |
description: "'$installinstruction2'" | |
id: LANG | |
options: | |
- "cs_CZ": "Czech" | |
- "da_DK": "Danish" | |
- "de_DE": "German" | |
- "en_US": "English" | |
- "es_ES": "Spanish" | |
- "fi_FI": "Finnish" | |
- "fr_FR": "French" | |
- "it_IT": "Italian" | |
- "ja_JP": "Japanese" | |
- "ko_KR": "Korean" | |
- "nl_NL": "Dutch" | |
- "no_NO": "Norwegian" | |
- "pl_PL": "Polish" | |
- "pt_BR": "Portuguese (Brazil)" | |
- "ru_RU": "Russian" | |
- "sv_SE": "Swedish" | |
- "zh_TW": "Chinese (Traditional)" | |
preselect: ja_JP | |
- task: | |
name: set_regedit | |
prefix: $GAMEDIR | |
path: HKEY_LOCAL_MACHINE\SOFTWARE\Maxis\The Sims 4 | |
key: "Locale" | |
value: $INPUT_LANG | |
type: REG_SZ | |
- task: | |
name: set_regedit | |
prefix: $GAMEDIR | |
path: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Maxis\The Sims 4 | |
key: "Locale" | |
value: $INPUT_LANG | |
type: REG_SZ | |
system: | |
env: | |
STAGING_SHARED_MEMORY: "0" | |
__GL_SHADER_DISK_CACHE: "1" | |
__GL_SHADER_DISK_CACHE_PATH: $GAMEDIR | |
__GL_THREADED_OPTIMIZATIONS: "1" | |
mesa_glthread: "true" | |
wine: | |
dxvk: true | |
esync: true | |
overrides: | |
nvapi,nvapi64: disabled' > "$(pwd)/ts4install.yml" #essa etapa cria o arquivo script que o lutris precisa | |
sleep 3 | |
lutris -i "$(pwd)/ts4install.yml" #executando o script no lutris | |
sleep 3 | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment