Skip to content

Instantly share code, notes, and snippets.

@Lantizia
Last active August 11, 2021 08:45
Show Gist options
  • Save Lantizia/a5728d720033890b26351fc2a8007ca1 to your computer and use it in GitHub Desktop.
Save Lantizia/a5728d720033890b26351fc2a8007ca1 to your computer and use it in GitHub Desktop.
Sid Meier's Colonization Wine Prefix AutoExec
#!/bin/bash
LOCALDATA=$(dirname "$(readlink -f "$0")")
export WINEPREFIX=$(dirname $LOCALDATA)
PATH=$WINEPREFIX/wine/bin:$PATH
choice=$(zenity --title "Sid Meier's Colonization" --text "Select an item to launch from the list below." --window-icon $LOCALDATA/colwin.png --ok-label "Launch" --list --radiolist --hide-header --column x --column y TRUE "Sid Meier's Colonization for Windows" FALSE "Select map when starting in AMERICA" FALSE "Map Editor" FALSE "Instruction manual" FALSE "Browse installation path")
case "$choice" in
"Sid Meier's Colonization for Windows")
swdrv insert "$LOCALDATA/Colonize.toc"
wine cmd /c md "%UserProfile%\My Documents\Sid Meier's Colonization"
wine cmd /c "C:&&cd %UserProfile%\My Documents\Sid Meier's Colonization&&C:\MPS\COLWIN\colonize"
swdrv eject
;;
"Select map when starting in AMERICA")
cd $WINEPREFIX/drive_c/MPS/COLWIN
select=$(find * -type f -iname "*.mp"|sed '1iOriginal amer2.mp'|grep -iv ^amer2.mp$|sed 's/^/\n/'|sed '1cTRUE'|zenity --title "Sid Meier's Colonization" --text "Select map filename for the starting in AMERICA option from the list below." --window-icon $LOCALDATA/colwin.png --ok-label "Select" --list --radiolist --hide-header --column x --column y)
case "$select" in
"Original amer2.mp")
find $WINEPREFIX/drive_c/MPS/COLWIN -type f -iname amer2.mp -delete
cp $LOCALDATA/amer2.mp $WINEPREFIX/drive_c/MPS/COLWIN
;;
"")
;;
*)
cp -f "$WINEPREFIX/drive_c/MPS/COLWIN/$select" "$WINEPREFIX/drive_c/MPS/COLWIN/amer2.mp"
;;
esac
exec "$(readlink -f "$0")" "$@"
;;
"Map Editor")
dosbox -conf $(c=$(mktemp);echo -e "[sdl]\nfullscreen=true\n[autoexec]\nmount c $WINEPREFIX/drive_c\nc:\ncd MPS\COLWIN\nMAPEDIT.EXE\nexit">>$c;echo $c)
;;
"Instruction manual")
xdg-open "$LOCALDATA/COLONIZ.PDF"
;;
"Browse installation path")
xdg-open "$WINEPREFIX/drive_c/MPS/COLWIN"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment