add flatpak enabler script and default config file

This commit is contained in:
Victor 2025-07-20 01:21:20 -03:00
parent dd5190aa68
commit e79c539a9d
2 changed files with 79 additions and 0 deletions

33
conf.toml Normal file
View file

@ -0,0 +1,33 @@
version = 1
[global]
# override the location of Lossless Scaling
# dll = "/games/Lossless Scaling"
# [[game]] # example entry
# exe = "Game.exe"
# env = "SteamDeck=0"
#
# multiplier = 3
# flow_scale = 0.7
# performance_mode = true
# hdr_mode = false
#
# experimental_present_mode = fifo
# experimental_fps_limit = 48
[[game]] # default vkcube entry
exe = "vkcube"
multiplier = 4
performance_mode = true
[[game]] # default benchmark entry
exe = "benchmark"
multiplier = 4
performance_mode = false
[[game]] # override Genshin Impact
exe = "Genshin"
multiplier = 3

46
flatpak-enabler.sh Normal file
View file

@ -0,0 +1,46 @@
#!/bin/bash
# set up function
flatpak_enabler () {
# initialize variables with locations
DLL_FIND=$(find $HOME -name Lossless.dll | head -n 1)
DLL_ABSOLUTE_PATH=$(dirname "$(realpath "$DLL_FIND")")
ESCAPED_DLL_PATH=$(printf '%s\n' "$DLL_ABSOLUTE_PATH" | sed 's/[&/\]/\\&/g')
CONF_LOC="${HOME}/.config/lsfg-vk/conf.toml"
# check if config exists, and if not, gets a model file
if [ ! -f "$CONF_LOC" ]; then
# make sure target dir exists
mkdir -p ${HOME}/.config/lsfg-vk/
wget https://raw.githubusercontent.com/PancakeTAS/lsfg-vk/refs/heads/develop/conf.toml
mv conf.toml ${HOME}/.config/lsfg-vk/
fi
# register dll location in config file
sed -i -E "s|^# dll = \".*\"|dll = \"$ESCAPED_DLL_PATH\"|" ${HOME}/.config/lsfg-vk/conf.toml
# apply flatpak overrides -- Lutris has permission for /home, so won't need any, but still needs the symlinks
_flatpaks=(com.heroicgameslauncher.hgl com.valvesoftware.Steam net.lutris.Lutris)
for flat in "${_flatpaks[@]}"; do
if flatpak list | grep -q "$flat"; then
APP_DIR="$HOME/.var/app/$flat"
flatpak override \
--user \
--filesystem="$HOME/.local" \
--filesystem="$HOME/.config/lsfg-vk" \
--filesystem="$DLL_ABSOLUTE_PATH" \
"$flat"
# set up symlinks for lsfg-vk files
mkdir -p "$APP_DIR/lib"
mkdir -p "$APP_DIR/config/vulkan/implicit_layer.d/"
mkdir -p "$APP_DIR/.config/lsfg-vk/"
ln -s "$HOME/.local/lib/liblsfg-vk.so" "$APP_DIR/lib/liblsfg-vk.so"
ln -s "$HOME/.local/share/vulkan/implicit_layer.d/VkLayer_LS_frame_generation.json" "$APP_DIR/config/vulkan/implicit_layer.d/VkLayer_LS_frame_generation.json"
ln -s "$HOME/.config/lsfg-vk/conf.toml" "$APP_DIR/.config/lsfg-vk/conf.toml"
echo "Usage enabled successfully for $flat."
fi
done
}
# run function only if flatpak is present
if command -v flatpak &> /dev/null; then
flatpak_enabler
fi