updated on Fri Jan 13 04:01:25 UTC 2012
[aur-mirror.git] / epsxe-launcher-gentoo / epsxe
blobef24997c96f1e9424154c27c1fd5abda1f5062d1
1 #!/bin/sh
3 PSEMUDIR="/opt/epsxe"
4 EPSXEDIR="/opt/epsxe"
6 mkdir -p ~/.epsxe
7 cd ~/.epsxe
8 #cleanlinks
9 mkdir -p memcards bios cfg cheats snap sstates patches plugins
11 shopt -s nullglob
13 for f in `find "${EPSXEDIR}" -maxdepth 1 -type f -printf '%f '` ; do
14 [[ -e "${f}" ]] && continue
15 ln -s "${EPSXEDIR}/${f}" "${f}" >& /dev/null
16 done
18 if [[ -d "${PSEMUDIR}" ]] ; then
19 if [[ -d "${PSEMUDIR}/plugins" ]] ; then
20 for plugin in `find "${PSEMUDIR}/plugins" -maxdepth 1 -type f -printf '%f '` ; do
21 if [[ ! -e "plugins/${plugin}" ]] ; then
22 echo "Loading new plugin: ${plugin}"
23 ln -s "${PSEMUDIR}/plugins/${plugin}" "plugins/${plugin}"
25 done
28 if [[ -d "${PSEMUDIR}/cfg" ]] ; then
29 for configlib in `find "${PSEMUDIR}/cfg" -maxdepth 1 -iname '*.cfg' -prune -o -type f -printf '%f '`; do
30 if [[ ! -e "cfg/${configlib}" ]] ; then
31 echo "Loading config utility: ${configlib}"
32 ln -s "${PSEMUDIR}/cfg/${configlib}" "cfg/${configlib}"
34 done
36 for config in `find "${PSEMUDIR}/cfg" -maxdepth 1 -iname '*.cfg' -type f -printf '%f '`; do
37 if [[ ! -e "cfg/${config}" ]] ; then
38 echo "Loading default config: ${config}"
39 cp "${PSEMUDIR}/cfg/${config}" "cfg/${config}"
41 done
44 if [[ -d "${PSEMUDIR}/cheats" ]] ; then
45 for cheat in `find "${PSEMUDIR}/cheats" -maxdepth 1 -type f -printf '%f '`; do
46 if [[ ! -e "cheats/${cheat}" ]] ; then
47 ln -s "${PSEMUDIR}/cheats/${cheat}" "cheats/${cheat}"
49 done
52 if [[ -d "${PSEMUDIR}/bios" ]] ; then
53 for bios in `find "${PSEMUDIR}/bios" -maxdepth 1 -type f -printf '%f '`; do
54 if [[ ! -e "bios/${bios}" ]] ; then
55 ln -s "${PSEMUDIR}/bios/${bios}" "bios/${bios}"
57 done
61 # check for bios
62 if [[ -z "`cd bios && ls`" ]] ; then
63 # if the bios directory is empty, then ... well ...
64 echo
65 echo "*** Put your BIOS file into ~/.epsxe/bios/"
66 echo " or ePSXe may not work!"
67 echo
70 # execute program (with args)
71 export LD_PRELOAD="libpthread.so.0:${LD_PRELOAD}" # fix for Bug #26121
73 case "$1" in
74 ("-old")
75 shift
76 exec ./epsxe-152 "$@"
78 (*)
79 exec ./epsxe "$@"
81 esac