Hacker News

Decoding REXPaint Files in Odin

22 points by tylerelton ago | 2 comments

skrellm |next [-]

Nice, but the description and the code disagrees on the file format. I believe this struct

File :: struct { version: i32, layers: []Layer, }

Should be

File :: struct { version: i32, count: i32, layers: []Layer, }

Also it's a bit dumb to store a CP437 character on i32 because that codepage has only 256 entries (meaning 3 zero bytes overhead for every cell).

All in all I would rather store such character art in ANSI escape sequences (that's actually a sort of run-length-encoding), much smaller files, easier to decode.

FYI, besides REXPaint, there were other binary ANSI art formats too, like BIN and XBIN (https://deepwiki.com/andre-simon/ansifilter/7.4-bin-and-xbin...), but those could not break the hegemony of ANSI escape sequences either.

MiroslavPokorny |previous [-]

Sounds like something kool to read. Thanks for sharing!