forked from riperiperi/Simitone
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·83 lines (74 loc) · 2.86 KB
/
Copy pathrun.sh
File metadata and controls
executable file
·83 lines (74 loc) · 2.86 KB
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
#!/usr/bin/env bash
# Launch the Simitone Linux port.
#
# Usage:
# ./run.sh [extra Simitone args...]
#
# Environment:
# TS1_PATH Path to your The Sims 1 install (the directory containing
# GameData/ and UserData/). If unset, the script searches
# common locations including Wine prefixes.
# CONFIG Build configuration to launch (default: Release).
#
# Anything you pass on the command line is forwarded to Simitone, so:
# ./run.sh -3d -aa -hz144
set -euo pipefail
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CONFIG="${CONFIG:-Release}"
PROJECT="$REPO_DIR/Client/Simitone/Simitone.Windows/Simitone.Windows.csproj"
BIN_DIR="$REPO_DIR/Client/Simitone/Simitone.Windows/bin/$CONFIG/net9.0"
# ---- sanity ---------------------------------------------------------------
if ! command -v dotnet >/dev/null 2>&1; then
echo "error: dotnet SDK not found. Install .NET 9 SDK and retry." >&2
exit 1
fi
# ---- build if needed ------------------------------------------------------
if [[ ! -f "$BIN_DIR/Simitone.dll" ]]; then
echo ">> Building Simitone ($CONFIG)..."
dotnet build -c "$CONFIG" "$PROJECT"
fi
# ---- locate The Sims 1 install -------------------------------------------
find_ts1() {
local candidates=(
"${TS1_PATH:-}"
"$BIN_DIR/game1"
"$REPO_DIR/../The Sims"
"$HOME/.wine/drive_c/Program Files (x86)/Maxis/The Sims"
"$HOME/.wine/drive_c/Program Files/Maxis/The Sims"
"$HOME/.local/share/wineprefixes/thesims/drive_c/Program Files (x86)/Maxis/The Sims"
"$HOME/.local/share/wineprefixes/thesims/drive_c/Program Files/Maxis/The Sims"
"$HOME/.PlayOnLinux/wineprefix/TheSims/drive_c/Program Files (x86)/Maxis/The Sims"
"$HOME/Games/TheSims"
)
for c in "${candidates[@]}"; do
[[ -z "$c" ]] && continue
if [[ -f "$c/GameData/Behavior.iff" ]]; then
# Resolve to a real path so we never symlink game1 -> game1.
readlink -f "$c"
return 0
fi
done
return 1
}
if ts1="$(find_ts1)"; then
echo ">> Using The Sims 1 at: $ts1"
# Symlink as game1/ so the LinuxLocator finds it without -path,
# but only if the existing entry doesn't already point there.
if [[ ! -e "$BIN_DIR/game1" ]] || ! [[ "$BIN_DIR/game1" -ef "$ts1" ]]; then
ln -sfn "$ts1" "$BIN_DIR/game1"
fi
else
cat >&2 <<EOF
error: could not locate a The Sims 1 install.
Looked in: \$TS1_PATH, $BIN_DIR/game1,
~/.wine/.../Maxis/The Sims, common Wine prefixes, ~/Games/TheSims.
Either set TS1_PATH, e.g.
TS1_PATH="\$HOME/.wine/drive_c/Program Files (x86)/Maxis/The Sims" ./run.sh
or symlink your install as $BIN_DIR/game1.
EOF
exit 1
fi
# ---- launch ---------------------------------------------------------------
cd "$BIN_DIR"
echo ">> Launching Simitone (OpenGL)..."
exec dotnet Simitone.dll -gl "$@"