2023-09-23 16:24:55 +00:00
|
|
|
extends Control
|
|
|
|
|
2024-07-28 15:09:37 +00:00
|
|
|
var class_functions: ClassFunctions
|
|
|
|
|
2024-03-25 10:22:36 +00:00
|
|
|
var bios_type:int
|
2024-07-28 15:09:37 +00:00
|
|
|
var status_code_label: Label
|
|
|
|
var wrapper_command: String = "../../tools/retrodeck_function_wrapper.sh"
|
|
|
|
var log_text = "GD_Configurator: "
|
|
|
|
var log_parameters: Array = ["log", "i", log_text]
|
|
|
|
var log_results: Dictionary
|
2024-07-28 18:44:07 +00:00
|
|
|
var theme_option: OptionButton
|
|
|
|
signal signal_theme_changed
|
|
|
|
var custom_theme: Theme = $".".theme
|
2024-07-28 21:39:20 +00:00
|
|
|
var emu_select_option: OptionButton
|
|
|
|
var emu_pick_option: OptionButton
|
2024-07-28 22:19:57 +00:00
|
|
|
var tab_container: TabContainer
|
2024-03-25 10:22:36 +00:00
|
|
|
|
2023-09-23 16:24:55 +00:00
|
|
|
func _ready():
|
2024-07-28 15:09:37 +00:00
|
|
|
class_functions = ClassFunctions.new()
|
|
|
|
_get_nodes()
|
2024-07-28 18:44:07 +00:00
|
|
|
_connect_signals()
|
2024-07-28 22:19:57 +00:00
|
|
|
# set current startup tab to match IDE
|
|
|
|
print (tab_container.current_tab)
|
|
|
|
tab_container.current_tab = tab_container.current_tab
|
2024-07-28 15:09:37 +00:00
|
|
|
add_child(class_functions) # Needed for threaded results
|
2023-12-31 07:58:20 +00:00
|
|
|
var children = findElements(self, "Control")
|
2024-02-19 07:15:59 +00:00
|
|
|
for n: Control in children: #iterate the children
|
2024-01-11 07:34:38 +00:00
|
|
|
if (n.focus_mode == FOCUS_ALL):
|
2024-02-19 07:15:59 +00:00
|
|
|
n.mouse_entered.connect(_on_control_mouse_entered.bind(n)) #grab focus on mouse hover
|
|
|
|
if (n.is_class("BaseButton") and n.disabled == true): #if button-like control and disabled
|
|
|
|
n.self_modulate.a = 0.5 #make it half transparent
|
2024-02-13 12:45:30 +00:00
|
|
|
combine_tkeys()
|
2024-03-25 10:22:36 +00:00
|
|
|
|
2024-07-28 15:09:37 +00:00
|
|
|
func _get_nodes() -> void:
|
|
|
|
status_code_label = get_node("%status_code_label")
|
2024-07-28 18:44:07 +00:00
|
|
|
theme_option = get_node("%theme_optionbutton")
|
2024-07-28 21:39:20 +00:00
|
|
|
emu_select_option = get_node("%emu_select_option")
|
|
|
|
emu_pick_option = get_node("%emu_pick_option")
|
2024-07-28 22:19:57 +00:00
|
|
|
tab_container = get_node("%TabContainer")
|
2024-07-28 18:44:07 +00:00
|
|
|
|
|
|
|
func _connect_signals() -> void:
|
|
|
|
#signal_theme_changed.connect(_conf_theme)
|
|
|
|
theme_option.item_selected.connect(_conf_theme)
|
|
|
|
signal_theme_changed.emit(theme_option.item_selected)
|
2024-07-28 21:39:20 +00:00
|
|
|
emu_select_option.item_selected.connect(_emu_select)
|
2024-07-28 18:44:07 +00:00
|
|
|
|
2024-07-28 21:39:20 +00:00
|
|
|
func _emu_select(index: int) -> void:
|
|
|
|
emu_pick_option.visible = true
|
|
|
|
|
2024-07-28 18:44:07 +00:00
|
|
|
func _conf_theme(index: int) -> void:
|
|
|
|
match index:
|
|
|
|
1:
|
|
|
|
custom_theme = preload("res://assets/themes/default_theme.tres")
|
|
|
|
2:
|
|
|
|
custom_theme = preload("res://assets/themes/retro_theme.tres")
|
|
|
|
3:
|
|
|
|
custom_theme = preload("res://assets/themes/modern_theme.tres")
|
|
|
|
4:
|
|
|
|
custom_theme = preload("res://assets/themes/accesible_theme.tres")
|
|
|
|
$".".theme = custom_theme
|
2024-07-28 15:09:37 +00:00
|
|
|
|
2023-12-21 10:29:46 +00:00
|
|
|
func _input(event):
|
|
|
|
if event.is_action_pressed("quit"):
|
2024-01-12 07:37:05 +00:00
|
|
|
_exit()
|
2023-12-31 07:58:20 +00:00
|
|
|
|
|
|
|
func findElements(node: Node, className: String, result: Array = []) -> Array:
|
|
|
|
if node.is_class(className):
|
|
|
|
result.push_back(node)
|
|
|
|
for child in node.get_children():
|
|
|
|
result = findElements(child, className, result)
|
|
|
|
return result
|
|
|
|
|
|
|
|
func _on_control_mouse_entered(control: Node):
|
|
|
|
control.grab_focus()
|
2024-01-11 18:19:16 +00:00
|
|
|
|
2024-03-25 10:22:36 +00:00
|
|
|
func load_popup(title:String, content_path:String):
|
2024-01-11 18:19:16 +00:00
|
|
|
var popup = load("res://components/popup.tscn").instantiate() as Control
|
2024-03-25 10:22:36 +00:00
|
|
|
popup.set_title(title)
|
|
|
|
popup.set_content(content_path)
|
2024-01-11 18:19:16 +00:00
|
|
|
$Background.add_child(popup)
|
2024-01-12 07:37:05 +00:00
|
|
|
|
2024-03-25 10:22:36 +00:00
|
|
|
func _on_quickresume_advanced_pressed():
|
|
|
|
load_popup("Quick Resume Advanced", "res://components/popups_content/popup_content_test.tscn")
|
|
|
|
|
|
|
|
func _on_bios_button_pressed():
|
|
|
|
bios_type = 0
|
2024-07-28 16:06:58 +00:00
|
|
|
log_parameters[2] = log_text + "Bios_Check"
|
2024-07-28 15:09:37 +00:00
|
|
|
log_results = class_functions.execute_command(wrapper_command, log_parameters, false)
|
2024-03-25 10:22:36 +00:00
|
|
|
load_popup("BIOS File Check", "res://components/bios_check/bios_popup_content.tscn")
|
2024-07-28 15:09:37 +00:00
|
|
|
status_code_label.text = str(log_results["exit_code"])
|
2024-03-25 10:22:36 +00:00
|
|
|
|
|
|
|
func _on_bios_button_expert_pressed():
|
|
|
|
bios_type = 1
|
2024-07-28 16:06:58 +00:00
|
|
|
log_parameters[2] = log_text + "Advanced_Bios_Check"
|
2024-07-28 15:09:37 +00:00
|
|
|
log_results = class_functions.execute_command(wrapper_command, log_parameters, false)
|
2024-03-25 10:22:36 +00:00
|
|
|
load_popup("BIOS File Check", "res://components/bios_check/bios_popup_content.tscn")
|
2024-07-28 15:09:37 +00:00
|
|
|
status_code_label.text = str(log_results["exit_code"])
|
2024-01-12 07:37:05 +00:00
|
|
|
|
|
|
|
func _on_exit_button_pressed():
|
2024-07-28 15:39:26 +00:00
|
|
|
log_parameters[2] = log_text + "Exited"
|
2024-07-28 15:09:37 +00:00
|
|
|
log_results = class_functions.execute_command(wrapper_command, log_parameters, false)
|
2024-01-12 07:37:05 +00:00
|
|
|
_exit()
|
|
|
|
|
|
|
|
func _exit():
|
|
|
|
get_tree().root.propagate_notification(NOTIFICATION_WM_CLOSE_REQUEST)
|
|
|
|
get_tree().quit()
|
2024-01-24 17:00:26 +00:00
|
|
|
|
|
|
|
func _on_locale_selected(index):
|
|
|
|
match index:
|
|
|
|
0:
|
|
|
|
TranslationServer.set_locale("en")
|
|
|
|
1:
|
|
|
|
TranslationServer.set_locale("it")
|
2024-02-11 08:12:01 +00:00
|
|
|
2:
|
|
|
|
TranslationServer.set_locale("de")
|
2024-02-13 12:45:30 +00:00
|
|
|
3:
|
2024-02-16 07:17:39 +00:00
|
|
|
TranslationServer.set_locale("sv")
|
2024-02-18 08:32:34 +00:00
|
|
|
4:
|
|
|
|
TranslationServer.set_locale("ua")
|
|
|
|
5:
|
|
|
|
TranslationServer.set_locale("ja")
|
|
|
|
6:
|
|
|
|
TranslationServer.set_locale("zh")
|
2024-02-13 12:45:30 +00:00
|
|
|
combine_tkeys()
|
2024-01-24 17:00:26 +00:00
|
|
|
|
2024-02-13 12:45:30 +00:00
|
|
|
func combine_tkeys(): #More as a test
|
|
|
|
$Background/MarginContainer/TabContainer/TK_SYSTEM/ScrollContainer/VBoxContainer/game_control_container/GridContainer/cheats.text = tr("TK_CHEATS") + " " + tr("TK_SOON")
|
|
|
|
$Background/MarginContainer/TabContainer/TK_GRAPHICS/ScrollContainer/VBoxContainer/decorations_container/GridContainer/shaders.text = tr("TK_SHADERS") + " " + tr("TK_SOON")
|
|
|
|
$Background/MarginContainer/TabContainer/TK_GRAPHICS/ScrollContainer/VBoxContainer/extra_container/GridContainer/tate_mode.text = tr("TK_TATE") + " " + tr("TK_SOON")
|
|
|
|
$Background/MarginContainer/TabContainer/TK_CONTROLS/ScrollContainer/VBoxContainer/controls_container/hotkey_sound.text = tr("TK_HOTKEYSOUND") + " " + tr("TK_SOON")
|
|
|
|
$Background/MarginContainer/TabContainer/TK_NETWORK/ScrollContainer/VBoxContainer/cheevos_container/cheevos_advanced_container/cheevos_hardcore.text = tr("TK_CHEEVOSHARDCORE") + " " + tr("TK_SOON")
|
|
|
|
$Background/MarginContainer/TabContainer/TK_NETWORK/ScrollContainer/VBoxContainer/data_mng_container/saves_sync.text = tr("TK_SAVESSYNC") + " " + tr("TK_SOON")
|
|
|
|
$Background/MarginContainer/TabContainer/TK_CONFIGURATOR/ScrollContainer/VBoxContainer/system_container/easter_eggs.text = tr("TK_EASTEREGGS") + " " + tr("TK_SOON")
|