diff --git a/movie.py b/movie.py index 758c302..a9aee81 100644 --- a/movie.py +++ b/movie.py @@ -57,12 +57,7 @@ class Movie: # Keep track of where we are in TCP client socket buffer socket_pos = self.stream_pos % 2048 if socket_pos >= 2044: - # Pad out to last byte in frame - nops = (2047 - socket_pos) // 2 - # print("At position %04x, padding with %d nops" % ( - # socket_pos, nops)) - for _ in range(nops): - yield from self._emit_bytes(opcodes.Nop()) + # 2 dummy bytes + 2 address bytes for next opcode yield from self._emit_bytes(opcodes.Ack()) yield from self._emit_bytes(op) diff --git a/opcodes.py b/opcodes.py index 090d36b..ea5767b 100644 --- a/opcodes.py +++ b/opcodes.py @@ -115,6 +115,11 @@ class Ack(Opcode): COMMAND = OpcodeCommand.ACK _CYCLES = 100 # TODO: count + def emit_data(self) -> Iterator[int]: + # Dummy bytes to pad out TCP frame + yield 0xff + yield 0xff + def __data_eq__(self, other): return True