mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-22 14:05:39 +00:00
Merge branch 'cooker' into feat/steam-rom-manager
This commit is contained in:
commit
e6c95f78b9
|
@ -960,7 +960,8 @@
|
|||
"system": [
|
||||
"arcade"
|
||||
],
|
||||
"launch": "mame"
|
||||
"launch": "mame",
|
||||
"launch-args": "-inipath /var/config/mame/ini -rompath $(dirname \"$game\") $game"
|
||||
},
|
||||
"citra": {
|
||||
"description": "Citra Nintendo 3DS Emulator (via Ponzu)",
|
||||
|
@ -976,19 +977,19 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"ruffle": {
|
||||
"description": "Flash Games emulator",
|
||||
"name" : "Ruffle",
|
||||
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_about/what-is-retrodeck/",
|
||||
"system" : "flash",
|
||||
"launch": "ruffle-rd-wrapper.sh"
|
||||
},
|
||||
"ruffle": {
|
||||
"description": "Flash Games emulator",
|
||||
"name" : "Ruffle",
|
||||
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_about/what-is-retrodeck/",
|
||||
"system" : "flash",
|
||||
"launch": "ruffle-rd-wrapper.sh"
|
||||
},
|
||||
"melonds": {
|
||||
"description": "MelonDS Nintendo DS Emulator",
|
||||
"name": "melonds",
|
||||
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/melonds/melonds-guide/",
|
||||
"system": "nds",
|
||||
"launch": "MelonDS"
|
||||
"launch": "melonDS"
|
||||
},
|
||||
"pcsx2": {
|
||||
"name": "pcsx2",
|
||||
|
@ -996,6 +997,7 @@
|
|||
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/pcsx2/pcsx2-guide/",
|
||||
"system": "ps2",
|
||||
"launch": "pcsx2-qt",
|
||||
"launch_args": "-batch $game",
|
||||
"properties": [
|
||||
{
|
||||
"ask_to_exit": true,
|
||||
|
@ -1008,6 +1010,7 @@
|
|||
"description": "PlayStation Emulator",
|
||||
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/duckstation/duckstation-guide/",
|
||||
"launch": "duckstation-qt",
|
||||
"launch-args": "-batch $game",
|
||||
"system": "psx",
|
||||
"properties": [
|
||||
{
|
||||
|
@ -1034,7 +1037,8 @@
|
|||
"description": "Vita3K PSVita Emulator",
|
||||
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/vita3k/vita3k-guide/",
|
||||
"system": "psvita",
|
||||
"launch": "Vita3K"
|
||||
"launch": "Vita3K",
|
||||
"launch_args": "-r $game.psvita"
|
||||
},
|
||||
"rpcs3": {
|
||||
"name": "RPCS3",
|
||||
|
|
|
@ -935,9 +935,24 @@ run_game() {
|
|||
(.value.system[]? == $system)
|
||||
) | .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
|
||||
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
|
||||
emulator="$emulators"
|
||||
fi
|
||||
|
@ -950,13 +965,26 @@ run_game() {
|
|||
|
||||
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")
|
||||
# Handle RetroArch core separately
|
||||
if [[ "$emulator" == *"_libretro" ]]; then
|
||||
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
|
||||
launch_args=${launch_args//\$game/\"$game\"}
|
||||
|
||||
# Form and execute the command
|
||||
eval "$launch_command $launch_args"
|
||||
}
|
||||
# Only add launch_args if they are not null
|
||||
if [[ "$launch_args" != "null" ]]; then
|
||||
# Replace $game in launch_args with the actual game path, quoting it to handle spaces
|
||||
launch_args=${launch_args//\$game/\"$game\"}
|
||||
log d "Command: \"$launch_command $launch_args\""
|
||||
eval "$launch_command $launch_args"
|
||||
else
|
||||
log d "Command: \"$launch_command\""
|
||||
eval "$launch_command \"$game\""
|
||||
fi
|
||||
fi
|
||||
}
|
Loading…
Reference in a new issue