@@ -13,7 +13,7 @@ var game_data : RetroHubGameData: set = set_game_data
13
13
func _ready ():
14
14
# warning-ignore:return_value_discarded
15
15
RetroHubConfig .game_data_updated .connect (_on_game_data_updated )
16
-
16
+
17
17
n_emulator_options .get_popup ().max_size .y = RetroHubUI .max_popupmenu_height
18
18
19
19
func _on_game_data_updated (_game_data : RetroHubGameData ):
@@ -22,12 +22,14 @@ func _on_game_data_updated(_game_data: RetroHubGameData):
22
22
23
23
func set_game_data (_game_data : RetroHubGameData ) -> void :
24
24
game_data = _game_data
25
+ discard_changes ()
26
+ if not game_data : return
27
+
25
28
update_emulator_options ()
26
29
for idx in n_emulator_options .item_count :
27
30
if n_emulator_options .get_item_metadata (idx ) == game_data .emulator :
28
31
n_emulator_options .selected = idx
29
32
break
30
- discard_changes ()
31
33
32
34
func update_emulator_options () -> void :
33
35
n_emulator_options .clear ()
@@ -49,8 +51,12 @@ func update_emulator_options() -> void:
49
51
func discard_changes ():
50
52
if game_data :
51
53
n_override_emulator .button_pressed = ! game_data .emulator .is_empty ()
54
+ n_override_emulator .disabled = false
52
55
else :
53
56
n_override_emulator .button_pressed = false
57
+ n_override_emulator .disabled = true
58
+ n_emulator_options .disabled = true
59
+ n_emulator_options .clear ()
54
60
55
61
56
62
func save_changes ():
@@ -61,6 +67,8 @@ func save_changes():
61
67
game_data .emulator = ""
62
68
63
69
func grab_focus ():
70
+ if not game_data : return
71
+
64
72
if RetroHubConfig .config .accessibility_screen_reader_enabled :
65
73
n_intro_lbl .grab_focus ()
66
74
else :
0 commit comments