diff --git a/README.md b/README.md index 6247c71..afd4844 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -FROGTOOL v0.2.0 +FROGTOOL v0.2.1 =============== by taizou @@ -46,6 +46,11 @@ Compatible versions This tool has been tested & confirmed to work on the following SF2000 firmware/SD card image versions: * Launch version (with English & Chinese languages only) * 2023-04-20 update (with 17 languages) +* 2023-05-12 update (adds keymapping, favourites, history) - This works but can mess up the favourites and history + sections as they're based on position in the list rather than filename. For the time being, if you have problems, + delete Resources/Favorites.bin and Resources/History.bin from the SD card. This won't stop the features from working + but will remove any existing favourites or history you have. + Use on any later versions is at your own risk! @@ -246,8 +251,12 @@ Credits Developed by taizou +Contributors: Evan Clements + RGB565 conversion code based on PNG-to-RGB565 (c) 2019 jpfwong https://github.com/jimmywong2003/PNG-to-RGB565 Frog icon from public domain photo by LiquidGhoul https://commons.wikimedia.org/wiki/File:Australia_green_tree_frog_(Litoria_caerulea)_crop.jpg + +Special thanks to the firmware devs diff --git a/build.bat b/build.bat index 47099d7..2d79452 100644 --- a/build.bat +++ b/build.bat @@ -1,5 +1,5 @@ @echo off -set ver=0.2.0 +set ver=0.2.1 rem build script for the distributable versions of frogtool if not exist "venv\" ( py -m venv venv diff --git a/frogtool.py b/frogtool.py index 1050d0e..c52545d 100644 --- a/frogtool.py +++ b/frogtool.py @@ -213,7 +213,7 @@ def rgb565_convert(src_filename, dest_filename, dest_size=None): print("! Pillow module not found, can't do image conversion") return False try: - image = Image.open(src_filename) + srcimage = Image.open(src_filename) except (OSError, IOError): print(f"! Failed opening image file {src_filename} for conversion") return False @@ -223,6 +223,10 @@ def rgb565_convert(src_filename, dest_filename, dest_size=None): print(f"! Failed opening destination file {dest_filename} for conversion") return False + # convert the image to RGB if it was not already + image = Image.new('RGB', srcimage.size, (0, 0, 0)) + image.paste(srcimage, None) + if dest_size and image.size != dest_size: image = image.resize(dest_size) @@ -230,11 +234,19 @@ def rgb565_convert(src_filename, dest_filename, dest_size=None): image_width = image.size[0] pixels = image.load() + if not pixels: + print(f"! Failed to load image from {src_filename}") + return False + for h in range(image_height): for w in range(image_width): - r = pixels[w, h][0] >> 3 - g = pixels[w, h][1] >> 2 - b = pixels[w, h][2] >> 3 + pixel = pixels[w, h] + if not type(pixel) is tuple: + print(f"! Unexpected pixel type at {w}x{h} from {src_filename}") + return False + r = pixel[0] >> 3 + g = pixel[1] >> 2 + b = pixel[2] >> 3 rgb = (r << 11) | (g << 5) | b dest_file.write(struct.pack('H', rgb)) @@ -309,7 +321,7 @@ def check_sys_valid(system): def run(): - print("frogtool v0.2.0") + print("frogtool v0.2.1") flags = ["-sc", "-tm"] drive = sys.argv[1] if len(sys.argv) >= 2 and sys.argv[1] not in flags else "" diff --git a/versioninfo b/versioninfo index 5a949c4..fb5c8fb 100644 --- a/versioninfo +++ b/versioninfo @@ -1,7 +1,7 @@ VSVersionInfo( ffi=FixedFileInfo( - filevers=(0, 2, 0, 0), - prodvers=(0, 2, 0, 0), + filevers=(0, 2, 1, 0), + prodvers=(0, 2, 1, 0), mask=0x3f, flags=0x0, OS=0x4, @@ -15,12 +15,12 @@ VSVersionInfo( u'080904B0', [StringStruct(u'CompanyName', u'taizou'), StringStruct(u'FileDescription', u'frogtool'), - StringStruct(u'FileVersion', u'0.2.0'), + StringStruct(u'FileVersion', u'0.2.1'), StringStruct(u'InternalName', u'frogtool'), StringStruct(u'LegalCopyright', u'by taizou 2023'), StringStruct(u'OriginalFilename', u'frogtool.exe'), StringStruct(u'ProductName', u'frogtool'), - StringStruct(u'ProductVersion', u'0.2.0')]) + StringStruct(u'ProductVersion', u'0.2.1')]) ]), VarFileInfo([VarStruct(u'Translation', [2057, 1200])]) ]