# PFES-TR-005 — CCI v1 Image Format

**Status:** Validated structure; scrub-selection policy partially validated  
**Historical source:** `HTML-001` / `cci.html`  
**Primary implementations:** Team-Resurgent Repackinator and XboxToolkit  
**Sample:** Forza Motorsport (GLO) CCI prefix, tail/index and sidecars

## Header

| Offset | Size | Field |
|---:|---:|---|
| `0x00` | 4 | ASCII `CCIM` |
| `0x04` | 4 | little-endian header size (`32`) |
| `0x08` | 8 | little-endian uncompressed byte size |
| `0x10` | 8 | little-endian index offset |
| `0x18` | 4 | sector/block size (`2048`) |
| `0x1C` | 1 | version (`1`) |
| `0x1D` | 1 | index alignment (`2`) |
| `0x1E` | 2 | reserved (`0`) |

## Index

For `N = uncompressed_size / block_size`, the index contains `N + 1`
little-endian uint32 entries.

```text
compressed = bool(entry & 0x80000000)
position   = (entry & 0x7fffffff) << index_alignment
recordSize = nextPosition - position
```

The terminal entry identifies the end of the final sector record and equals the
header's index offset.

## Sector Records

- compressed: one-byte trailing-padding count, raw LZ4 payload, then alignment padding;
- uncompressed: raw 2,048-byte sector;
- records are independently addressable and four-byte aligned in v1;
- CCI is not a single LZ4 frame.

## Scrubbing

Repackinator scrubbing replaces eligible padding with zeros. The uploaded sample
contains zero-filled decoded sectors, but exact eligibility rules require a
matched original and scrubbed ISO comparison.

## Repackinator Sidecars

Repackinator extracts identity and title artwork from the original XBE inside
the source ISO. It converts the XPR title image to JPEG as `default.tbn` and
generates a new ISO-attacher `default.xbe` containing derived certificate/title
information and artwork. These are output sidecars, not embedded CCI members.

## Sample Values

- uncompressed size: `3919708160`
- sectors: `1913920`
- index offset: `3846915076`
- index entries: `1913921`
- inferred CCI size: `3854570760`
- compressed sectors: `162555`

## Acceptance Boundary

Format structure is validated. Complete encoder/decoder acceptance still
requires a matched full CCI and scrubbed ISO with whole-image byte equality,
malformed-input tests and cross-version samples.
