fix(Overlay Mode): Overlay Mode Fixes

- Temporary workaround for resource loading of SettingsManager and InputIconManager.
- Fixed loading and saving default target gamepad.
- Fixed loading the gamepad profile on startup in Overlay Mode, enabling
  opening overlay window.
- Added missing children to overlay_mode_card_ui.
- Fix loading GPU settings in PowerTools
This commit is contained in:
Derek J. Clark
2024-11-22 20:26:05 -08:00
committed by William Edwards
parent c9cb1e0303
commit 6737d9e795
12 changed files with 111 additions and 118 deletions

View File

@@ -238,7 +238,7 @@ assets/crypto/keys/opengamepadui.pub: assets/crypto/keys/opengamepadui.key
.PHONY: deploy
deploy: dist-archive $(SSH_MOUNT_PATH)/.mounted ## Build, deploy, and tunnel to a remote device
cp dist/opengamepadui.tar.gz $(SSH_MOUNT_PATH)
scp dist/opengamepadui.tar.gz $(SSH_USER)@$(SSH_HOST):$(SSH_DATA_PATH)
cd $(SSH_MOUNT_PATH) #&& tar xvfz opengamepadui.tar.gz
ssh -t $(SSH_USER)@$(SSH_HOST) tar xvfz "$(SSH_DATA_PATH)/opengamepadui.tar.gz"

View File

@@ -72,14 +72,14 @@ func _init() -> void:
# Listen for signals from the primary Gamescope XWayland
if _xwayland_primary:
# When window focus changes, update the current app and gamepad profile
# Debug print when the focused window changes
var on_focus_changed := func(from: int, to: int):
if from == to:
return
logger.info("Window focus changed from " + str(from) + " to: " + str(to))
_xwayland_primary.focused_window_updated.connect(on_focus_changed)
# Debug print when the focused app changed
# When focused app changes, update the current app and gamepad profile
var on_focused_app_changed := func(from: int, to: int) -> void:
if from == to:
return
@@ -150,7 +150,7 @@ func _init() -> void:
in_game_state.state_entered.connect(on_game_state_entered)
in_game_state.state_exited.connect(on_game_state_exited)
set_gamepad_profile("")
# Loads persistent data like recent games launched, etc.
func _load_persist_data():
@@ -345,26 +345,10 @@ func set_gamepad_profile(path: String, target_gamepad: String = "") -> void:
# If no profile was specified, unset the gamepad profiles
if path == "":
# Try check to see if there is a global gamepad setting
var profile_path := settings_manager.get_value("input", "gamepad_profile", InputPlumber.DEFAULT_GLOBAL_PROFILE) as String
if not profile_path.ends_with(".json") or not FileAccess.file_exists(profile_path):
profile_path = InputPlumber.DEFAULT_GLOBAL_PROFILE
logger.info("Loading global gamepad profile: " + profile_path)
for gamepad in input_plumber.get_composite_devices():
InputPlumber.load_target_modified_profile(gamepad, profile_path, profile_modifier)
# Set the target gamepad if one was specified
if not target_gamepad.is_empty():
var target_devices := PackedStringArray([target_gamepad, "keyboard", "mouse"])
match target_gamepad:
"xb360", "xbox-series", "xbox-elite", "gamepad":
target_devices.append("touchpad")
_:
logger.debug(target_gamepad, "needs no additional target devices.")
logger.info("Setting target devices to: ", target_devices)
gamepad.set_target_devices(target_devices)
return
path = settings_manager.get_value("input", "gamepad_profile", InputPlumber.DEFAULT_GLOBAL_PROFILE) as String
# Verify we loaded a valid profile, or fallback.
if not path.ends_with(".json") or not FileAccess.file_exists(path):
path = InputPlumber.DEFAULT_GLOBAL_PROFILE
logger.info("Loading gamepad profile: " + path)
if not FileAccess.file_exists(path):

View File

