extends Node const loader_cd_image := preload('res://scripts/loaders/cd/image.gd') var psx_productcode_regex := RegEx.new() const psx_ff5_productcodes = [ 'SLUS_008.79', # US Anthology, both 1.0 and 1.1 'SCES_138.40', # EU/Aus Anthology 'SLPM_860.81', # JP 'SCPS_452.14', # JP original, untested ] var ROM_filename := 'FF5_SCC_WepTweaks_Inus_Dash.sfc' # 'Final Fantasy V (Japan).sfc' var GBA_filename := '2564 - Final Fantasy V Advance (U)(Independent).gba' var rom_snes := File.new() var thread := Thread.new() func load_snes_rom(filename: String): var error := rom_snes.open(filename, File.READ) if error == OK: SpriteLoader.load_snes_rom(rom_snes) MapLoader.load_snes_rom(rom_snes) StringLoader.load_snes_rom(rom_snes, true) var _thread_error = thread.start(SoundLoader, 'parse_rom', rom_snes) func load_psx_folder(_dirname: String): pass func load_psx_image(filename: String): # While it would technically be possible to load everything with no temporary files, # It is more convenient to unpack the small files we care about to the user:// directory var rom_psx := File.new() var error := rom_psx.open(filename, File.READ) if error == OK: var cd := loader_cd_image.new(rom_psx) for key in cd.directory: var s = key.trim_prefix('./') var re_match := psx_productcode_regex.search(s) if re_match: print(re_match.get_string(0)) print(cd.directory) func _ready(): var _error := psx_productcode_regex.compile('(S[A-Z]{3}_\\d{3}\\.\\d{2});(\\d)') load_snes_rom(ROM_filename) func _exit_tree() -> void: thread.wait_to_finish()