From f623d7906f9cd058cd072d437f745042fc706341 Mon Sep 17 00:00:00 2001 From: monkeyx-net Date: Tue, 27 Aug 2024 21:05:59 +0100 Subject: [PATCH] Generic buttons please2 --- tools/configurator/main.gd | 2 +- tools/configurator/main.tscn | 5 ++++- tools/configurator/scripts/data_handler.gd | 5 ++++- tools/configurator/scripts/emulator.gd | 1 + tools/configurator/scripts/system.gd | 7 +++---- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/tools/configurator/main.gd b/tools/configurator/main.gd index 04ed7286..ba1929b8 100644 --- a/tools/configurator/main.gd +++ b/tools/configurator/main.gd @@ -139,7 +139,7 @@ func _connect_signals() -> void: %decorations_button.pressed.connect(_hide_show_containers.bind(%decorations_button, %decorations_gridcontainer)) %systems_button.pressed.connect(_hide_show_containers.bind(%systems_button, %systems_gridcontainer)) %save_resume_button.pressed.connect(_hide_show_containers.bind(%decorations_button,%systems_gridcontainer)) - + func _load_log(index: int) -> void: var log_content:String match index: diff --git a/tools/configurator/main.tscn b/tools/configurator/main.tscn index f616f426..2eaf0cbf 100644 --- a/tools/configurator/main.tscn +++ b/tools/configurator/main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=90 format=3 uid="uid://61f6m4r1mpan"] +[gd_scene load_steps=91 format=3 uid="uid://61f6m4r1mpan"] [ext_resource type="Texture2D" uid="uid://bv6vh33cnfaw4" path="res://icon.svg" id="1_axfei"] [ext_resource type="Theme" uid="uid://hhc60cllcg47" path="res://assets/themes/default_theme.tres" id="1_if8nh"] @@ -157,6 +157,8 @@ animations = [{ "speed": 5.0 }] +[sub_resource type="GDScript" id="GDScript_j7wyh"] + [node name="Control" type="Control"] layout_mode = 3 anchors_preset = 15 @@ -1655,6 +1657,7 @@ offset_top = -69.0 offset_right = -337.0 grow_horizontal = 2 grow_vertical = 0 +script = SubResource("GDScript_j7wyh") [node name="controller_guide_text" type="RichTextLabel" parent="controller_guide"] layout_mode = 2 diff --git a/tools/configurator/scripts/data_handler.gd b/tools/configurator/scripts/data_handler.gd index 04b469c3..800fcf9d 100644 --- a/tools/configurator/scripts/data_handler.gd +++ b/tools/configurator/scripts/data_handler.gd @@ -34,6 +34,7 @@ func load_base_data() -> AppData: var emulator = Emulator.new() emulator.name = emulator_data["name"] emulator.description = emulator_data["description"] + emulator.url = emulator_data["url"] emulator.launch = emulator_data["launch"] if emulator_data.has("properties"): for property_data in emulator_data["properties"]: @@ -87,7 +88,7 @@ func load_base_data() -> AppData: get_tree().quit() return null -func save_base_data(app_dict: AppData): # was apP_data but gave warning +func save_base_data(app_dict: AppData): var file = FileAccess.open(data_file_path, FileAccess.READ) var existing_data = {} if file: @@ -132,6 +133,8 @@ func save_base_data(app_dict: AppData): # was apP_data but gave warning emulators[key] = { "name": emulator.name, "description": emulator.description, + "launch": emulator.launch, + "url": emulator.url, "properties": properties } diff --git a/tools/configurator/scripts/emulator.gd b/tools/configurator/scripts/emulator.gd index 756e72bf..52092c80 100644 --- a/tools/configurator/scripts/emulator.gd +++ b/tools/configurator/scripts/emulator.gd @@ -5,4 +5,5 @@ class_name Emulator @export var name: String @export var description: String @export var launch: String +@export var url: String @export var properties: Array[EmulatorProperty] diff --git a/tools/configurator/scripts/system.gd b/tools/configurator/scripts/system.gd index 544f80f5..d7b92025 100644 --- a/tools/configurator/scripts/system.gd +++ b/tools/configurator/scripts/system.gd @@ -18,7 +18,8 @@ func _connect_signals() -> void: %vita3k_button.pressed.connect(_hide_show_buttons.bind(%vita3k_button,%system_gridcontainer, %action_gridcontainer)) %rpcs3_button.pressed.connect(_hide_show_buttons.bind(%rpcs3_button,%system_gridcontainer, %action_gridcontainer)) %ryujinx_button.pressed.connect(_hide_show_buttons.bind(%ryujinx_button,%system_gridcontainer, %action_gridcontainer)) - %dolphin_button.pressed.connect(_hide_show_buttons.bind(%primehack_button,%system_gridcontainer, %action_gridcontainer)) + %dolphin_button.pressed.connect(_hide_show_buttons.bind(%dolphin_button,%system_gridcontainer, %action_gridcontainer)) + %primehack_button.pressed.connect(_hide_show_buttons.bind(%primehack_button,%system_gridcontainer, %action_gridcontainer)) %cemu_button.pressed.connect(_hide_show_buttons.bind(%cemu_button,%system_gridcontainer, %action_gridcontainer)) %xemu_button.pressed.connect(_hide_show_buttons.bind(%xemu_button,%system_gridcontainer, %action_gridcontainer)) %esde_button.pressed.connect(_hide_show_buttons.bind(%esde_button,%system_gridcontainer, %action_gridcontainer)) @@ -53,7 +54,7 @@ func _do_action(button: Button) -> void: ["help_button", current_system.name]: class_functions.log_parameters[2] = class_functions.log_text + "Launching " + current_system.name + " Help" class_functions.execute_command(class_functions.wrapper_command,class_functions.log_parameters, false) - class_functions.launch_help("https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/retroarch/retroarch-guide/") + class_functions.launch_help(current_system.url) ["launch_button", current_system.name]: class_functions.log_parameters[2] = class_functions.log_text + "Launching " + current_system.name class_functions.execute_command(class_functions.wrapper_command,class_functions.log_parameters, false) @@ -61,5 +62,3 @@ func _do_action(button: Button) -> void: #Log the result TODO class_functions.log_parameters[2] = class_functions.log_text + "Exit Code: " + str(launch["exit_code"]) class_functions.execute_command(class_functions.wrapper_command,class_functions.log_parameters, false) - -