From 2773d2e8e1910258637e65072b781326838e5f63 Mon Sep 17 00:00:00 2001 From: SkyanUltra Date: Tue, 2 Dec 2025 08:26:08 -0500 Subject: [PATCH] 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 --- Assets/Sprites/UI/PanelHover.png | Bin 0 -> 140 bytes Assets/Sprites/UI/PanelHover.png.import | 40 ++++++++++ Resources/Theme.tres | 75 ++++++++++++++++++- Scenes/Levels/RomVerifier.tscn | 95 +++++++++++++++++++++--- Scripts/UI/RomVerifier.gd | 33 +++++++- 5 files changed, 229 insertions(+), 14 deletions(-) create mode 100644 Assets/Sprites/UI/PanelHover.png create mode 100644 Assets/Sprites/UI/PanelHover.png.import diff --git a/Assets/Sprites/UI/PanelHover.png b/Assets/Sprites/UI/PanelHover.png new file mode 100644 index 0000000000000000000000000000000000000000..0c0cad1ef4db043bf6f74e6c593872c870066fc2 GIT binary patch literal 140 zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4mJh`hT^KKFANL}jKx9jP7LeL$-HD>U~uzv zaSVxQeS2L|j6s2e<>JBTf7kc8>Xd10?mcpU2ct^!O$JMsjvWnFR>4cd-`}=pV&M=_ oaA;s)1T!Aw9^Tk!WqY3A+lj;RymsSs1_lNOPgg&ebxsLQ0DJf 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: