EmuELEC 4.3 1280x800 overscan

Hi everyone
my setup specs
device: WeTek Play 2
cpu model: amlogic s905h rev c
EmuELEC version: EmuELEC-Amlogic.aarch64-4.3-Generic.img
monitor: eyoyo 16:10 inch LCD monitor 1280x800
i could tell the image is cut off on the top and not looking right.
i went into the emuelec.conf file and changed the

Set video mode ee_videomode=1080p60hz

to

Set video mode ee_videomode=1280x800p60hz

hoping that would fix the problem but it is still the same overscan screen
any help would be greatly appreciated thank you everyone.

Udate i found a post on
Screen overscan · Issue #145 · EmuELEC/EmuELEC · GitHub
so i launched terminal and put in these lines
fbset -fb /dev/fb0 -g 1280 800 1280 1600 32
echo 0 0 1279 799 > /sys/class/graphics/fb0/free_scale_axis
echo 45 25 1235 775 > /sys/class/graphics/fb0/window_axis
echo 0x10001 > /sys/class/graphics/fb0/free_scale
and after i put in them lines the overscan is gone in the terminal the screen is perfect.
but when i exit the terminal the overscan comes back.
i do not know how to save the settings to keep the changes.
the post has 4 steps i can only understand 2 out of 4.
and i cannot find the setres.sh file in emuelec on winscp.

SSH in, Copy the setres.sh to /emuelec/bin:
cp /usr/bin/setres.sh /emuelec/bin
Then modify the file to include the custom resolution.

1 Like

Thank you so much Langerz82 for helping me. i am new to the hole inner workings of emuelec.
i have tried what you said about copying the setres.sh file from /usr/bin to /emuelec/bin and
modifying it with the lines i used in the terminal but its not working and l don’t think i’m doing it right

#!/bin/sh

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2019-present Shanti Gilbert (shantigilbert · GitHub)

Read the video output mode and set it for emuelec to avoid video flicking.

This file sets the hdmi output and frame buffer to the argument in pixel width.

Allowed argument example ./setres.sh 1080p60hz ← For height 1080 pixels.

set -x #echo on

1080p60hz

1080i60hz

720p60hz

720p50hz

480p60hz

480cvbs

576p50hz

1080p50hz

1080i50hz

576cvbs

arg1, 1 = Hides, 0 = Show.

show_buffer ()
{
echo $1 > /sys/class/graphics/fb0/blank
echo $1 > /sys/class/graphics/fb1/blank
}

blank_buffer()
{

Blank the buffer.

dd if=/dev/zero of=/dev/fb0 bs=12M > /dev/null 2>&1
}

BPP=32
HZ=60

MODE=$1
CUR_MODE=cat /sys/class/display/mode;

If the current display is the same as the change just exit.

[ -z “$MODE” ] && exit 0;
[[ $MODE == “auto” ]] && exit 0;

Removed because if try to set invalid video mode it becomes a valid MODE

in display/mode and then when trying to revert back this becomes true exiting.

#[[ “$MODE” == “$CUR_MODE” ]] && exit 0;

if [[ ! “$MODE” == “x” ]]; then
case $MODE in
p) H=$(echo $MODE | cut -d’p’ -f 1) ;;
i) H=$(echo $MODE | cut -d’i’ -f 1) ;;
cvbs) H=$(echo $MODE | cut -d’c’ -f 1) ;;
esac
fi

HZ=${MODE:(-4):2}
if [[ ! -n “$HZ” ]] || [[ $HZ -eq 50 ]]; then
HZ=60
fi

hides buffer

show_buffer 1

