winefps 622 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. usage () {
  3. cat <<EOF>&2
  4. Usage: ${0##*/} WIN_EXE PARAMS"
  5. Run Wine application while displaying FPS onscreen.
  6. EOF
  7. }
  8. [ $# -eq 0 ] && usage && exit 1
  9. [ "$1" = "-h" ] && usage && exit
  10. [ "$1" = "--" ] && shift
  11. if ! command -v osd_cat >/dev/null 2>&1; then
  12. echo >&2 "osd_cat not found"
  13. exit 1
  14. fi
  15. ## The unbuffered option is -u on GNU and OpenBSD, -l on others.
  16. OPT_UNBUF=-l
  17. case "$(uname)" in
  18. Linux|OpenBSD) OPT_UNBUF=-u ;;
  19. esac
  20. WINEDEBUG=fps wine "$@" 2>&1 | tee /dev/stderr | \
  21. sed $OPT_UNBUF -n '/^trace:fps:/{s/.* \([^ ]*\)fps/\1/;p}' | \
  22. osd_cat -l1 -f "-*-*-*-*-*-*-32-*-*-*-*-*-*-*" -O1 -c "yellow"