aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsinanmohd <pcmsinan@gmail.com>2023-02-18 10:24:33 +0530
committersinanmohd <pcmsinan@gmail.com>2023-02-18 10:24:33 +0530
commit53759a69e132bd1fec21304426a93cd4bcff9bed (patch)
tree24c6c5106b3c917232469f809f647056ec462ff0
parent9daa111d2a50a0b7d4c0a574f8ac3caafa7142c9 (diff)
feature: mangohud: add support for diffrent perfomance overlay levels
-rw-r--r--example/example.sb5
-rwxr-xr-xsoibox51
2 files changed, 50 insertions, 6 deletions
diff --git a/example/example.sb b/example/example.sb
index 476be3b..87b9956 100644
--- a/example/example.sb
+++ b/example/example.sb
@@ -6,8 +6,9 @@
# 3) soibox config is located at ~/.config/soibox/soibox.conf, this applies
# to all games, game profiles are specific to each game
-# use mangohud for perfomance overlay in games.
-# mangohud : on
+# use mangohud perfomance overlay, the value can either be on, 1,2,3,4 or path to
+# a mangohud config. 1 being just the fps and 4 being the most verbose option,
+# mangohud : 3
# 4 options 0,1,2,3. 1 outputs just progress bars and banners, 3 being the most verbose
# loglevel : 1
diff --git a/soibox b/soibox
index 05cfb14..4614890 100755
--- a/soibox
+++ b/soibox
@@ -17,7 +17,7 @@ usage()
Options:
-i Ignore global config
-l 0-3 Loglevel, 1 being nothing, 2 being errors, and 3 all
- -m Mangohud, enable fps overlay
+ -m [1-4] Enable performance overlay, 4 being the most verbose
-g Use feral's gamemode
-s Use gamescope
-d Dryrun, shows you errors in config
@@ -164,7 +164,7 @@ parse_opts()
shift
fi
- while getopts ":r:mil:gsfdb" f
+ while getopts ":r:m:il:gsfdb" f
do
case "$f" in
r)
@@ -174,7 +174,7 @@ parse_opts()
die "$local_config, no such file"
;;
m)
- mangohud=on
+ mangohud="${OPTARG:-on}"
;;
i)
ignore_globalconf=true
@@ -454,6 +454,46 @@ setup_groot()
fi
}
+setup_mangohud()
+{
+ : "${1:?setup_mangohud: empty \$1}"
+
+ MANGOHUD_CONFIG=
+ mangohud=on
+ dep_check "mangohud"
+
+ case "$1" in
+ 1)
+ MANGOHUD_CONFIG="frame_timing=0,cpu_stats=0,gpu_stats=0,fps=1,fps_only,legacy_layout=0,width=40,frametime=0"
+ ;;
+ 2)
+ MANGOHUD_CONFIG="battery"
+ ;;
+ 3)
+ MANGOHUD_CONFIG="cpu_temp,gpu_temp,ram,vram,io_read,io_write,arch,gpu_name,cpu_power,gpu_power,wine,frametime,battery"
+ ;;
+ 4)
+ MANGOHUD_CONFIG="full,cpu_temp,gpu_temp,ram,vram,io_read,io_write,arch,gpu_name,cpu_power,gpu_power,wine,frametime,battery"
+ ;;
+ on)
+ # use the default config
+ ;;
+ *)
+ if [ -f "$(absolute_path "$mangohud" "$local_config" )" ]
+ then
+ MANGOHUD_CONFIGFILE="$(absolute_path "$mangohud" "$local_config" )"
+ export MANGOHUD_CONFIGFILE
+ else
+ warn "config, mangohud, ${1}, invalid option"
+ mangohud=off
+ fi
+ ;;
+ esac
+
+ [ -n "$MANGOHUD_CONFIG" ] &&
+ export MANGOHUD_CONFIG
+}
+
absolute_path()
{
# usage: absolute_path "path" "local_conf"
@@ -569,6 +609,9 @@ main()
die "unable to locate the game executable"
fi
+ [ -n "$mangohud" ] &&
+ setup_mangohud "$mangohud"
+
[ "$dry_run" = "true" ] &&
exit
@@ -592,7 +635,7 @@ main()
[ -n "$wine" ] &&
cmd="${wine_exe} ${cmd}"
- [ "$mangohud" = on ] && dep_check "mangohud" &&
+ [ "$mangohud" = on ] &&
cmd="mangohud ${cmd}"
[ "$gamemode" = on ] && dep_check "gamemoderun" &&
cmd="gamemoderun ${cmd}"