From 98b53b03900e69e24e584b84f1530b76f1bc7bd8 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Sun, 31 Oct 2021 23:48:13 +0100 Subject: [PATCH] Kobo: More readable crash screen on sunxi (Sage, especially). Switch to flashing GC16, because the screen is so fast that using GL16 simply leaves us with an unreadable mess of ghosting. I'm halfway considering rewriting this in Lua so that I can do a proper batched update... --- platform/kobo/koreader.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/platform/kobo/koreader.sh b/platform/kobo/koreader.sh index 1514863fc..b623e0f88 100755 --- a/platform/kobo/koreader.sh +++ b/platform/kobo/koreader.sh @@ -245,6 +245,9 @@ fi # will also enforce UR... (Only actually meaningful on sunxi). if [ "${PLATFORM}" = "b300-ntx" ]; then export FBINK_FORCE_ROTA=0 + # Screen is too fast for GL16 not to look like utter crap. + FBINK_WFM="GC16" + FBINK_FLASH="-f" # And we also cannot use batched updates for the crash screens, as buffers are private, # so each invocation essentially draws in a different buffer... FBINK_BATCH_FLAG="" @@ -256,6 +259,8 @@ if [ "${PLATFORM}" = "b300-ntx" ]; then # Make sure we poke the right input device KOBO_TS_INPUT="/dev/input/by-path/platform-0-0010-event" else + FBINK_WFM="GL16" + FBINK_FLASH="" FBINK_BATCH_FLAG="-b" FBINK_BGLESS_FLAG="-O" FBINK_OT_PADDING="" @@ -398,19 +403,21 @@ while [ ${RETURN_VALUE} -ne 0 ]; do bombMargin=$((FONTH + FONTH / 2)) # Start with a big gray screen of death, and our friendly old school crash icon ;) # U+1F4A3, the hard way, because we can't use \u or \U escape sequences... - # shellcheck disable=SC2039,SC3003 - ./fbink -q ${FBINK_BATCH_FLAG} -c -B GRAY9 -m -t regular=./fonts/freefont/FreeSerif.ttf,px=${bombHeight},top=${bombMargin} -W GL16 -- $'\xf0\x9f\x92\xa3' + # shellcheck disable=SC2039,SC3003,SC2086 + ./fbink -q ${FBINK_BATCH_FLAG} -c -B GRAY9 -m -t regular=./fonts/freefont/FreeSerif.ttf,px=${bombHeight},top=${bombMargin} -W ${FBINK_WFM} ${FBINK_FLASH} -- $'\xf0\x9f\x92\xa3' # With a little notice at the top of the screen, on a big gray screen of death ;). - ./fbink -q ${FBINK_BATCH_FLAG} ${FBINK_BGLESS_FLAG} -m -y 1 "Don't Panic! (Crash n°${CRASH_COUNT} -> ${RETURN_VALUE})" -W GL16 + # shellcheck disable=SC2086 + ./fbink -q ${FBINK_BATCH_FLAG} ${FBINK_BGLESS_FLAG} -m -y 1 -W ${FBINK_WFM} ${FBINK_FLASH} -- "Don't Panic! (Crash n°${CRASH_COUNT} -> ${RETURN_VALUE})" if [ ${CRASH_COUNT} -eq 1 ]; then # Warn that we're waiting on a tap to continue... - ./fbink -q ${FBINK_BATCH_FLAG} ${FBINK_BGLESS_FLAG} -m -y 2 "Tap the screen to continue." -W GL16 + # shellcheck disable=SC2086 + ./fbink -q ${FBINK_BATCH_FLAG} ${FBINK_BGLESS_FLAG} -m -y 2 -W ${FBINK_WFM} ${FBINK_FLASH} -- "Tap the screen to continue." fi # And then print the tail end of the log on the bottom of the screen... crashLog="$(tail -n 25 crash.log | sed -e 's/\t/ /g')" # The idea for the margins being to leave enough room for an fbink -Z bar, small horizontal margins, and a font size based on what 6pt looked like @ 265dpi # shellcheck disable=SC2086 - ./fbink -q ${FBINK_BATCH_FLAG} ${FBINK_BGLESS_FLAG} -t regular=./fonts/droid/DroidSansMono.ttf,top=$((viewHeight / 2 + FONTH * 2 + FONTH / 2)),left=$((viewWidth / 60)),right=$((viewWidth / 60)),px=$((viewHeight / 64))${FBINK_OT_PADDING} -W GL16 -- "${crashLog}" + ./fbink -q ${FBINK_BATCH_FLAG} ${FBINK_BGLESS_FLAG} -t regular=./fonts/droid/DroidSansMono.ttf,top=$((viewHeight / 2 + FONTH * 2 + FONTH / 2)),left=$((viewWidth / 60)),right=$((viewWidth / 60)),px=$((viewHeight / 64))${FBINK_OT_PADDING} -W ${FBINK_WFM} ${FBINK_FLASH} -- "${crashLog}" if [ "${PLATFORM}" != "b300-ntx" ]; then # So far, we hadn't triggered an actual screen refresh, do that now, to make sure everything is bundled in a single flashing refresh. ./fbink -q -f -s