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

This commit is contained in:
XargonWan 2024-09-08 14:50:17 +09:00
commit e6c95f78b9
2 changed files with 52 additions and 20 deletions

View file

@ -960,7 +960,8 @@
"system": [ "system": [
"arcade" "arcade"
], ],
"launch": "mame" "launch": "mame",
"launch-args": "-inipath /var/config/mame/ini -rompath $(dirname \"$game\") $game"
}, },
"citra": { "citra": {
"description": "Citra Nintendo 3DS Emulator (via Ponzu)", "description": "Citra Nintendo 3DS Emulator (via Ponzu)",
@ -976,19 +977,19 @@
} }
] ]
}, },
"ruffle": { "ruffle": {
"description": "Flash Games emulator", "description": "Flash Games emulator",
"name" : "Ruffle", "name" : "Ruffle",
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_about/what-is-retrodeck/", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_about/what-is-retrodeck/",
"system" : "flash", "system" : "flash",
"launch": "ruffle-rd-wrapper.sh" "launch": "ruffle-rd-wrapper.sh"
}, },
"melonds": { "melonds": {
"description": "MelonDS Nintendo DS Emulator", "description": "MelonDS Nintendo DS Emulator",
"name": "melonds", "name": "melonds",
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/melonds/melonds-guide/", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/melonds/melonds-guide/",
"system": "nds", "system": "nds",
"launch": "MelonDS" "launch": "melonDS"
}, },
"pcsx2": { "pcsx2": {
"name": "pcsx2", "name": "pcsx2",
@ -996,6 +997,7 @@
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/pcsx2/pcsx2-guide/", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/pcsx2/pcsx2-guide/",
"system": "ps2", "system": "ps2",
"launch": "pcsx2-qt", "launch": "pcsx2-qt",
"launch_args": "-batch $game",
"properties": [ "properties": [
{ {
"ask_to_exit": true, "ask_to_exit": true,
@ -1008,6 +1010,7 @@
"description": "PlayStation Emulator", "description": "PlayStation Emulator",
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/duckstation/duckstation-guide/", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/duckstation/duckstation-guide/",
"launch": "duckstation-qt", "launch": "duckstation-qt",
"launch-args": "-batch $game",
"system": "psx", "system": "psx",
"properties": [ "properties": [
{ {
@ -1034,7 +1037,8 @@
"description": "Vita3K PSVita Emulator", "description": "Vita3K PSVita Emulator",
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/vita3k/vita3k-guide/", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/vita3k/vita3k-guide/",
"system": "psvita", "system": "psvita",
"launch": "Vita3K" "launch": "Vita3K",
"launch_args": "-r $game.psvita"
}, },
"rpcs3": { "rpcs3": {
"name": "RPCS3", "name": "RPCS3",

View file

@ -935,9 +935,24 @@ run_game() {
(.value.system[]? == $system) (.value.system[]? == $system)
) | .key' "$features") ) | .key' "$features")
# Check if the system is handled by RetroArch cores
local retroarch_cores=$(jq -r --arg system "$system" '
.emulator.retroarch.cores | to_entries[] |
select(
.value.system == $system or
(.value.system[]? == $system)
) | .key' "$features")
# If the system is handled by RetroArch cores, add them to the list of emulators
if [[ -n "$retroarch_cores" ]]; then
emulators=$(echo -e "$emulators\n$retroarch_cores")
fi
local pretty_system=$(jq -r --arg system "$system" '.system[$system].name' "$features")
# Check if multiple emulators are found and prompt the user to select one with zenity # Check if multiple emulators are found and prompt the user to select one with zenity
if [[ $(echo "$emulators" | wc -l) -gt 1 ]]; then 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") emulator=$(echo "$emulators" | zenity --list --title="Select Emulator" --text="Multiple emulators found for $pretty_system. Select one to run." --column="Emulator")
else else
emulator="$emulators" emulator="$emulators"
fi fi
@ -950,13 +965,26 @@ run_game() {
log d "Run game: selected emulator $emulator" log d "Run game: selected emulator $emulator"
# Parse emulator launch command and arguments from the JSON file # Handle RetroArch core separately
local launch_command=$(jq -r ".emulator.$emulator.launch" "$features") if [[ "$emulator" == *"_libretro" ]]; then
local launch_args=$(jq -r ".emulator.$emulator.\"launch-args\"" "$features") local core_path="/var/config/retroarch/cores/$emulator.so"
log d "Running RetroArch core: $core_path"
log d "Command: retroarch -L $core_path \"$game\""
eval "retroarch -L $core_path \"$game\""
else
# Parse emulator launch command and optional 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 # Only add launch_args if they are not null
launch_args=${launch_args//\$game/\"$game\"} if [[ "$launch_args" != "null" ]]; then
# Replace $game in launch_args with the actual game path, quoting it to handle spaces
# Form and execute the command launch_args=${launch_args//\$game/\"$game\"}
eval "$launch_command $launch_args" log d "Command: \"$launch_command $launch_args\""
eval "$launch_command $launch_args"
else
log d "Command: \"$launch_command\""
eval "$launch_command \"$game\""
fi
fi
} }