RetroDECK/tools/configurator/scripts/GlobalsTab.gd

49 lines
1.6 KiB
GDScript3
Raw Normal View History

2024-09-11 18:23:05 +00:00
extends MarginContainer
var app_data := AppData.new()
var button_swap: Array
func _ready():
app_data = data_handler.app_data
_connect_signals()
#for emulator in app_data.emulators:
#var emulator_data: Emulator = app_data.emulators[emulator]
#if emulator_data.properties:
#if emulator_data.properties:
##print (emulator_data.name)
#for property: EmulatorProperty in emulator_data.properties:
##print (property.abxy_button)
#button_swap.append(emulator_data.name)
##print (button_swap)
func _connect_signals():
%quick_resume_button.pressed.connect(run_function.bind(%quick_resume_button))
func run_function(button: Button) -> void:
2024-09-12 15:29:10 +00:00
if button.button_pressed:
enable_global(button)
else:
disable_global(button)
func enable_global(button: Button) -> void:
var result: Array
match button.name:
"quick_resume_button":
result = data_handler.change_cfg_value(class_functions.config_file_path, "retroarch", "quick_resume", "true")
change_global(result)
func disable_global(button: Button) -> void:
var result: Array
match button.name:
"quick_resume_button":
result = data_handler.change_cfg_value(class_functions.config_file_path, "retroarch", "quick_resume", "false")
change_global(result)
func change_global(parameters: Array) -> void:
2024-09-12 15:48:16 +00:00
parameters.push_front("build_preset_config")
class_functions.logger("d", "Running: %s" % var_to_str(parameters))
var result: Dictionary
result = await class_functions.run_thread_command(class_functions.wrapper_command, parameters, false)
class_functions.logger("d", "Exit code: %s" % result["exit_code"])