Merge branch 'cooker' into feat/steam-rom-manager

This commit is contained in:
XargonWan 2024-09-08 12:35:55 +09:00
commit daa20ef175
3 changed files with 63 additions and 1 deletions

View file

@ -1061,6 +1061,7 @@
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_about/what-is-retrodeck/",
"launch": "Yuzu",
"system": "switch",
"launch-args": "-f -g $game",
"ponzu": true,
"abxy_button": true
},
@ -1069,6 +1070,7 @@
"description": "Dolphin Wii and GameCube Emulator",
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/dolphin-primehack/dolphin-primehack-guide/",
"launch": "dolphin-emu-wrapper",
"launch-args": "-e $game",
"system": [
"gc",
"wii"
@ -1088,6 +1090,7 @@
"description": "A fork of Dolphiin to enhance Metroid Prime experience",
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/dolphin-primehack/dolphin-primehack-guide/",
"launch": "primehack-wrapper",
"launch-args": "-e $game",
"system": [
"wii"
],
@ -1104,6 +1107,7 @@
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/cemu/cemu-guide/",
"system": "wiiu",
"launch": "Cemu-wrapper",
"launch-args": "-g $game",
"properties": [
{
"abxy_button": true,
@ -1116,7 +1120,8 @@
"name": "xemu",
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/xemu/xemu-guide/",
"system": "xbox",
"launch": "xemu"
"launch": "xemu",
"launch-args": "-dvd_path $game"
},
"es-de": {
"description": "ES-DE Emulation Frontend",

View file

@ -908,3 +908,55 @@ start_retrodeck() {
log i "Starting RetroDECK v$version"
es-de
}
run_game() {
# Arguments: $1 -> game path, $2 -> optional system
local game="$1"
local system="$2"
# If no system is provided, extract it from the game path
if [[ -z "$system" ]]; then
system=$(echo "$game" | grep -oP '(?<=roms/)[^/]+')
fi
log d "Run game: running $(basename "$game") for $system system"
# Special case for retroarch
if [[ "$system" == "retroarch" ]]; then
log d "TODO: implement retroarch"
return
fi
# Query the features JSON for emulators that support the system
local emulators=$(jq -r --arg system "$system" '
.emulator | to_entries[] |
select(
(.value.system == $system) or
(.value.system[]? == $system)
) | .key' "$features")
# Check if multiple emulators are found and prompt the user to select one with zenity
if [[ $(echo "$emulators" | wc -l) -gt 1 ]]; then
emulator=$(echo "$emulators" | zenity --list --title="Select Emulator" --text="Multiple emulators found for $system. Select one to run." --column="Emulator")
else
emulator="$emulators"
fi
# If no emulator was selected, exit
if [[ -z "$emulator" ]]; then
log e "No emulator selected. Exiting."
return 1
fi
log d "Run game: selected emulator $emulator"
# Parse emulator launch command and arguments from the JSON file
local launch_command=$(jq -r ".emulator.$emulator.launch" "$features")
local launch_args=$(jq -r ".emulator.$emulator.\"launch-args\"" "$features")
# Replace $game in launch_args with the actual game path, quoting it to handle spaces
launch_args=${launch_args//\$game/\"$game\"}
# Form and execute the command
eval "$launch_command $launch_args"
}

View file

@ -25,6 +25,7 @@ flatpak run [FLATPAK-RUN-OPTION] net.retrodeck-retrodeck [ARGUMENTS]
Arguments:
-h, --help Print this help
-v, --version Print RetroDECK version
--run <path> (system) Run a game from cli, if no system is defined it will deducted from the path. For example --run ~/retrodeck/roms/system/game.ext will be run with the system "system".
--info-msg Print paths and config informations
--configurator Starts the RetroDECK Configurator
--compress-one <file> Compresses target file to a compatible format
@ -42,6 +43,10 @@ https://retrodeck.net
echo "RetroDECK v$version"
exit
;;
--run*)
run_game "$2" "$3"
exit
;;
--info-msg*)
echo "RetroDECK v$version"
echo "RetroDECK config file is in: $rd_conf"