From 04ebb5c5d6763266e170d006801c57ca36abc4c3 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Sun, 8 Sep 2024 16:30:23 +0900 Subject: [PATCH] RUN_GAME: various fixes, time up --- .../retrodeck/reference_lists/features.json | 5 +-- functions/other_functions.sh | 34 ++++++++++++------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/config/retrodeck/reference_lists/features.json b/config/retrodeck/reference_lists/features.json index c256aeb4..e67563aa 100644 --- a/config/retrodeck/reference_lists/features.json +++ b/config/retrodeck/reference_lists/features.json @@ -997,7 +997,7 @@ "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/pcsx2/pcsx2-guide/", "system": "ps2", "launch": "pcsx2-qt", - "launch_args": "-batch $game", + "launch-args": "-batch $game", "properties": [ { "ask_to_exit": true, @@ -1038,7 +1038,7 @@ "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/vita3k/vita3k-guide/", "system": "psvita", "launch": "Vita3K", - "launch_args": "-r $game.psvita" + "launch-args": "-r $game.psvita" }, "rpcs3": { "name": "RPCS3", @@ -1046,6 +1046,7 @@ "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/rpcs3/rpcs3-guide/", "system": "ps3", "launch": "rpcs3", + "launch-override": "cd $(dirname $game) && rpcs3 $game", "properties": [ { "ask_to_exit": true diff --git a/functions/other_functions.sh b/functions/other_functions.sh index ae615e80..3360a412 100644 --- a/functions/other_functions.sh +++ b/functions/other_functions.sh @@ -955,19 +955,29 @@ run_game() { 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") - - # 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" + # Check if launch-override exists + local launch_override=$(jq -r ".emulator.$emulator.\"launch-override\"" "$features") + if [[ "$launch_override" != "null" ]]; then + # Use launch-override + launch_override=${launch_override//\$game/\"$game\"} + log d "Using launch-override: $launch_override" + eval "$launch_override" else - log d "Command: \"$launch_command\"" - eval "$launch_command \"$game\"" + # Use standard launch and launch-args + local launch_command=$(jq -r ".emulator.$emulator.launch" "$features") + local launch_args=$(jq -r ".emulator.$emulator.\"launch-args\"" "$features") + log d "launch args: $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 fi } \ No newline at end of file