Skip to content

HzMod Packet Format

ChainSwordCS edited this page Sep 6, 2023 · 1 revision

See also: ChirunoMod packet format

In a given packet, data is ordered like so:

┌───┬───┬───┬───┬───┬───
│ T | L │ L │ L │ D │...
└───┴───┴───┴───┴───┴───
T: Packet Type
L: Length (3 bytes, LE)
D: Data ($Length bytes)

Packet Types

0x01: Disconnect
0x02: Set Mode
0x03: TGA
0x04: JPEG
0x7E: Config ("CFGBLK")
0xFF: Debug

"Set Mode" Packet Format (0x02)

16 bytes in total.

  1. Top Screen Color Format [32-bit integer]
  2. Top Screen 'Stride' / "bytesize" [32-bit integer]
  3. Bottom Screen Color Format [32-bit integer]
  4. Bottom Screen 'Stride' / "bytesize" [32-bit integer]

Notes:

  • When using Color Format, make sure to perform an "& 7" operation to discard all but the lowest three bits.
  • 'Stride' / "bytesize" is the screen height (240) multiplied by the number of bytes-per-pixel of the current color format. (This should be redundant... But maybe not, after seeing weird resolution-based bugs with games like Mario Kart 7. -C)
  • To mimic HorizonScreen behavior: if a given screen's color format is zeroed-out, that's a signal to leave that screen's format info unchanged. (I don't know if this ever happens in practice. -C)

JPEG Packet Format (0x04)

  • Header [8 bytes]
    1. Horizontal pixel offset [32-bit integer]
    2. unused 4 bytes
  • JPEG image data

Notes:

  • If the offset is greater than or equal to 400 (hex $190) this is the bottom screen. In this case, subtract 400 from this number to find the relative offset.
Clone this wiki locally