forked from sigboe/pie-galaxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdosbox-launcher.sh
executable file
·55 lines (42 loc) · 1.46 KB
/
dosbox-launcher.sh
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
#!/usr/bin/env bash
dosboxromdir="${HOME}/RetroPie/roms/pc/gog"
game=$(basename -s .sh "${0}")
# DOSBox settings override
export DOSBOX_SDL_USESCANCODES=false
if [[ -x "/opt/retropie/emulators/dosbox/bin/dosbox" ]]; then
emu="/opt/retropie/emulators/dosbox/bin/dosbox"
fi
if ! [[ -x "$(command -v ${emu:-dosbox})" ]]; then
echo "DOSBox not installed."
exit 1
fi
echo "Launching ${game}"
cd "${dosboxromdir}/${game}/DOSBOX" || exit 1
#fixes
if [[ -f "../dosboxSTARGUN_single.conf" ]] && ! grep -q "pause" ../dosboxSTARGUN_single.conf; then
#This fixes stargunner from crashing on load on linux
ed -s ../dosboxSTARGUN_single.conf <<< $'g/STARGUN\\.exe/i\\\npause\nw'
fi
dosboxargs=( $(jq --raw-output '.playTasks[] | select(.isPrimary==true) | .arguments' ../goggame-*.info | sed 's:\\:/:g;s:\"::g') )
if [[ -z "${dosboxargs[*]}" ]]; then
dosboxargs=(
-conf
"$(find .. -maxdepth 1 -name 'dosbox*.conf' | awk '{print length " " $1}' | sort -n | head -1 | awk '{print $2}')"
-conf
"$(find .. -maxdepth 1 -name 'dosbox*single.conf' | head -1)"
-c
exit
)
fi
# match=$(echo "${dosboxargs[@]:0}" | grep -o "STARGUN") && if [[ -n "${match}" ]]; then
# #pause emulation before game starts, because it will crash if not
# printf '[autoexec]\npause' > dosboxSTARGUN_pause.conf
# dosboxargs=(
# "${dosboxargs[@]:0:2}"
# -config
# dosboxSTARGUN_pause.conf
# "${dosboxargs[@]:2}"
# )
# fi
echo "Found arugments: ${dosboxargs[*]}"
"${emu:-dosbox}" ${dosboxargs[@]}