ambevar-dotfiles/.local/bin/winefps

30 lines
622 B
Plaintext
Raw Normal View History

#!/bin/sh
usage () {
cat <<EOF>&2
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.
2013-06-25 22:56:10 +02:00
EOF
}
[ $# -eq 0 ] && usage && exit 1
[ "$1" = "-h" ] && usage && exit
[ "$1" = "--" ] && shift
2015-10-15 12:57:03 +02:00
if ! command -v osd_cat >/dev/null 2>&1; then
echo >&2 "osd_cat not found"
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"