forked from libretro/retroarch-snap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathretroarch.wrapper
executable file
·67 lines (48 loc) · 3.87 KB
/
retroarch.wrapper
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh
#Notify user that we're working so they don't think anything is broken
[ ! -d "$SNAP_USER_DATA/.config/retroarch" ] && notify-send "RetroArch" "Preparing the environment..." -i "$SNAP/.config/assets/xmb/monochrome/png/retroarch.png" -t 2000
set -e
#Notify the user that it might take a while to copy everything
[ ! -d "$SNAP_USER_DATA/.config/retroarch" ] && notify-send "RetroArch" "Copying necessary files (this could take a minute)..." -i "$SNAP/.config/assets/xmb/monochrome/png/retroarch.png" -t 2000
#Create RetroArch user configuration directory if doesn't exist
[ ! -d "$SNAP_USER_DATA/.config" ] && mkdir "$SNAP_USER_DATA/.config"
[ ! -d "$SNAP_USER_DATA/.config/retroarch" ] && mkdir "$SNAP_USER_DATA/.config/retroarch"
#Copy assets if doesn't exist
[ ! -d "$SNAP_USER_DATA/.config/retroarch/assets" ] && cp -R "$SNAP/.config/assets" "$SNAP_USER_DATA/.config/retroarch"
#Copy joypad autoconfig files if doesn't exist
[ ! -d "$SNAP_USER_DATA/.config/retroarch/autoconfig" ] && cp -R "$SNAP/.config/autoconfig" "$SNAP_USER_DATA/.config/retroarch"
#Copy cheats files if doesn't exist
[ ! -d "$SNAP_USER_DATA/.config/retroarch/cheats" ] && cp -R "$SNAP/.config/cheats" "$SNAP_USER_DATA/.config/retroarch"
#Copy database files if doesn't exist
[ ! -d "$SNAP_USER_DATA/.config/retroarch/database" ] && cp -R "$SNAP/.config/database" "$SNAP_USER_DATA/.config/retroarch"
#Copy info files if doesn't exist
[ ! -d "$SNAP_USER_DATA/.config/retroarch/cores" ] && cp -R "$SNAP/.config/cores" "$SNAP_USER_DATA/.config/retroarch"
#Copy overlay if doesn't exist
[ ! -d "$SNAP_USER_DATA/.config/retroarch/overlay" ] && cp -R "$SNAP/.config/overlay" "$SNAP_USER_DATA/.config/retroarch"
#Copy shaders if doesn't exist
[ ! -d "$SNAP_USER_DATA/.config/retroarch/shaders" ] && cp -R "$SNAP/.config/shaders" "$SNAP_USER_DATA/.config/retroarch"
#Copy filters if doesn't exist
[ ! -d "$SNAP_USER_DATA/.config/retroarch/filters" ] && cp -R "$SNAP/.config/filters" "$SNAP_USER_DATA/.config/retroarch"
[ ! -f "$SNAP_USER_DATA/.config/retroarch/retroarch.cfg" ] && notify-send "RetroArch" "Done!" -i "$SNAP/.config/assets/xmb/monochrome/png/retroarch.png" -t 2000
#If the config file doesn't exist, create it and point the browser directory outside of the snap package
[ ! -f "$SNAP_USER_DATA/.config/retroarch/retroarch.cfg" ] && touch "$SNAP_USER_DATA/.config/retroarch/retroarch.cfg" && echo "rgui_browser_directory = $SNAP_REAL_HOME" >> "$SNAP_USER_DATA/.config/retroarch/retroarch.cfg" && echo "input_joypad_driver = sdl2" >> "$SNAP_USER_DATA/.config/retroarch/retroarch.cfg"
# As discussed here:
# - https://forum.snapcraft.io/t/egl-using-snaps-on-impish-seem-to-be-broken-when-using-the-nvidia-proprietary-driver/25715
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH#$SNAP_LIBRARY_PATH:}"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${SNAP_LIBRARY_PATH}"
export SNAPCRAFT_PRELOAD=$SNAP
export LD_PRELOAD=$SNAP/usr/lib/libsnapcraft-preload.so
# As discussed here:
# - https://forum.snapcraft.io/t/correct-way-to-do-nvidia-vulkan/20361/2
# Export the Vulkan ICD filename paths to fix Vulkan on Nvidia proprietary driver
# - There is no Intel ICD for ARM
if [ "$SNAP_ARCH" = "amd64" ]; then
export VK_ICD_FILENAMES="/var/lib/snapd/lib/vulkan/icd.d/nvidia_icd.json:$SNAP/usr/share/vulkan/icd.d/radeon.x86_64.json:$SNAP/usr/share/vulkan/icd.d/intel_icd.x86_64.json"
elif [ "$SNAP_ARCH" = "i386" ]; then
export VK_ICD_FILENAMES="/var/lib/snapd/lib/vulkan/icd.d/nvidia_icd.json:$SNAP/usr/share/vulkan/icd.d/radeon.i686.json:$SNAP/usr/share/vulkan/icd.d/intel_icd.i686.json"
elif [ "$SNAP_ARCH" = "armhf" ]; then
export VK_ICD_FILENAMES="/var/lib/snapd/lib/vulkan/icd.d/nvidia_icd.json:$SNAP/usr/share/vulkan/icd.d/radeon.armv7l.json"
elif [ "$SNAP_ARCH" = "arm64" ]; then
export VK_ICD_FILENAMES="/var/lib/snapd/lib/vulkan/icd.d/nvidia_icd.json:$SNAP/usr/share/vulkan/icd.d/radeon.aarch64.json"
fi
exec $SNAP/usr/local/bin/retroarch "$@"