From e8f03c4d6a94aa16b3587bdce525cf0cf7c6c6c3 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Tue, 14 Jan 2025 14:38:52 +0100 Subject: next commit --- extractor/grf.gd | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'extractor/grf.gd') diff --git a/extractor/grf.gd b/extractor/grf.gd index a723fdc..84918de 100644 --- a/extractor/grf.gd +++ b/extractor/grf.gd @@ -190,17 +190,29 @@ static func open(path: String): return grf +signal extracted_file(index: int) + func extract(destination: String = "user://client_data"): DirAccess.make_dir_recursive_absolute(destination) - for file_entry in file_entries: + for idx in file_entries.size(): + var file_entry := file_entries[idx] var file_path: String = file_entry.get_file_path() var base_directory = DirAccess.open(destination) base_directory.make_dir_recursive(file_path.get_base_dir()) var file = FileAccess.open("%s/%s" % [destination, file_path], FileAccess.WRITE_READ) + + #if file_path.ends_with(".bmp"): + #var img := Image.create_empty(1, 1, false, Image.FORMAT_RGBA8) + #img.load_bmp_from_buffer(file_entry.get_contents(file_access)) + #img.save_png(file.get_path()) + #return + #else: file.store_buffer(file_entry.get_contents(file_access)) + + extracted_file.emit(idx) func convert(destination: String = "res://client_data"): @@ -220,6 +232,18 @@ func convert(destination: String = "res://client_data"): #DirAccess.make_dir_recursive_absolute(base_file_directory_path) + # BMP + if file_path.ends_with(".bmp"): + if not FileAccess.file_exists("%s/%s" % [destination, file_path]): + continue + + var image := BMPTexture.convert_image( + Image.load_from_file("%s/%s" % [destination, file_path]), + [Color.MAGENTA] + ) + image.save_png("%s/%s" % [destination, file_path.replace(".bmp", ".png")]) + + continue # Sprite.spr and Action.act var player_head_path_part = "¸Ó¸®Åë" -- cgit v1.2.3