RUN_GAME: various fixes, time up

This commit is contained in:
XargonWan 2024-09-08 16:30:23 +09:00
parent 0cafedbe70
commit 04ebb5c5d6
2 changed files with 25 additions and 14 deletions

View file

@ -997,7 +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", "launch-args": "-batch $game",
"properties": [ "properties": [
{ {
"ask_to_exit": true, "ask_to_exit": true,
@ -1038,7 +1038,7 @@
"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" "launch-args": "-r $game.psvita"
}, },
"rpcs3": { "rpcs3": {
"name": "RPCS3", "name": "RPCS3",
@ -1046,6 +1046,7 @@
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/rpcs3/rpcs3-guide/", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/rpcs3/rpcs3-guide/",
"system": "ps3", "system": "ps3",
"launch": "rpcs3", "launch": "rpcs3",
"launch-override": "cd $(dirname $game) && rpcs3 $game",
"properties": [ "properties": [
{ {
"ask_to_exit": true "ask_to_exit": true

View file

@ -955,19 +955,29 @@ run_game() {
log d "Command: retroarch -L $core_path \"$game\"" log d "Command: retroarch -L $core_path \"$game\""
eval "retroarch -L $core_path \"$game\"" eval "retroarch -L $core_path \"$game\""
else else
# Parse emulator launch command and optional arguments from the JSON file # Check if launch-override exists
local launch_command=$(jq -r ".emulator.$emulator.launch" "$features") local launch_override=$(jq -r ".emulator.$emulator.\"launch-override\"" "$features")
local launch_args=$(jq -r ".emulator.$emulator.\"launch-args\"" "$features") if [[ "$launch_override" != "null" ]]; then
# Use launch-override
# Only add launch_args if they are not null launch_override=${launch_override//\$game/\"$game\"}
if [[ "$launch_args" != "null" ]]; then log d "Using launch-override: $launch_override"
# Replace $game in launch_args with the actual game path, quoting it to handle spaces eval "$launch_override"
launch_args=${launch_args//\$game/\"$game\"}
log d "Command: \"$launch_command $launch_args\""
eval "$launch_command $launch_args"
else else
log d "Command: \"$launch_command\"" # Use standard launch and launch-args
eval "$launch_command \"$game\"" 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
fi fi
} }