Skip to content

Commit

Permalink
fix(Full Session): Fix opening Quick Bar while in game.
Browse files Browse the repository at this point in the history
  • Loading branch information
pastaq committed Nov 27, 2024
1 parent c708809 commit 6bec7ac
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 9 deletions.
15 changes: 14 additions & 1 deletion assets/gamepad/profiles/default.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": 1,
"kind": "DeviceProfile",
"name": "Default",
"name": "OpenGamepadUI Default",
"mapping": [
{
"name": "LeftTop",
Expand Down Expand Up @@ -82,6 +82,19 @@
}
}
]
},
{
"name": "QuickAccess",
"source_event": {
"gamepad": {
"button": "QuickAccess"
}
},
"target_events": [
{
"dbus": "ui_quick"
}
]
}
]
}
11 changes: 11 additions & 0 deletions core/systems/input/input_plumber.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
17 changes: 10 additions & 7 deletions core/ui/card_ui/card_ui.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions core/ui/card_ui/card_ui.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
1 change: 0 additions & 1 deletion core/ui/card_ui_overlay_mode/card_ui_overlay_mode.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6bec7ac

Please sign in to comment.