0
0
mirror of https://github.com/libretro/Lakka-LibreELEC.git synced 2025-03-01 11:31:22 +00:00
GavinDarkglider 3cc9dbb9ca Switch: Tons of fixes, with poor commit history. lol. (#1839)
* Switch: Minor kernel config update

* fat32-boot: Attempt to fix umounting flash partition to prevent possible corruption on reboot

* Switch: Bootloader: Fix mistake in boot.txt that wasnt properly setting up dvfsb stuff

* Switch: Add user for retroarch to run as

* Busybox: Fix writing flash partition when using fat32-boot option to give all users write access

* Audio: Pulseaudio-configs: Minor updates for use when running apps as non root user

* Switch: Finalize changes so for running as non root user.

* Retroarch: Revert broken WAR in retroarch-config script

* Switch: Fix default retroarch config, to work out of box with new user

* Fix retroarch controller configs for switch, and add line to fix it to the update.sh file

* Add back missing lite gamepad config, which got lost in a rebase somewhere

* Retroarch: Start Reworking Switch Clocks

* Switch: Bump switch specific package versions, and add changes needed to make built in lakka clock speed menu work properly. Also hide gamemode.

* Retroarch: add patch to remove game mode from menu to all builds

* Switch: dont enable overclock by default

* sort

* Sort me.

* Switch: Drop old flycast from switch build in favor of newer core.

This has some issues with some games showing artifact bars using vulkan renderer,
but also fixes a lot of issues. As a work around to this issue, users can set opengl renderer, and the bars will not be there.

* More to sort

* Fix CEC stuff

* Fix dock audio switching with new user config

* WIP: GPU Clocks

* sort

* fix quotes

* Add working single joycon configs

* Update Switch Joycond to latest

* Switch: Retroarch: add bluetooth ertm disable, and add patch to fix l2cap kernel hang

* Switch: Update image stuff, so kernel reflects Lakka/Libreelec kernel makes in uimage header, and re-arange some things to make them global

* Switch: Linux: Enable Xpad Driver for wired xbox controllers

* Switch: More xpadneo stuff
This should at a minimum fix issues with Xbox One S controllers
8bitdo and GuliKit KingKong Controller families will probably need more
hid-core patching to redirect them to this driver for support.

Also, when 0.10 version of Xpadneo is released, It will stop building due to kernel not having this patch:
f07b3c1da9

When the time comes, this will need to be looked into.

* xpadneo: update package

* Switch: Update U-Boot to Switchroot 2023-NX03 version

* Switch: Update kernel to Switchroot 5.1.0

* Switch: Create Singular switch-bsp Package
This package consolodates the switch specific configs into one package,
as this feels cleaner, and easier to deal with later, if/when needed.
This package combines the switch-alsa-ucm and switch-bluetooth-dock stuff
into one package.

---------

Co-authored-by: Tomáš Kelemen (vudiq) <vudiq@vudiq.sk>
2023-06-10 03:17:06 +03:00

82 lines
3.2 KiB
Bash
Executable File

#!/bin/bash
dock_hotplug_handle() {
export DISPLAY=
export DP_SETTINGS=
# Let X parse connected display info.
sleep 0.2
# Read custom WIDTHxHEIGHT from dock-hotplug.conf.
if [ -e "/storage/dock-hotplug.conf" ]; then
export DP_SETTINGS=$(cat /storage/dock-hotplug.conf)
fi
if [ "$DP_SETTINGS" == "" ]; then
export DP_SETTINGS="--primary --auto"
else
export DP_SETTINGS="--primary --mode "$DP_SETTINGS" --panning "$DP_SETTINGS"+0+0 --pos 0x0"
fi
while [ "$DISPLAY" = "" ]
do
cd /tmp/.X11-unix && for x in X*;
do
if [ ! -e "$x" ]; then continue; fi
export DISPLAY=":${x#X}"
export PULSE_SERVER="127.0.0.1"
if [[ "$1" -eq 1 ]]
then
xrandr --output DP-0 $DP_SETTINGS --output DSI-0 --off
pactl set-card-profile 1 off
pactl set-card-profile 0 output:hdmi-stereo
#Fix volume if needed(Pulseaudio sink volume's should not change ever in libreelec builds)
if [ ! $(pactl list sinks | grep '^[[:space:]]Volume:' | head -n $(( $SINK + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,') -eq 100 ]; then
pactl set-sink-volume alsa_output.0.hdmi-stereo 100%
fi
# Reapply config to avoid X stubbornness.
sleep 0.2
xrandr --output DSI-0 --off --output DP-0 $DP_SETTINGS
else
xrandr --output DSI-0 --primary --mode 720x1280 --rotate left --panning 1280x720+0+0 --pos 0x0 --dpi 237 --output DP-0 --off
pactl set-card-profile 1 HiFi
pactl set-card-profile 0 off
#Fix volume if needed(Pulseaudio sink volume's should not change ever in libreelec builds
if [ ! $(pactl list sinks | grep '^[[:space:]]Volume:' | head -n $(( $SINK + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,') -eq 100 ]; then
pactl set-sink-volume alsa_output.1.HiFi__hw_tegrasndt210ref__sink 100%
fi
# Reapply config to avoid X stubbornness.
sleep 0.2
xrandr --output DP-0 --off --output DSI-0 --primary --mode 720x1280 --rotate left --panning 1280x720+0+0 --pos 0x0 --dpi 237
fi
done
# Wait for X to set current resolution.
sleep 0.2
RESOLUTION=$(xrandr -q | sed -n 's/.*current[ ]\([0-9]*\) x \([0-9]*\),.*/\1 \2/p')
# Set current resolution to main app's window.
# The following search results to the correct window because it's the only one existing in LibreELEC.
xdotool search --onlyvisible --name . windowsize $RESOLUTION
done
}
# Main call.
i=1
DP_ENABLED=1
LOOPS=1
if [[ "$1" -eq 1 ]]; then LOOPS=5; fi
while [ "$i" -le "$LOOPS" ]; do
if grep -q 1 "/sys/class/switch/dp/state"; then DP_ENABLED=1; else DP_ENABLED=0; fi
# Prepare CEC info.
if [ -f /tmp/.CEC ]; then
if [[ "$DP_ENABLED" -eq 0 ]]; then cec-ctl -C
else cec-ctl -s -o NintendoSwitch --playback --active-source phys-addr="$(cec-ctl | sed -n 's/.*Physical Address.*: //p')"; fi
fi
# Configure dock
dock_hotplug_handle $DP_ENABLED
i=$(($i + 1))
done