mirror of
https://github.com/pmret/papermario.git
synced 2024-11-09 12:32:38 +01:00
ae66312d8c
* Add Python linter to github actions * wip * Add back splat_ext * Format files * C++ -> C * format 2 files * split workflow into separate file, line length 120, fix excludes * -l 120 in ci * update black locally and apply formatting changes * pyproject.toject --------- Co-authored-by: Ethan Roseman <ethteck@gmail.com>
18 lines
411 B
Python
Executable File
18 lines
411 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
from sys import argv
|
|
import struct
|
|
|
|
if __name__ == "__main__":
|
|
infile, outfile, cname = argv[1:]
|
|
|
|
with open(outfile, "w") as f:
|
|
f.write(f"unsigned short {cname}[] = {{ ")
|
|
|
|
with open(infile, "rb") as i:
|
|
while short := i.read(2):
|
|
color = struct.unpack(">H", short)[0]
|
|
f.write(f"0x{color:04X}, ")
|
|
|
|
f.write("};\n")
|