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/",
"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

View file

@ -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
}