-
Notifications
You must be signed in to change notification settings - Fork 6
Bug for import image #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Next issue - importing CZ1 is broken. If i see correctly, some informations are written as big endian instead of little endian, in indexes RGB (transparency is fine) is written too in wrong order. |
Fixed the issue with CZ3 layers. If there is more than one layer, uncompressed size of first layer is 1 byte too high, and of last layer 1 byte too low. After fixing this all images are rendered correctly in Summer Pockets. import sys
file = open(sys.argv[1], "rb+")
if (file.read(4) != b"CZ3\x00"):
print("Wrong FILE!")
sys.exit()
header_size = int.from_bytes(file.read(4), byteorder="little")
file.seek(header_size-8, 1)
layer_count = int.from_bytes(file.read(4), byteorder="little")
if (layer_count == 1):
print("File doesn't need correction!")
sys.exit()
next_pointer = file.tell() + (8 * (layer_count-1))
file.seek(4, 1)
unc_size1 = int.from_bytes(file.read(4), byteorder="little", signed=False)
file.seek(-4, 1)
unc_size1 -= 1
file.write(unc_size1.to_bytes(4, "little", signed=False))
file.seek(next_pointer)
file.seek(4, 1)
unc_size2 = int.from_bytes(file.read(4), byteorder="little", signed=False)
file.seek(-4, 1)
unc_size2 += 1
file.write(unc_size2.to_bytes(4, "little", signed=False))
file.close() |
When converting to CZ3, tool is using compressed size from source as some kind of limitation of how big 1 compressed image can be, which is not always correct. For Summer Pockets max size per each layer is 0xFEFD, and for some reason images converted by this tool with more than 1 layer are rendered as garbage by game except for first layer.
The text was updated successfully, but these errors were encountered: