The script is placed in the directory with the executable file of the game and is also called as this file but without ".exe".
The script disassembles the video mode necessary for this game and comments all the others.
Code: Select all
#!/bin/sh
vga=`xrandr | grep -P " connected (primary )?\d+" | sed -e "s/\(\w\+\) .*/\1/"`
if xrandr --output $vga --set "scaling mode" "Full aspect" 2>/dev/null;then
wine "$0".exe
else
#res=640x480 && off=107
#res=800x600 && off=133
#res=1024x768 && off=171
#res=1152x864 && off=192
#res=1280x960 && off=213
res=1440x1080 && off=240
xrandr --output $vga --mode $res --panning $res --transform 1.33333333,0,-$off,0,1,0,0,0,1 && wine "$0".exe ; xrandr --output $vga --auto --panning 0x0 --scale 1x1
fi
It is also need checking all of the modes are supported by your monitor.
If the required modes are not available, you can add them manually by editing the Xorg configuration file.
/etc/X11/xorg.conf.d/50-monitor.conf
Code: Select all
Section "Monitor"
Identifier "VGA1"
Modeline "1280x960" 101.25 1280 1360 1488 1696 960 963 967 996 -hsync +vsync
Modeline "1280x960" 130.00 1280 1368 1504 1728 960 963 967 1005 -hsync +vsync
Modeline "1440x1080" 129.00 1440 1528 1680 1920 1080 1083 1087 1120 -hsync +vsync
EndSection
Where Identifier "VGA1" is the name of the output, you can determine by executing xradr;
Modeline ... parameters of the added mode.
These parameters are determined by the corresponding cvt calls with the transmitted resolution and frequency.
"_60.00" from the first parameter is cut out.
Code: Select all
cvt 1280 960 60
cvt 1280 960 75
cvt 1440 1080 60
If the monitor supports "scaling mode" "Full aspect" then the file is running via wine without changes.
If not, then the screen is corrected through xrandr.
And then returns the screen to the normal state.