The resource archive¶
Almost the entire iPod interface ships as data. One archive of roughly 4.1 MiB holds the strings, bitmaps, colours, fonts, view geometry, screen definitions and event wiring. Chikuma reads it with one parser, the way the firmware reads it, and the UI stays faithful because its screens build themselves from these records.
Lossless round trip¶
Chikuma's tooling decodes the archive and re-encodes it byte for byte. Of the 7,845 records in the main archive, all but two round-trip exactly. Those two belong to record types with no traced consumer, and they are carried verbatim.
Every codec is verified per record, so a single wrong field fails the check.
The container format¶
The archive is a container, format version 3, parsed in chikuma/ui/archive/. Top to bottom:
header { version, payload offset, section count }
sections a table of { fourcc, record count, flag, directory offset }
directories per section, a table of { id, payload offset, length }
payloads the record bodies
The archive and every language blob share this format and one id space, so one reader serves them all. A record is addressed by a numeric resource id.
A separate name table maps human names such as Extras_Screen or MainMenu_List_Music to those ids.
Navigation is written in names, which is why the table is needed.
The record types¶
The sections divide the interface into kinds. The important ones:
| Section | Holds |
|---|---|
SCST |
the controller class a screen uses, by name, for example TSilverCntlr |
ITEM |
menu row tables, one list of rows per id |
SORC |
the sources a row's dynamic content binds to, as triples of value, id and kind. One kind is a static value, the others are publish/subscribe bindings. A row's label lives here. |
CEVT SEVT AEVT TEVT |
event bindings, all in one format: an event name mapped to an action name and, optionally, a navigator verb with its arguments. All re-encode byte-exact. |
COLR |
colours |
FONT FSTR |
font ids and names |
IMAG BMap |
image references and the bitmaps. Each bitmap decodes to PNG with a JSON sidecar and re-encodes byte-exact, across palette, BGRA, RGB565 and alpha-mask formats. |
Str |
the UTF-8 strings |
View SLyt VSlt and kin |
view geometry and screen layout, as fixed-size records per view class. Each decodes to an object with a frame rectangle, a resource id, a visibility flag and a per-class tail. |
A screen builds itself¶
Entering a menu does not construct a new screen tree. A shared list view gets re-pointed at another
row table, and the rows come from the archive. The target screen's slot record names which view and
which ITEM id. Dozens of screens share one list view this way.
Behaviour is data too¶
When a row is highlighted or pressed, the chain runs:
row event -> CEVT entry (keyed by the row's own list instance)
-> an action name and/or a navigator verb with arguments
-> the controller picks an event by the device's state
-> SEVT entry (keyed by the current layout)
-> navigator verb (switch layout / push screen) with a target NAME
-> the name table turns that name into a resource id
In the archive's own vocabulary, with names shown and numbers left out, a few bindings read:
<the Music row>, chosen -> HandleMusicSelected
<the Extras row>, chosen -> navigator.PushScreen Extras_Screen Extras_Screen_WorldClock
<the Extras row>, delayed-select -> navigator.SwitchLayout MainMenus_Main_Screen_Extras
The preview pane that follows the highlight is one such binding. On delayed-select, the screen
switches to another of its own layouts, and no component code is involved.
How the blobs are cut¶
archive_blob.bin and names_blob.bin are cut from the firmware image at fixed offsets. The
straight cut is the oracle. The re-packing tools are diffed against it, and re-packing all the
containers reproduces them byte-identical.
Localization¶
Localization is an override run keyed by resource id, exactly as the firmware does it. There is no English blob, because English is the archive itself.
Each of the twenty other languages is a small container of two sections, laid out after the archive: the strings, and a date/time format table. A language overrides a string by carrying the same id and fourcc with different text.
The ids a language leaves alone fall back to English by design. Font family names are among them, and so is the entire Legal screen. Lookup asks the selected language first, then the archive, with no search chain.
Editing the text¶
Because the whole archive round-trips, its strings can be exported, edited and applied again. Chikuma's tooling writes them out as an Xcode String Catalog keyed by resource name. The archive still re-packs byte-identical afterwards, so changing the interface's text is a data operation.
The date/time table¶
The LDTm table, one per language, gets read where it is used, and the packer leaves it alone. Its
slots hold the month and weekday names, AM and PM, the separators, and the strftime-style patterns
the firmware's date formatter runs. The Date & Time picker and Calendars draw from it. The re-packing
tools carry it as raw bytes, which is lossless.
Chikuma's own records¶
A builder that authors brand-new screens from zero exists only in part. What exists is an append-only overlay with an id ledger.
The overlay carries Chikuma's additions as records the ordinary readers walk:
- the Display, Appearance and Night Shift screens
- their labels in all twenty languages
- two sections of its own,
CDRKandBDRK, holding the dark skin's colour and picture twins
The ledger keeps new ids clear of the name table's ids.
Unread records¶
One record type has no traced consumer. It is an alias table shaped like the event bindings, naming remote buttons, and it is carried raw.
Roughly a sixth of the view-body bytes are read by nothing traced so far. None of them are unexplained, though, so a new screen needs only the named fields its classes actually read.