Oriel — AI & technology worth noticing, every day.

Decoding REXPaint Files in Odin

Web page · https://tylerelton.com/posts/decoding-rexpaint-files-in-odin

First seen by Oriel on .

AI summary

This tutorial implements an Odin decoder for REXPaint v1.70 .xp files, covering gzip decompression, binary parsing, memory ownership, validation, error reporting, and terminal rendering.

  • REXPaint .xp files are gzip-compressed; decompressed data contains a version, layer count, per-layer dimensions, and 10-byte cells.
  • Each cell stores an i32 character index plus three-byte foreground and background RGB colors, with cells arranged in column-major order.
  • The decoder uses Reader helpers for little-endian integers and bytes, returning specific errors for truncation, invalid dimensions, and oversized layers.
  • Allocation checks reject impossible counts before memory allocation, while defer-based cleanup prevents leaks when parsing fails partway through.
  • The resulting File can be printed in Odin, although displaying characters outside printable ASCII requires a CP437-to-Unicode lookup table.

#odin #rexpaint #binary parsing #gzip

Generated by gpt-5.6-sol. Check the original for details.

Metric trends

Last 30 days · Up to 120 recorded samples per source and metric, with reposts kept separate · First and latest retained

Points

Score reported by the source.

  • Hacker News: 22, latest observation ; +18 over observed period since

Comments

Comment count reported by the source.

  • Hacker News: 1, latest observation ; 0 over observed period since

Aliases

SourceExternal IDURL
Hacker News50436363https://tylerelton.com/posts/decoding-rexpaint-files-in-odin/ Read discussion