Generic buttons please2

This commit is contained in:
monkeyx-net 2024-08-27 21:05:59 +01:00
parent c17c6bc1f7
commit f623d7906f
5 changed files with 13 additions and 7 deletions

View file

@ -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

View file

@ -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
}

View file

@ -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]

View file

@ -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)