From 2818362e30ab7acb3feff97d13627d1b4ba6d565 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Sun, 8 Sep 2024 13:36:16 +0900 Subject: [PATCH 1/4] RUN_GAME: system name prettyfied --- functions/other_functions.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functions/other_functions.sh b/functions/other_functions.sh index 81931318..d8b854f0 100644 --- a/functions/other_functions.sh +++ b/functions/other_functions.sh @@ -918,9 +918,11 @@ run_game() { (.value.system[]? == $system) ) | .key' "$features") + 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 From b2a59be611d13a894649f3fc713726a31e45d1df Mon Sep 17 00:00:00 2001 From: XargonWan Date: Sun, 8 Sep 2024 13:52:05 +0900 Subject: [PATCH 2/4] RUN_GAME: added retroarch cores --- functions/other_functions.sh | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/functions/other_functions.sh b/functions/other_functions.sh index d8b854f0..03544f87 100644 --- a/functions/other_functions.sh +++ b/functions/other_functions.sh @@ -918,6 +918,19 @@ 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 @@ -935,13 +948,20 @@ 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" + eval "retroarch -L $core_path \"$game\"" + else + # 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\"} + # 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" -} + # Form and execute the command + eval "$launch_command $launch_args" + fi +} \ No newline at end of file From 36b7ee6cdca1c7fd32f3c3e5862632cd16699316 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Sun, 8 Sep 2024 14:35:45 +0900 Subject: [PATCH 3/4] FEATURES: added more launch args --- .../retrodeck/reference_lists/features.json | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/config/retrodeck/reference_lists/features.json b/config/retrodeck/reference_lists/features.json index 962f5adc..c256aeb4 100644 --- a/config/retrodeck/reference_lists/features.json +++ b/config/retrodeck/reference_lists/features.json @@ -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", From 0cafedbe70f269c42639647e074448ad7f9d3251 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Sun, 8 Sep 2024 14:36:06 +0900 Subject: [PATCH 4/4] RUN_GAME: fixed retroarch --- functions/other_functions.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/functions/other_functions.sh b/functions/other_functions.sh index 03544f87..ae615e80 100644 --- a/functions/other_functions.sh +++ b/functions/other_functions.sh @@ -952,16 +952,22 @@ run_game() { 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 arguments from the JSON file + # 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 } \ No newline at end of file