* Complete work for the Audio reset feature (Danger Zone).

* Make fbwidth and fbheight available as a function, and ensure it supports
  rotated displays.
This commit is contained in:
fewtarius 2023-07-29 00:44:10 +00:00
parent 5e88499edd
commit fa5359d937
No known key found for this signature in database
GPG key ID: F4AE55305D1B8C1A
12 changed files with 45 additions and 22 deletions

View file

@ -2,8 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2023-present Fewtarius (https://github.com/fewtarius)
FBHEIGHT=$(fbset | awk '/geometry/ {print $2}')
FBWIDTH=$(fbset | awk '/geometry/ {print $3}')
. /etc/profile
if [ ! -f "/storage/.config/moonlight/moonlight.conf" ]
then
@ -11,5 +10,5 @@ then
cp /usr/config/moonlight/moonlight.conf /storage/.config/moonlight/moonlight.conf
fi
sed -i "s#@MWIDTH@#${FBWIDTH}#g;
s#@MHEIGHT@#${FBHEIGHT}#g" /storage/.config/moonlight/moonlight.conf
sed -i "s#@MWIDTH@#$(fbwidth)#g;
s#@MHEIGHT@#$(fbheight)#g" /storage/.config/moonlight/moonlight.conf

View file

@ -18,9 +18,6 @@ BIOS_PATH="/storage/roms/bios"
MAX_DRIVES=4
i=0
FBWIDTH=$(fbset | awk '/geometry/ {print $2}')
FBHEIGHT=$(fbset | awk '/geometry/ {print $3}')
echo "Amiberry Log" > "${AMIBERRY_LOG}"
if [ ! -d "${AMIBERRY_TMP_DIR}" ]
@ -68,8 +65,8 @@ AMIBERRY_SET_CONF() {
cp ${AMIBERRY_CONFIG_DIR}/AmigaA500-default.uae "${AMIBERRY_TMP_CONFIG}"
fi
sed -i "s#@BIOS_PATH@#${BIOS_PATH}#g" ${AMIBERRY_TMP_CONFIG}
sed -i "s#gfx_width=.*\$#${FBWIDTH}#g" ${AMIBERRY_TMP_CONFIG}
sed -i "s#gfx_height=.*\$#${FBHEIGHT}#g" ${AMIBERRY_TMP_CONFIG}
sed -i "s#gfx_width=.*\$#$(fbwidth)#g" ${AMIBERRY_TMP_CONFIG}
sed -i "s#gfx_height=.*\$#$(fbheight)#g" ${AMIBERRY_TMP_CONFIG}
find_gamepad
}

View file

@ -6,7 +6,8 @@
MYDEVICE=$(get_setting system.audiodevice)
if [ -z "${MYDEVICE}" ]
if [ -z "${MYDEVICE}" ] || \
[ ! -e "/storage/.config/asound.conf" ]
then
### Set the audio device.
set-audio set "ALC269VB (1:0)"

View file

@ -5,7 +5,8 @@
. /etc/profile
MYDEVICE=$(get_setting system.audiodevice)
if [ -z "${MYDEVICE}" ]
if [ -z "${MYDEVICE}" ] || \
[ ! -e "/storage/.config/asound.conf" ]
then
### Set the audio device
set-audio set "HDMI (0:3)"

View file

@ -6,7 +6,8 @@
MYDEVICE=$(get_setting system.audiodevice)
if [ -z "${MYDEVICE}" ]
if [ -z "${MYDEVICE}" ] || \
[ ! -e "/storage/.config/asound.conf" ]
then
### Set the audio device.
set-audio set "ALC269VB (1:0)"

View file

@ -6,7 +6,8 @@
MYDEVICE=$(get_setting system.audiodevice)
if [ -z "${MYDEVICE}" ]
if [ -z "${MYDEVICE}" ] || \
[ ! -e "/storage/.config/asound.conf" ]
then
### Set the audio device.
set-audio set "ALC269VB (1:0)"

View file

@ -6,7 +6,8 @@
MYDEVICE=$(get_setting system.audiodevice)
if [ -z "${MYDEVICE}" ]
if [ -z "${MYDEVICE}" ] || \
[ ! -e "/storage/.config/asound.conf" ]
then
### Set the audio device.
set-audio set "ALC269VB (1:0)"

View file

@ -6,7 +6,8 @@
MYDEVICE=$(get_setting system.audiodevice)
if [ -z "${MYDEVICE}" ]
if [ -z "${MYDEVICE}" ] || \
[ ! -e "/storage/.config/asound.conf" ]
then
### Set the audio device.
set-audio set "SN6140 (1:0)"

View file

@ -11,7 +11,8 @@ then
fi
MYDEVICE=$(get_setting system.audiodevice)
if [ -z "${MYDEVICE}" ]
if [ -z "${MYDEVICE}" ] || \
[ ! -e "/storage/.config/asound.conf" ]
then
touch /storage/.config/modprobe.d/alsa-base.conf
set-audio set "ROCKCHIP-HDMI0 (1:0)"

View file

@ -99,9 +99,29 @@ function get_es_setting() {
echo $(sed -n "s|\s*<${1} name=\"${2}\" value=\"\(.*\)\" />|\1|p" ${ES_CONF})
}
function fbwidth() {
local ORIENTATION=$(</sys/devices/virtual/graphics/fbcon/rotate)
if [ "${ORIENTATION}" = "0" ]
then
fbset | awk '/geometry/ {print $2}'
else
fbset | awk '/geometry/ {print $3}'
fi
}
function fbheight() {
local ORIENTATION=$(</sys/devices/virtual/graphics/fbcon/rotate)
if [ "${ORIENTATION}" = "0" ]
then
fbset | awk '/geometry/ {print $3}'
else
fbset | awk '/geometry/ {print $2}'
fi
}
function get_aspect_ratio() {
FBWIDTH=$(fbset | awk '/geometry/ {print $2}')
FBHEIGHT=$(fbset | awk '/geometry/ {print $3}')
FBWIDTH=$(fbwidth)
FBHEIGHT=$(fbheight)
ASPECT=$(printf "%.2f" $(echo "(${FBWIDTH} / ${FBHEIGHT})" | bc -l))

View file

@ -6,8 +6,8 @@
. /etc/profile
jslisten set "mpv"
FBHEIGHT=$(fbset | awk '/geometry/ {print $2}')
FBWIDTH=$(fbset | awk '/geometry/ {print $3}')
FBWIDTH="$(fbwidth)"
FBHEIGHT="$(fbheight)"
ASPECT=$(printf "%.2f" $(echo "(${FBWIDTH} / ${FBHEIGHT})" | bc -l))

View file

@ -16,8 +16,8 @@ then
fi
FBHEIGHT=$(fbset | awk '/geometry/ {print $2}')
FBWIDTH=$(fbset | awk '/geometry/ {print $3}')
FBHEIGHT="$(fbheight)"
FBWIDTH="$(fbwidth)"
if [ ! -d "${GMUPATH}" ]
then