dreamcast/1bpp.py
Zack Buhman 481a0cb0dc move maple definitions to a new maple/ directory
maple.cpp now uses the new maple_bus_commands.h
2023-12-09 16:38:57 +08:00

32 lines
573 B
Python

import sys
width = 640
height = 480
with open(sys.argv[1], 'rb') as f:
b = f.read()
assert len(b) == width * height, len(b)
buf = []
for i in range(len(b) // 8):
ix = i * 8
px = b[ix:ix + 8]
assert all(p in {0, 1} for p in px)
out = (
(px[0] << 7)
| (px[1] << 6)
| (px[2] << 5)
| (px[3] << 4)
| (px[4] << 3)
| (px[5] << 2)
| (px[6] << 1)
| (px[7] << 0)
)
buf.append(out)
assert len(buf) == width * height // 8
with open(sys.argv[2], 'wb') as f:
f.write(bytes(buf))