Full BIOS check functionality, temp file management

Added BIOS check (both basic and expert)
Blocking godot until bios files are checked (to check if ok)
Calling function wrapper
Added conditions to check for runtime dir env var
Changed fallback dir
This commit is contained in:
WallK 2024-03-25 12:22:36 +02:00
parent 258cdcc869
commit 671623dd4f
29 changed files with 225 additions and 67 deletions

View file

@ -50,8 +50,12 @@ incompatible_presets_reference_list="$emuconfigs/defaults/retrodeck/reference_li
pretty_system_names_reference_list="$emuconfigs/defaults/retrodeck/reference_lists/pretty_system_names.cfg" # An internal translation list for turning internal names (eg. gbc) to "pretty" names (Nintendo GameBoy Color) pretty_system_names_reference_list="$emuconfigs/defaults/retrodeck/reference_lists/pretty_system_names.cfg" # An internal translation list for turning internal names (eg. gbc) to "pretty" names (Nintendo GameBoy Color)
# Godot data transfer temp files # Godot data transfer temp files
# Check if XDG_RUNTIME_DIR is set
godot_bios_files_checked="/var/config/retrodeck/godot/godot_bios_files_checked.tmp" if [ -n "$XDG_RUNTIME_DIR" ]; then
godot_bios_files_checked="$XDG_RUNTIME_DIR/godot_temp/godot_bios_files_checked.tmp"
else
godot_bios_files_checked="/var/config/retrodeck/godot_temp/godot_bios_files_checked.tmp"
fi
# Config files for emulators with single config files # Config files for emulators with single config files

View file

@ -25,6 +25,13 @@ prepare_component() {
create_dir "$rdhome/$(basename $current_setting_value)" create_dir "$rdhome/$(basename $current_setting_value)"
fi fi
done < <(grep -v '^\s*$' $rd_conf | awk '/^\[paths\]/{f=1;next} /^\[/{f=0} f') done < <(grep -v '^\s*$' $rd_conf | awk '/^\[paths\]/{f=1;next} /^\[/{f=0} f')
if [ -n "$XDG_RUNTIME_DIR" ]; then
create_dir "$XDG_RUNTIME_DIR/godot_temp"
else
create_dir "/var/config/retrodeck/godot_temp"
fi
create_dir "/var/config/retrodeck/godot" create_dir "/var/config/retrodeck/godot"
dir_prep "$rd_logs_folder" "$logs_folder" dir_prep "$rd_logs_folder" "$logs_folder"
fi fi

View file

@ -0,0 +1,44 @@
extends Control
var file := FileAccess
var bios_tempfile : String
var BIOS_COLUMNS_BASIC := ["BIOS File Name", "System", "Found", "Hash Match", "Description"]
var BIOS_COLUMNS_EXPERT := ["BIOS File Name", "System", "Found", "Hash Match", "Description", "Subdirectory", "Hash"]
@onready var bios_type:int = get_tree().current_scene.bios_type
func _ready():
#Check if XDG_RUNTIME_DIR is set and choose temp file location
if OS.has_environment("XDG_RUNTIME_DIR"):
bios_tempfile = OS.get_environment("XDG_RUNTIME_DIR") + "/godot_temp/godot_bios_files_checked.tmp"
else:
bios_tempfile = "/var/config/retrodeck/godot_temp/godot_bios_files_checked.tmp"
var table := $Table
if bios_type == 0: #Basic BIOS button pressed
table.columns = BIOS_COLUMNS_BASIC.size()
for i in BIOS_COLUMNS_BASIC.size():
table.set_column_title(i, BIOS_COLUMNS_BASIC[i])
else: #Assume advanced BIOS button pressed
table.columns = BIOS_COLUMNS_EXPERT.size()
for i in BIOS_COLUMNS_EXPERT.size():
table.set_column_title(i, BIOS_COLUMNS_EXPERT[i])
var root = table.create_item()
table.hide_root = true
if bios_type == 0: #Basic BIOS button pressed
OS.execute("/app/tools/retrodeck_function_wrapper.sh",["check_bios_files", "basic"])
else: #Assume advanced BIOS button pressed
OS.execute("/app/tools/retrodeck_function_wrapper.sh",["check_bios_files"])
if file.file_exists(bios_tempfile): #File to be removed after script is done
var bios_list := file.open(bios_tempfile, FileAccess.READ)
var bios_line := []
while ! bios_list.eof_reached():
bios_line = bios_list.get_csv_line("^")
var table_line: TreeItem = table.create_item(root)
for i in bios_line.size():
table_line.set_text(i, bios_line[i])
if table_line.get_index() % 2 == 1:
table_line.set_custom_bg_color(i,Color(1, 1, 1, 0.1),false)

View file

@ -0,0 +1,38 @@
[gd_scene load_steps=2 format=3 uid="uid://bihon3xtx45y7"]
[ext_resource type="Script" path="res://components/bios_check/bios_check.gd" id="1_qrkee"]
[node name="PopupContent" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_qrkee")
[node name="RichTextLabel" type="RichTextLabel" parent="."]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
text = "This is a list of problematic BIOS?
Very multiline text
Why do we use it?
PS3 BIOS IS VERY BAD
I'm not sure what else?"
[node name="Table" type="Tree" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
columns = 5
column_titles_visible = true
select_mode = 1

View file

@ -2,18 +2,15 @@ extends Control
var content = null var content = null
# Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
if (content != null): if (content != null):
$Panel/VBoxContainer/ContentContainer.add_child(content) $Panel/MarginContainer/VBoxContainer/ContentContainer/MarginContainer.add_child(content)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func set_content(new_content): func set_content(new_content):
content = load(new_content).instantiate() content = load(new_content).instantiate()
func set_title(new_title):
$Panel/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer/Label.text = new_title
func _on_back_pressed(): func _on_back_pressed():
queue_free() queue_free()

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=2 format=3 uid="uid://ixg127wfv7wo"] [gd_scene load_steps=3 format=3 uid="uid://ixg127wfv7wo"]
[ext_resource type="Script" path="res://components/popup.gd" id="1_ck1vn"] [ext_resource type="Script" path="res://components/popup.gd" id="1_ck1vn"]
[ext_resource type="Theme" uid="uid://bq8dsxeo34sl" path="res://res/pixel_ui_theme/RetroDECKTheme.tres" id="1_oqd8s"]
[node name="Popup" type="Control"] [node name="Popup" type="Control"]
layout_mode = 3 layout_mode = 3
@ -9,6 +10,7 @@ anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
theme = ExtResource("1_oqd8s")
script = ExtResource("1_ck1vn") script = ExtResource("1_ck1vn")
[node name="Panel" type="Panel" parent="."] [node name="Panel" type="Panel" parent="."]
@ -19,7 +21,7 @@ anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="Panel"] [node name="MarginContainer" type="MarginContainer" parent="Panel"]
layout_mode = 1 layout_mode = 1
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
@ -27,13 +29,43 @@ anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
[node name="Button" type="Button" parent="Panel/VBoxContainer"] [node name="VBoxContainer" type="VBoxContainer" parent="Panel/MarginContainer"]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 0
[node name="MarginContainer" type="MarginContainer" parent="Panel/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_left = 10
theme_override_constants/margin_top = 0
theme_override_constants/margin_right = 0
theme_override_constants/margin_bottom = 0
[node name="HBoxContainer" type="HBoxContainer" parent="Panel/MarginContainer/VBoxContainer/MarginContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="Panel/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 23
text = "This is the label"
[node name="BackButton" type="Button" parent="Panel/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 10
text = "Back" text = "Back"
[node name="ContentContainer" type="Panel" parent="Panel/VBoxContainer"] [node name="ContentContainer" type="Panel" parent="Panel/MarginContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
size_flags_vertical = 3 size_flags_vertical = 3
[connection signal="pressed" from="Panel/VBoxContainer/Button" to="." method="_on_back_pressed"] [node name="MarginContainer" type="MarginContainer" parent="Panel/MarginContainer/VBoxContainer/ContentContainer"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 10
theme_override_constants/margin_top = 6
theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 6
[connection signal="pressed" from="Panel/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer/BackButton" to="." method="_on_back_pressed"]

View file

@ -0,0 +1,15 @@
[gd_scene format=3 uid="uid://c5uvguthjpfjq"]
[node name="PopupContentTest" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Button" type="Button" parent="."]
layout_mode = 1
offset_right = 12.0
offset_bottom = 8.0
text = "Test"

0
tools/configurator/icon.svg.import Executable file → Normal file
View file

View file

@ -1,5 +1,7 @@
extends Control extends Control
var bios_type:int
func _ready(): func _ready():
var children = findElements(self, "Control") var children = findElements(self, "Control")
for n: Control in children: #iterate the children for n: Control in children: #iterate the children
@ -8,8 +10,7 @@ func _ready():
if (n.is_class("BaseButton") and n.disabled == true): #if button-like control and disabled 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 n.self_modulate.a = 0.5 #make it half transparent
combine_tkeys() combine_tkeys()
func _input(event): func _input(event):
if event.is_action_pressed("quit"): if event.is_action_pressed("quit"):
_exit() _exit()
@ -24,11 +25,23 @@ func findElements(node: Node, className: String, result: Array = []) -> Array:
func _on_control_mouse_entered(control: Node): func _on_control_mouse_entered(control: Node):
control.grab_focus() control.grab_focus()
func load_popup(title:String, content_path:String):
var popup = load("res://components/popup.tscn").instantiate() as Control
popup.set_title(title)
popup.set_content(content_path)
$Background.add_child(popup)
func _on_quickresume_advanced_pressed(): func _on_quickresume_advanced_pressed():
var popup = load("res://components/popup.tscn").instantiate() as Control load_popup("Quick Resume Advanced", "res://components/popups_content/popup_content_test.tscn")
popup.set_content("res://popup_content_test.tscn")
$Background.add_child(popup) func _on_bios_button_pressed():
bios_type = 0
load_popup("BIOS File Check", "res://components/bios_check/bios_popup_content.tscn")
func _on_bios_button_expert_pressed():
bios_type = 1
load_popup("BIOS File Check", "res://components/bios_check/bios_popup_content.tscn")
func _on_exit_button_pressed(): func _on_exit_button_pressed():

View file

@ -91,6 +91,7 @@ anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
script = ExtResource("1_obpq7") script = ExtResource("1_obpq7")
metadata/bios_type = 0
[node name="Background" type="Panel" parent="."] [node name="Background" type="Panel" parent="."]
layout_mode = 1 layout_mode = 1
@ -117,9 +118,11 @@ grow_vertical = 2
[node name="TabContainer" type="TabContainer" parent="Background/MarginContainer"] [node name="TabContainer" type="TabContainer" parent="Background/MarginContainer"]
layout_mode = 2 layout_mode = 2
tab_alignment = 1 tab_alignment = 1
current_tab = 3
script = ExtResource("3_id6l4") script = ExtResource("3_id6l4")
[node name="TK_SYSTEM" type="MarginContainer" parent="Background/MarginContainer/TabContainer"] [node name="TK_SYSTEM" type="MarginContainer" parent="Background/MarginContainer/TabContainer"]
visible = false
layout_mode = 2 layout_mode = 2
theme_override_constants/margin_right = 240 theme_override_constants/margin_right = 240
@ -346,7 +349,6 @@ button_pressed = true
text = "TK_HOTKEYSOUND" text = "TK_HOTKEYSOUND"
[node name="TK_TOOLS" type="MarginContainer" parent="Background/MarginContainer/TabContainer"] [node name="TK_TOOLS" type="MarginContainer" parent="Background/MarginContainer/TabContainer"]
visible = false
layout_mode = 2 layout_mode = 2
theme_override_constants/margin_right = 240 theme_override_constants/margin_right = 240
@ -392,6 +394,10 @@ text = "TK_3DSDECRYPT"
layout_mode = 2 layout_mode = 2
text = "TK_BIOS" text = "TK_BIOS"
[node name="bios_button_expert" type="Button" parent="Background/MarginContainer/TabContainer/TK_TOOLS/ScrollContainer/VBoxContainer/scan_container"]
layout_mode = 2
text = "TK_BIOS_EXPERT"
[node name="tools_container" type="VBoxContainer" parent="Background/MarginContainer/TabContainer/TK_TOOLS/ScrollContainer/VBoxContainer"] [node name="tools_container" type="VBoxContainer" parent="Background/MarginContainer/TabContainer/TK_TOOLS/ScrollContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
@ -959,5 +965,7 @@ animation = &"speech"
frame_progress = 0.664627 frame_progress = 0.664627
[connection signal="pressed" from="Background/MarginContainer/TabContainer/TK_SYSTEM/ScrollContainer/VBoxContainer/game_control_container/GridContainer/quick_resume_adv_button" to="." method="_on_quickresume_advanced_pressed"] [connection signal="pressed" from="Background/MarginContainer/TabContainer/TK_SYSTEM/ScrollContainer/VBoxContainer/game_control_container/GridContainer/quick_resume_adv_button" to="." method="_on_quickresume_advanced_pressed"]
[connection signal="pressed" from="Background/MarginContainer/TabContainer/TK_TOOLS/ScrollContainer/VBoxContainer/scan_container/bios_button" to="." method="_on_bios_button_pressed"]
[connection signal="pressed" from="Background/MarginContainer/TabContainer/TK_TOOLS/ScrollContainer/VBoxContainer/scan_container/bios_button_expert" to="." method="_on_bios_button_expert_pressed"]
[connection signal="pressed" from="Background/exit_button" to="." method="_on_exit_button_pressed"] [connection signal="pressed" from="Background/exit_button" to="." method="_on_exit_button_pressed"]
[connection signal="item_selected" from="Background/locale_option" to="." method="_on_locale_selected"] [connection signal="item_selected" from="Background/locale_option" to="." method="_on_locale_selected"]

0
tools/configurator/res/Rekku/base.png.import Executable file → Normal file
View file

0
tools/configurator/res/Rekku/blink1.png.import Executable file → Normal file
View file

0
tools/configurator/res/Rekku/blink2.png.import Executable file → Normal file
View file

0
tools/configurator/res/Rekku/eyes-open.png.import Executable file → Normal file
View file

0
tools/configurator/res/Rekku/mouth-A.png.import Executable file → Normal file
View file

0
tools/configurator/res/Rekku/mouth-O.png.import Executable file → Normal file
View file

0
tools/configurator/res/Rekku/mouth-base.png.import Executable file → Normal file
View file

0
tools/configurator/res/configurator.mp3.import Executable file → Normal file
View file

View file

View file

File diff suppressed because one or more lines are too long

0
tools/configurator/res/pixel_ui_theme/m5x7.ttf.import Executable file → Normal file
View file