41 lines
1.0 KiB
Bash
41 lines
1.0 KiB
Bash
#!/bin/sh
|
|
|
|
# NOTE: This is dfhack's modification of the normal invocation script,
|
|
# changed to properly set LD_PRELOAD so as to run DFHACK.
|
|
#
|
|
# You can run DF under gdb by passing -g or --gdb as the first argument.
|
|
|
|
DF_DIR=$(dirname "$0")
|
|
cd "${DF_DIR}"
|
|
export SDL_DISABLE_LOCK_KEYS=1 # Work around for bug in Debian/Ubuntu SDL patch.
|
|
#export SDL_VIDEO_CENTERED=1 # Centre the screen. Messes up resizing.
|
|
|
|
case "$1" in
|
|
-g | --gdb)
|
|
shift
|
|
echo "set environment LD_PRELOAD=./libdfhack.so" > gdbcmd.tmp
|
|
gdb -x gdbcmd.tmp ./libs/Dwarf_Fortress $*
|
|
rm gdbcmd.tmp
|
|
ret=$?
|
|
;;
|
|
-h | --helgrind)
|
|
shift
|
|
LD_PRELOAD=./libdfhack.so valgrind --tool=helgrind --log-file=helgrind.log ./libs/Dwarf_Fortress $*
|
|
ret=$?
|
|
;;
|
|
-v | --valgrind)
|
|
shift
|
|
LD_PRELOAD=./libdfhack.so valgrind --log-file=valgrind.log ./libs/Dwarf_Fortress $*
|
|
ret=$?
|
|
;;
|
|
*)
|
|
LD_PRELOAD=./libdfhack.so ./libs/Dwarf_Fortress $*
|
|
ret=$?
|
|
;;
|
|
esac
|
|
|
|
# Reset terminal to sane state in case of a crash
|
|
reset
|
|
|
|
exit $ret
|