mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-01 20:28:16 +02:00
RetroArch game launcher installer (#5753)
* Agents should use the notification helper * Turn a single RetroArch game into its own application launcher * Tweak installer * Extract selection logic into cli * Use consistent glyph * One more
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 63 KiB |
@@ -40,6 +40,7 @@ GROUP_DESCRIPTIONS[default]="Default application selection"
|
||||
GROUP_DESCRIPTIONS[dev]="Omarchy development tools"
|
||||
GROUP_DESCRIPTIONS[drive]="Drive selection and encryption"
|
||||
GROUP_DESCRIPTIONS[font]="Font management"
|
||||
GROUP_DESCRIPTIONS[games]="Game launchers and helpers"
|
||||
GROUP_DESCRIPTIONS[hibernation]="Hibernation setup and removal"
|
||||
GROUP_DESCRIPTIONS[hook]="User hook runner"
|
||||
GROUP_DESCRIPTIONS[hw]="Hardware detection and controls"
|
||||
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=List installed RetroArch core names
|
||||
|
||||
set -e
|
||||
|
||||
core_dir="/usr/lib/libretro"
|
||||
preferred_cores=(
|
||||
"Amstrad CPC|cap32"
|
||||
"Arcade FBNeo|fbneo"
|
||||
"Arcade MAME|mame"
|
||||
"Commodore Amiga|puae"
|
||||
"Commodore C128|vice_x128"
|
||||
"Commodore C64|vice_x64"
|
||||
"Commodore VIC-20|vice_xvic"
|
||||
"Nintendo DS|desmume"
|
||||
"Nintendo Game Boy / Color|gambatte"
|
||||
"Nintendo Game Boy Advance|mgba"
|
||||
"Nintendo GameCube / Wii|dolphin"
|
||||
"Nintendo NES / Famicom|mesen"
|
||||
"Nintendo 64|parallel_n64"
|
||||
"Nintendo SNES / SFC|snes9x"
|
||||
"NEC PC Engine / TurboGrafx-16|mednafen_pce_fast"
|
||||
"NEC PC Engine CD / TurboGrafx-CD|mednafen_pce"
|
||||
"NEC PC Engine SuperGrafx|mednafen_supergrafx"
|
||||
"Sega Dreamcast|flycast"
|
||||
"Sega Mega Drive / Master System / Game Gear|genesis_plus_gx"
|
||||
"Sega Saturn|kronos"
|
||||
"Sony PlayStation|mednafen_psx_hw"
|
||||
"Sony PlayStation Portable|ppsspp"
|
||||
)
|
||||
|
||||
[[ -d $core_dir ]] || exit 0
|
||||
|
||||
for preferred_core in "${preferred_cores[@]}"; do
|
||||
label="${preferred_core%%|*}"
|
||||
core="${preferred_core#*|}"
|
||||
[[ -f $core_dir/${core}_libretro.so ]] && printf '%s (%s)\n' "$label" "$core"
|
||||
done
|
||||
Executable
+76
@@ -0,0 +1,76 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Create a desktop launcher for a RetroArch game
|
||||
# omarchy:args=[core path-to-game]
|
||||
# omarchy:examples=omarchy games retro install snes9x ~/Games/roms/snes/game.sfc | omarchy-games-retro-install /usr/lib/libretro/mgba_libretro.so ~/Games/roms/gba/game.gba
|
||||
|
||||
set -e
|
||||
|
||||
if (( $# == 0 )); then
|
||||
mapfile -t cores < <(omarchy-games-retro-cores)
|
||||
|
||||
if (( ${#cores[@]} == 0 )); then
|
||||
omarchy-notification-send -g "" "No RetroArch cores found" "/usr/lib/libretro"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
core=$(omarchy-menu-select "RetroArch core" "${cores[@]}") || exit 0
|
||||
[[ -n $core ]] || exit 0
|
||||
core="${core##*(}"
|
||||
core="${core%)}"
|
||||
|
||||
game_path=$(omarchy-menu-file "Retro game" "$HOME/Games/roms" "7z bin ccd chd cue dmg elf fds gb gba gbc iso lha m3u md n64 nds nes pbp sfc smc swc zip z64") || exit 0
|
||||
[[ -n $game_path ]] || exit 0
|
||||
elif (( $# == 2 )); then
|
||||
core="$1"
|
||||
game_path="$2"
|
||||
else
|
||||
echo "Usage: omarchy-games-retro-install [core path-to-game]"
|
||||
echo "Example: omarchy-games-retro-install snes9x ~/Games/roms/snes/game.sfc"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f $game_path ]]; then
|
||||
echo "Game not found: $game_path"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $core == */* ]]; then
|
||||
core_path="$core"
|
||||
else
|
||||
core_path="/usr/lib/libretro/${core}_libretro.so"
|
||||
fi
|
||||
|
||||
if [[ ! -f $core_path ]]; then
|
||||
echo "Core not found: $core_path"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
game_name=$(printf '%s' "${game_path##*/}" | sed 's/\.[^.]*$//; s/[[:space:]]*([^)]*)//g; s/[[:space:]]\+/ /g; s/^ //; s/ $//' | perl -Mopen=locale -pe 's/(^|[[:space:]])([^[:space:]])/$1\U$2/g')
|
||||
desktop_name="$game_name"
|
||||
desktop_id=$(printf '%s' "$desktop_name" | tr '[:upper:]' '[:lower:]' | tr -cs '[:alnum:]' '-' | sed 's/^-//; s/-$//')
|
||||
desktop_dir="$HOME/.local/share/applications"
|
||||
desktop_file="$desktop_dir/$desktop_id.desktop"
|
||||
icon_dir="$desktop_dir/icons"
|
||||
icon_path="$icon_dir/Retro Gaming.png"
|
||||
|
||||
mkdir -p "$desktop_dir" "$icon_dir"
|
||||
[[ -f $icon_path ]] || cp "$HOME/.local/share/omarchy/applications/icons/Retro Gaming.png" "$icon_path"
|
||||
|
||||
cat >"$desktop_file" <<EOF
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Name=$desktop_name
|
||||
Comment=Play $game_name with RetroArch
|
||||
Exec=retroarch -L "$core_path" "$game_path"
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Icon=$icon_path
|
||||
StartupNotify=true
|
||||
Categories=Game;Emulator;
|
||||
EOF
|
||||
|
||||
chmod +x "$desktop_file"
|
||||
update-desktop-database "$desktop_dir" &>/dev/null || true
|
||||
|
||||
omarchy-notification-send -g "" "$game_name installed" "Start it with Super + Space"
|
||||
+2
-1
@@ -600,8 +600,9 @@ show_install_ai_menu() {
|
||||
}
|
||||
|
||||
show_install_gaming_menu() {
|
||||
case $(menu "Install" " Steam\n RetroArch\n Minecraft\n NVIDIA GeForce NOW\n Xbox Cloud Gaming\n Xbox Controller\n Moonlight (GameStream)\n Lutris (Battle.net)\n Heroic (Epic Games)") in
|
||||
case $(menu "Install" " Steam\n RetroArch\n Minecraft\n NVIDIA GeForce NOW\n Xbox Cloud Gaming\n Xbox Controller\n Moonlight (GameStream)\n Lutris (Battle.net)\n Heroic (Epic Games)\n RetroArch Game Launcher") in
|
||||
*Steam*) present_terminal omarchy-install-gaming-steam ;;
|
||||
*"RetroArch Game Launcher"*) omarchy-games-retro-install ;;
|
||||
*RetroArch*) present_terminal omarchy-install-gaming-retroarch ;;
|
||||
*Minecraft*) install_and_launch "Minecraft" "minecraft-launcher" "minecraft-launcher" ;;
|
||||
*GeForce*) present_terminal omarchy-install-gaming-geforce-now ;;
|
||||
|
||||
Reference in New Issue
Block a user