Files
kdm-re/docs/spec/05-data-formats.md
ulw-execute 3910630c25 docs: mark release-difference facts verified; fix doc inconsistencies
Owner confirmed the differing sizes/export counts/RVAs are just a different
release of the same official game. Remove the "pending re-check against
clean-release binary" / "contaminated install" caveats throughout and state
those numbers (module sizes, export counts, gameMain RVA 0x9e20) as verified
facts. Drop the stale 3,369,104-byte gamekdm figure in favor of the
consistent 3.19 MB. Genuine format/behavior UNVERIFIED markers (undecoded
.arc/.ifs/.ttc/etc. formats, Kinect dispatch/sync) are preserved.
2026-11-28 21:01:37 -05:00

307 lines
15 KiB
Markdown

# 05 — Data Formats
Game-directory layout, configuration formats, the AVS2 filesystem/property-tree
model, and the asset container formats of the clean KDM-2016021900
`contents/` release (`GAME-DIR`). All paths below are relative to `contents/` unless marked
otherwise. No
copyrighted asset content (audio/video/lyrics/art) is reproduced; only file
structure, headers, and extension inventories are described.
See also: [00-overview.md](./00-overview.md), [01-runtime-boot.md](./01-runtime-boot.md),
[07-companion-apis.md](./07-companion-apis.md).
The release layout follows the [official scope contract](../../.omo/scope/official-scope.md).
## 1. Top-level game-dir layout
```
contents/
├── data/ game assets (sound, 2D/animation, fonts, textures, movies, dal manifests)
├── arkdata/ ARK engine assets (fonts, test-mode screens, e-amusement license art, sound presets)
├── prop/ AVS2 property-tree config XML (device defaults, shipped with the install)
└── modules/ nine shipped Konami modules
```
The clean-release listing records:
- `data/arc/`, `data/arc/2d/`, `data/bm2d/`, `data/dal/`, `data/dal/2d/`,
`data/data/`, `data/font/`, `data/sound/`, `data/bgmov/` — asset trees.
- `arkdata/ark/{font,testmode,xml}` and
`arkdata/arkkdm/{ea3license,qc,sound,testmode}` — ARK/KDM-specific assets,
e.g. `arkdata/arkkdm/ea3license/license1.dds`,
`arkdata/arkkdm/qc/zero.bin`, `arkdata/arkkdm/sound/{seteq.def,setvolume.def}`.
- `prop/` contains `ark-config.xml`, `ark-config_nopp.xml`, `avs-config.xml`,
`card_allow.bin`, `coin.xml`, `eacoin.xml`, `eamuse-config.xml`,
`ess-config.xml`, `share-config.xml`, and `testmode-v.xml`.
- `modules/` contains exactly the nine Konami modules listed in
[docs/companion-inventory.md](../companion-inventory.md).
## 2. `prop/` configuration XML — structure
All `prop/*.xml` files use a flat, typed-attribute XML dialect: every leaf
element carries no namespace and, where the value is not implicitly a UTF-8
string, an `__type` attribute (`str`, `u8`, `u16`, `u32`, `s32`, `bool`)
giving its decoded scalar type. This is the textual (`format=binary`-adjacent
but XML-serialized) form of the AVS2 **property tree** (§3) — the same typed
node model gamekdm and the AVS2 runtime manipulate in memory and that ships
binary-encoded inside the e-amusement network protocol
([07-companion-apis.md:62](./07-companion-apis.md)).
### 2.1 `eamuse-config.xml` — e-amusement client config
The clean release supplies `prop/eamuse-config.xml`.
### 2.2 `avs-config.xml` — AVS2 runtime config
Structure of `prop/avs-config.xml`, root `<config>`:
```xml
<config>
<fs>
<root><device __type="str">.</device></root> <!-- avs-config.xml:5 -->
<nvram>
<fstype __type="str">fs</fstype> <!-- avs-config.xml:8 -->
<device __type="str">dev\nvram</device> <!-- avs-config.xml:9 -->
<option __type="str">sz_block=768,nr_block=128,nr_mirror=4</option> <!-- avs-config.xml:11 -->
</nvram>
<raw><device __type="str">dev\raw</device></raw> <!-- avs-config.xml:14 -->
<nr_mountpoint __type="u16">256</nr_mountpoint>
<nr_filedesc __type="u16">256</nr_filedesc>
</fs>
<time><gmt_offset __type="s32">32400</gmt_offset></time>
<log>
<level>all</level>
<sz_buf __type="u32">8192</sz_buf>
<enable_console __type="bool">1</enable_console>
<enable_file __type="bool">1</enable_file>
<rotate __type="bool">1</rotate>
<gen __type="u16">10</gen> <!-- avs-config.xml:33: keep 10 rotated log generations -->
</log>
<net>
<nr_protocol __type="u16">8</nr_protocol>
<nr_socket __type="u16">16</nr_socket>
<lz77sock><enable __type="bool">1</enable></lz77sock> <!-- avs-config.xml:39-41: compressed-socket transport -->
<multisock><enable __type="bool">1</enable></multisock>
</net>
<thread>
<nr_thread __type="u16">100</nr_thread>
<nr_semaphore __type="u16">50</nr_semaphore>
<nr_mutex __type="u16">512</nr_mutex>
<nr_event __type="u16">64</nr_event>
</thread>
<sntp><ea_on __type="bool">0</ea_on></sntp>
</config>
```
`<fs>` declares the AVS2 virtual filesystem's mount table: a `root` device
mapped to `.` (GAME-DIR itself), an `nvram` device backed by `dev\nvram`
mounted with filesystem type `fs` and block options
(`sz_block=768,nr_block=128,nr_mirror=4` — 768-byte blocks, 128 blocks, 4
mirrored copies, matching the small XML snapshot files actually present
under `dev/nvram/`), and a `raw` device backed by `dev\raw` (matching the
`bookkeeping/`, `fscache/`, `log/`, `ranking/`, `settings/` subdirectories
observed there). `nr_mountpoint`/`nr_filedesc` size the AVS2 VFS table and
open-file-descriptor table respectively.
### 2.3 Other `prop/*.xml` files (by name, structure not fully enumerated here)
- `ark-config.xml`, `ark-config_nopp.xml`, `coin.xml`, `eacoin.xml`,
`eamuse-config.xml`, `ess-config.xml`, `share-config.xml`, and
`testmode-v.xml` are the remaining shipped configuration files.
`prop/card_allow.bin` is the only non-XML file in `prop/`; its contents are
UNVERIFIED.
## 3. AVS2 filesystem + property-tree model
Evidence base: `prop/avs-config.xml` (§2.2), `re/avs/property_node.h`,
`re/avs/recon_avs_harness.cpp`, `re/avs/prove_t14.py`, and the exported
module inventory in [docs/companion-inventory.md](../companion-inventory.md)
(`libavs-win32.dll`, zero shipped-DLL dependencies — the AVS2 base companion;
`libavs-win32-ea3.dll`, the e-amusement-v3 extension).
- **Virtual filesystem.** AVS2's configuration declares named devices and
mount points with the observed runtime backing trees.
- **Property tree.** Every `*-config.xml` in `prop/` and `dev/nvram/` is the
textual serialization of an AVS2 *property* object: a typed, path-addressed
tree. Each leaf node carries a type tag (`str`/`u8`/`u16`/
`u32`/`s32`/`bool`) matching the C scalar types the AVS2 property API
reads/writes — the reconstruction's `re/avs/property_node.h` declares
accessors following this documented AVS2 C API (`re/avs/property_node.h:1-3`),
and `re/avs/recon_avs_harness.cpp` / `re/avs/prove_t14.py` are a
differential-test harness proving a MinGW reconstruction of
`property_node_datasize` against the real `libavs-win32.dll`
(`re/avs/recon_avs_harness.cpp:1`, `re/avs/prove_t14.py:1`). This confirms
the property tree is not merely a config-loading convention but a typed
in-memory data structure with its own ABI inside `libavs-win32.dll`.
- gamekdm/ARK read the property tree through `libavs-win32.dll` (AVS2 base)
and `libavs-win32-ea3.dll` (e-amusement v3 extension).
- `prop/avs-config.xml:1` — root tag is `<config>`, not `<ea3>` or `<avs>`:
this file configures the AVS2 kernel itself (filesystem, logging,
networking, threading, SNTP), distinct from `eamuse-config.xml` which
configures the e-amusement client layer running on top of it.
## 4. Archive / container formats (by inspection)
### 4.1 `.arc` — the dominant asset archive (2,214 files under `data/`)
Twelve sampled `.arc` files across `data/arc/*.arc` and `data/arc/2d/*.arc`
(`2d_font_ark_system.arc`, `2d_font_lang_han.arc`, `2d_font_lang_kan.arc`,
`2d_font_system.arc`, `2d_font_ui.arc`, `animtest.arc`, two `ani_back000_*`
files, `2d_mask_128data.arc`, `2d_sys.arc`, `2d_sys_ja.arc`,
`2d_sys_sys_list.arc`) **all** begin with the same little-endian 32-bit word:
```
offset 0x00: 20 11 75 19 -> u32 LE = 0x19751120 (constant across all 12 samples)
offset 0x04: 01 00 00 00 -> u32 LE = 1
offset 0x08: 34 00 00 00 -> u32 LE = 0x34 (52)
offset 0x0c: 02 00 00 00 -> u32 LE = 2
```
(verified by direct Python `struct.unpack_from('<I', data, 0)` over all 12
files; see also the raw `xxd -l 64` dump of
`data/arc/2d/2d_mask_128data.arc`, which shows the same leading
`20 11 75 19 01 00 00 00` bytes). `0x19751120` is treated here as the `.arc`
container's magic/version constant; its field-level meaning (beyond "first
header word, constant across every sampled file") is UNVERIFIED — no `.arc`
parser or on-disk format description was found elsewhere in this repository.
`file(1)` classifies all sampled `.arc` files as generic `data` (no libmagic
signature). `data/arc/2d/2d_sys.arc` (1,320,128 bytes) contains the ASCII
substrings `lob` at file offset `0x370` and `afp` at offset `0x707`, i.e. the
packed payload embeds path fragments ending in `.lob`/`.afp` — the same
component extensions a `.dal` manifest for the same 2D package lists (§4.3),
which is consistent with `.arc` being a packed-archive container whose
entries are the `.lob`/`.lp`/`.afp`/texture/font components a `.dal`
manifest names, though the entry table layout itself was not reverse
engineered for this section (UNVERIFIED beyond "contains an embedded,
multi-u32 header and readable path-like substrings at non-zero offsets").
### 4.2 `.ifs` — Flash/UI archive (326 files, concentrated in `data/bm2d/`)
Sampled `data/bm2d/120paseli_lang_eng_v0.ifs`: `file(1)` reports plain
`data`; the first 64 bytes show no readable ASCII and no recognizable magic
(`6c ad 8f 89 00 03 ff fc 53 7b 33 ac ...`), consistent with either a
compressed or obfuscated/encrypted header rather than a plaintext TOC.
`game-internals.md` records that the external pip package `ifstools`
(pure-Python) successfully extracts `data/bm2d/*.ifs` into an `afp/<name>`
Flash-asset tree, and `game-internals.md` states the menu UI (including
the cursor sprite) is compiled Flash packed inside these `.ifs` archives.
`rvadb.json` contains dozens of `.ifs` path-format strings referenced by
gamekdm (e.g. `"value": "jk_%s_v0.ifs"` at `re/rvadb.json:175117`,
`"value": "%s_%s_v0.ifs"` at `re/rvadb.json:219441`, and about 30 concrete
UI-screen `.ifs` names such as `title_v0.ifs`, `game_hud_v0.ifs`,
`calibration_v0.ifs`, `license_v0.ifs` around `re/rvadb.json:206500-207100`),
confirming gamekdm opens `.ifs` files by printf-style name pattern per UI
screen/locale. The internal entry-table layout was not reverse engineered
here; `ifstools`' published format description (not reproduced in this repo)
is the only known decoder. This repository's own format knowledge for `.ifs`
is therefore UNVERIFIED beyond "Konami IFS container, Flash payload,
externally decodable via `ifstools`."
### 4.3 `.dal` — 2D package manifest (3,167 files, the most numerous extension)
Plain text, not a binary container. Sampled
`data/dal/2d/2d_calibration.dal` in full:
```
# this file was created by mk2Ddal.py
# .lob
data/2d/calibration/calibpic1_layout.lob
...
# .lp
data/2d/calibration/bgcalib1_pack.lp
...
# .afp
data/2d/calibration/bgcalib.afp
...
```
Each `.dal` file is a `#`-comment-sectioned plain list of relative component
paths grouped by extension (`.lob` layout files, `.lp` pack files, `.afp`
Flash/vector assets observed in this sample; other `.dal` files under
`data/dal/` may list additional component extensions). The header comment
names the authoring tool, `mk2Ddal.py` — a Konami build-pipeline script, not
present in GAME-DIR. `.dal` is therefore a build-time manifest of which
`.lob`/`.lp`/`.afp` component files compose one named 2D UI package (here,
the calibration screen), analogous in role to the `.arc` archives' packed
contents (§4.1) but shipped as loose files plus a manifest rather than a
single packed blob in this directory. `.inc` files (166 under `data/`, e.g.
`data/dal/em_clnm01.inc`) are the same family: UTF-8-with-BOM, CRLF text
created by a sibling tool (`MahoroMagic`, per the file's own header comment),
listing includable sub-resources.
### 4.4 Audio containers
- `.xwb` (115 files, e.g. `data/sound/afpr.xwb`): magic `WBND` at offset 0
(`57 42 4e 44` = `"WBND"`), the Microsoft XACT **Wave Bank** container
format — `file(1)` does not classify it, but the ASCII magic is
unambiguous.
- `.xsb` (115 files, e.g. `data/sound/afpr.xsb`): magic `SDBK` at offset 0
(`53 44 42 4b` = `"SDBK"`), the Microsoft XACT **Sound Bank** format (paired
1:1 with `.xwb` by base name — both samples here are `afpr.{xwb,xsb}`).
- `.xgs` (1 file, `data/sound/dmas.xgs`): the XACT **global settings** file
that normally accompanies a wave/sound-bank pair; present as a single
shared file rather than per-package. Header bytes not decoded for this
section (UNVERIFIED beyond file presence/naming).
- `.ttc` (3 files) — likely TrueType Collection font containers (standard
`ttcf` magic was not independently re-verified here; name/extension
evidence only — UNVERIFIED).
### 4.5 Texture / font containers
- `.dds` (16 files, e.g. `data/font/2d_font_ark_system.0.dds`,
`arkdata/arkkdm/ea3license/license1.dds`): standard Microsoft DirectDraw
Surface magic `44 44 53 20` (`"DDS "`) at offset 0; `file(1)` decodes the
sample as `2048 x 1136, 8-bit color, luminance` — an 8-bit single-channel
(luminance/alpha-style) atlas texture, consistent with a font glyph sheet.
- `.kbf` (6 files, e.g. `data/font/2d_font_ark_system.kbf`): magic
`6b 62 66 00` = ASCII `"kbf\0"` at offset 0, followed by an ASCII version
string `"00"` at offset 4 — a Konami-proprietary font-metrics/glyph-layout
companion to the `.dds` atlas of the same base name
(`2d_font_ark_system.{kbf,0.dds}`). Internal field layout beyond the magic
and version bytes was not decoded (UNVERIFIED).
### 4.6 Video container
- `.wmv` (25 files, e.g. `data/bgmov/brav.wmv`): standard ASF/WMV GUID magic
`30 26 b2 75 8e 66 cf 11 a6 d9 00 aa 00 62 ce 6c` at offset 0 (the
canonical Microsoft ASF header object GUID); `file(1)` confirms
`Microsoft ASF`. These are background/attract-mode movies
(`data/bgmov/`), standard WMV, no custom wrapper.
### 4.7 Miscellaneous
- `data/data/texture.db` and `data/data/dam_en_us.cfg`: present as single
named files rather than per-asset extensions; contents not decoded for
this section (UNVERIFIED — plausibly a texture index and a locale-specific
config/string table respectively, based on naming only).
- `prop/card_allow.bin`, `arkdata/arkkdm/qc/zero.bin` (2 `.bin` files
total under the sampled scope): opaque binary, not decoded.
- `arkdata/arkkdm/sound/{seteq.def,setvolume.def}` (2 `.def` files): not
decoded; likely plain key=value EQ/volume preset text based on naming
(UNVERIFIED).
## 5. Summary table — extensions observed under `data/` + `arkdata/`
| ext | count | format (verified) |
|---|---|---|
| `.dal` | 3,167 | plain-text component manifest (§4.3) |
| `.arc` | 2,214 | packed archive, magic `0x19751120` (§4.1) |
| `.ifs` | 326 | Flash/UI container, opaque header, decodable via external `ifstools` (§4.2) |
| `.inc` | 166 | plain-text include list, `mk2Ddal.py`/`MahoroMagic`-family tooling (§4.3) |
| `.xwb` | 115 | Microsoft XACT Wave Bank, magic `WBND` (§4.4) |
| `.xsb` | 115 | Microsoft XACT Sound Bank, magic `SDBK` (§4.4) |
| `.wmv` | 25 | Microsoft ASF/WMV, standard GUID magic (§4.6) |
| `.dds` | 16 | Microsoft DirectDraw Surface, magic `"DDS "` (§4.5) |
| `.kbf` | 6 | Konami font companion, magic `"kbf\0"` (§4.5) |
| `.xml` | 5 (under `data/`) | typed property-tree XML, same dialect as §2 |
| `.ttc` | 3 | likely TrueType Collection (unverified magic) |
| `.def` | 2 | plain text preset (unverified) |
| `.bin` | 2 | opaque binary (unverified) |
| `.xgs` | 1 | XACT global settings (unverified header) |
| `.db` | 1 | `texture.db`, unverified internal format |
| `.cfg` | 1 | `dam_en_us.cfg`, unverified internal format |
Counts from `find GAME-DIR/data GAME-DIR/arkdata -type f | sed -E 's/.*\./ /' |
tr A-Z a-z | sort | uniq -c`, run directly against the live install.