Skip to Content
Octapus

.ofrm format

Byte layout of the first-screen snapshot (v4) and of the laid-out frame a device draws (v3).

.ofrm files come in two versions that share the magic number "OFRM":

VersionWritten byContains
4, the snapshotoct build --bakeThe first commit and baked styles, no geometry. Platform-neutral; this is what you ship
3, the laid-out frameThe deviceThe snapshot laid out for one platform and viewport, ready to draw in one pass. Built at launch and kept in the on-device layout cache

All integers and f32 values are little-endian. A runtime refuses versions, style schemas and bytecode hashes it does not expect, and launches without the snapshot instead.

For what these files are for, see First-screen snapshot.

v4: the snapshot

SectionContents
header80 B
batchThe first commit, UTF-8 JSON as Octane's renderer emitted it ({renderer, version, commands})
scopedJSON {moduleId: [[id, css], …]}: scoped <style> sheets registered before the first commit
light stylesBinary: page styles (html, body, root), the canvas color, then every computed style. Each style stores only the fields that differ from the initial style
dark stylesSame, for dark mode. A device decodes only the scheme it shows
hosts16 B per element, in tree order

Header (80 B)

OffTypeField
0u32magic "OFRM"
4u16version (4)
6u16flags: 1 = the page depends on the viewport (restyle everything on device)
8u32element count
12u32elements restyled on device
16u64FNV-1a 64 of the app.hbc it was baked from
24 / 28f32reference viewport width / height (--viewport)
32 / 36u32batch: offset, length
40 / 44u32scoped: offset, length
48 / 52u32light styles: offset, length
56 / 60u32dark styles: offset, length
64u32hosts offset
68u16style schema version (role indices and style table layout; currently 2)
70u16style codec version (the binary computed-style encoding)
72–79reserved

Host row (16 B)

OffTypeField
0i32element id in the first commit
4u32light style index
8u32dark style index
12u8render role: 0 box, 1 text, 2 button, 3 styled button, 4 input, 5 svg, 6 inline part, 7 none
13u8flags: 1 = restyle on device; 2 = its role depends on the viewport too, restyle its subtree
14–15reserved

Baked styles leave out what only the cascade needs (roles are baked), and keep custom properties only where a restyled child inherits them.

v3: the laid-out frame

A v3 frame is what the device draws. Rows are in pre-order (parent < self), and each row points straight at its paint style, its text runs and its rectangle, so drawing is one forward pass with constant work per row:

for i in 0..<nodeCount:
  n = node(i)
  if n.flags & notDrawn: continue
  v = makeView(n.kind)                    // element / button / input
  v.paint = paint(styles[n.style], runs[n.runFirst ..< n.runFirst + n.runCount], insets(i))
  v.frame = rect(i)                       // relative to parent view
  v.hidden = n.flags & hidden
  views[n.parent == 0xFFFFFFFF ? root : n.parent].addSubview(v)
  views[i] = v

Sections

All integers and f32 values are little-endian. Sections follow each other in the order below with no gaps; the only padding is 4-byte alignment before the layout blocks.

SectionSizeNotes
header64 B
nodesnodeCount × 56 BPre-order, includes #text rows
stylesstyleCount × 96 BDeduplicated paint styles
eventseventCount × 12 BRows that had listeners at bake time, and their event types
runsrun count × 12 BInline runs of text blocks
stringsbyte sizeUTF-8 pool
(padding)0–3 B4-byte alignment
layoutslayoutCount × (16 B + nodeCount × 32 B)Per-platform layout blocks

The run count is not in the header. It is computed as (stringsOffset − runsOffset) / 12.

Header (64 B)

OffTypeField
0u32magic "OFRM" (0x4D52464F)
4u16version (3)
6u16reserved (0)
8u32nodeCount
12u32styleCount
16u32eventCount
20u32strings byte size
24u32layoutCount (always 1 with the current encoder)
28u32runs offset
32u32nodes offset
36u32styles offset
40u32events offset
44u32strings offset
48u64hbcHash: FNV-1a 64 of the HBC this snapshot was baked from
56u32number of drawn rows (rows that get a view)
60u32offset of the first layout block

The reader checks the header length, magic, version (exactly 3), the strings section bounds, that nodes end before styles, and the bounds of each layout block.

