RUN_GAME: if the emulator is only one just skip the zenity and run it

This commit is contained in:
XargonWan 2024-09-11 10:20:28 +09:00
parent 6496e1f051
commit e80c30a1d9

View file

@ -936,7 +936,6 @@ find_emulator() {
# TODO: add the logic of alt emulator and default emulator # TODO: add the logic of alt emulator and default emulator
# TODO: if the emulator is only one just skip the zenity and run it
run_game() { run_game() {
@ -1110,11 +1109,17 @@ replace_emulator_placeholder() {
command_list+=("$label" "$command") command_list+=("$label" "$command")
done <<< "$commands" done <<< "$commands"
# Check if there's only one command
if [ ${#command_list[@]} -eq 2 ]; then
log d "Only one command found for $system_name, running it directly: ${command_list[1]}"
selected_command="${command_list[1]}"
else
# Show the list with Zenity and return the **command** (second column) selected # Show the list with Zenity and return the **command** (second column) selected
selected_command=$(zenity --list \ selected_command=$(zenity --list \
--title="Select an emulator for $system_name" \ --title="Select an emulator for $system_name" \
--column="Emulator" --column="Hidden Command" "${command_list[@]}" \ --column="Emulator" --column="Hidden Command" "${command_list[@]}" \
--width=800 --height=400 --print-column=2 --hide-column=2) --width=800 --height=400 --print-column=2 --hide-column=2)
fi
echo "$selected_command" echo "$selected_command"
} }