Audio Quake launcher added. Not working quite right yet.
This commit is contained in:
parent
ad0e7e3d7e
commit
8258419f7c
67
.launch/Audio Quake.game
Normal file
67
.launch/Audio Quake.game
Normal file
@ -0,0 +1,67 @@
|
||||
configure_audio() {
|
||||
local sudo=$(command -v sudo)
|
||||
sudo="${sudo:-doas}"
|
||||
local audioProvider
|
||||
if pgrep pipewire &> /dev/null ; then
|
||||
audioProvider="pipewire"
|
||||
elif pgrep pulse &> /dev/null ; then
|
||||
audioProvider="pulseaudio"
|
||||
else
|
||||
audioProvider="alsa"
|
||||
fi
|
||||
lsmod | grep snd_aloop || $sudo modprobe snd_aloop
|
||||
cardNumber="$(aplay -l |grep -P '^card \d+: Loopback' |head -n1 | cut -d\ -f2 | cut -d: -f1)"
|
||||
if ! [[ "$cardNumber" =~ ^[0-9]+$ ]] ; then
|
||||
dialog --backtitle "Linux Game Manager" \
|
||||
--msgbox "The loopback module card number was not properly set.\nThis could mean that you failed to type your password for root privileges, or something else has gone wrong.\n If you think root privileges were succesfully obtained, please report this to the maintainers. Mention the card value: ${cardNumber}." -1 -1
|
||||
exit 1
|
||||
fi
|
||||
alsaloop -C hw:${cardNumber},1,0 -P default &> /dev/null &
|
||||
}
|
||||
|
||||
|
||||
configure_webkit() {
|
||||
local webkitPath
|
||||
local sudo=$(command -v sudo)
|
||||
sudo="${sudo:-doas}"
|
||||
# First check if it's already properly set up
|
||||
[[ -d /usr/libexec/webkit2gtk-4.0 ]] && return 0
|
||||
webkitPath=$(find /usr/lib* /usr/local/lib* -type d -name 'webkit2gtk-4.0' 2>/dev/null | head -n1)
|
||||
if [[ -z "${webkitPath}" ]]; then
|
||||
dialog --backtitle "Linux Game manager" \
|
||||
--msgbox "Error: webkit2gtk-4.0 not found. Please install webkit2gtk package for your distribution." -1 -1
|
||||
exit 1
|
||||
fi
|
||||
# Create libexec directory if it doesn't exist
|
||||
if [[ ! -d /usr/libexec ]]; then
|
||||
if ! $sudo mkdir -p /usr/libexec; then
|
||||
echo "Error: Failed to create /usr/libexec directory"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
if ! $sudo ln -s "${webkitPath}" /usr/libexec/webkit2gtk-4.0; then
|
||||
echo "Error: Failed to create symlink for webkit2gtk-4.0"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
set_sound_device() {
|
||||
if ! grep -q 'set s_device' "${installPath}/Audio Quake/data/id1/config.cfg" ; then
|
||||
echo "set s_device hw:${cardNumber},0,0" >> "${installPath}/Audio Quake/data/id1/config.cfg"
|
||||
else
|
||||
sed -E -i 's/set s_device/set s_device hw:${cardNumber},0,0/g' "${installPath}/Audio Quake/data/id1/config.cfg"
|
||||
fi
|
||||
if ! grep -q 'set s_device' "${installPath}/Audio Quake/data/oq/config.cfg" ; then
|
||||
echo "set s_device hw:${cardNumber},0,0" >> "${installPath}/Audio Quake/data/oq/config.cfg"
|
||||
else
|
||||
sed -E -i 's/set s_device/set s_device hw:${cardNumber},0,0/g' "${installPath}/Audio Quake/data/oq/config.cfg"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
trap 'pkill -P $$' EXIT
|
||||
configure_audio
|
||||
configure_webkit
|
||||
set_sound_device
|
||||
pushd "${installPath}/AudioQuake"
|
||||
./AudioQuake
|
@ -244,7 +244,7 @@ download() {
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if [[ $downloadError -eq 0 ]]; then
|
||||
if [[ $downloadError -ne 0 ]]; then
|
||||
rm -fv "${cache}/${dest}"
|
||||
dialog --backtitle "Linux Game Manager" \
|
||||
--infobox "Error downloading \"${dest}\". Installation cannot continue." -1 -1 --stdout
|
||||
@ -398,7 +398,7 @@ game_installer() {
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
if [[ -e "${0%/*}/.launch/${game}.game" ]] && ! [[ -L "${0%/*}/.launch/${game.sh}" ]]; then
|
||||
if [[ -e "${0%/*}/.launch/${game}.game" ]] && ! [[ -L "${0%/*}/.launch/${game}.sh" ]]; then
|
||||
ln -srf "${0%/*}/.launch/${game}.game" "${0%/*}/.launch/${game}.sh"
|
||||
fi
|
||||
exit 0
|
||||
@ -494,7 +494,7 @@ game_launcher() {
|
||||
mapfile -t lines < <(
|
||||
sed '/^$/d' "${configFile}" 2> /dev/null
|
||||
if [[ -d ".launch" ]]; then
|
||||
find "${0%/*}/.launch" -maxdepth 1 -type f -iname "*.sh" -exec bash -c '
|
||||
find -L "${0%/*}/.launch" -maxdepth 1 -type f -iname "*.sh" -exec bash -c '
|
||||
for f; do
|
||||
[[ $(head -n1 "$f") == "#"* ]] && continue
|
||||
name="${f##*/}"
|
||||
|
Loading…
Reference in New Issue
Block a user