Improve packer formatting
This commit is contained in:
parent
7cefa4f969
commit
874d9b3819
1 changed files with 6 additions and 2 deletions
|
@ -9,9 +9,13 @@ res = ""
|
||||||
for resource in os.listdir(resources):
|
for resource in os.listdir(resources):
|
||||||
encoded = f"const unsigned char {os.path.splitext(resource)[0].decode().upper()}[] = {'{'}"
|
encoded = f"const unsigned char {os.path.splitext(resource)[0].decode().upper()}[] = {'{'}"
|
||||||
file = open(RES_DIR + resource.decode(), "rb") # read binary
|
file = open(RES_DIR + resource.decode(), "rb") # read binary
|
||||||
|
bytes_processed = 0
|
||||||
for byte in file.read():
|
for byte in file.read():
|
||||||
|
if bytes_processed % 16 == 0:
|
||||||
|
encoded += "\n\t"
|
||||||
encoded += f"0x{byte.to_bytes(1, byteorder='little').hex()}, "
|
encoded += f"0x{byte.to_bytes(1, byteorder='little').hex()}, "
|
||||||
encoded = encoded[:-2] + " };"
|
bytes_processed += 1
|
||||||
|
encoded = encoded[:-2] + "\n};"
|
||||||
res += encoded + "\n"
|
res += encoded + "\n"
|
||||||
|
|
||||||
res_file = open(RES_FILE, "w")
|
res_file = open(RES_FILE, "w")
|
||||||
|
|
Loading…
Add table
Reference in a new issue