Various ROM verification screen improvements (#682)

* Added file prompt button for selecting rom and additional error checks

Updated the rom verification screen with clarified errors and a slight bug fix to the error text.

Along with this, there is now a button on the rom verification screen to select a file directly, defaulting to an array of NES rom extensions, and a proper theme set for buttons, which shouldn't interfere with other themes.

* Updated label and repositioned elements

Label now properly mentions either selecting the rom file using the button or dragging it onto the window. Button also clarified a little more clearly

* final touches

* bro

* i hate labels
This commit is contained in:
SkyanUltra 2025-12-02 08:26:08 -05:00 committed by GitHub
parent 85aef0d92f
commit 2773d2e8e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 229 additions and 14 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

View file

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b4vej1pkyqomg"
path="res://.godot/imported/PanelHover.png-41824b38e004dba7008ad1f1352f9881.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Sprites/UI/PanelHover.png"
dest_files=["res://.godot/imported/PanelHover.png-41824b38e004dba7008ad1f1352f9881.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -1,14 +1,47 @@
[gd_resource type="Theme" load_steps=39 format=3 uid="uid://dtn507x2b5de7"]
[gd_resource type="Theme" load_steps=57 format=3 uid="uid://dtn507x2b5de7"]
[ext_resource type="FontVariation" uid="uid://bl7sbw4nx3l1t" path="res://Resources/ThemedResources/FontMain.tres" id="1_kpcpn"]
[ext_resource type="Texture2D" uid="uid://7qtdxl2cjxeh" path="res://Assets/Sprites/UI/Checkbox.png" id="1_rioqa"]
[ext_resource type="Texture2D" uid="uid://dp4b0cpisp5cs" path="res://Assets/Sprites/UI/Arrow.png" id="1_vmxg5"]
[ext_resource type="Texture2D" uid="uid://b4vej1pkyqomg" path="res://Assets/Sprites/UI/PanelHover.png" id="2_2ratw"]
[ext_resource type="Texture2D" uid="uid://bnv2ocqgws3p7" path="res://Assets/Sprites/UI/Panel.png" id="2_rij67"]
[ext_resource type="Texture2D" uid="uid://da1j4turmb4rt" path="res://Assets/Sprites/UI/EditorOptionButtonIcon.png" id="3_dbcfw"]
[ext_resource type="Texture2D" uid="uid://bhgjvnslkt143" path="res://Assets/Sprites/UI/PanelSelected.png" id="3_eltnc"]
[ext_resource type="Texture2D" uid="uid://bcvq28r3d3pij" path="res://Assets/Sprites/UI/ScrollBar.png" id="5_xbsuy"]
[ext_resource type="Texture2D" uid="uid://dktb2ljmou31p" path="res://Resources/UI/Cursor.tres" id="6_f6qpy"]
[ext_resource type="Texture2D" uid="uid://m14upykpri8v" path="res://Assets/Sprites/UI/SpinBoxArrows.png" id="7_f6qpy"]
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_w50ow"]
texture = ExtResource("2_rij67")
texture_margin_left = 4.0
texture_margin_top = 4.0
texture_margin_right = 4.0
texture_margin_bottom = 4.0
modulate_color = Color(0.5, 0.5, 0.5, 1)
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_2ratw"]
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_pbjdw"]
texture = ExtResource("2_2ratw")
texture_margin_left = 4.0
texture_margin_top = 4.0
texture_margin_right = 4.0
texture_margin_bottom = 4.0
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_u3www"]
texture = ExtResource("2_rij67")
texture_margin_left = 4.0
texture_margin_top = 4.0
texture_margin_right = 4.0
texture_margin_bottom = 4.0
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_7t41e"]
texture = ExtResource("3_eltnc")
texture_margin_left = 4.0
texture_margin_top = 4.0
texture_margin_right = 4.0
texture_margin_bottom = 4.0
[sub_resource type="AtlasTexture" id="AtlasTexture_f6qpy"]
atlas = ExtResource("1_rioqa")
region = Rect2(16, 0, 16, 16)
@ -17,8 +50,30 @@ region = Rect2(16, 0, 16, 16)
atlas = ExtResource("1_rioqa")
region = Rect2(0, 0, 16, 16)
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_eltnc"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_f6qpy"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_w50ow"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_pbjdw"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_1cpra"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ont7o"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_bomg6"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_sonp3"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_lk3ve"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ddui1"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_wiser"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_wud1c"]
[sub_resource type="AtlasTexture" id="AtlasTexture_brolu"]
atlas = ExtResource("1_vmxg5")
region = Rect2(0, 0, 8, 8)
@ -145,11 +200,29 @@ region_rect = Rect2(12, 0, 11, 12)
[resource]
default_font = ExtResource("1_kpcpn")
Button/colors/font_color = Color(1, 1, 1, 1)
Button/colors/font_pressed_color = Color(0, 1, 0, 1)
Button/styles/disabled = SubResource("StyleBoxTexture_w50ow")
Button/styles/focus = SubResource("StyleBoxEmpty_2ratw")
Button/styles/hover = SubResource("StyleBoxTexture_pbjdw")
Button/styles/normal = SubResource("StyleBoxTexture_u3www")
Button/styles/pressed = SubResource("StyleBoxTexture_7t41e")
CheckBox/icons/checked = SubResource("AtlasTexture_f6qpy")
CheckBox/icons/radio_checked = SubResource("AtlasTexture_f6qpy")
CheckBox/icons/radio_unchecked = SubResource("AtlasTexture_wytm8")
CheckBox/icons/unchecked = SubResource("AtlasTexture_wytm8")
CheckBox/styles/disabled = SubResource("StyleBoxEmpty_eltnc")
CheckBox/styles/focus = SubResource("StyleBoxEmpty_f6qpy")
CheckBox/styles/hover = SubResource("StyleBoxEmpty_w50ow")
CheckBox/styles/hover_pressed = SubResource("StyleBoxEmpty_pbjdw")
CheckBox/styles/normal = SubResource("StyleBoxEmpty_1cpra")
CheckBox/styles/pressed = SubResource("StyleBoxEmpty_ont7o")
CheckButton/styles/disabled = SubResource("StyleBoxEmpty_bomg6")
CheckButton/styles/focus = SubResource("StyleBoxEmpty_sonp3")
CheckButton/styles/hover = SubResource("StyleBoxEmpty_lk3ve")
CheckButton/styles/hover_pressed = SubResource("StyleBoxEmpty_ddui1")
CheckButton/styles/normal = SubResource("StyleBoxEmpty_wiser")
CheckButton/styles/pressed = SubResource("StyleBoxEmpty_wud1c")
FoldableContainer/colors/font_color = Color(1, 1, 1, 1)
FoldableContainer/icons/expanded_arrow = SubResource("AtlasTexture_brolu")
FoldableContainer/icons/folded_arrow = SubResource("AtlasTexture_ifwja")

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=27 format=3 uid="uid://d0mmkuq7wtpcl"]
[gd_scene load_steps=29 format=3 uid="uid://d0mmkuq7wtpcl"]
[ext_resource type="Theme" uid="uid://dtn507x2b5de7" path="res://Resources/Theme.tres" id="1_qwra1"]
[ext_resource type="Script" uid="uid://dhxt5av5njyiv" path="res://Scripts/UI/RomVerifier.gd" id="1_r85ci"]
@ -59,6 +59,12 @@ script = ExtResource("8_c20ch")
Overworld = SubResource("Resource_22hnx")
metadata/_custom_type_script = "uid://cmvlgsjmsk0v5"
[sub_resource type="InputEventAction" id="InputEventAction_2ok7u"]
action = &"ui_accept"
[sub_resource type="Shortcut" id="Shortcut_5175m"]
events = [SubResource("InputEventAction_2ok7u")]
[sub_resource type="AtlasTexture" id="AtlasTexture_sxtnd"]
atlas = ExtResource("2_r85ci")
region = Rect2(0, 0, 16, 16)
@ -157,6 +163,23 @@ theme_override_constants/margin_bottom = 16
unique_name_in_owner = true
layout_mode = 2
[node name="SelectRom" type="Button" parent="BG/Border/MarginContainer/DefaultText"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = -1
anchor_left = 0.157
anchor_top = 0.52900004
anchor_right = 0.84300005
anchor_bottom = 0.64400005
offset_left = -0.08600044
offset_top = -0.03201294
offset_right = 0.08598328
offset_bottom = 0.04801941
shortcut = SubResource("Shortcut_5175m")
shortcut_in_tooltip = false
text = "BROWSE FILES..."
autowrap_mode = 2
[node name="Label" type="Label" parent="BG/Border/MarginContainer/DefaultText"]
layout_mode = 1
anchors_preset = -1
@ -164,22 +187,36 @@ anchor_right = 1.0
offset_bottom = 16.0
grow_horizontal = 2
size_flags_vertical = 0
text = "ROM VERIFICATION REQUIRED!"
text = "VERIFICATION REQUIRED!"
horizontal_alignment = 1
autowrap_mode = 2
[node name="ColorRect" type="ColorRect" parent="BG/Border/MarginContainer/DefaultText/Label"]
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
offset_left = 9.200001
offset_top = 13.0
offset_right = -10.800003
offset_bottom = 14.0
grow_horizontal = 2
[node name="Label2" type="Label" parent="BG/Border/MarginContainer/DefaultText"]
layout_mode = 1
anchors_preset = 15
anchors_preset = -1
anchor_top = 0.082
anchor_right = 1.0
anchor_bottom = 1.0
anchor_bottom = 0.505
offset_left = -4.799999
offset_top = -0.055999756
offset_right = -4.800003
offset_bottom = -0.040000916
grow_horizontal = 2
grow_vertical = 2
text = "Please Drag and drop your vanilla WORLD \"super mario bros\" rom onto the window."
text = "PLEASE PROVIDE A VANILLA ROM FILE FOR \"SUPER MARIO BROS.\" BY SELECTING THE ROM IN YOUR FILES OR DRAGGING THE ROM FILE OVER THE GAME WINDOW."
horizontal_alignment = 1
vertical_alignment = 1
autowrap_mode = 2
uppercase = true
[node name="Error" type="Label" parent="BG/Border/MarginContainer/DefaultText"]
unique_name_in_owner = true
@ -194,9 +231,9 @@ offset_top = -40.0
grow_horizontal = 2
grow_vertical = 0
size_flags_vertical = 8
text = "ERROR VERIFYING ROM!
text = "INVALID ROM HEADER!
ARE YOU SURE ITS A VALID VANILLA NES SMB1 ROM?"
ARE YOU SURE THIS IS A VANILLA ROM OF SMB1?"
horizontal_alignment = 1
autowrap_mode = 2
@ -213,7 +250,28 @@ offset_top = -40.0
grow_horizontal = 2
grow_vertical = 0
size_flags_vertical = 8
text = "PLEASE EXTRACT THE ROM FILE, OUT OF THE ZIP FIRST"
text = "ERROR EXTRACTING ROM!
ENSURE YOUR ROM ISN'T STORED IN A COMPRESSED FILE FORMAT!"
horizontal_alignment = 1
autowrap_mode = 2
[node name="ExtensionError" type="Label" parent="BG/Border/MarginContainer/DefaultText"]
unique_name_in_owner = true
visible = false
modulate = Color(0.99999994, 0.17417294, 0.12721592, 1)
layout_mode = 1
anchors_preset = -1
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -40.0
grow_horizontal = 2
grow_vertical = 0
size_flags_vertical = 8
text = "ERROR VERIFYING ROM!
ARE YOU SURE THIS IS A ROM IMAGE FILE?"
horizontal_alignment = 1
autowrap_mode = 2
@ -245,3 +303,22 @@ stream = ExtResource("11_4o1wk")
[node name="ErrorSFX" type="AudioStreamPlayer" parent="."]
stream = ExtResource("12_2ok7u")
[node name="FileDialog" type="FileDialog" parent="."]
oversampling_override = 1.0
title = "SELECT A VALID ROM"
size = Vector2i(352, 240)
popup_window = true
ok_button_text = "OPEN"
dialog_hide_on_ok = true
cancel_button_text = "CANCEL"
file_mode = 0
access = 2
filters = PackedStringArray("*.nes", "*.nez", "*.fds", "*.qd", "*.unf", "*.unif", "*.nsf", "*.nsfe")
use_native_dialog = true
folder_creation_enabled = false
favorites_enabled = false
recent_list_enabled = false
[connection signal="file_selected" from="FileDialog" to="." method="handle_rom"]
[connection signal="files_selected" from="FileDialog" to="." method="on_file_dropped"]

View file

@ -8,6 +8,7 @@ const VALID_HASHES := [
var args: PackedStringArray
var rom_arg: String = ""
@onready var file_dialog = $FileDialog
func _ready() -> void:
args = OS.get_cmdline_args()
@ -28,8 +29,11 @@ func _ready() -> void:
if local_rom != "" and handle_rom(local_rom):
return
# Otherwise wait for dropped files
# Otherwise wait for dropped/selected files
# SkyanUltra: Added button to select files for convenience
get_window().files_dropped.connect(on_file_dropped)
file_dialog.canceled.connect(file_prompt_closed)
%SelectRom.pressed.connect(file_prompt_open)
await get_tree().physics_frame
# Window setup
@ -48,15 +52,26 @@ func find_local_rom() -> String:
func on_file_dropped(files: PackedStringArray) -> void:
for file in files:
if file.ends_with(".zip"):
zip_error()
return
if handle_rom(file):
return
error()
func file_prompt_open() -> void:
$FileDialog.show()
%SelectRom.disabled = true
func file_prompt_closed() -> void:
%SelectRom.disabled = false
func handle_rom(path: String) -> bool:
file_prompt_closed()
if path.get_extension() in ["zip", "7z", "rar", "tar", "gz", "gzip", "bz2"]:
zip_error()
return false
if not is_valid_rom(path):
if path.get_extension() in ["nes", "nez", "fds", "qd", "unf", "unif", "nsf", "nsfe"]:
error()
else: extension_error()
return false
Global.rom_path = path
copy_rom(path)
@ -80,10 +95,20 @@ static func is_valid_rom(rom_path := "") -> bool:
func error() -> void:
%Error.show()
%ZipError.hide()
%ExtensionError.hide()
$ErrorSFX.play()
func zip_error() -> void:
%ZipError.show()
%Error.hide()
%ExtensionError.hide()
$ErrorSFX.play()
func extension_error() -> void:
%ExtensionError.show()
%Error.hide()
%ZipError.hide()
$ErrorSFX.play()
func verified() -> void: