Skip to content

Commit

Permalink
Merge pull request #7 from tzlion/dev
Browse files Browse the repository at this point in the history
v0.2.1
  • Loading branch information
tzlion authored May 23, 2023
2 parents 76d5912 + af6bfb0 commit 8689265
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 11 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROGTOOL v0.2.0
FROGTOOL v0.2.1
===============

by taizou
Expand Down Expand Up @@ -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!

Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion build.bat
Original file line number Diff line number Diff line change
@@ -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
Expand Down
22 changes: 17 additions & 5 deletions frogtool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -223,18 +223,30 @@ 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)

image_height = image.size[1]
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))

Expand Down Expand Up @@ -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 ""
Expand Down
8 changes: 4 additions & 4 deletions versioninfo
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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])])
]
Expand Down

0 comments on commit 8689265

Please sign in to comment.