blob: b6f849d07310ae0aba6ffc31530a6be833bf469a (
plain)
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
|
#!/bin/sh
#
# run the gameboy emulator "bgb" in wine
#
# environment variables:
# BGB_CONFIG_PATH=<path> Override the path of the bgb.ini file
# BGB_EXE_PATH=<path> Override the path to bgb.exe
# BGB_DEBUGMSG_DIR=<path> Override the path where debugmsg*.txt will be saved
# BGB_SAVE_DEBUGMSG=false Don't save debugmsg*.txt files
# BGB_SAVE_CONFIG=false Don't save GUI configuration changes
set -e
if [ -z "$BGB_EXE_PATH" ]; then
BGB_EXE_PATH=/usr/lib/bgb/bgb.exe
fi
if [ -z "$BGB_CONFIG_PATH" ]; then
BGB_CONFIG_PATH="${XDG_CONFIG_HOME:-$HOME/.config}/bgb/bgb.ini"
fi
if [ -z "$BGB_DEBUGMSG_DIR" ]; then
BGB_DEBUGMSG_DIR=.
fi
tmp="$(mktemp -d)"
cp "$BGB_EXE_PATH" "$tmp/bgb.exe"
if [ -e "$BGB_CONFIG_PATH" ]; then
cp "$BGB_CONFIG_PATH" "$tmp/bgb.ini"
fi
wine "$tmp/bgb.exe" "$@"
if [ "$BGB_SAVE_DEBUGMSG" != false ]; then
mkdir -p "$(dirname "$BGB_DEBUGMSG_DIR")"
cp -t "$BGB_DEBUGMSG_DIR" "$tmp"/debugmsg*.txt 2>/dev/null || true
fi
if [ "$BGB_SAVE_CONFIG" != false ] && [ -e "$tmp/bgb.ini" ]; then
mkdir -p "$(dirname "$BGB_CONFIG_PATH")"
cp "$tmp/bgb.ini" "$BGB_CONFIG_PATH"
fi
rm -r "$tmp"
|