diff --git a/assets/gamepad/profiles/default.json b/assets/gamepad/profiles/default.json index cbed2a77..547f49f2 100644 --- a/assets/gamepad/profiles/default.json +++ b/assets/gamepad/profiles/default.json @@ -1,7 +1,7 @@ { "version": 1, "kind": "DeviceProfile", - "name": "Default", + "name": "OpenGamepadUI Default", "mapping": [ { "name": "LeftTop", @@ -82,6 +82,19 @@ } } ] + }, + { + "name": "QuickAccess", + "source_event": { + "gamepad": { + "button": "QuickAccess" + } + }, + "target_events": [ + { + "dbus": "ui_quick" + } + ] } ] } diff --git a/core/systems/input/input_plumber.gd b/core/systems/input/input_plumber.gd index 1f35096a..4de6a01a 100644 --- a/core/systems/input/input_plumber.gd +++ b/core/systems/input/input_plumber.gd @@ -17,6 +17,17 @@ const PROFILES_DIR := "user://data/gamepad/profiles" var _dbus_devices := {} +func _init() -> void: + # Ensure the default global profile exists in the user directory. + if not FileAccess.file_exists(DEFAULT_GLOBAL_PROFILE): + var file := FileAccess.open(DEFAULT_PROFILE, FileAccess.READ) + var content := file.get_as_text() + file.close() + var new_file := FileAccess.open(DEFAULT_GLOBAL_PROFILE, FileAccess.WRITE) + new_file.store_string(content) + new_file.close() + + func _ready() -> void: # Add listeners for any new devices var on_device_added := func(device: CompositeDevice): diff --git a/core/ui/card_ui/card_ui.gd b/core/ui/card_ui/card_ui.gd index a1d62c2f..9e68d3fe 100644 --- a/core/ui/card_ui/card_ui.gd +++ b/core/ui/card_ui/card_ui.gd @@ -119,14 +119,17 @@ func _ready() -> void: get_viewport().gui_focus_changed.connect(_on_focus_changed) library_manager.reload_library() - # Set the initial intercept mode + # Setup inputplumber to receive guide presses. input_plumber.set_intercept_mode(InputPlumberInstance.INTERCEPT_MODE_ALL) - #var on_device_changed := func(device: CompositeDevice): - # var intercept_mode := input_plumber.intercept_mode - # logger.debug("Setting intercept mode to: " + str(intercept_mode)) - # device.intercept_mode = intercept_mode - ## TODO: Do we still need this..? - #input_plumber.composite_device_changed.connect(on_device_changed) + input_plumber.set_intercept_activation(PackedStringArray(["Gamepad:Button:Guide"]), "Gamepad:Button:Guide") + + # Sets the intercept mode and intercept activation keys to what overlay_mode expects. + var on_device_changed := func(device: CompositeDevice): + var intercept_mode := input_plumber.intercept_mode + logger.debug("Setting intercept mode to: " + str(intercept_mode)) + device.intercept_mode = intercept_mode + device.set_intercept_activation(PackedStringArray(["Gamepad:Button:Guide"]), "Gamepad:Button:Guide") + input_plumber.composite_device_added.connect(on_device_changed) # Set the theme if one was set var theme_path := settings_manager.get_value("general", "theme", "res://assets/themes/card_ui-dracula.tres") as String diff --git a/core/ui/card_ui/card_ui.tscn b/core/ui/card_ui/card_ui.tscn index 68f7f2a5..1375de96 100644 --- a/core/ui/card_ui/card_ui.tscn +++ b/core/ui/card_ui/card_ui.tscn @@ -105,6 +105,9 @@ instance = ExtResource("5_wmkau") [node name="DesktopLibrary" parent="." instance=ExtResource("3_68bes")] [node name="Launcher" type="Node" parent="."] +process_thread_group = 2 +process_thread_group_order = 0 +process_thread_messages = 0 script = ExtResource("14_fs00k") [node name="PluginManager" parent="." instance=ExtResource("5_dv70s")] diff --git a/core/ui/card_ui_overlay_mode/card_ui_overlay_mode.gd b/core/ui/card_ui_overlay_mode/card_ui_overlay_mode.gd index 92b86c6e..a1b88b86 100644 --- a/core/ui/card_ui_overlay_mode/card_ui_overlay_mode.gd +++ b/core/ui/card_ui_overlay_mode/card_ui_overlay_mode.gd @@ -173,7 +173,6 @@ func _setup_overlay_mode(args: PackedStringArray) -> void: input_plumber.set_intercept_mode(InputPlumberInstance.INTERCEPT_MODE_PASS) input_plumber.set_intercept_activation(PackedStringArray(["Gamepad:Button:Guide", "Gamepad:Button:East"]), "Gamepad:Button:QuickAccess2") - # TODO: Do we need this? # Sets the intercept mode and intercept activation keys to what overlay_mode expects. var on_device_changed := func(device: CompositeDevice): var intercept_mode := input_plumber.intercept_mode