case $MODE in
480phz|480ihz|576phz|720phz|1080phz|1440phz|2160phz|576ihz|720ihz|1080ihz|1440ihz|2160ihz)
W=$(($H16/9))
[[ “$MODE” == “480”
]] && W=854
DH=$(($H2))
W1=$(($W-1))
H1=$(($H-1))
fbset -fb /dev/fb0 -g $W $H $W $DH $BPP
fbset -fb /dev/fb1 -g $BPP $BPP $BPP $BPP $BPP
echo $MODE > /sys/class/display/mode
echo 0 > /sys/class/graphics/fb0/free_scale
echo 1 > /sys/class/graphics/fb0/freescale_mode
echo 0 0 $W1 $H1 > /sys/class/graphics/fb0/free_scale_axis
echo 0 0 $W1 $H1 > /sys/class/graphics/fb0/window_axis
echo 0 > /sys/class/graphics/fb1/free_scale
;;
480cvbs)
fbset -fb /dev/fb0 -g 1280 960 1280 1920 $BPP
fbset -fb /dev/fb1 -g $BPP $BPP $BPP $BPP $BPP
echo 0 0 1279 959 > /sys/class/graphics/fb0/free_scale_axis
echo 30 10 669 469 > /sys/class/graphics/fb0/window_axis
echo 640 > /sys/class/graphics/fb0/scale_width
echo 480 > /sys/class/graphics/fb0/scale_height
echo 0x10001 > /sys/class/graphics/fb0/free_scale
;;
576cvbs)
fbset -fb /dev/fb0 -g 1280 960 1280 1920 $BPP
fbset -fb /dev/fb1 -g $BPP $BPP $BPP $BPP $BPP
echo 0 0 1279 959 > /sys/class/graphics/fb0/free_scale_axis
echo 35 20 680 565 > /sys/class/graphics/fb0/window_axis
echo 720 > /sys/class/graphics/fb0/scale_width
echo 576 > /sys/class/graphics/fb0/scale_height
echo 0x10001 > /sys/class/graphics/fb0/free_scale
;;
1280x800p60hz)
fbset -fb /dev/fb0 -g 1280 800 1280 1600 32
echo 0 0 1279 799 > /sys/class/graphics/fb0/free_scale_axis
echo 45 25 1235 775 > /sys/class/graphics/fb0/window_axis
echo 0x10001 > /sys/class/graphics/fb0/free_scale
;;
x)
W=$(echo $MODE | cut -d’x’ -f 1)
H=$(echo $MODE | cut -d’x’ -f 2 | cut -d’p’ -f 1)
[ ! -n “$H” ] && H=$(echo $MODE | cut -d’x’ -f 2 | cut -d’i’ -f 1)
if [ -n “$W” ] && [ -n “$H” ]; then
DH=$(($H
2))
W1=$(($W-1))
H1=$(($H-1))
fbset -fb /dev/fb0 -g $W $H $W $DH $BPP
fbset -fb /dev/fb1 -g $BPP $BPP $BPP $BPP $BPP

[[ “$MODE” = “720x480p”* ]] && MODE=$(echo “${H}p${HZ}hz”)

	echo $MODE > /sys/class/display/mode
	echo 0 > /sys/class/graphics/fb0/free_scale
	echo 1 > /sys/class/graphics/fb0/freescale_mode
	echo 0 0 $W1 $H1 > /sys/class/graphics/fb0/free_scale_axis
	echo 0 0 $W1 $H1 > /sys/class/graphics/fb0/window_axis
	echo 0 > /sys/class/graphics/fb1/free_scale      
fi
;;

esac

blank_buffer

shows buffer

show_buffer 0

End of reading the video output mode and setting it for emuelec to avoid video flicking.

The codes can be simplified with “elseif” sentences.

The codes for 480I and 576I are adjusted to avoid overscan.

Forece 720p50hz to 720p60hz and 1080i/p60hz to 1080i/p60hz since 50hz would make video very choppy.

Also make sure you set 1280x800p60hz in the emuelec video settings (you might have to apply a custom setting), or for the emulator select native video and 1280x800p60hz if it’s there or just auto will use the emuelec setting.

Also paste the modified setres.sh file here:
https://gist.github.com/
and provide the link as the nested code seems to be breaking.

1 Like

I pasted the modified file emuelec 4.3 modified file · GitHub
I made a custom file in /usr/config/ called EE_VIDEO_MODE and inside of it i put 1280x800p60hz
and also in /storage/.config/emuelec/configs file emuelec.confg i replaced

Set video mode

ee_videomode=1080p60hz
to

Set video mode

ee_videomode=1280x800p60hz
and auto is set for all emulators.
Again thank you so much for helping me out Langerz82.

