Merge pull request #381 from MilhouseVH/splash_native

splash: Select splash image based on native resolution
This commit is contained in:
Christian Hewitt 2016-05-28 15:42:26 +04:00
commit 29c61959e2
8 changed files with 40 additions and 13 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -144,6 +144,10 @@
overlay)
OVERLAY=yes
;;
setfbres=*)
SWITCH_FRAMEBUFFER="${arg#*=}"
SWITCH_FRAMEBUFFER="${SWITCH_FRAMEBUFFER//,/ }"
;;
break=*)
BREAK="${arg#*=}"
;;
@ -395,25 +399,50 @@
}
load_splash() {
local set_default_res=no
local vres
if [ ! "$SPLASH" = "no" ]; then
progress "Loading bootsplash"
SPLASHIMAGE="/splash/splash-full.png"
# load uvesafb module if needed
if [ -f "$MODULE_DIR/uvesafb.ko" -a ! -e /dev/fb0 ]; then
progress "Loading kernel module uvesafb.ko"
insmod "$MODULE_DIR/uvesafb.ko" || \
insmod "$MODULE_DIR/uvesafb.ko" && \
set_default_res=yes || \
progress "... Failed to load kernel module uvesafb, skipping"
# set framebuffer to a default resolution (1024x768-32)
if [ ! "$SWITCH_FRAMEBUFFER" = "no" ]; then
fbset -g 1024 768 1024 768 32
SPLASHIMAGE="/splash/splash-1024.png"
fi
fi
if [ -e /dev/fb0 ]; then
# Set framebuffer to a custom resolution and/or fallback to default resolution (1024x768-32), if required.
if [ ! "$SWITCH_FRAMEBUFFER" = "no" ]; then
if [ "$SWITCH_FRAMEBUFFER" = "1080" ]; then
SWITCH_FRAMEBUFFER="1920 1080 1920 1080 32"
elif [ "$SWITCH_FRAMEBUFFER" = "720" ]; then
SWITCH_FRAMEBUFFER="1280 720 1280 720 32"
fi
# Try setting a custom framebuffer resolution
if [ ! "${SWITCH_FRAMEBUFFER:-yes}" = "yes" ]; then
fbset -g $SWITCH_FRAMEBUFFER 2>/dev/null && set_default_res=no
fi
# Set a default resolution if required
if [ "$set_default_res" = "yes" ]; then
fbset -g 1024 768 1024 768 32
fi
fi
# Select splash image based on current native resolution
if [ -z "$SPLASHIMAGE" ]; then
vres="$(fbset | awk '/geometry/ { print $3 }')"
if [ -n "$vres" -a -f /splash/splash-$vres.png ]; then
SPLASHIMAGE="/splash/splash-$vres.png"
else
SPLASHIMAGE="/splash/splash-1080.png"
fi
fi
# load splash
if [ -f /flash/oemsplash.png ]; then
SPLASHIMAGE="/flash/oemsplash.png"

View File

@ -50,14 +50,12 @@ makeinstall_init() {
if [ -f $PROJECT_DIR/$PROJECT/splash/splash.conf ]; then
cp $PROJECT_DIR/$PROJECT/splash/splash.conf $INSTALL/splash
cp $PROJECT_DIR/$PROJECT/splash/*.png $INSTALL/splash
elif [ -f $PROJECT_DIR/$PROJECT/splash/splash-1024.png \
-o -f $PROJECT_DIR/$PROJECT/splash/splash-full.png ]; then
elif ls $PROJECT_DIR/$PROJECT/splash/splash-*.png 1>/dev/null 2>&1; then
cp $PROJECT_DIR/$PROJECT/splash/splash-*.png $INSTALL/splash
elif [ -f $DISTRO_DIR/$DISTRO/splash/splash.conf ]; then
cp $DISTRO_DIR/$DISTRO/splash/splash.conf $INSTALL/splash
cp $DISTRO_DIR/$DISTRO/splash/*.png $INSTALL/splash
elif [ -f $DISTRO_DIR/$DISTRO/splash/splash-1024.png \
-o -f $DISTRO_DIR/$DISTRO/splash/splash-full.png ]; then
elif ls $DISTRO_DIR/$DISTRO/splash/splash-*.png 1>/dev/null 2>&1; then
cp $DISTRO_DIR/$DISTRO/splash/splash-*.png $INSTALL/splash
else
cp $PKG_DIR/splash/splash-*.png $INSTALL/splash