Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f = open("Red.gb", "rb")
- f2 = open("Input Log", "w")
- f2.write("LogKey:#Up|Down|Left|Right|Start|Select|B|A|Power|\n")
- byte = f.read(1)
- while byte:
- byte = int.from_bytes(byte, byteorder="big")
- s = "|"
- if byte & 0x80:
- s += "U"
- else:
- s += "."
- if byte & 0x40:
- s += "D"
- else:
- s += "."
- if byte & 0x20:
- s += "L"
- else:
- s += "."
- if byte & 0x10:
- s += "R"
- else:
- s += "."
- if byte & 0x08:
- s += "S"
- else:
- s += "."
- if byte & 0x04:
- s += "s"
- else:
- s += "."
- if byte & 0x02:
- s += "B"
- else:
- s += "."
- if byte & 0x01:
- s += "A"
- else:
- s += "."
- s += ".|\n"
- f2.write(s) #repeat this multiple times to hold buttons for more than one frame
- byte = f.read(1)
- f2.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement