You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
1.7 KiB
75 lines
1.7 KiB
from tkinter import *
|
|
from copy import deepcopy
|
|
from struct import unpack
|
|
|
|
def main():
|
|
master = Tk()
|
|
|
|
w = Canvas(master, width=144, height=80)
|
|
w.pack()
|
|
|
|
w.create_rectangle(0, 0, 144, 80, fill="black")
|
|
|
|
with open("OddParents.bin", "rb") as f:
|
|
f.seek(5480)
|
|
video = []
|
|
audio = []
|
|
r_first = True
|
|
|
|
for blocks in range(0, 1920):
|
|
# print(f.tell())
|
|
# input("hit enter...")
|
|
|
|
for byte in range(0, 9):
|
|
current_byte = f.read(1)
|
|
# print(current_byte)
|
|
|
|
video.append(getNibble(current_byte, True))
|
|
video.append(getNibble(current_byte, False))
|
|
|
|
audio.append(f.read(1))
|
|
|
|
for y in range(0, 80):
|
|
line1 = deepcopy(video[0:216])
|
|
line2 = deepcopy(video[216:432])
|
|
|
|
# print(video)
|
|
|
|
# print(line1)
|
|
# print(video[0:216])
|
|
# print(line2)
|
|
# print(video[216:432])
|
|
|
|
# input("hit enter...")
|
|
|
|
del video[0:432]
|
|
|
|
for x in range(0, 144):
|
|
if(r_first):
|
|
r = line1.pop(0)
|
|
g = line2.pop(0)
|
|
b = line2.pop(0)
|
|
else:
|
|
r = line2.pop(0)
|
|
g = line1.pop(0)
|
|
b = line1.pop(0)
|
|
|
|
|
|
r_first = not r_first
|
|
|
|
colorval = "#%01x%01x%01x" % (r, g, b)
|
|
print(x, y, ": ", colorval)
|
|
|
|
w.create_line(x, y, x+1, y, fill=colorval)
|
|
|
|
mainloop()
|
|
|
|
def getNibble(byte, nibble):
|
|
print(byte)
|
|
if(nibble):
|
|
return unpack("<B", byte)[0]>>0x04
|
|
else:
|
|
return unpack("<B", byte)[0] & 0x0F
|
|
|
|
if __name__ == "__main__":
|
|
main()
|
|
|