mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-25 23:45:39 +00:00
RUN_GAME: added retroarch cores
This commit is contained in:
parent
2818362e30
commit
b2a59be611
|
@ -918,6 +918,19 @@ run_game() {
|
||||||
(.value.system[]? == $system)
|
(.value.system[]? == $system)
|
||||||
) | .key' "$features")
|
) | .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")
|
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
|
# Check if multiple emulators are found and prompt the user to select one with zenity
|
||||||
|
@ -935,6 +948,12 @@ run_game() {
|
||||||
|
|
||||||
log d "Run game: selected emulator $emulator"
|
log d "Run game: selected emulator $emulator"
|
||||||
|
|
||||||
|
# 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
|
# Parse emulator launch command and 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")
|
||||||
|
@ -944,4 +963,5 @@ run_game() {
|
||||||
|
|
||||||
# Form and execute the command
|
# Form and execute the command
|
||||||
eval "$launch_command $launch_args"
|
eval "$launch_command $launch_args"
|
||||||
|
fi
|
||||||
}
|
}
|
Loading…
Reference in a new issue