updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / epsxe-launcher-bash / epsxe.bash
blob7494e42d7c2fe4995dbbfecbb009ff12e0aab354
1 #!/bin/bash
3 # epsxe.bash -- an ePSXe wrapper script
5 # This script will setup an environment for ePSXe 1.5.2 and 1.6.0 and run the
6 # emulator in it.
8 # The directory where the configuration will be stored.
9 DOTDIR="$HOME/.epsxe"
11 # The full path -- including the filename -- to the ePSXe 1.6.0 executable.
12 EPSXE="/opt/epsxe/epsxe"
14 # The full path -- including the filename -- to the ePSXe 1.5.2 executable.
15 EPSXE_OLD="/opt/epsxe/epsxe-1.5.2"
17 # The full path -- including the filename -- to keycodes.lst
18 KEYFILE="/opt/epsxe/keycodes.lst"
20 BIOSDIRS=("/opt/epsxe/bios" "/usr/lib/games/psemu" "/usr/lib/psemu")
21 BIOSPATTERN="*.[Bb][Ii][Nn]"
23 PLUGINDIRS=("/opt/epsxe/plugins" "/usr/lib/games/psemu" "/usr/lib/psemu")
24 PLUGINPATTERN="lib*.so*"
26 CFGDIRS=("/opt/epsxe/cfg" "/usr/lib/games/psemu" "/usr/lib/psemu")
27 CFGPATTERN="cfg*"
29 # Array of filenames of plugins which will never work with ePSXe but with other
30 # PSX emulators. To allow to run everything side by side smoothly you can
31 # blacklist them here.
32 if [ -z "$EPSXE_BLACKLIST"]; then
33 EPSXE_BLACKLIST=("libcdrmooby*.so*" "libDFIso*.so*")
36 mkdir -p "$DOTDIR"
37 cd "$DOTDIR"
38 mkdir -p bios plugins cfg memcards snap sstates
40 echo "Linking executables..."
41 ln -fsv "$EPSXE" epsxe-160
42 ln -fsv "$EPSXE_OLD" epsxe-152
44 echo "Linking keycode file..."
45 ln -fsv "$KEYFILE" keycodes.lst
47 echo "Linking BIOS files..."
48 for dir in ${BIOSDIRS[@]}; do
49 ln -fsv $dir/$BIOSPATTERN -t bios
50 done
52 echo "Linking plugins..."
53 for dir in ${PLUGINDIRS[@]}; do
54 ln -fsv $dir/$PLUGINPATTERN -t plugins
55 done
57 echo "Linking configuration utilities..."
58 for dir in ${CFGDIRS[@]}; do
59 ln -fsv $dir/$CFGPATTERN -t cfg
60 done
62 echo "Cleaning up..."
63 find -P bios cfg plugins -type l | while read link; do
64 [ -e "$link" ] || rm -fv "$link"
65 done
66 for plugin in ${EPSXE_BLACKLIST[@]}; do
67 rm -fv plugins/$plugin
68 done
70 cd - > /dev/null
72 case "$1" in
73 ("-old")
74 shift
75 exec "$DOTDIR/epsxe-152" "$@"
77 (*)
78 exec "$DOTDIR/epsxe-160" "$@"
80 esac