# DanceEvolution Arcade (KDM) — Technical Specification This is the master index for the full technical specification of **DanceEvolution Arcade** (DEA), a Konami arcade Kinect dance game shipped under the internal engine/module codename **KDM**, and of the `kdm-re` reconstruction codebase that rebuilds its main logic DLL, `gamekdm.dll`, from static and dynamic analysis. Every claim in every section below is grounded in a cited artifact — a `file:line`, an RVA such as `0x10009e20`, `objdump` output from a clean-release binary, or an official `contents/` artifact path — and anything that could not be checked is marked `UNVERIFIED` rather than asserted. `GAME-DIR` for the build analyzed throughout this spec is the owner's local copy of **KDM-2016021900** (`.../KDM-2016021900/contents`): `data/`, `arkdata/`, `prop/`, and exactly nine DLLs in `modules/` (docs/companion-inventory.md, "What the clean release contains"). `re/rvadb.json` is the shared reconstruction locator database. No copyrighted creative asset (song audio, video, lyrics, or art) is reproduced anywhere in this spec; only file formats, code structure, and behavior are described. ## Table of contents | # | Section | Summary | |---|---------|---------| | 00 | [Overview and high-level architecture](./00-overview.md) | What DEA is, the official AVS2/ARK platform, the `arkkdm.dll` entry path, the nine-module clean-release stack, and the three-dimension (GAME / ORIGINAL / RECONSTRUCTION) organizing structure this whole spec follows. | | 01 | [Runtime environment and boot/startup chain](./01-runtime-boot.md) | The Win32/AVS2/e-amusement-v3 cabinet platform and official `arkkdm.dll` → `gamekdm.dll` entry facts. Any community-loader material still present in that section is out of game scope and not evidence; the official config is `eamuse-config.xml`, not `ea3-config.xml`. | | 02 | [DLL architecture and module dependency graph](./02-dll-architecture.md) | The nine official modules and their shipped-module dependency DAG, reconciled against `docs/companion-inventory.md`. Any 22-DLL or community-glue inventory still present in that section is superseded and is not game evidence. | | 03 | [Kinect input and skeleton pipeline](./03-kinect-skeleton.md) | The external Microsoft `Kinect10.dll` NUI v1 runtime boundary imported by `gamekdm.dll`, the `NuiThread`/`hid::Natal` skeleton-ingest functions and their RVAs, and depth-to-skeleton coordinate projection math. `Kinect10.dll` is not a shipped module. | | 04 | [Player validity gate and menu hand cursor](./04-validity-cursor.md) | The gravity/floor-relative transform and box-distance gate (`FUN_10018570`, `FUN_100e4140`, `FUN_101ab6d0`) that decides whether a tracked skeleton is allowed to render/play, and the structurally separate Flash/`afp` PhIZ hand-cursor system that drives menu navigation. | | 05 | [Data formats](./05-data-formats.md) | Official layout (`data/`, `arkdata/`, `prop/`), the AVS2 property-tree/filesystem model, the typed-attribute `prop/*.xml` config dialect, and asset container formats identified by direct inspection. The clean release uses `prop/eamuse-config.xml`; references there to `ea3-config.xml` or `dev/` are superseded. | | 06 | [gamekdm.dll subsystem map](./06-gamekdm-subsystems.md) | An RVA-anchored, evidence-tiered partition of the 9,728-function DLL into functional subsystems (game-state manager, Kinect/skeleton, validity gate, menu cursor, scoring, song/chart flow, D3D9 render, movie, particle, sound, UI, boot/entry), with an explicit coverage note (~2.7% named). | | 07 | [Companion DLL API surfaces](./07-companion-apis.md) | The exported APIs of the official companions: `libavs-win32.dll`, `libavs-win32-ea3.dll`, `libafp-win32.dll`, `libafputils-win32.dll`, `ess.dll`, `libacio.dll`, `arkkdm.dll`, and `arkkdmtest.dll`. Non-release modules mentioned in that section are superseded and are not game evidence. | | 08 | [ABI, calling conventions, and struct layouts](./08-abi-conventions.md) | The MSVC/VS2010 SP1 x86 ABI the original binary was built with, the `GK_CDECL`/`GK_STDCALL`/`GK_THISCALL` convention macros and per-companion calling-convention table, struct-packing rules, and the reconstructed struct layouts (`Vec3`/`Matrix4x4`, `SkeletonData`/`SkeletonFrame`, `LiveManager`, `ValidityBox`/`ValidityCandidate`) with `static_assert`-pinned offsets. | | 09 | [The kdm-re reconstruction codebase](./09-reconstruction-codebase.md) | The `kdm-re` repository layout, the no-sudo i686 cross-build and its three build modes (hybrid proxy, detour carve-out, PURE slice), the Unicorn differential and golden-I/O verification gates, the per-function reconstruction loop, and current cutover status (1 of 9,728 functions `verified`). | All ten section files (`00-overview.md` through `09-reconstruction-codebase.md`) exist in this repository. This index and §00's specification map use the real, on-disk filenames. Stale links elsewhere are document defects rather than alternate section names. ## The three dimensions Every section above is organized along one (or more) of three axes, following the structure §00 establishes: | Dimension | What it covers | Primary sections | |---|---|---| | **THE GAME** | Observable product behavior and the platform it runs on: what DEA does for a player, the Kinect data path, the AVS2/ARK/e-Amusement-v3 middleware, the boot chain, and on-disk asset formats. | 00, 01, 03, 04, 05 | | **The ORIGINAL binary codebase** | The nine official shipped modules as reverse-engineering subjects: their dependency DAG, the `gamekdm.dll` function/subsystem map (`re/rvadb.json`, 9,728 records), companion export surfaces, and the binary-level ABI/struct facts recovered from official binaries. | 00, 02, 06, 07, 08 | | **The RECONSTRUCTION codebase** | The hand-reviewed MinGW C/C++ under `src/`/`include/` that rebuilds `gamekdm.dll` behavior, the cross-build system, and the verification/cutover workflow that proves and ships it. | 08, 09 | Section 00 spans all three (it is the entry point); 01, 03, 04, 05 are GAME-dimension with an ORIGINAL-dimension RVA/evidence layer underneath (04 in particular straddles GAME and ORIGINAL, since the validity gate and cursor are both observable game behavior *and* disassembled binary routines); 02, 06, 07 are ORIGINAL; 08 bridges ORIGINAL (the facts being matched) and RECONSTRUCTION (the macros/headers that encode them); 09 is pure RECONSTRUCTION. ## Glossary - **DEA** — DanceEvolution Arcade, the product specified by the official KDM release artifacts: the e-amusement model in `prop/eamuse-config.xml`, the `arkKDM*` API prefix, and the `arkkdm.dll`/`gamekdm.dll` file stems (see [00](./00-overview.md)). - **KDM** — Konami's model/engine code for this title. Appears as the e-amusement model in `eamuse-config.xml`, as the `arkKDM*` export prefix in `arkkdm.dll`, and as the `gamekdm.dll`/`arkkdm.dll` file name stems (see [01](./01-runtime-boot.md), [07](./07-companion-apis.md)). - **gamekdm(.dll)** — the main game-logic DLL (3.19 MB in the clean release; exports `gameMain`). It is the primary target (see [00](./00-overview.md), [06](./06-gamekdm-subsystems.md)). - **gameMain** — `gamekdm.dll`'s sole export, RVA `0x9e20` / absolute VA `0x10009e20`, `cdecl`, taking one `void* hInstance` argument that is `arkkdm.dll`'s own `HINSTANCE` (not `gamekdm.dll`'s), relayed through `arkkdm.dll`'s internal `g_MainDllInfo` struct (see [01](./01-runtime-boot.md) §3.7). - **AVS2** — "Application/Audio-Visual System v2," Konami's core middleware runtime (`libavs-win32.dll`): property-tree config store, virtual filesystem, and thread/mutex/event primitives underlying every other in-scope DLL (see [07](./07-companion-apis.md)). - **ea3** — "e-Amusement v3," the Konami network/identity/coin-economy extension layered on AVS2 (`libavs-win32-ea3.dll`), configured by `prop/eamuse-config.xml`; there is no `ea3-config.xml` in the clean release (see [05](./05-data-formats.md)). - **ARK** — Konami's reusable arcade-cabinet game-engine framework (`arkkdm.dll` in this build, i.e. "ARK instantiated for KDM"): credit/coin handling, card I/O, networking, threading, heap management, and the `arkAFP*` rendering wrapper over AFP (see [07](./07-companion-apis.md)). - **ACIO** — Konami's amusement-cabinet serial I/O protocol for coin mechs, button/LED boards, and card readers, implemented by the official `libacio.dll` (see [07](./07-companion-apis.md)). - **PhIZ** — the body-relative, reach-normalized hand-to-cursor mapping used by the Flash/Natal menu runtime inside `libafp-win32.dll`; `gamekdm.dll` never writes the cursor position itself, it only reads it (see [04](./04-validity-cursor.md) §5). - **RVA DB / `re/rvadb.json`** — the canonical per-function database for `gamekdm.dll`: 9,728 records (`function_count = 9728`), each with `rva`, `name`, `callers`/`callees`, `globals_touched`, and a reconstruction `status` (`orig`/`reimpl`/`stub`/`verified`), keyed against `image_base = "0x10000000"` (independently confirmed in this session by reading the file directly; see [09](./09-reconstruction-codebase.md)). - **Differential (Unicorn differential)** — the verification method in `tools/unicorn_diff/` that emulates the real routine inside the shipping `gamekdm.dll` under Unicorn (oracle) and runs the compiled C++ reconstruction under wine on the same inputs, asserting behavioral equality, with an injected-bug non-vacuity check (see [09](./09-reconstruction-codebase.md) §4). - **Detour** — a hot-patch of a reconstructed function into the loaded *original* image at runtime, restricted by an ownership allowlist (`pod_only` functions only; `shared_mutable_globals` and `foreign_object_abi` functions are blocked from detouring even though they are reconstructed and verified) (see [09](./09-reconstruction-codebase.md) §3). - **PURE build** — the reconstruction build mode that excludes the proxy and detour targets and never links an original DLL; gated by a fail-closed coverage check (`cmake/check_pure_coverage.py`) that, in full mode, demands 100% `verified` status across the whole call graph before it will build at all (see [09](./09-reconstruction-codebase.md) §2). ## Grounding and scope - **Behavioral, not byte-identical.** The reconstruction's goal is to reproduce `gamekdm.dll`'s observable behavior (given the same inputs, the same outputs and global-state effects), proven function-by-function via the Unicorn differential and golden-I/O harnesses. It does not aim to byte-match the original compiled machine code; the toolchain (MinGW/GCC targeting x86) differs from the original's MSVC/VS2010 SP1 toolchain by construction, and the ABI/FP-model conventions in [08](./08-abi-conventions.md) exist precisely to keep that different toolchain producing matching behavior (register-level calling convention, x87 vs. SSE float model, MSVC struct packing, Itanium-vs-MSVC vtable/RTTI layout handled explicitly rather than memcpy'd). - **Copyrighted creative assets are out of scope for reproduction.** No song audio, video, lyrics, or art is reproduced anywhere in this spec or the reconstruction codebase; [05](./05-data-formats.md) describes container *formats* and directory *structure* only, never asset content. - **Coverage is early and explicitly tracked, not implied.** As of this writing, `re/rvadb.json` records exactly 1 of 9,728 functions as `verified` (confirmed via `re/pure-slice-status.json` and the status histogram in [09](./09-reconstruction-codebase.md) §1); the subsystem map in [06](./06-gamekdm-subsystems.md) classifies only ~2.7% of functions into a named subsystem by design (positive-evidence-only attribution, not a claim about the unclassified 97.3%). Any claim about "what a function does" beyond a function explicitly reconstructed, decompiled, or cited to a disassembly listing in one of the sections above should be treated as unestablished. - **Deferred items**, named explicitly rather than silently dropped, per section: cabinet hardware specifics ([01](./01-runtime-boot.md)); the `.arc`/`.ifs` internal entry-table layouts ([05](./05-data-formats.md)); `FUN_10018570`'s full re-decompilation and the cursor path (`FUN_1007fbf0`/`FUN_101d84c0`/`DAT_103d2bb8`), neither of which has a reconstruction yet ([04](./04-validity-cursor.md)); the remaining 9,467 unclassified `gamekdm.dll` functions ([06](./06-gamekdm-subsystems.md)); and full Windows cabinet-runtime cutover QA, which the project treats as deliberately gated and incomplete ([09](./09-reconstruction-codebase.md) §6). - **A claim without a citation is a bug.** Every section inherits this rule from [00-overview.md](./00-overview.md); report any uncited claim found in this spec as a defect rather than treating it as established fact.