Last active
March 7, 2022 11:42
-
-
Save divadsn/a1586841dcce072c1c57fd290daf17bb to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
export WINEPREFIX=/home/$USER/.local/share/TRS2004 | |
export WINEARCH=win32 | |
wineboot -u | |
# Install dependencies | |
winetricks -q mfc42 | |
# Remove symlinks to homedir | |
winetricks settings fontsmooth=rgb | |
winetricks settings sandbox | |
# Restart wineprefix | |
wineboot -r | |
# Install Windows fonts | |
curl "https://mirror.codebucket.de/.testing/fonts.zip" --output /tmp/fonts.zip | |
unzip /tmp/fonts.zip -d $WINEPREFIX/drive_c/windows/Fonts/ | |
rm /tmp/fonts.zip | |
SETUP_FILE=$(zenity --file-selection) | |
if [ $? -ne 0 ]; then | |
print "No file selected, aborting..." | |
exit 1 | |
fi | |
# Extract game to wineprefix | |
7z x "$SETUP_FILE" -o$WINEPREFIX/drive_c/Trainz/ | |
# Set fullscreen resolution to display size | |
IFS='x' read -ra DISPLAY_SIZE <<< $(xrandr --current | grep '*' | uniq | awk '{print $1}') | |
WIDTH=${DISPLAY_SIZE[0]} | |
HEIGHT=${DISPLAY_SIZE[1]} | |
# Create application shortcut | |
cat << EOF > "$HOME/.local/share/applications/TRS2004.desktop" | |
[Desktop Entry] | |
Name=Trainz Railroad Simulator 2004 | |
Comment=Build and operate the railroad of your dreams. | |
Exec=env WINEPREFIX="${WINEPREFIX}" wine TRS2004.exe | |
Path=${WINEPREFIX}/drive_c/Trainz | |
Icon=trs2004 | |
Type=Application | |
Categories=Game; | |
StartupWMClass=TRS2004.exe | |
EOF | |
# Download app icon | |
curl "https://i.imgur.com/n8kV0Yv.png" --output "$HOME/.local/share/icons/hicolor/128x128/apps/trs2004.png" | |
update-desktop-database -q | |
echo "Done! You can launch the game from your applications menu." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment