Does anyone know how to make 4:3 resolutions set in-game use their correct aspect ratio (black bars) on Linux, as opposed to just stretching the game to fit my monitor? When I used Windows 7 there was a setting like that in the NVIDIA Control Panel, but I can't find anything like that when I check NVIDIA X Server Settings. There is a scaling option on my physical monitor settings menu but it's greyed out and not usable unless it detects that you're using a 4:3 desktop resolution, and I can't even try that because I have an LCD that won't let me use 144hz refresh rate (just 60hz-75hz) if I'm not on the native 1920x1080.
https://i.imgur.com/6ZtdMcj.png
When I play Goldsrc games like Counter-Strike or Half-Life: Opposing Force, those automatically maintain their aspect ratio without stretching and have no problems at all. Any Source Engine game just stretches the picture out to fit my monitor, though.
https://i.imgur.com/fJf9iHX.png
I've spent the past couple days searching all over Google for how to fix this problem but all I seem to get are suggestions for deprecated xrandr commands (things like --set "scaling mode" "Full aspect") which do nothing but give me a bunch of errors. I'm not very Linux-savvy when it comes to all the terminal stuff so any help or suggestions would be greatly appreciated.
Some system information:
canti@manjaro
OS: Manjaro 17.1.10 Hakoila
Kernel: x86_64 Linux 4.14.39-1-MANJARO
Uptime: 10h 29m
Packages: 1182
DE: KDE 5.45.0 / Plasma 5.12.5
WM: KWin
CPU: Intel Core i5-4670K @ 4x 3.8GHz
GPU: GeForce GTX 980
RAM: 4029MiB / 15989MiB
NVIDIA Driver Version: 390.48
Does anyone know how to make 4:3 resolutions set in-game use their correct aspect ratio (black bars) on Linux, as opposed to just stretching the game to fit my monitor? When I used Windows 7 there was a setting like that in the NVIDIA Control Panel, but I can't find anything like that when I check NVIDIA X Server Settings. There is a scaling option on my physical monitor settings menu but it's greyed out and not usable unless it detects that you're using a 4:3 desktop resolution, and I can't even try that because I have an LCD that won't let me use 144hz refresh rate (just 60hz-75hz) if I'm not on the native 1920x1080.
[img]https://i.imgur.com/6ZtdMcj.png[/img]
When I play Goldsrc games like Counter-Strike or Half-Life: Opposing Force, those automatically maintain their aspect ratio without stretching and have no problems at all. Any Source Engine game just stretches the picture out to fit my monitor, though.
[img]https://i.imgur.com/fJf9iHX.png[/img]
I've spent the past couple days searching all over Google for how to fix this problem but all I seem to get are suggestions for deprecated xrandr commands (things like [i]--set "scaling mode" "Full aspect"[/i]) which do nothing but give me a bunch of errors. I'm not very Linux-savvy when it comes to all the terminal stuff so any help or suggestions would be greatly appreciated.
Some system information:
[code]canti@manjaro
OS: Manjaro 17.1.10 Hakoila
Kernel: x86_64 Linux 4.14.39-1-MANJARO
Uptime: 10h 29m
Packages: 1182
DE: KDE 5.45.0 / Plasma 5.12.5
WM: KWin
CPU: Intel Core i5-4670K @ 4x 3.8GHz
GPU: GeForce GTX 980
RAM: 4029MiB / 15989MiB
NVIDIA Driver Version: 390.48[/code]
just use 16:9 it's 2018 bro
just use 16:9 it's 2018 bro
https://forums.linuxmint.com/viewtopic.php?t=204531
try the commands in the last post (run xrandr and replace DFP-0 with your output)
nvidia-settings --assign CurrentMetaMode="DFP-0: 1024x768 { ViewPortIn=1024x768, ViewPortOut=804x768+110+0 }"
if you need to figure out other resolutions it's documented here
http://download.nvidia.com/XFree86/Linux-x86/302.07/README/configtwinview.html
https://forums.linuxmint.com/viewtopic.php?t=204531
try the commands in the last post (run xrandr and replace DFP-0 with your output)
nvidia-settings --assign CurrentMetaMode="DFP-0: 1024x768 { ViewPortIn=1024x768, ViewPortOut=804x768+110+0 }"
if you need to figure out other resolutions it's documented here
http://download.nvidia.com/XFree86/Linux-x86/302.07/README/configtwinview.html
lumiereshttps://forums.linuxmint.com/viewtopic.php?t=204531
try the commands in the last post (run xrandr and replace DFP-0 with your output)
nvidia-settings --assign CurrentMetaMode="DFP-0: 1024x768 { ViewPortIn=1024x768, ViewPortOut=804x768+110+0 }"
if you need to figure out other resolutions it's documented here
http://download.nvidia.com/XFree86/Linux-x86/302.07/README/configtwinview.html
I tried all of this already too. Closest I could get to what I want was using ViewPortOut=1440x1080+240+0 to make my desktop in 4:3 with the black bars. That almost works, but when I go into TF2/CS:S all of the menu items and their clickable space gets misaligned (e.g. I have to put my cursor near the center of the screen to select the Scout image/class on the left side). None of the panning options (both "Panning" in the NVIDIA X Server Settings interface and the PanningTrackingArea option listed in the updated documentation for my driver version) did anything to help that, either.
Even if I could get that option to work, I'm not really interested in having that much wasted space on my primary monitor at all times, I just want my 4:3 aspect ratio to show up properly in-game while still making full use of my 16:9 monitor space in every other window. It's clearly possible with other games (CS1.6 in OP) so why can't I get it to work like that with Source Engine/TF2?
[quote=lumieres]https://forums.linuxmint.com/viewtopic.php?t=204531
try the commands in the last post (run xrandr and replace DFP-0 with your output)
nvidia-settings --assign CurrentMetaMode="DFP-0: 1024x768 { ViewPortIn=1024x768, ViewPortOut=804x768+110+0 }"
if you need to figure out other resolutions it's documented here
http://download.nvidia.com/XFree86/Linux-x86/302.07/README/configtwinview.html[/quote]
I tried all of this already too. Closest I could get to what I want was using ViewPortOut=1440x1080+240+0 to make my desktop in 4:3 with the black bars. That almost works, but when I go into TF2/CS:S all of the menu items and their clickable space gets misaligned (e.g. I have to put my cursor near the [i]center[/i] of the screen to select the Scout image/class on the [i]left[/i] side). None of the panning options (both "Panning" in the NVIDIA X Server Settings interface and the PanningTrackingArea option listed in [url=http://download.nvidia.com/XFree86/Linux-x86_64/390.48/README/configtwinview.html]the updated documentation for my driver version[/url]) did anything to help that, either.
Even if I could get that option to work, I'm not really interested in having that much wasted space on my primary monitor at all times, I just want my 4:3 aspect ratio to show up properly in-game while still making full use of my 16:9 monitor space in every other window. It's clearly possible with other games (CS1.6 in OP) so why can't I get it to work like that with Source Engine/TF2?
changing the resolution in source games doesn't actually change the desktop resolution in my experience
the trick is making a script that manually changes the resolution of your desktop when you open the game, and returns back to your normal desktop resolution when you close it
1.- figure out the xrandr name assigned to your screen by typing "xrandr" on a terminal (for example VGA-1 or LVDS-1)
2.- open hl2.sh in your Team Fortress 2 folder and right under #1/bin/bash create a line and put "xrandr --output LVDSS-1 --mode 1024x768" (replace LVDS-1 with your screen name)
3.- at the end of the file, between "done" and "exit", create a line saying xrandr --output LVDS-1 --mode 1920x1080 (again, replace with your actual screen name, and your native monitor resolution of course). This will execute when you exit the game.
this works on my laptop
changing the resolution in source games doesn't actually change the desktop resolution in my experience
the trick is making a script that manually changes the resolution of your desktop when you open the game, and returns back to your normal desktop resolution when you close it
1.- figure out the xrandr name assigned to your screen by typing "xrandr" on a terminal (for example VGA-1 or LVDS-1)
2.- open hl2.sh in your Team Fortress 2 folder and right under [b]#1/bin/bash[/b] create a line and put "[b]xrandr --output LVDSS-1 --mode 1024x768[/b]" (replace LVDS-1 with your screen name)
3.- at the end of the file, between "done" and "exit", create a line saying [b]xrandr --output LVDS-1 --mode 1920x1080[/b] (again, replace with your actual screen name, and your native monitor resolution of course). This will execute when you exit the game.
this works on my laptop
sagechanging the resolution in source games doesn't actually change the desktop resolution in my experience
the trick is making a script that manually changes the resolution of your desktop when you open the game, and returns back to your normal desktop resolution when you close it
1.- figure out the xrandr name assigned to your screen by typing "xrandr" on a terminal (for example VGA-1 or LVDS-1)
2.- open hl2.sh in your Team Fortress 2 folder and right under #1/bin/bash create a line and put "xrandr --output LVDSS-1 --mode 1024x768" (replace LVDS-1 with your screen name)
3.- at the end of the file, between "done" and "exit", create a line saying xrandr --output LVDS-1 --mode 1920x1080 (again, replace with your actual screen name, and your native monitor resolution of course). This will execute when you exit the game.
this works on my laptop
Well after a whole afternoon of searching, I found a combination of these instructions & ViewPortOut to be the answer to my problems!
Basically I just replaced "xrandr --output [display] --mode [resolution]" with "nvidia-settings --assign CurrentMetaMode="_______________" and filled the blank space with the normal settings I use for my dual monitor setup (from /etc/X11/xorg.conf), edited my viewport settings to {viewportin=1920x1080, viewportout=1440x1080+240+0} to make a cramped 4:3 desktop (while still being recognized as 1920x1080@144hz), and then made it change back to the original viewport settings at the end of the file.
Obviously I'd still like the old flat panel scaling functionality back but this will do for the time being, I guess I can always make a separate global bind/shortcut for restoring my viewport settings if I ever need to tab out of the game to do something. Thank you very much for your help!
https://i.imgur.com/BmdbELi.jpg
And my hl2.sh:
#!/bin/bash
nvidia-settings --assign CurrentMetaMode="DVI-I-1: 1920x1080_144 +0+267 {viewportin=1920x1080, viewportout=1440x1080+240+0}, HDMI-0: nvidia-auto-select +1920+0 {rotation=left}"
# figure out the absolute path to the script being run a bit
# non-obvious, the ${0%/*} pulls the path out of $0, cd's into the
# specified directory, then uses $PWD to figure out where that
# directory lives - and all this in a subshell, so we don't affect
# $PWD
GAMEROOT=$(cd "${0%/*}" && echo $PWD)
#determine platform
UNAME=`uname`
if [ "$UNAME" == "Darwin" ]; then
# Workaround OS X El Capitan 10.11 System Integrity Protection (SIP) which does not allow
# DYLD_INSERT_LIBRARIES to be set for system processes.
if [ "$STEAM_DYLD_INSERT_LIBRARIES" != "" ] && [ "$DYLD_INSERT_LIBRARIES" == "" ]; then
export DYLD_INSERT_LIBRARIES="$STEAM_DYLD_INSERT_LIBRARIES"
fi
# prepend our lib path to LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH="${GAMEROOT}"/bin:$DYLD_LIBRARY_PATH
elif [ "$UNAME" == "Linux" ]; then
# prepend our lib path to LD_LIBRARY_PATH
export LD_LIBRARY_PATH="${GAMEROOT}"/bin:$LD_LIBRARY_PATH
fi
if [ -z $GAMEEXE ]; then
if [ "$UNAME" == "Darwin" ]; then
GAMEEXE=hl2_osx
elif [ "$UNAME" == "Linux" ]; then
GAMEEXE=hl2_linux
fi
fi
ulimit -n 2048
# enable nVidia threaded optimizations
export __GL_THREADED_OPTIMIZATIONS=1
# and launch the game
cd "$GAMEROOT"
# Enable path match if we are running with loose files
if [ -f pathmatch.inf ]; then
export ENABLE_PATHMATCH=1
fi
# Do the following for strace:
# GAME_DEBUGGER="strace -f -o strace.log"
# Do the following for tcmalloc
# LD_PRELOAD=../src/thirdparty/gperftools-2.0/.libs/libtcmalloc_debug.so:$LD_PRELOAD
STATUS=42
while [ $STATUS -eq 42 ]; do
if [ "${GAME_DEBUGGER}" == "gdb" ] || [ "${GAME_DEBUGGER}" == "cgdb" ]; then
ARGSFILE=$(mktemp $USER.hl2.gdb.XXXX)
echo b main > "$ARGSFILE"
# Set the LD_PRELOAD varname in the debugger, and unset the global version. This makes it so that
# gameoverlayrenderer.so and the other preload objects aren't loaded in our debugger's process.
echo set env LD_PRELOAD=$LD_PRELOAD >> "$ARGSFILE"
echo show env LD_PRELOAD >> "$ARGSFILE"
unset LD_PRELOAD
echo run $@ >> "$ARGSFILE"
echo show args >> "$ARGSFILE"
${GAME_DEBUGGER} "${GAMEROOT}"/${GAMEEXE} -x "$ARGSFILE"
rm "$ARGSFILE"
else
${GAME_DEBUGGER} "${GAMEROOT}"/${GAMEEXE} "$@"
fi
STATUS=$?
done
nvidia-settings --assign CurrentMetaMode="DVI-I-1: 1920x1080_144 +0+267 {viewportin=1920x1080, viewportout=1920x1080+0+0}, HDMI-0: nvidia-auto-select +1920+0 {rotation=left}"
exit $STATUS
[quote=sage]changing the resolution in source games doesn't actually change the desktop resolution in my experience
the trick is making a script that manually changes the resolution of your desktop when you open the game, and returns back to your normal desktop resolution when you close it
1.- figure out the xrandr name assigned to your screen by typing "xrandr" on a terminal (for example VGA-1 or LVDS-1)
2.- open hl2.sh in your Team Fortress 2 folder and right under [b]#1/bin/bash[/b] create a line and put "[b]xrandr --output LVDSS-1 --mode 1024x768[/b]" (replace LVDS-1 with your screen name)
3.- at the end of the file, between "done" and "exit", create a line saying [b]xrandr --output LVDS-1 --mode 1920x1080[/b] (again, replace with your actual screen name, and your native monitor resolution of course). This will execute when you exit the game.
this works on my laptop[/quote]
Well after a whole afternoon of searching, I found a combination of these instructions & [i]ViewPortOut[/i] to be the answer to my problems!
Basically I just replaced [i]"xrandr --output [display] --mode [resolution]"[/i] with [b]"nvidia-settings --assign CurrentMetaMode="_______________"[/b] and filled the blank space with the normal settings I use for my dual monitor setup (from /etc/X11/xorg.conf), edited my viewport settings to [b]{viewportin=1920x1080, viewportout=1440x1080+240+0}[/b] to make a cramped 4:3 desktop (while still being recognized as 1920x1080@144hz), and then made it change back to the original viewport settings at the end of the file.
Obviously I'd still like the old flat panel scaling functionality back but this will do for the time being, I guess I can always make a separate global bind/shortcut for restoring my viewport settings if I ever need to tab out of the game to do something. Thank you very much for your help!
[img]https://i.imgur.com/BmdbELi.jpg[/img]
And my [i][b]hl2[i][/i][i].sh[/b][/i]:
[code]#!/bin/bash
nvidia-settings --assign CurrentMetaMode="DVI-I-1: 1920x1080_144 +0+267 {viewportin=1920x1080, viewportout=1440x1080+240+0}, HDMI-0: nvidia-auto-select +1920+0 {rotation=left}"
# figure out the absolute path to the script being run a bit
# non-obvious, the ${0%/*} pulls the path out of $0, cd's into the
# specified directory, then uses $PWD to figure out where that
# directory lives - and all this in a subshell, so we don't affect
# $PWD
GAMEROOT=$(cd "${0%/*}" && echo $PWD)
#determine platform
UNAME=`uname`
if [ "$UNAME" == "Darwin" ]; then
# Workaround OS X El Capitan 10.11 System Integrity Protection (SIP) which does not allow
# DYLD_INSERT_LIBRARIES to be set for system processes.
if [ "$STEAM_DYLD_INSERT_LIBRARIES" != "" ] && [ "$DYLD_INSERT_LIBRARIES" == "" ]; then
export DYLD_INSERT_LIBRARIES="$STEAM_DYLD_INSERT_LIBRARIES"
fi
# prepend our lib path to LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH="${GAMEROOT}"/bin:$DYLD_LIBRARY_PATH
elif [ "$UNAME" == "Linux" ]; then
# prepend our lib path to LD_LIBRARY_PATH
export LD_LIBRARY_PATH="${GAMEROOT}"/bin:$LD_LIBRARY_PATH
fi
if [ -z $GAMEEXE ]; then
if [ "$UNAME" == "Darwin" ]; then
GAMEEXE=hl2_osx
elif [ "$UNAME" == "Linux" ]; then
GAMEEXE=hl2_linux
fi
fi
ulimit -n 2048
# enable nVidia threaded optimizations
export __GL_THREADED_OPTIMIZATIONS=1
# and launch the game
cd "$GAMEROOT"
# Enable path match if we are running with loose files
if [ -f pathmatch.inf ]; then
export ENABLE_PATHMATCH=1
fi
# Do the following for strace:
# GAME_DEBUGGER="strace -f -o strace.log"
# Do the following for tcmalloc
# LD_PRELOAD=../src/thirdparty/gperftools-2.0/.libs/libtcmalloc_debug.so:$LD_PRELOAD
STATUS=42
while [ $STATUS -eq 42 ]; do
if [ "${GAME_DEBUGGER}" == "gdb" ] || [ "${GAME_DEBUGGER}" == "cgdb" ]; then
ARGSFILE=$(mktemp $USER.hl2.gdb.XXXX)
echo b main > "$ARGSFILE"
# Set the LD_PRELOAD varname in the debugger, and unset the global version. This makes it so that
# gameoverlayrenderer.so and the other preload objects aren't loaded in our debugger's process.
echo set env LD_PRELOAD=$LD_PRELOAD >> "$ARGSFILE"
echo show env LD_PRELOAD >> "$ARGSFILE"
unset LD_PRELOAD
echo run $@ >> "$ARGSFILE"
echo show args >> "$ARGSFILE"
${GAME_DEBUGGER} "${GAMEROOT}"/${GAMEEXE} -x "$ARGSFILE"
rm "$ARGSFILE"
else
${GAME_DEBUGGER} "${GAMEROOT}"/${GAMEEXE} "$@"
fi
STATUS=$?
done
nvidia-settings --assign CurrentMetaMode="DVI-I-1: 1920x1080_144 +0+267 {viewportin=1920x1080, viewportout=1920x1080+0+0}, HDMI-0: nvidia-auto-select +1920+0 {rotation=left}"
exit $STATUS
[/code]