Node row (56 B)

OffTypeField
0u8kind (table below)
1u8flags (table below)
2u16reserved
4u32parent row (0xFFFFFFFF = root)
8u32Octane core host id at bake time (coreID)
12u32style row (0 for rows that are not drawn)
16 / 20u32text: offset, length
24 / 28u32aux: offset, length
32u32first event row
36u16event count
38u16reserved
40 / 44u32host type string (div, button, #text …): offset, length
48u32first run row
52u16run count
54u16reserved

coreID is not used for matching (matching is structural). It is for diagnostics, and for mapping early events that happened on the snapshot to runtime ids.

text / aux contents

Rowtextaux
buttonButton label
inputvalueplaceholder
svgSVG subtree JSON {"t": tag, "a": {attrs}, "c": [children]}
#text type rowText content (used for structural matching)
OthersEmpty

An empty string is (0, 0). The actual content of a text block lives in its runs, not in text.

Kind

ValueNameView
0elementBox: background / border / children
1textBox + text runs
2buttonNative button (label in text)
3inputNative text field (text = value, aux = placeholder)
4rawText#text inside a text block (not drawn)
5svgInline SVG (subtree JSON in aux)
6styledButtonButton styled with CSS: box + label runs
7inlinePartInline element inside a text block (not drawn)

Flags

BitNameCondition
1hiddenNot rendered (display: none, empty text)
2notDrawnHas no view (inlinePart or a row that is not rendered)
4clipsoverflow-x or overflow-y is not visible
8clickableHas a click listener

Paint style row (96 B)

Everything the painter and text layout read from the computed style. Node styles and run styles share the same table, and rows with identical bytes are merged into one.

OffTypeField
0u32background color RGBA8 (valid only when flags has 1)
4u32text color RGBA8
8 / 12 / 16 / 20u32border color top / right / bottom / left
24 / 28 / 32 / 36f32border width top / right / bottom / left
40 / 44 / 48 / 52f32corner radius top-left / top-right / bottom-right / bottom-left (px; 0 if not px)
56f32opacity
60f32font size
64f32letter spacing
68f32line height (px, when line-height kind is 1)
72 / 76u32font family string: offset, length (family list joined with U+001F)
80u16font weight
82u8line-height kind: 0 normal, 1 px (multipliers are baked to px as multiplier × font size)
83u8text-align: 0 start, 1 left, 2 center, 3 right, 4 end, 5 justify
84u8white-space: 0 normal, 1 nowrap, 2 pre, 3 pre-wrap, 4 pre-line, 5 break-spaces
85u8flags: 1 has background, 2 italic, 4 underline, 8 visibility hidden
86–95reserved

Colors are written as the value r << 24 | g << 16 | b << 8 | a in u32 little-endian (byte order in memory is a, b, g, r).

Event row (12 B)

OffTypeField
0u32node row
4 / 8u32event type string (click, input …): offset, length

Event types are sorted per node and written contiguously (the node's eventFirst, eventCount). This tells which controls are interactive even before JS exists; those events are buffered and replayed after adoption.

Run row (12 B)

OffTypeField
0 / 4u32run text: offset, length
8u32style row

Only drawn text and styledButton rows have runs. A run is an inline text fragment with CSS whitespace collapsing and text-transform applied; block-level properties come from the node's own style.

Strings

A UTF-8 byte pool. Each distinct string is stored once. References are always (offset, length), with the offset relative to the start of the strings section.

Layout blocks

Text measurement and control sizes differ by platform, so layout is kept in separate blocks. Blocks are placed contiguously starting at the first block offset (header 60).

Block header (16 B)

OffTypeField
0u16platform: 1 macOS, 2 iOS, 3 Android, 4 Web, 5 Windows
2u16reserved
4f32viewport width
8f32viewport height
12f32scale

Rect (32 B × nodeCount)

OffTypeField
0 / 4 / 8 / 12f32x, y, w, h: frame relative to the parent view (top-level nodes relative to the document origin; buttons use the alignment rect)
16 / 20 / 24 / 28f32content insets top, left, bottom, right (padding + border)

Rows that are not drawn have a zero rect.

Block selection: the runner picks the block for its platform whose viewport width is closest (height is ignored). The format allows multiple blocks (platform × viewport class), but the current encoder writes only one.

On this page