@@ -402,8 +402,6 @@ func _get_matching_event(path: String, input_type: InputType) -> Array[InputEven
## Set the last input type to the given value and emit a signal
func set_last_input_type(_last_input_type: InputType):
last_input_type = _last_input_type
if not self.disabled:
input_type_changed.emit(_last_input_type)
## Signal whenever a gamepad is connected/disconnected

View File

@@ -32,8 +32,12 @@ func _input(event: InputEvent) -> void:
"InputEventJoypadMotion":
if abs(event.axis_value) > DEADZONE:
input_type = InputIconManager.InputType.GAMEPAD
var refresh := false
if input_type != icon_manager.last_input_type:
icon_manager.set_last_input_type(input_type)
refresh = true
if device_name != icon_manager.last_input_device:
icon_manager.last_input_device = device_name
refresh = true
if refresh:
icon_manager.refresh()

View File

@@ -151,7 +151,7 @@ func load_or_create_profile(profile_path: String, library_item: LibraryLaunchIte
if profile:
logger.debug("Found profile at: " + profile_path)
return profile
# If the profile does not exist, create one with the currently applied
# performance settings.
logger.debug("No profile found. Creating one.")
@@ -163,18 +163,8 @@ func apply_profile(profile: PerformanceProfile) -> void:
if not _power_station.is_running():
logger.info("Unable to apply performance profile. PowerStation not detected.")
return
logger.info("Applying performance profile: " + profile.name)
# Apply CPU settings from the given profile
if _power_station.cpu:
logger.debug("Applying CPU performance settings from profile")
if _power_station.cpu.boost_enabled != profile.cpu_boost_enabled:
_power_station.cpu.boost_enabled = profile.cpu_boost_enabled
if _power_station.cpu.smt_enabled != profile.cpu_smt_enabled:
_power_station.cpu.smt_enabled = profile.cpu_smt_enabled
if profile.cpu_core_count_current > 0 and _power_station.cpu.cores_enabled != profile.cpu_core_count_current:
_power_station.cpu.cores_enabled = profile.cpu_core_count_current
logger.info("Applying performance profile: " + profile.name)
# Detect all GPU cards
var cards: Array[GpuCard] = []
@@ -187,6 +177,15 @@ func apply_profile(profile: PerformanceProfile) -> void:
if card.class != "integrated":
continue
logger.debug("Applying GPU performance settings from profile")
if profile.gpu_power_profile >= 0:
var power_profile := "max-performance"
if profile.gpu_power_profile == 0:
power_profile = "max-performance"
if profile.gpu_power_profile == 1:
power_profile = "power-saving"
if card.power_profile != power_profile:
logger.debug("Applying Power Profile: " + power_profile)
card.power_profile = power_profile
if card.manual_clock != profile.gpu_manual_enabled:
card.manual_clock = profile.gpu_manual_enabled
if profile.tdp_current > 0 and card.tdp != profile.tdp_current:
@@ -201,19 +200,20 @@ func apply_profile(profile: PerformanceProfile) -> void:
if profile.gpu_freq_max_current > 0 and card.clock_value_mhz_max != profile.gpu_freq_max_current:
logger.debug("Applying Clock Freq Max: " + str(profile.gpu_freq_max_current))
card.clock_value_mhz_max = profile.gpu_freq_max_current
if profile.gpu_power_profile >= 0:
var power_profile := "max-performance"
if profile.gpu_power_profile == 0:
power_profile = "max-performance"
if profile.gpu_power_profile == 1:
power_profile = "power-saving"
if card.power_profile != power_profile:
logger.debug("Applying Power Profile: " + power_profile)
card.power_profile = power_profile
if profile.gpu_temp_current > 0 and card.thermal_throttle_limit_c != profile.gpu_temp_current:
logger.debug("Applying Thermal Throttle Limit: " + str(profile.gpu_temp_current))
card.thermal_throttle_limit_c = profile.gpu_temp_current
# Apply CPU settings from the given profile
if _power_station.cpu:
logger.debug("Applying CPU performance settings from profile")
if _power_station.cpu.boost_enabled != profile.cpu_boost_enabled:
_power_station.cpu.boost_enabled = profile.cpu_boost_enabled
if _power_station.cpu.smt_enabled != profile.cpu_smt_enabled:
_power_station.cpu.smt_enabled = profile.cpu_smt_enabled
if profile.cpu_core_count_current > 0 and _power_station.cpu.cores_enabled != profile.cpu_core_count_current:
_power_station.cpu.cores_enabled = profile.cpu_core_count_current
logger.info("Applied Performance Profile: " + profile.name)
profile_applied.emit(profile)

View File

@@ -63,8 +63,8 @@ func _ready() -> void:
self.gamepad_type_selected = item_selected
if self.profile:
var gamepad_type := self.get_selected_target_gamepad()
profile_gamepad = InputPlumberProfile.get_target_device_string(gamepad_type)
logger.debug("Setting gamepad to " + profile_gamepad)
self.profile_gamepad = InputPlumberProfile.get_target_device_string(gamepad_type)
logger.debug("Setting gamepad to " + self.profile_gamepad)
else:
logger.debug("No profile, unable to set gamepad type.")
self._update_mapping_elements()
@@ -72,9 +72,9 @@ func _ready() -> void:
# Load the default profile
var profile_path = settings_manager.get_value("input", "gamepad_profile", "")
profile_gamepad = settings_manager.get_value("input", "gamepad_profile_target", "")
for gamepad in input_plumber.get_composite_devices():
_set_gamepad_profile(gamepad, profile_path)
self.profile_gamepad = settings_manager.get_value("input", "gamepad_profile_target", "")
for composite_device in input_plumber.get_composite_devices():
_set_gamepad_profile(composite_device, profile_path)
# Grab focus when the mapper exits
var on_state_changed := func(_from: State, to: State):
@@ -103,7 +103,7 @@ func _on_state_entered(_from: State) -> void:
main_container.visible = true
# Read from the state to determine which gamepad is being configured
gamepad = null
self.gamepad = null
if !gamepad_state.has_meta("dbus_path"):
logger.error("No gamepad was set to configure!")
# Make menu empty, unable to find gamepad to configure
@@ -116,56 +116,48 @@ func _on_state_entered(_from: State) -> void:
# Find the composite device to configure
for device: CompositeDevice in input_plumber.get_composite_devices():
if device.dbus_path == dbus_path:
gamepad = device
self.gamepad = device
break
if gamepad == null:
if self.gamepad == null:
logger.error("Unable to find CompositeDevice with path: " + dbus_path)
not_available.visible = true
main_container.visible = false
$ServiceNotAvailableContainer/Label.text = "No gamepad to configure"
return
logger.debug("Configuring gamepad '" + gamepad.name + "': " + dbus_path)
logger.debug("Configuring gamepad '" + self.gamepad.name + "': " + dbus_path)
# Set the gamepad name label
gamepad_label.text = gamepad.name
gamepad_label.text = self.gamepad.name
# Populate the menu with the source inputs for the given gamepad
populate_mappings_for(gamepad)
populate_mappings_for(self.gamepad)
# Set the library item, if one exists
library_item = null
profile = null
self.library_item = null
self.profile = null
if gamepad_state.has_meta("item"):
library_item = gamepad_state.get_meta("item") as LibraryItem
self.library_item = gamepad_state.get_meta("item") as LibraryItem
# If no library item was set, but there's a running app, try to see if
# there is a library item for it instead.
if not library_item:
library_item = launch_manager.get_current_app_library_item()
if not self.library_item:
self.library_item = launch_manager.get_current_app_library_item()
# If no library item was set with the state, then configure the OGUI profile
if not library_item:
profile_label.text = "Global"
@warning_ignore("confusable_local_declaration")
var profile_path := settings_manager.get_value("input", "gamepad_profile", InputPlumber.DEFAULT_GLOBAL_PROFILE) as String
var profile_target_gamepad := settings_manager.get_value("input", "gamepad_profile_target", "") as String
profile = _load_profile(profile_path)
profile_gamepad = profile_target_gamepad
_update_mapping_elements()
return
# Set the profile text to the game name
profile_label.text = library_item.name
# Check to see if the given game has a gamepad profile
var profile_path := settings_manager.get_library_value(library_item, "gamepad_profile", "") as String
var profile_target_gamepad := settings_manager.get_library_value(library_item, "gamepad_profile_target", "") as String
profile = _load_profile(profile_path)
profile_gamepad = profile_target_gamepad
_update_mapping_elements()
var profile_path: String
if not self.library_item:
self.profile_label.text = "Global"
profile_path = settings_manager.get_value("input", "gamepad_profile", InputPlumber.DEFAULT_GLOBAL_PROFILE) as String
else:
self.profile_label.text = self.library_item.name
profile_path = settings_manager.get_library_value(self.library_item, "gamepad_profile", "") as String
self.profile = _load_profile(profile_path)
self.profile_gamepad = settings_manager.get_library_value(self.library_item, "gamepad_profile_target", "") as String
_update_mapping_elements()
# Clear focus
mapping_focus_group.current_focus = null
@@ -402,8 +394,8 @@ func _update_mapping_elements() -> void:
profile_label.text = profile.name
# Update the dropdown based on the profile's target gamepad type
if not profile_gamepad.is_empty():
var target_device := InputPlumberProfile.get_target_device(profile_gamepad)
if not self.profile_gamepad.is_empty():
var target_device := InputPlumberProfile.get_target_device(self.profile_gamepad)
var gamepad_text := self.get_target_gamepad_text(target_device)
var i := 0
var idx := 0
@@ -612,16 +604,16 @@ func _set_gamepad_profile(gamepad: CompositeDevice, profile_path: String = "") -
profile_path = settings_manager.get_library_value(library_item, "gamepad_profile", "")
logger.debug("Setting " + gamepad.name + " to profile: " + profile_path)
InputPlumber.load_target_modified_profile(gamepad, profile_path, profile_gamepad)
InputPlumber.load_target_modified_profile(gamepad, profile_path, self.profile_gamepad)
# Set the target gamepad if one was specified
if not profile_gamepad.is_empty():
var target_devices := PackedStringArray([profile_gamepad, "keyboard", "mouse"])
match profile_gamepad:
if not self.profile_gamepad.is_empty():
var target_devices := PackedStringArray([self.profile_gamepad, "keyboard", "mouse"])
match self.profile_gamepad:
"xb360", "xbox-series", "xbox-elite", "gamepad":
target_devices.append("touchpad")
_:
logger.debug(profile_gamepad, "needs no additional target devices.")
logger.debug(self.profile_gamepad, "needs no additional target devices.")
logger.debug("Setting target devices to: ", target_devices)
gamepad.set_target_devices(target_devices)
@@ -645,8 +637,9 @@ func _save_profile() -> void:
return
# Update the game settings to use this global profile
self.logger.info("Saving gamepad profile at", path, "and gamepad target", self.profile_gamepad)
settings_manager.set_value("input", "gamepad_profile", path)
settings_manager.set_value("input", "gamepad_profile_target", profile_gamepad)
settings_manager.set_value("input", "gamepad_profile_target", self.profile_gamepad)
for gamepad in input_plumber.get_composite_devices():
_set_gamepad_profile(gamepad, path)
@@ -668,7 +661,7 @@ func _save_profile() -> void:
# Update the game settings to use this gamepad profile
var section := "game.{0}".format([library_item.name.to_lower()])
settings_manager.set_value(section, "gamepad_profile", path)
settings_manager.set_value(section, "gamepad_profile_target", profile_gamepad)
settings_manager.set_value(section, "gamepad_profile_target", self.profile_gamepad)
logger.debug("Saved gamepad profile to: " + path)
notify.text = "Gamepad profile saved"
notification_manager.show(notify)

View File

@@ -3,7 +3,7 @@
[ext_resource type="PackedScene" uid="uid://b5xnora73yd8x" path="res://core/ui/card_ui/quick_bar/qb_card.tscn" id="1_6lv34"]
[ext_resource type="PackedScene" uid="uid://dv3dt0j3jketh" path="res://core/ui/common/quick_bar/powertools_menu.tscn" id="2_votl1"]
[sub_resource type="Image" id="Image_n6cge"]
[sub_resource type="Image" id="Image_c7ewe"]
data = {
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 93, 93, 41, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0),
"format": "RGBA8",
@@ -13,7 +13,7 @@ data = {
}
[sub_resource type="ImageTexture" id="ImageTexture_ca0vc"]
image = SubResource("Image_n6cge")
image = SubResource("Image_c7ewe")
[node name="PowerToolsCard" instance=ExtResource("1_6lv34")]
title = "Power Tools"

View File

@@ -97,6 +97,9 @@ func _ready() -> void:
# 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
if theme_path.is_empty():
logger.error("Failed to load theme from settings manager.")
return
logger.debug("Setting theme to: " + theme_path)
var loaded_theme = load(theme_path)
if loaded_theme != null:
@@ -252,7 +255,6 @@ func _find_underlay_window_id() -> void:
if xwayland_ogui.has_notification(window):
underlay_window_id = window
logger.info("Found steam! " + str(underlay_window_id))
xwayland_primary.focused_app_updated.connect(_on_app_focus_changed)
break
# If we didn't find the window_id, set up a tiemr to loop back and try again.
@@ -306,18 +308,3 @@ func _check_exit() -> void:
return
logger.debug("Steam closed. Shutting down.")
get_tree().quit()
func _on_app_focus_changed(from: int, to: int) -> void:
# On focus to the steam overlay, ensure the default profile is used.
logger.warn("Changed window focus from", from, "to app ID:", to)
if to in [gamescope.OVERLAY_GAME_ID, 0]:
launch_manager.set_gamepad_profile("")
return
# On focus back to the game, ensure the game profile is set
var _current_app := launch_manager.get_current_app()
if not _current_app:
logger.error("Unable to set gamepad profile. Current app is NULL and we aren't focused")
return
launch_manager.set_app_gamepad_profile(_current_app)

View File

@@ -1,13 +1,20 @@
[gd_scene load_steps=9 format=3 uid="uid://b13lnfkjbafkj"]
[gd_scene load_steps=16 format=3 uid="uid://b13lnfkjbafkj"]
[ext_resource type="Theme" uid="uid://ehplgpp70vxa" path="res://assets/themes/card_ui-dracula.tres" id="1_0qmlq"]
[ext_resource type="Script" path="res://core/ui/card_ui_overlay_mode/card_ui_overlay_mode.gd" id="2_3ptao"]
[ext_resource type="PackedScene" uid="uid://bxnb8t7i08vma" path="res://core/systems/input/overlay_mode_input_manager.tscn" id="3_klhmb"]
[ext_resource type="Script" path="res://core/systems/input/input_icon_processor.gd" id="4_6rltg"]
[ext_resource type="Script" path="res://core/systems/launcher/launcher.gd" id="4_o0rva"]
[ext_resource type="PackedScene" uid="uid://d2jiecrd5sw4s" path="res://core/ui/card_ui/settings/settings_menu.tscn" id="5_4sdt1"]
[ext_resource type="Script" path="res://core/systems/gamescope/gamescope.gd" id="5_sgddx"]
[ext_resource type="GamescopeInstance" uid="uid://chd0nc6gbfnw0" path="res://core/systems/gamescope/gamescope.tres" id="6_jj3bv"]
[ext_resource type="PackedScene" uid="uid://cwarv58ju0sow" path="res://core/ui/card_ui/gamepad/gamepad_settings.tscn" id="6_oddte"]
[ext_resource type="PackedScene" uid="uid://hroo3ll4inrb" path="res://core/ui/card_ui/quick_bar/quick_bar_menu.tscn" id="7_e54f8"]
[ext_resource type="Script" path="res://core/systems/plugin/plugin_manager.gd" id="7_qqh0e"]
[ext_resource type="Script" path="res://core/systems/performance/power_station.gd" id="8_kxe4b"]
[ext_resource type="PackedScene" uid="uid://eqqk1uve143x" path="res://core/ui/components/dialog.tscn" id="8_otm5f"]
[ext_resource type="ResourceRegistry" uid="uid://bsr58xihnpn1j" path="res://core/systems/resource/resource_registry.tres" id="9_4si0w"]
[ext_resource type="PowerStationInstance" uid="uid://c2mmrnh3rcs58" path="res://core/systems/performance/power_station.tres" id="9_nw6s5"]
[node name="CardUIOverlayMode" type="Control" groups=["main"]]
layout_mode = 3
@@ -21,9 +28,26 @@ script = ExtResource("2_3ptao")
[node name="InputManager" parent="." instance=ExtResource("3_klhmb")]
[node name="InputIconProcessor" type="Node" parent="."]
script = ExtResource("4_6rltg")
[node name="Gamescope" type="Node" parent="."]
script = ExtResource("5_sgddx")
instance = ExtResource("6_jj3bv")
[node name="Launcher" type="Node" parent="."]
script = ExtResource("4_o0rva")
[node name="PluginManager" type="Node" parent="."]
script = ExtResource("7_qqh0e")
[node name="PowerStation" type="Node" parent="."]
script = ExtResource("8_kxe4b")
instance = ExtResource("9_nw6s5")
[node name="ResourceProcessor" type="ResourceProcessor" parent="."]
registry = ExtResource("9_4si0w")
[node name="MenuContent" type="MarginContainer" parent="."]
unique_name_in_owner = true
layout_mode = 1

View File

@@ -143,6 +143,7 @@ func _on_apply_timer_timeout() -> void:
logger.debug("Applying and saving profile")
# Update the profile based on the currently set values
current_profile.gpu_power_profile = power_profile_dropdown.selected
current_profile.cpu_boost_enabled = cpu_boost_button.button_pressed
current_profile.cpu_smt_enabled = smt_button.button_pressed
current_profile.cpu_core_count_current = int(cpu_cores_slider.value)
@@ -152,7 +153,6 @@ func _on_apply_timer_timeout() -> void:
current_profile.gpu_freq_min_current = gpu_freq_min_slider.value
current_profile.gpu_freq_max_current = gpu_freq_max_slider.value
current_profile.gpu_temp_current = gpu_temp_slider.value
current_profile.gpu_power_profile = power_profile_dropdown.selected
performance_manager.apply_and_save_profile(current_profile)
@@ -267,7 +267,7 @@ func _get_integrated_card() -> GpuCard:
var card: GpuCard
var cards := power_station.gpu.get_cards()
for c in cards:
if c.class_type != "integrated":
if c.class != "integrated":
continue
card = c
return card

View File

@@ -31,15 +31,15 @@ var internal_children: Array[Node] = []
self.textures = input_icons.parse_path(path, force_mapping, force_type - 1)
else:
self.textures = input_icons.parse_path(path, force_mapping)
# If no textures are found, become invisible
self.visible = !self.textures.is_empty()
# Remove old children
for child in internal_children.duplicate():
_remove_internal_child(child)
internal_children.clear()
# Add new children
var i := 0
for texture in self.textures:
@@ -123,8 +123,7 @@ func _on_input_type_changed(input_type: InputIconManager.InputType):
(show_only == 2 and input_type == InputIconManager.InputType.GAMEPAD):
self.visible = true
self.path = path
var width := self.max_width
self.max_width = width
self.max_width = max_width
else:
self.visible = false

View File

@@ -9,6 +9,10 @@ var args := OS.get_cmdline_args()
var child_pid := -1
var logger := Log.get_logger("Entrypoint")
# We don't need this here, except we do. For some reason it won't load properly
# after the entrypoint anymore and I don't care why. Don't touch this.
var settings_manager := load("res://core/global/settings_manager.tres") as SettingsManager
var input_icons := load("res://core/systems/input/input_icon_manager.tres") as InputIconManager
# Called when the node enters the scene tree for the first time.
func _ready() -> void: