RUN_GAME: fixed retroarch

This commit is contained in:
XargonWan 2024-09-08 14:36:06 +09:00
parent 36b7ee6cdc
commit 0cafedbe70

View file

@ -952,16 +952,22 @@ run_game() {
if [[ "$emulator" == *"_libretro" ]]; then if [[ "$emulator" == *"_libretro" ]]; then
local core_path="/var/config/retroarch/cores/$emulator.so" local core_path="/var/config/retroarch/cores/$emulator.so"
log d "Running RetroArch core: $core_path" log d "Running RetroArch core: $core_path"
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 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_command=$(jq -r ".emulator.$emulator.launch" "$features")
local launch_args=$(jq -r ".emulator.$emulator.\"launch-args\"" "$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 # Only add launch_args if they are not null
launch_args=${launch_args//\$game/\"$game\"} if [[ "$launch_args" != "null" ]]; then
# Replace $game in launch_args with the actual game path, quoting it to handle spaces
# Form and execute the command launch_args=${launch_args//\$game/\"$game\"}
eval "$launch_command $launch_args" 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
} }