Maybe just also have in your code:

  1280x800p60hz)              
        fbset -fb /dev/fb0 -g 1280 800 1280 1600 32 
        echo 0 0 1279 799 > /sys/class/graphics/fb0/free_scale_axis
        echo 45 25 1235 775 > /sys/class/graphics/fb0/window_axis
	echo 1200 > /sys/class/graphics/fb0/scale_width
	echo 800 > /sys/class/graphics/fb0/scale_height
        echo 0x10001 > /sys/class/graphics/fb0/free_scale
        ;;  

I think that should be all. Oh hang on 4.3 might have the PATH order mixed up as there was a patch done to re-order it.
If you do: echo $PATH
it should be:

/emuelec/scripts:/emuelec/bin:/usr/bin/batocera:/storage/roms/bios/jdk/bin/:/usr/bin:/usr/sbin

If emuelec/bin isnt before /usr/bin then in you will have to modify the 99-emuelec.conf in the source and re-build to have near the top:

export PATH="/emuelec/scripts:/emuelec/bin:/usr/bin/batocera:/storage/roms/bios/jdk/bin/:$PATH"
1 Like

I put in the code you sent me in the modified setres.sh file
1280x800p60hz)
fbset -fb /dev/fb0 -g 1280 800 1280 1600 32
echo 0 0 1279 799 > /sys/class/graphics/fb0/free_scale_axis
echo 45 25 1235 775 > /sys/class/graphics/fb0/window_axis
echo 1200 > /sys/class/graphics/fb0/scale_width
echo 800 > /sys/class/graphics/fb0/scale_height
echo 0x10001 > /sys/class/graphics/fb0/free_scale
;;
But no change.
I did the echo $PATH code in the terminal and this is that it showed
/emuelec/scripts:/emuelec/bin:/usr/bin/batocera:/usr/bin:/usr/sbin

Big update it did work! The code you posted Langerz82 that i put into the modified setres.sh file
Then dropped that file in emuelec/bin thru using ssh worked but i I didn’t see the changes until i went into something like a game or the terminal and then existed back to the main screen of emuelec then the overscan was gone.The screen
stays normal untill i shutdown emuelec and when start emuelec back up the overscan comes back so
I just need to into a game or the terminal again exit and its fixed. I’m Super happy it’s fixed i only i have to do that little thing to fix the overscan no biggie.
Thank you emuelec.discourse.group and thank you
Langerz82.

You can edit /storage/.config/custom_start.sh and add your commands there

1 Like

I ssh into /storage/.config/custom_start.sh and under the text where it says

Any commands that you want to run before the frontend begins should go here

i put in this code

1280x800p60hz)
fbset -fb /dev/fb0 -g 1280 800 1280 1600 32
echo 0 0 1279 799 > /sys/class/graphics/fb0/free_scale_axis
echo 5 35 1275 785 > /sys/class/graphics/fb0/window_axis
echo 1200 > /sys/class/graphics/fb0/scale_width
echo 800 > /sys/class/graphics/fb0/scale_height
echo 0x10001 > /sys/class/graphics/fb0/free_scale
;;
and saved it and restarted emuelec but the code didn’t change the resolution.

lol no:
try first setting the custom res by doing in ssh:

echo 1280x800p60hz > /storage/.config/EE_VIDEO_MODE

clear the contents of custom_start.sh and just add:

/emuelec/bin/setres.sh $(cat /storage/.config/EE_VIDEO_MODE)

and that should switch to that res on startup. If in future you want to change resolutions edit the EE_VIDEO_MODE file for your other resolution.

1 Like

sorry I should have said you also need the correct headers in your custom_start.sh file.
So you could either have in /storage/.config/custom_start.sh file:

#!/bin/sh

/emuelec/bin/setres.sh $(cat /storage/.config/EE_VIDEO_MODE)

or alternatively if you want to use the Emuelec setting ee_videomode in emuelec.conf:

#!/bin/sh

# load the profile script.
. /etc/profile

/emuelec/bin/setres.sh $(get_ee_setting ee_videomode)

All the best and good luck. ^-^

1 Like