ambevar-dotfiles/.scripts/winefps

26 lines
572 B
Plaintext
Raw Normal View History

#!/bin/sh
2013-10-23 11:56:42 +02:00
if [ $# -eq 0 ] || [ "$1" = "-h" ]; then
cat<<EOF
2015-10-08 10:52:40 +02:00
Usage: ${0##*/} WIN_EXE PARAMS"
2013-06-25 22:56:10 +02:00
Run Wine application while displaying FPS onscreen.
EOF
exit
fi
2015-10-15 12:57:03 +02:00
if ! command -v osd_cat >/dev/null 2>&1; then
echo >&2 "osd_cat not found in path."
2015-09-12 16:09:01 +02:00
exit 1
fi
2013-10-23 11:56:42 +02:00
## The unbuffered option is -u on GNU and OpenBSD, -l on others.
OPT_UNBUF=-l
2015-10-15 12:57:03 +02:00
case "$(uname)" in
Linux|OpenBSD) OPT_UNBUF=-u ;;
esac
WINEDEBUG=fps wine "$@" 2>&1 | tee /dev/stderr | \
sed $OPT_UNBUF -n '/^trace:fps:/{s/.* \([^ ]*\)fps/\1/;p}' | \
osd_cat -l1 -f "-*-*-*-*-*-*-32-*-*-*-*-*-*-*" -O1 -c "yellow"