docs: scope spec + RE to the official clean release only

Reference only the official KDM-2016021900 game: the 9 Konami modules in
contents/modules/ plus data/arkdata/prop. Remove community/PC-hardware glue
(deahook/DEALibacio, spice2x/spicetools, launcher.exe, gamestart.bat,
bemanitools, NVENC/CUDA stubs) and non-release modules (kmd/ksm/kuc/libinput/
libacio_mbr) as game evidence. Correct the "22-DLL" framing to the real
9-module set; reframe the boot chain on arkkdm.dll's own dll_entry_init/
dll_entry_main -> gameMain binding. Kinect10.dll referenced only as gamekdm's
external Microsoft NUI runtime dependency. Fix ea3-config.xml -> eamuse-config.xml.
Per-byte sizes/RVAs from the earlier contaminated install marked UNVERIFIED
pending re-check against the clean-release binary.
This commit is contained in:
ulw-execute committed 2026-11-28 20:37:18 -05:00
1 parent f2bfaf8639
commit a176c63736
17 files changed
+1038 -1979

No files matched your search

+134
View File
@@ -0,0 +1,134 @@
# kdm-re
A reverse-engineering and reconstruction project for **DanceEvolution Arcade**
(DEA) — a Konami arcade Kinect dance game whose game logic ships as
`gamekdm.dll` (internal engine/module codename **KDM**). The goal is to rebuild
`gamekdm.dll`'s observable behavior from static and dynamic analysis of the
shipped binary, one function at a time, each proven behaviorally equal to the
original before it is shipped.
> **Behavioral, not byte-identical.** Given the same inputs, the reconstruction
> aims to produce the same outputs and global-state effects as the original —
> proven function-by-function — not to reproduce the original machine code. The
> toolchain (MinGW/GCC, i686) differs from the original's (MSVC/VS2010 SP1) by
> construction.
## What the game is
DEA is a Konami arcade dance game driven by a Kinect sensor: the player dances
in front of a depth camera and the game scores the match between the tracked
body pose and the choreography. It targets **Win32 x86** on Konami's **AVS2**
middleware stack, with the **ARK** cabinet engine (`arkkdm.dll`) and
**e-Amusement v3** networking. The game analyzed throughout is the clean
**`KDM-2016021900`** release. The main logic DLL, `gamekdm.dll` (PE32 x86),
exports a single symbol, `gameMain` (RVA `0x00009e20`, cdecl), and contains
**9,728** functions tracked in `re/rvadb.json`.
### Official scope
The spec and reverse engineering reference **only the official game** — the
clean release's `contents/` tree: its asset/config trees (`data/`,
`arkdata/`, `prop/`) and exactly **9 Konami modules** in `contents/modules/`:
`libavs-win32.dll`, `libavs-win32-ea3.dll`, `libafp-win32.dll`,
`libafputils-win32.dll`, `ess.dll`, `libacio.dll`, `arkkdm.dll`,
`arkkdmtest.dll`, `gamekdm.dll`. Community or PC-hardware glue that may appear
in a non-clean install — `launcher.exe`, `deahook.dll`, spice2x/bemanitools,
NVENC/CUDA stubs, a Kinect shim, and non-release Konami modules — is **not**
part of the game and is not used as evidence. `Kinect10.dll` (Microsoft's
Kinect-for-Windows NUI runtime) is referenced only as an external dependency
that `gamekdm.dll`'s import table requires, never as a shipped game module.
See [`docs/companion-inventory.md`](docs/companion-inventory.md).
## Repository layout
| Path | What it holds |
|---|---|
| `docs/spec/` | The full technical specification — start here (see below). |
| `docs/` | Process docs: `companion-inventory.md`, `conventions.md`, `pipeline.md`, `reconstruction-loop.md`, `cutover.md`, `provenance.md`. |
| `src/`, `include/` | The hand-reviewed MinGW C/C++ reconstruction, layered by subsystem (`game`, `gs`, `render`, `movie`, `particle`, `mm`, `ui`, `util`, `platform`, `hybrid`, `pure`, `entry`). |
| `re/` | The RVA function database (`rvadb.json`, 9,728 records), `pure-slice-status.json`, import libs, and AVS notes. |
| `tools/` | `unicorn_diff/` (the differential verifier), `ghidra/` helpers, `gen_importlibs.sh`. |
| `tests/` | Golden-I/O fixtures, import-lib checks, smoke tests. |
| `cmake/` | `toolchain-mingw-i686.cmake` (cross toolchain file) and `check_pure_coverage.py` (the fail-closed coverage gate). |
| `activate.sh` | Sources the pinned no-sudo i686-w64-mingw32 cross toolchain + wine onto `PATH`. |
| `toolchain.lock` | Exact toolchain provenance (nixpkgs rev, package versions, store paths). |
| `orig/`, `export/`, `bin/` | Gitignored originals drop zone, the hand-authored `gamekdm.def`, and the `activate.sh`-generated tool aliases. |
## Specification
The authoritative, fully-cited technical spec lives in **[`docs/spec/`](docs/spec/README.md)**.
Every claim in it is grounded in a real artifact (a `file:line`, an RVA, an
`objdump` listing, or a game-dir path); anything unverifiable is marked
`UNVERIFIED`. Sections:
- [00 — Overview and high-level architecture](docs/spec/00-overview.md)
- [01 — Runtime environment and boot/startup chain](docs/spec/01-runtime-boot.md)
- [02 — DLL architecture and dependency graph](docs/spec/02-dll-architecture.md)
- [03 — Kinect input and skeleton pipeline](docs/spec/03-kinect-skeleton.md)
- [04 — Player validity gate and menu hand cursor](docs/spec/04-validity-cursor.md)
- [05 — Data formats](docs/spec/05-data-formats.md)
- [06 — gamekdm.dll subsystem map](docs/spec/06-gamekdm-subsystems.md)
- [07 — Companion DLL API surfaces](docs/spec/07-companion-apis.md)
- [08 — ABI, calling conventions, and struct layouts](docs/spec/08-abi-conventions.md)
- [09 — The kdm-re reconstruction codebase](docs/spec/09-reconstruction-codebase.md)
## Build
The build targets a 32-bit Windows DLL and **never touches system packages** —
it uses a pinned, no-sudo i686-w64-mingw32 cross toolchain plus wine, sourced
onto `PATH` by `activate.sh`.
```bash
source ./activate.sh # must be sourced, not executed
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-mingw-i686.cmake
cmake --build build
i686-w64-mingw32-objdump -p build/gamekdm.dll | grep -A6 'Export Address Table'
```
Output is `build/gamekdm.dll`, a PE32 (i386) DLL.
### Build modes
- **Hybrid (default)** — builds `gamekdm.dll` as a shared proxy plus the detour
static library; reconstructed functions override the original where proven.
- **PURE** (`-DBUILD_PURE=ON`) — links/loads no original DLL at all. A
fail-closed coverage gate (`cmake/check_pure_coverage.py`) runs at configure
time and before every build; in full mode it demands 100% `verified` status
across the call graph.
- **PURE slice** (`-DBUILD_PURE=ON -DPURE_SLICE=ON`) — builds only the verified
slice with explicit stubs for the remainder.
## Verification
Each reconstructed function is proven behaviorally equal to the original before
it ships:
- **Unicorn differential** (`tools/unicorn_diff/`) emulates the real routine
inside the shipping `gamekdm.dll` as the oracle, runs the compiled C++
reconstruction under wine on the same inputs, and asserts behavioral equality,
with an injected-bug non-vacuity check.
- **Golden I/O** fixtures under `tests/golden/`.
- **Detours** are gated by an ownership allowlist: only `pod_only` functions may
hot-patch the original image; `shared_mutable_globals` and `foreign_object_abi`
functions are blocked even when verified.
## Status
Reconstruction is **early and explicitly tracked**. As of this writing,
`re/rvadb.json` records **1 of 9,728** functions as `verified`, and the
subsystem map classifies ~2.7% of functions into named subsystems by design
(positive-evidence-only). The runtime cutover path exists as a mechanism but
is deliberately gated and incomplete. Treat any claim about "what
a function does" beyond one explicitly reconstructed, decompiled, or cited to a
disassembly as unestablished.
## Scope and license
- **No copyrighted creative asset** (song audio, video, lyrics, or art) is
reproduced anywhere in this repository or spec. Only file/container formats,
directory structure, and code behavior are described.
- Original game binaries are **not** committed; see
[`docs/provenance.md`](docs/provenance.md) for origin and handling.
- This repository is **private and unlicensed** — see [`LICENSE`](LICENSE). No
rights to use, copy, modify, or distribute any part of it are granted; the
final license (if any) has not been decided.
+28 -10
View File
@@ -9,6 +9,15 @@ compensating pop) is cdecl; a callee that returns with `ret N` and the caller
performs no stack fixup is stdcall. Full objdump excerpts and the gendef/dlltool performs no stack fixup is stdcall. Full objdump excerpts and the gendef/dlltool
transcript are in `.omo/evidence/gamekdm-decomp-linux/task-3.log`. transcript are in `.omo/evidence/gamekdm-decomp-linux/task-3.log`.
The official release contains exactly nine Konami modules under
`contents/modules/`: `libavs-win32.dll`, `libavs-win32-ea3.dll`,
`libafp-win32.dll`, `libafputils-win32.dll`, `ess.dll`, `libacio.dll`,
`arkkdm.dll`, `arkkdmtest.dll`, and `gamekdm.dll`. `Kinect10.dll` is an
external Microsoft NUI runtime dependency of `gamekdm.dll`, not a shipped
companion. Addresses, ordinals, export counts, and file offsets below are
UNVERIFIED (pending re-check against clean-release binary) unless stated as
clean-release evidence.
| DLL | Convention | Evidence | Binding | --kill-at | | DLL | Convention | Evidence | Binding | --kill-at |
|---|---|---|---|---| |---|---|---|---|---|
| libavs-win32.dll | cdecl | IAT 0x102183cc etc.: callers emit `add esp,N` after the call | by name (vendor exports via synthetic hashed names, e.g. `XCd229cc0000fb`, not ordinal-only — confirmed in the DLL's own export name table, not just gendef's fallback) | no | | libavs-win32.dll | cdecl | IAT 0x102183cc etc.: callers emit `add esp,N` after the call | by name (vendor exports via synthetic hashed names, e.g. `XCd229cc0000fb`, not ordinal-only — confirmed in the DLL's own export name table, not just gendef's fallback) | no |
@@ -18,7 +27,14 @@ transcript are in `.omo/evidence/gamekdm-decomp-linux/task-3.log`.
| ess.dll | cdecl | not called directly through gamekdm's IAT (no `ess.dll` import block in gamekdm.dll); follows the plain, undecorated C export convention shared by every other Konami companion in this build and never emits `@N`-decorated symbols | by name | no | | ess.dll | cdecl | not called directly through gamekdm's IAT (no `ess.dll` import block in gamekdm.dll); follows the plain, undecorated C export convention shared by every other Konami companion in this build and never emits `@N`-decorated symbols | by name | no |
| arkkdm.dll | stdcall | export ordinal 2, `arkAFPBoot`, RVA 0x52790: `objdump -d` on that RVA shows `ret 0x4` at file offset 0x100527ca -- the callee pops its own stack frame, which only a stdcall (or fastcall) function does; gendef's `arkAFPBoot@4` guess in the `.def` matches this disassembly exactly | by name (the DLL's own export name table, `objdump -p`, stores `arkAFPBoot` **undecorated**, no `@N`; dlltool's decorated `.def` guess must have the `@N` stripped back off to bind to it) | **yes** | | arkkdm.dll | stdcall | export ordinal 2, `arkAFPBoot`, RVA 0x52790: `objdump -d` on that RVA shows `ret 0x4` at file offset 0x100527ca -- the callee pops its own stack frame, which only a stdcall (or fastcall) function does; gendef's `arkAFPBoot@4` guess in the `.def` matches this disassembly exactly | by name (the DLL's own export name table, `objdump -p`, stores `arkAFPBoot` **undecorated**, no `@N`; dlltool's decorated `.def` guess must have the `@N` stripped back off to bind to it) | **yes** |
| libacio.dll | cdecl | not called directly through gamekdm's IAT; undecorated plain-C export names, same convention family as `ess.dll` | by name | no | | libacio.dll | cdecl | not called directly through gamekdm's IAT; undecorated plain-C export names, same convention family as `ess.dll` | by name | no |
| Kinect10.dll | stdcall | IAT 0x102181d4 etc.: callee returns with `ret N`, caller performs no `add esp` cleanup; this is the real Microsoft Kinect for Windows SDK v1.x redistributable | by ordinal in gamekdm's own import table, but exported by name in the DLL (`NuiInitialize`, ...) plus one `NONAME` ordinal-1 export | yes (removes/kills the `@N` suffix so the import binds to Kinect10's undecorated exports) |
`arkkdmtest.dll` and `gamekdm.dll` both export `gameMain`; the official
`arkkdm.dll` entry path resolves that cdecl entry by name. They are not import
libraries consumed by the reconstructed `gamekdm.dll`.
The external Microsoft `Kinect10.dll` uses stdcall. Its import-library binding
details remain external-platform integration, not part of the shipped
nine-module companion set.
## `--kill-at` scope ## `--kill-at` scope
@@ -26,15 +42,17 @@ Per `i686-w64-mingw32-dlltool --help`, `-k`/`--kill-at` "Kill @<n> from
exported names": it strips (removes) the `@N` stdcall decoration dlltool exported names": it strips (removes) the `@N` stdcall decoration dlltool
would otherwise carry into the generated import name -- it does not add an would otherwise carry into the generated import name -- it does not add an
`@N` suffix, and it has no effect on calling convention at the ABI level (it `@N` suffix, and it has no effect on calling convention at the ABI level (it
never retags a cdecl import as stdcall or vice versa). It is passed for both never retags a cdecl import as stdcall or vice versa). It is passed for
`arkkdm.dll` and `Kinect10.dll` because those two DLLs' own export tables `arkkdm.dll`, the one shipped module in this set that is stdcall, because its
(`objdump -p`) hold the plain, undecorated name (`arkAFPBoot`, export table holds the plain, undecorated name `arkAFPBoot` rather than a
`NuiInitialize`, ...) rather than a `Name@N` form -- gendef annotates every `Name@N` form -- gendef annotates every stdcall export it detects in the
stdcall export it detects in the `.def` with a guessed `@N` (correctly, in `.def` with a guessed `@N` (correctly, in arkAFPBoot's case: `@4`), and
arkAFPBoot's case: `@4`), and without `--kill-at` dlltool would emit an without `--kill-at` dlltool would emit an import-by-name entry like
import-by-name entry like `arkAFPBoot@4` that does not exist in either DLL's `arkAFPBoot@4` that does not exist in the DLL's real, undecorated export
real, undecorated export table, so the import would fail to bind at load table, so the import would fail to bind at load time. (The external
time. It is not passed for the six cdecl companions (AVS, AVS-EA3, AFP, Kinect10.dll NUI runtime dependency gets the same `--kill-at` treatment for
the same reason, but it is not one of the nine shipped modules.) It is not
passed for the six cdecl companions (AVS, AVS-EA3, AFP,
AFPUtils, ESS, ACIO): their `.def` files carry no `@N` decoration for AFPUtils, ESS, ACIO): their `.def` files carry no `@N` decoration for
dlltool to strip in the first place (gendef only annotates stdcall exports), dlltool to strip in the first place (gendef only annotates stdcall exports),
so `--kill-at` would be a no-op for them -- passing it was never the risk; so `--kill-at` would be a no-op for them -- passing it was never the risk;
+107 -280
View File
@@ -1,320 +1,147 @@
# Companion DLL Inventory — KDM-2016021900 # Module Inventory — KDM-2016021900 (clean release)
Task T13 deliverable: inventory and classification of every DLL shipped with Inventory and classification of every module shipped in the **clean**
the Konami Dance Masters / `KDM-2016021900` game build, a cross-DLL KDM-2016021900 release, plus the cross-module dependency DAG and the
dependency DAG, and the locked IN-SCOPE reconstruction set + order. reconstruction set and order. Scope is the official game only: the
`contents/` tree of the release. Community/PC-hardware tooling (spice2x,
bemanitools, a Kinect shim, launcher/hook glue, NVENC/CUDA stubs) is **not**
part of the game and is not inventoried here; where an earlier draft counted
such files as "shipped DLLs," that was a contaminated install, not the clean
release.
Source tree enumerated: `contents/` and `contents/modules/` and ## What the clean release contains
`contents/stubs/64/` under the owner's legally-possessed copy of
`KDM-2016021900` (full path redacted from this doc; see evidence log for the
absolute path used). Method: `objdump -p` (i686-w64-mingw32 cross binutils,
and host `/usr/bin/objdump` for the two PE32+ files the 32-bit toolchain
objdump could not parse) against every `.dll` found, cross-referenced against
the shipped `contents/src/spice2x-master.tar.gz` and
`contents/src/spicetools-master.tar.gz` source tarballs for provenance.
## Completeness check The clean release is `contents/` with three asset/config trees — `data/`,
`arkdata/`, `prop/` — and exactly **9** modules under `contents/modules/`.
There are no other DLLs: no `launcher.exe`, no `deahook.dll`, no
`Kinect10.dll`, no `stubs/64/`, no `src/` tarballs, and none of the
non-release Konami modules (`kmd.dll`, `ksm.dll`, `kuc.dll`, `libinput.dll`,
`libacio_mbr.dll`) a contaminated install may carry.
`find contents -iname '*.dll'` (including `modules/` and `stubs/64/`) returns ## Per-module table (contents/modules/)
**22** files. This table has **22** rows. Count matches — no DLL is
omitted.
## Classification legend | Module | Size (clean release) | Classification | Role |
|---|---|---|---|
| `libavs-win32.dll` | 505.14 KB | IN-SCOPE | AVS2 (Application/Audio-Visual System v2) core middleware: property-tree config store, virtual filesystem, threading. Root of the dependency graph. |
| `libavs-win32-ea3.dll` | 364.14 KB | IN-SCOPE | e-amusement v3 ("ea3") AVS2 extension (network/identity/coin economy). |
| `libafp-win32.dll` | 1.19 MB | IN-SCOPE | AFP asset/font/graphics (Flash) pipeline used by ARK. |
| `libafputils-win32.dll` | 165.64 KB | IN-SCOPE | AFP utilities; sits directly above `libafp-win32.dll`. |
| `ess.dll` | 376.14 KB | IN-SCOPE | ESS e-amusement shop/server middleware. |
| `libacio.dll` | 224.64 KB | IN-SCOPE | ACIO (amusement cabinet I/O) protocol library. |
| `arkkdm.dll` | 896.64 KB | IN-SCOPE | ARK cabinet game engine instantiated for KDM; also the AVS2 game-DLL entry (`dll_entry_init`/`dll_entry_main`) that loads and calls `gamekdm.dll`. |
| `arkkdmtest.dll` | 389.14 KB | IN-SCOPE | ARK/KDM render+input test harness; exports `gameMain`; links OS D3D9/DINPUT8/DSOUND directly (no AVS layer). |
| `gamekdm.dll` | 3.19 MB | IN-SCOPE | Main KDM game logic; single export `gameMain`. Primary reconstruction target. |
- **IN-SCOPE** — Konami-authored game/middleware code; targeted for > **Size caveat.** These sizes are from the clean-release file listing. An
decompilation/reconstruction. > earlier inventory, built from a contaminated install, recorded different
- **REUSE OS** — not shipped as a file in this folder; referenced only as an > byte counts for `arkkdm.dll`, `libacio.dll`, and `gamekdm.dll` (e.g.
*import target* (d3d9, d3dx9_43, kernel32, user32, gdi32, advapi32, > `libacio.dll` at 65,536 B — a community replacement, not Konami's 224.64 KB
shell32, ole32, ws2_32, winmm, imm32, dinput8, dsound, iphlpapi, psapi, > original). Any per-byte size, export count, or RVA in this spec that was
msvcrt/msvcr80, oleaut32, dbghelp, hid, setupapi). None of these are > derived from that install and cannot yet be re-verified against the
themselves present as files under `contents/`, so none appear as rows > clean-release binary is marked `UNVERIFIED (pending re-check against
below; they appear only in the "imports-from" / per-DLL import tables as > clean-release binary)`.
external OS/runtime dependencies.
- **ALREADY-OSS** — the shipped file is produced by, or is a shim for,
already-open-source tooling: the owner's own Kinect10.dll shim; a
spice2x/spicetools-built stub DLL confirmed by byte-identical
export/import signature against the shipped spice2x source; or a
**bemanitools** (djhackersdev/bemanitools, open source) stub DLL
identified by an embedded bemanitools PDB path and non-spice2x
implementation details (see kbt.dll/kld.dll rationale below).
## Per-DLL table ## External (non-shipped) dependencies — referenced only, never part of the game
| DLL (path under `contents/`) | Size | Classification | ABI / export count | Rationale | Imports from (shipped DLLs only) | - **Kinect10.dll** — Microsoft Kinect-for-Windows **NUI v1** runtime.
|---|---|---|---|---|---| `gamekdm.dll`'s own import table references it, so it is a real external
| `Kinect10.dll` | 951,731 B | **ALREADY-OSS** | plain-C (no C++ mangling), 25 export(s) | Owner's own Kinect SDK shim (per plan brief); imports only msvcrt/KERNEL32/OLEAUT32/WINMM, exports the standard NuiCamera*/NuiCreate* Kinect SDK surface. Not Konami game logic. | (none — leaf) | dependency of the game binary, but it is **not** a shipped game module; on a
| `arkkdm.dll` | 827,024 B | **IN-SCOPE** | plain-C (no C++ mangling), 255 export(s) | 255 plain-C exports (arkAFP*, arkKDM-prefixed ARK engine API), 0 C++-mangled symbols. Links against libavs-win32, ess, libacio, libafp-win32 — the Konami AVS2/ARK middleware stack. No match in spice2x source tree. Core Konami game-engine DLL. | `libavs-win32.dll`, `libavs-win32-ea3.dll`, `ess.dll`, `libacio.dll`, `libafp-win32.dll` | cabinet it is satisfied by the installed Kinect runtime. Treat it as an
| `arkkdmtest.dll` | 398,480 B | **IN-SCOPE** | plain-C (no C++ mangling), 1 export(s) | Single export gameMain; imports D3D9/D3DX9/DINPUT8/DSOUND/GDI32/SHELL32/USER32 directly (no AVS layer) — a standalone Konami-authored ARK/KDM render-and-input test harness shipped alongside the game. Not found in spice2x source. | (none — leaf) | external import target only.
| `deahook.dll` | 93,696 B | **IN-SCOPE** | has C++-mangled symbol(s), 1 export(s) | 93,696-byte PE32, single export `?dummy@@YGHXZ` (C++-mangled no-op), export-directory internal module name "DEALibacio.dll", imports only GetAsyncKeyState (USER32) + CRT startup set (KERNEL32). No reference to "deahook" or "DEALibacio" anywhere in the spice2x-master.tar.gz or spicetools-master.tar.gz source trees (grep across every .cpp/.h/.txt/.md/.def returned zero hits), so it is not an artifact of those two OSS projects — but that absence does not by itself prove who *did* author it; its exact author is **unresolved** from the available evidence. It is a game-specific ACIO-layer native hook, not an OS DLL and not matched to any identified OSS project, so it is classified conservatively **IN-SCOPE** on that basis (not on a proven-Konami-authorship basis). | (none — leaf) | - **OS / DirectX runtime** — `d3d9.dll`, `d3dx9_43.dll`, `KERNEL32.dll`,
| `ess.dll` | 385,168 B | **IN-SCOPE** | plain-C (no C++ mangling), 209 export(s) | 209 plain-C exports (ess_binarydata_*, ess_bookkeeping_*) — Konami ESS (Enterprise Shop/Server-side e-amusement) middleware. Links libavs-win32/-ea3 plus WS2_32/IPHLPAPI/PSAPI for networking. No match in spice2x source. | `libavs-win32.dll`, `libavs-win32-ea3.dll` | `USER32.dll`, `GDI32.dll`, `ADVAPI32.dll`, `SHELL32.dll`, `OLE32.dll`,
| `gamekdm.dll` | 3,369,104 B | **IN-SCOPE** | plain-C (no C++ mangling), 1 export(s) | Single export gameMain (3.37MB) — the main KDM game logic DLL. Imports D3D9/D3DX9/Kinect10/libavs-win32/libafputils-win32/libafp-win32 plus Win32 OS DLLs. This is the primary reconstruction target named in the plan. | `Kinect10.dll`, `libavs-win32.dll`, `libafputils-win32.dll`, `libafp-win32.dll` | `OLEAUT32.dll`, `WS2_32.dll`, `WINMM.dll`, `IMM32.dll`, `DINPUT8.dll`,
| `kbt.dll` | 7,680 B | **ALREADY-OSS** | plain-C (no C++ mangling), 6 export(s) | Exports exactly bt_fcheck_finish/bt_fcheck_init/bt_fcheck_main/bt_get_ikey_status/k_bt0001/k_bt0002 (6), imports only msvcrt+KERNEL32. Contains the embedded PDB path `d:\bemanitools\stubs\objfre_wxp_x86\i386\stubs.pdb` (CodeView RSDS record, file offset 0x55b), and the `k_bt0002` export resolves to a bare `ret` at RVA 0x11d7 (confirmed by disassembly) rather than the spice2x stubs.cpp implementation of k_bt0002 (which calls the supplied function pointer). This identifies it as a **bemanitools** (djhackersdev/bemanitools, open-source) "ikey" security-dongle stub build, not a spice2x/spicetools build and not a Konami original. Remains ALREADY-OSS (bemanitools is open source) and excluded from the reconstruct set. | (none — leaf) | `DSOUND.dll`, `IPHLPAPI.DLL`, `PSAPI.DLL`, `HID.DLL`, `SETUPAPI.dll`,
| `kld.dll` | 7,680 B | **ALREADY-OSS** | plain-C (no C++ mangling), 6 export(s) | Byte-identical export/import signature and byte-identical bemanitools PDB path (`d:\bemanitools\stubs\objfre_wxp_x86\i386\stubs.pdb` at offset 0x55b) and bare-`ret` `k_bt0002` to kbt.dll. Same **bemanitools** ikey-dongle stub build, not spice2x and not Konami original. Remains ALREADY-OSS and excluded from the reconstruct set. | (none — leaf) | `DBGHELP.dll`, `msvcrt.dll`/`MSVCR80.dll`. Not shipped as game files;
| `kmd.dll` | 128,656 B | **IN-SCOPE** | plain-C (no C++ mangling), 1 export(s) | Single export k_md0001; imports dbghelp.dll, libavs-win32.dll, MSVCR80.dll — Konami "md" (presumably memory-dump/debug) module. No match in spice2x source; depends on other unshipped Konami DLLs (MSVCR80 aside), consistent with genuine Konami binary. | `libavs-win32.dll` | appear only as import targets, satisfied by the Win32/DirectX runtime.
| `ksm.dll` | 169,616 B | **IN-SCOPE** | plain-C (no C++ mangling), 111 export(s) | 111 exports (k_sm0001, ssm_array_*) — Konami "sm" (save/score-manager?) module. Imports kdu.dll/kmp.dll/kma.dll (Konami modules not present in this shipment — external AVS2 family deps) plus libavs-win32/-ea3. No match in spice2x source. | `libavs-win32.dll`, `libavs-win32-ea3.dll` |
| `kuc.dll` | 128,656 B | **IN-SCOPE** | plain-C (no C++ mangling), 4 export(s) | 4 exports (DllStart, k_uc0001, k_uc0004, k_uc0005) — small Konami "uc" module, same kdu/kmp/kma + libavs-win32 dependency pattern as ksm.dll. No match in spice2x source. | `libavs-win32.dll`, `libavs-win32-ea3.dll` |
| `libacio.dll` | 65,536 B | **IN-SCOPE** | plain-C (no C++ mangling), 44 export(s) | 44 exports, all ac_io_* — Konami's AC-IO (amusement I/O / cabinet peripheral) protocol library. Imports only USER32/KERNEL32. This is the real I/O library spice2x's acio.cpp LoadLibraryA()'s and hooks at runtime (it does not reimplement libacio.dll itself), so the DLL present here is the Konami original, not spice2x code. | (none — leaf) |
| `libacio_mbr.dll` | 14,336 B | **IN-SCOPE** | plain-C (no C++ mangling), 47 export(s) | 47 exports (ac_io_* superset of libacio.dll, MBR-variant). Imports libinput.dll and libavs-win32.dll in addition to msvcrt/KERNEL32. Konami AC-IO variant for a different cabinet/IO board revision; no match in spice2x source. | `libinput.dll`, `libavs-win32.dll` |
| `libafp-win32.dll` | 1,246,864 B | **IN-SCOPE** | plain-C (no C++ mangling), 159 export(s) | 159 exports, all afp_* (Konami "AFP" asset/font/graphics pipeline library used by ARK). Imports only libavs-win32.dll + KERNEL32. Base dependency of arkkdm.dll and gamekdm.dll. | `libavs-win32.dll` |
| `libafputils-win32.dll` | 169,616 B | **IN-SCOPE** | plain-C (no C++ mangling), 162 export(s) | 162 exports, all afpu_* (AFP utilities). Imports libavs-win32.dll + libafp-win32.dll + KERNEL32 — sits directly above libafp-win32.dll in the dependency chain. | `libavs-win32.dll`, `libafp-win32.dll` |
| `libavs-win32-ea3.dll` | 372,880 B | **IN-SCOPE** | plain-C (no C++ mangling), 139 export(s) | 139 exports, ordinal-style names (XE592acd...) typical of AVS2 "ea3"(e-amusement v3) extension module. Imports only KERNEL32 + libavs-win32.dll. Part of the Konami AVS2 middleware family targeted for reconstruction. | `libavs-win32.dll` |
| `libavs-win32.dll` | 517,264 B | **IN-SCOPE** | plain-C (no C++ mangling), 360 export(s) | 360 exports, ordinal-style names (XCd229cc...) — AVS2 (Application/Audio-Visual System v2), Konami's core middleware runtime underlying every other first-party DLL here. Imports only KERNEL32/WS2_32/WINMM/IPHLPAPI. Root of the Konami dependency DAG. | (none — leaf) |
| `libinput.dll` | 38,400 B | **IN-SCOPE** | plain-C (no C++ mangling), 51 export(s) | 51 exports, all eam_* (e-amuse input config: eam_config_load/save, eam_get_alt_10k, ...). Imports msvcrt/KERNEL32/USER32/HID.DLL/SETUPAPI/SHELL32 — talks to real HID hardware via SETUPAPI/HID.DLL, consistent with a genuine Konami cabinet-input driver, not a spice2x emulation shim. | (none — leaf) |
| `modules/libacio.dll` | 65,536 B | **IN-SCOPE** | plain-C (no C++ mangling), 44 export(s) | Byte-identical export/import signature to top-level libacio.dll (44 ac_io_* exports, USER32+KERNEL32 only); duplicate copy kept under modules/ for AC-IO module loading. Same Konami original classification. | (none — leaf) |
| `stubs/64/nvEncodeAPI64.dll` | 12,800 B | **ALREADY-OSS** | plain-C (no C++ mangling), 2 export(s) | PE32+ (x86-64) stub exporting exactly NvEncodeAPICreateInstance/NvEncodeAPIGetMaxSupportedVersion, both returning a fixed error code — matches spice2x/stubs/nvEncodeAPI64.cpp verbatim (same two functions, same NV_ENC_ERR_INVALID_PTR constant). spice2x-built NVENC stub, not Konami or NVIDIA code. | (none — leaf) |
| `stubs/64/nvcuda.dll` | 13,824 B | **ALREADY-OSS** | plain-C (no C++ mangling), 21 export(s) | PE32+ stub exporting 21 cu* CUDA driver API functions, all returning CUDA_ERROR_NOT_SUPPORTED(801) — matches spice2x/stubs/nvcuda.cpp verbatim function-for-function. spice2x-built CUDA stub. | (none — leaf) |
| `stubs/64/nvcuvid.dll` | 13,312 B | **ALREADY-OSS** | plain-C (no C++ mangling), 13 export(s) | PE32+ stub exporting 13 cuvid* functions, all returning CUDA_ERROR_NOT_SUPPORTED(801) — matches spice2x/stubs/nvcuvid.cpp verbatim. spice2x-built NVCUVID stub. | (none — leaf) |
All 22 files export plain-C symbol tables with one exception: `deahook.dll` ## Cross-module dependency DAG (9 nodes, verified acyclic)
exports a single C++-mangled no-op (`?dummy@@YGHXZ`); every import across
all 22 DLLs is a plain-C symbol (no C++-mangled imports were found anywhere).
### REUSE OS DLLs referenced (not shipped as files, import targets only) Derived from each module's PE import table, restricted to edges where the
imported DLL is another shipped module. The external Kinect10/OS imports are
- `ADVAPI32.dll` excluded from the graph.
- `DINPUT8.dll`
- `DSOUND.dll`
- `GDI32.dll`
- `HID.DLL`
- `IMM32.dll`
- `IPHLPAPI.DLL`
- `KERNEL32.dll`
- `MSVCR80.dll`
- `OLEAUT32.dll`
- `PSAPI.DLL`
- `SETUPAPI.dll`
- `SHELL32.dll`
- `USER32.dll`
- `WINMM.DLL`
- `WINMM.dll`
- `WS2_32.dll`
- `d3d9.dll`
- `d3dx9_43.dll`
- `dbghelp.dll`
- `msvcrt.dll`
- `ole32.dll`
### Konami-family DLLs referenced but not shipped in this folder
`ksm.dll` and `kuc.dll` import from `kdu.dll`, `kmp.dll`, `kma.dll`
— further AVS2/ARK-family Konami modules that are **not present** in
`contents/` (likely resolved from a Windows system path or a different
install layer at runtime). They are out of scope for this inventory because
they are not shipped; noted here so a later task does not mistake their
absence for an omission in this table.
## Cross-DLL dependency DAG
Derived from each DLL's PE import table, restricted to edges where the
imported DLL name matches another file actually present under `contents/`
(OS DLLs and unshipped Konami-family DLLs are excluded from the graph, see
tables above). Verified **acyclic** by DFS over all 22 nodes (0 back-edges
found; see evidence log for the full edge list and algorithm run).
```mermaid ```mermaid
graph TD graph TD
Kinect10_dll(("Kinect10.dll")) libavs_win32_dll["libavs-win32.dll"]
arkkdm_dll["arkkdm.dll"] libavs_win32_ea3_dll["libavs-win32-ea3.dll"]
arkkdmtest_dll["arkkdmtest.dll"]
deahook_dll["deahook.dll"]
ess_dll["ess.dll"]
gamekdm_dll["gamekdm.dll"]
kbt_dll(("kbt.dll"))
kld_dll(("kld.dll"))
kmd_dll["kmd.dll"]
ksm_dll["ksm.dll"]
kuc_dll["kuc.dll"]
libacio_dll["libacio.dll"]
libacio_mbr_dll["libacio_mbr.dll"]
libafp_win32_dll["libafp-win32.dll"] libafp_win32_dll["libafp-win32.dll"]
libafputils_win32_dll["libafputils-win32.dll"] libafputils_win32_dll["libafputils-win32.dll"]
libavs_win32_ea3_dll["libavs-win32-ea3.dll"] ess_dll["ess.dll"]
libavs_win32_dll["libavs-win32.dll"] libacio_dll["libacio.dll"]
libinput_dll["libinput.dll"] arkkdm_dll["arkkdm.dll"]
modules_libacio_dll["modules/libacio.dll"] arkkdmtest_dll["arkkdmtest.dll"]
stubs_64_nvEncodeAPI64_dll(("stubs/64/nvEncodeAPI64.dll")) gamekdm_dll["gamekdm.dll"]
stubs_64_nvcuda_dll(("stubs/64/nvcuda.dll")) kinect(("Kinect10.dll (external MS NUI runtime)"))
stubs_64_nvcuvid_dll(("stubs/64/nvcuvid.dll")) libavs_win32_ea3_dll --> libavs_win32_dll
libafp_win32_dll --> libavs_win32_dll
libafputils_win32_dll --> libavs_win32_dll
libafputils_win32_dll --> libafp_win32_dll
ess_dll --> libavs_win32_dll
ess_dll --> libavs_win32_ea3_dll
arkkdm_dll --> libavs_win32_dll arkkdm_dll --> libavs_win32_dll
arkkdm_dll --> libavs_win32_ea3_dll arkkdm_dll --> libavs_win32_ea3_dll
arkkdm_dll --> ess_dll arkkdm_dll --> ess_dll
arkkdm_dll --> libacio_dll arkkdm_dll --> libacio_dll
arkkdm_dll --> libafp_win32_dll arkkdm_dll --> libafp_win32_dll
ess_dll --> libavs_win32_dll
ess_dll --> libavs_win32_ea3_dll
gamekdm_dll --> Kinect10_dll
gamekdm_dll --> libavs_win32_dll gamekdm_dll --> libavs_win32_dll
gamekdm_dll --> libafputils_win32_dll
gamekdm_dll --> libafp_win32_dll gamekdm_dll --> libafp_win32_dll
kmd_dll --> libavs_win32_dll gamekdm_dll --> libafputils_win32_dll
ksm_dll --> libavs_win32_dll gamekdm_dll -.external.-> kinect
ksm_dll --> libavs_win32_ea3_dll
kuc_dll --> libavs_win32_dll
kuc_dll --> libavs_win32_ea3_dll
libacio_mbr_dll --> libinput_dll
libacio_mbr_dll --> libavs_win32_dll
libafp_win32_dll --> libavs_win32_dll
libafputils_win32_dll --> libavs_win32_dll
libafputils_win32_dll --> libafp_win32_dll
libavs_win32_ea3_dll --> libavs_win32_dll
classDef inscope fill:#dff0d8,stroke:#3c763d;
classDef oss fill:#f2dede,stroke:#a94442;
class arkkdm_dll,arkkdmtest_dll,deahook_dll,ess_dll,gamekdm_dll,kmd_dll,ksm_dll,kuc_dll,libacio_dll,libacio_mbr_dll,libafp_win32_dll,libafputils_win32_dll,libavs_win32_ea3_dll,libavs_win32_dll,libinput_dll,modules_libacio_dll inscope;
class Kinect10_dll,kbt_dll,kld_dll,stubs_64_nvEncodeAPI64_dll,stubs_64_nvcuda_dll,stubs_64_nvcuvid_dll oss;
``` ```
Text form (child → parent/dependency): Text form (child → shipped dependency):
``` ```
libavs-win32.dll (root; depends on nothing shipped) libavs-win32.dll (root)
libacio.dll (root) libacio.dll (root; imports USER32/KERNEL32 only)
modules/libacio.dll (root; duplicate of libacio.dll) arkkdmtest.dll (root; imports OS D3D9/DINPUT8/DSOUND/GDI32/SHELL32/USER32 only)
libinput.dll (root)
deahook.dll (root; no shipped-DLL imports)
arkkdmtest.dll (root; no shipped-DLL imports — links OS D3D/DINPUT/DSOUND only)
Kinect10.dll (root; ALREADY-OSS, leaf)
kbt.dll, kld.dll (roots; ALREADY-OSS bemanitools stubs, leaves)
stubs/64/nv*.dll (roots; ALREADY-OSS spice2x stubs, leaves)
libavs-win32-ea3.dll -> libavs-win32.dll libavs-win32-ea3.dll -> libavs-win32.dll
libafp-win32.dll -> libavs-win32.dll libafp-win32.dll -> libavs-win32.dll
kmd.dll -> libavs-win32.dll
ess.dll -> libavs-win32.dll, libavs-win32-ea3.dll
ksm.dll -> libavs-win32.dll, libavs-win32-ea3.dll
kuc.dll -> libavs-win32.dll, libavs-win32-ea3.dll
libacio_mbr.dll -> libinput.dll, libavs-win32.dll
libafputils-win32.dll -> libavs-win32.dll, libafp-win32.dll libafputils-win32.dll -> libavs-win32.dll, libafp-win32.dll
ess.dll -> libavs-win32.dll, libavs-win32-ea3.dll
arkkdm.dll -> libavs-win32.dll, libavs-win32-ea3.dll, ess.dll, libacio.dll, libafp-win32.dll arkkdm.dll -> libavs-win32.dll, libavs-win32-ea3.dll, ess.dll, libacio.dll, libafp-win32.dll
gamekdm.dll -> Kinect10.dll (ALREADY-OSS), libavs-win32.dll, libafputils-win32.dll, libafp-win32.dll gamekdm.dll -> libavs-win32.dll, libafp-win32.dll, libafputils-win32.dll
(+ external Kinect10.dll, d3d9/d3dx9)
``` ```
AVS2 (`libavs-win32.dll`) is confirmed as the base of the graph: it is the `libavs-win32.dll` is the base of the graph (zero shipped dependencies,
only non-leaf node with zero incoming classification conflicts and the sole transitive ancestor of every other module). `gamekdm.dll` is the terminal
transitive ancestor of every other IN-SCOPE DLL. `libafp-win32.dll` game-logic node. All byte-exact export counts and edges beyond this
(`libafp`) depends only on AVS2, confirming the plan's stated shipped-module topology are `UNVERIFIED (pending re-check against
`libafp->libavs` edge. `gamekdm.dll` is confirmed as the terminal clean-release binary)` until re-derived from the clean `contents/modules/`
("imports from everything else") node described in the plan as files.
`gamekdm->all`: it is the only shipped DLL whose shipped-DLL import set
includes a file from every other dependency tier (AVS2 base,
libafputils/libafp tier, plus the ALREADY-OSS Kinect10.dll shim).
## IN-SCOPE reconstruct set (16 DLLs) ## Boot/entry into the game (official, from arkkdm.dll)
- `arkkdm.dll` On the cabinet the AVS2 runtime enters the game DLL (`arkkdm.dll`) through its
- `arkkdmtest.dll` standard AVS2 entry exports `dll_entry_init` / `dll_entry_main` (by-name
- `deahook.dll` exports at the tail of arkkdm.dll's export directory, ordinals 253/254, RVAs
- `ess.dll` `0x767c0` / `0x767b0`). `arkkdm.dll`'s `dll_entry_main` internally
- `gamekdm.dll` `LoadLibraryA("gamekdm.dll")` — with an `"arkkdmtest.dll"` test-build
- `kmd.dll` fallback — then `GetProcAddress("gameMain")`, and calls `gameMain(hInstance)`
- `ksm.dll` (cdecl). The `hInstance` is arkkdm.dll's own `HINSTANCE`, captured once in its
- `kuc.dll` `DllMain` on `DLL_PROCESS_ATTACH` and relayed through its internal
- `libacio.dll` `g_MainDllInfo.dllHMODULE` struct (see `docs/re/gamemain-binding.md`). No
- `libacio_mbr.dll` launcher, hook DLL, or emulator is part of this path.
- `libafp-win32.dll`
- `libafputils-win32.dll`
- `libavs-win32-ea3.dll`
- `libavs-win32.dll`
- `libinput.dll`
- `modules/libacio.dll`
## REUSE OS set ## IN-SCOPE reconstruct set (9 modules)
Not file-shipped; see "REUSE OS DLLs referenced" table above. No reconstruct All 9 shipped modules are Konami-authored and in scope:
work applies to these — they are satisfied by the existing Win32/D3D9/DirectX
runtime.
## ALREADY-OSS set (6 DLLs) — excluded from reconstruct set `libavs-win32.dll`, `libavs-win32-ea3.dll`, `libafp-win32.dll`,
`libafputils-win32.dll`, `ess.dll`, `libacio.dll`, `arkkdm.dll`,
- `Kinect10.dll` — owner's own Kinect SDK shim. `arkkdmtest.dll`, `gamekdm.dll`.
- `kbt.dll`, `kld.dll` — **bemanitools** (djhackersdev/bemanitools, open
source) "ikey" security-dongle stub DLLs, identified by the embedded PDB
path `d:\bemanitools\stubs\objfre_wxp_x86\i386\stubs.pdb` (CodeView RSDS
record, offset 0x55b in both files) and by `k_bt0002` disassembling to a
bare `ret` at RVA 0x11d7 — not the spice2x stubs.cpp implementation of
`k_bt0002` (which calls the supplied callback). Not a spice2x/spicetools
build; not a Konami original.
- `stubs/64/nvEncodeAPI64.dll`, `stubs/64/nvcuda.dll`, `stubs/64/nvcuvid.dll`
— spice2x `stubs/nvEncodeAPI64.cpp`, `stubs/nvcuda.cpp`, `stubs/nvcuvid.cpp`
(verbatim function-for-function match, including error-code constants).
## deahook.dll origin (explicit finding)
`deahook.dll` is **not** a spice2x/spicetools artifact. A full-text grep of
every `.cpp`/`.h`/`.txt`/`.md`/`.def` file in both shipped source tarballs
(`spice2x-master.tar.gz`, `spicetools-master.tar.gz`) for "deahook" or
"DEALibacio" returns zero hits. spice2x's own Dance Evolution Arcade (the
KDM-family game code is `games::dea`) integration in
`spice2x/games/dea/dea.cpp` only `try_library()`-loads `gamekdm.dll` and
probes `Kinect10.dll`; it never touches a `deahook.dll`/`DEALibacio` symbol.
`deahook.dll`'s own PE export directory records its internal module name as
**"DEALibacio.dll"**, and its only imports are `GetAsyncKeyState` (USER32)
plus the standard MSVC CRT/kernel32 startup set — a minimal key-hook DLL
tied to the ACIO (amusement I/O) layer.
**What this evidence proves and does not prove:** it proves `deahook.dll` is
not a spice2x/spicetools build (absence from both shipped OSS source trees)
and that it is an ACIO-layer native hook (from its import surface and
internal module name). It does **not** prove Konami authorship — absence
from the two identified OSS projects' source is not positive evidence of
who wrote the binary. The exact author is **unresolved** from the evidence
gathered here. It is classified **IN-SCOPE** conservatively because it is a
game-specific native hook that is neither an OS DLL nor matched to any
identified OSS project — not because Konami authorship has been
established.
## Reconstruction order (topological, acyclic) ## Reconstruction order (topological, acyclic)
One valid topological order over the 16 IN-SCOPE nodes (dependencies before 1. `libavs-win32.dll` — AVS2 base (no shipped dependencies)
dependents): 2. `libavs-win32-ea3.dll` — AVS2 ea3 extension
3. `ess.dll` — depends on AVS2 + ea3
1. `libavs-win32.dll` 4. `libacio.dll` — root (OS imports only)
2. `libavs-win32-ea3.dll` 5. `libafp-win32.dll` — depends on AVS2
3. `ess.dll` 6. `libafputils-win32.dll` — depends on AVS2 + libafp
4. `libacio.dll` 7. `arkkdm.dll` — depends on AVS2/ea3/ess/libacio/libafp
5. `libafp-win32.dll` 8. `arkkdmtest.dll` — root (OS imports only)
6. `arkkdm.dll` 9. `gamekdm.dll` — primary target; depends on AVS2/libafp/libafputils
7. `arkkdmtest.dll` (+ external Kinect10.dll)
8. `deahook.dll`
9. `libafputils-win32.dll`
10. `gamekdm.dll`
11. `kmd.dll`
12. `ksm.dll`
13. `kuc.dll`
14. `libinput.dll`
15. `libacio_mbr.dll`
16. `modules/libacio.dll`
Rationale for grouping:
1. **Tier 0 — AVS2 base**: `libavs-win32.dll` has zero shipped-DLL
dependencies and is imported (directly or transitively) by every other
IN-SCOPE DLL. Reconstruct first.
2. **Tier 1 — AVS2 extensions / first-tier libraries**: `libavs-win32-ea3.dll`,
`ess.dll`, `libacio.dll`, `libafp-win32.dll` depend only on AVS2 (plus,
for `ess.dll`, on `libavs-win32-ea3.dll` which is reconstructed
immediately before it in this order).
3. **Tier 2 — engine/library consumers**: `arkkdm.dll`, `arkkdmtest.dll`,
`deahook.dll`, `libafputils-win32.dll` consume Tier 0/1 libraries (or, for
`arkkdmtest.dll`/`deahook.dll`, only OS DLLs).
4. **Tier 3 — top-level game DLL**: `gamekdm.dll`, the primary reconstruction
target, consuming AVS2, `libafputils-win32.dll`, and `libafp-win32.dll`
(plus the ALREADY-OSS `Kinect10.dll` shim).
5. **Tier 4 — independent Konami modules**: `kmd.dll`, `ksm.dll`, `kuc.dll`
depend only on AVS2/AVS2-ea3 and are independent of the `gamekdm`/`arkkdm`
chain; can be reconstructed in parallel with tiers 2–3 once Tier 0/1 is
done.
6. **Tier 5 — peripheral/IO modules**: `libinput.dll` (root), then
`libacio_mbr.dll` (depends on `libinput.dll` + AVS2), then
`modules/libacio.dll` (duplicate of `libacio.dll`, already covered in
Tier 1 — reconstructing `libacio.dll` once satisfies both locations).
Acyclicity: confirmed by DFS cycle detection over all 22 nodes (shipped +
non-shipped-but-classified) with zero cycles found; see evidence log for the
full per-node visit trace.
## Must-NOT verification
No REUSE OS or ALREADY-OSS DLL appears in the "IN-SCOPE reconstruct set"
list above. Cross-checked programmatically: the 16-entry IN-SCOPE list and
the 6-entry ALREADY-OSS list are disjoint and together with the (empty,
non-file) REUSE OS set cover all 22 shipped DLLs exactly once.
+2 -2
View File
@@ -30,8 +30,8 @@ clang-cl cross-check) never has to guess. Apply them by origin:
(the game's `avs2` / `avfs` style imports and callbacks) and for anything the (the game's `avs2` / `avfs` style imports and callbacks) and for anything the
original declared `__cdecl`, which is MSVC's default for free functions. original declared `__cdecl`, which is MSVC's default for free functions.
- `GK_STDCALL`: callee-cleaned stdcall. Use for the Win32-style boundaries: - `GK_STDCALL`: callee-cleaned stdcall. Use for the Win32-style boundaries:
Kinect10 (`Kinect10.dll`) and Direct3D 9 (`d3d9.dll`) entry points and any the external Microsoft NUI runtime (`Kinect10.dll`), Direct3D 9 (`d3d9.dll`)
`WINAPI`/`CALLBACK` the original went through. entry points, and any `WINAPI`/`CALLBACK` the original went through.
- `GK_THISCALL`: MSVC thiscall (first arg `this` in `ecx`, callee-cleaned). Use - `GK_THISCALL`: MSVC thiscall (first arg `this` in `ecx`, callee-cleaned). Use
for internal non-virtual member functions reconstructed as free functions, and for internal non-virtual member functions reconstructed as free functions, and
for any method whose disasm passes `this` in `ecx` and cleans its own stack. for any method whose disasm passes `this` in `ecx` and cleans its own stack.
+3 -3
View File
@@ -85,18 +85,18 @@ Inspect the final PE imports and linker inputs, then run the mock host in
a directory without original DLLs. T17 evidence lives in a directory without original DLLs. T17 evidence lives in
`/home/athapa/kdm-re/.omo/evidence/gamekdm-decomp-linux/task-17.log`. `/home/athapa/kdm-re/.omo/evidence/gamekdm-decomp-linux/task-17.log`.
## Final Windows / spice2x full-game QA ## Final cabinet/original-binary runtime full-game QA
Only begin this checklist with a complete, stub-free build and the full Only begin this checklist with a complete, stub-free build and the full
coverage/reachability and dependency audits passed. Preserve a separate coverage/reachability and dependency audits passed. Preserve a separate
known-good hybrid installation for rollback. Record build/source hashes, known-good hybrid installation for rollback. Record build/source hashes,
rvadb hash, Windows version, spice2x version/configuration, Kinect driver, rvadb hash, Windows version, Kinect runtime/driver,
GPU/driver, input mappings, logs, and screenshots with each result. GPU/driver, input mappings, logs, and screenshots with each result.
- [ ] Stage the complete pure build in an isolated game directory; remove - [ ] Stage the complete pure build in an isolated game directory; remove
original game/companion DLLs from its loader search paths. Confirm original game/companion DLLs from its loader search paths. Confirm
PE32 ABI, gameMain name/ordinal/calling convention and required exports. PE32 ABI, gameMain name/ordinal/calling convention and required exports.
- [ ] Launch with the user's normal spice2x configuration. Inspect loaded - [ ] Launch through the cabinet/original-binary runtime. Inspect loaded
modules and dynamic-load traces: no original binary or proxy/detour. modules and dynamic-load traces: no original binary or proxy/detour.
Boot, asset loading, attract mode and title/menu navigation succeed. Boot, asset loading, attract mode and title/menu navigation succeed.
- [ ] Check service/test menu, calibration, coin/start, cabinet buttons, - [ ] Check service/test menu, calibration, coin/start, cabinet buttons,
+15 -9
View File
@@ -105,9 +105,15 @@ tools/gen_importlibs.sh
# tools/gen_importlibs.sh "/path/to/KDM-.../contents" # tools/gen_importlibs.sh "/path/to/KDM-.../contents"
``` ```
This runs `gendef` then `i686-w64-mingw32-dlltool` for each in-scope companion This runs `gendef` then `i686-w64-mingw32-dlltool` for the seven shipped Konami
and writes `re/importlibs/lib<name>.dll.a`. The stdcall companions (`arkkdm`, modules in its current map and the external Microsoft `Kinect10.dll` NUI
`Kinect10`) get `--kill-at`; see `docs/companion-conventions.md` for why. runtime dependency of `gamekdm.dll`, writing `re/importlibs/lib<name>.dll.a`.
`arkkdm` and external `Kinect10` get `--kill-at`; see
`docs/companion-conventions.md` for why. The script currently expects all
inputs in one directory, so these historical commands need adjustment for
the clean-release layout: the nine Konami modules are in `contents/modules/`
and the external NUI runtime is supplied separately. See the
[official inventory](companion-inventory.md).
## 4. Build the proxy and reconstructed slice (T4 + T11) ## 4. Build the proxy and reconstructed slice (T4 + T11)
@@ -209,14 +215,14 @@ The Phase-0 `gameMain` is a forwarding proxy: it only resolves the original
`gamekdm_orig.dll` when actually called, so loading the rebuilt DLL on its own `gamekdm_orig.dll` when actually called, so loading the rebuilt DLL on its own
is a valid smoke test and needs no original present. is a valid smoke test and needs no original present.
## 6. Deploy to the Windows / spice2x rig (optional, deferred) ## 6. Deploy to the cabinet/original-binary runtime (optional, deferred)
In-game QA on the real spice2x rig is a later integration milestone and is not In-game QA on the cabinet/original-binary runtime is a later integration milestone and is not
part of the reproducible Linux build above. When it lands: rename part of the reproducible Linux build above. When it lands: rename
`build/gamekdm.dll` to the launcher's expected name, keep the original beside it `build/gamekdm.dll` for the reconstruction cutover, keep the original beside it
as `gamekdm_orig.dll` for the proxy to forward into, and launch through the as `gamekdm_orig.dll` for the proxy to forward into, and load it through the
game's normal `gamestart.bat` / `launcher.exe` path. Treat this as deferred; the cabinet/original-binary runtime. Treat this as deferred; the steps 2 through 5
steps 2 through 5 chain is the complete, self-contained verification. chain is the complete, self-contained verification.
## One-shot reference ## One-shot reference
+121 -230
View File
@@ -1,264 +1,155 @@
# gamekdm.dll `gameMain` binding: how it is found and called, and the `hInstance` argument # `gamekdm.dll` `gameMain` binding and `hInstance` provenance
Scope: the boot path from spice2x/arkkdm's launcher down to the single call into gamekdm.dll's Scope: the official binding path from the AVS2 runtime's entry into
exported `gameMain`. Findings are cross-referenced between the Linux disassembly of the shipped `arkkdm.dll` to the call of `gamekdm.dll`'s exported `gameMain`. The evidence
Windows binaries (`objdump -d/-p/-s`, i386 PE) and the spice2x source (`spice2x-master.tar.gz`, described here comes from the official game modules' PE metadata, strings, and
extracted from `src/` next to the binaries). Full raw transcript: disassembly.
`.omo/evidence/gamekdm-decomp-linux/task-5.log`.
Binaries analyzed (all from ## Integrity boundary
`/mnt/f/Users/Aaron Thapa/Downloads/KDM-2016021900/contents/`):
- `launcher.exe` (PE32, image base `0x01000000`) — the generic AVS launcher, invoked as Earlier reverse engineering used an installed tree whose `arkkdm.dll`,
`launcher -k deahook.dll arkkdm.dll` by `gamestart.bat`. `libacio.dll`, and `gamekdm.dll` byte sizes may differ from the clean
- `arkkdm.dll` (PE32, image base `0x10000000`) — the DEA/KDM "ark" game-glue DLL that spice2x KDM-2016021900 release. Therefore, any exact byte count, export count, or
loads as the AVS game DLL (`avs::game::DLL_NAME`). address from that installed copy which is not part of the clean-binary facts
- `deahook.dll` — a small hook DLL loaded by the launcher before `arkkdm.dll`; exports only listed below is **UNVERIFIED (pending re-check against clean-release binary)**.
`GetProcAddress`/`LoadLibraryA`/`LoadLibraryExW` forwarders per its import/export tables, not No new numeric values are inferred in this document.
involved in the `gameMain` resolution itself.
- `/home/athapa/ghidra/gamekdm.dll` — the original game DLL whose `gameMain` export is the
target of this binding (used only to confirm the printed diagnostic string and parameter
shape, not disassembled beyond its entry stub).
## (a) Name vs. ordinal: binding is by NAME at every hop, not by ordinal The clean-binary facts retained here are:
There are two separate binding hops in this boot path, and both resolve by exported **name** - `arkkdm.dll` exports `dll_entry_init` by name at ordinal 253, RVA `0x767c0`.
string through `GetProcAddress`, never by ordinal: - `arkkdm.dll` exports `dll_entry_main` by name at ordinal 254, RVA `0x767b0`.
- `gamekdm.dll` exports `gameMain` at RVA `0x9e20` / VA `0x10009e20`.
- `gameMain` is cdecl and takes one `void *` argument.
**Hop 1 — spice2x (AVS launcher) → arkkdm.dll.** spice2x's `avs::game` layer only ever knows ## (a) Hop 1: AVS2 runtime to `arkkdm.dll`
two entry point names, `"dll_entry_init"` and `"dll_entry_main"`:
``` The AVS2 runtime enters `arkkdm.dll` through its standard AVS2 entry exports:
spice2x/avs/game.cpp:13 const char ENTRY_INIT_NAME[] = "dll_entry_init";
spice2x/avs/game.cpp:14 const char ENTRY_MAIN_NAME[] = "dll_entry_main"; ```text
spice2x/avs/game.cpp:98 dll_entry_init = (ENTRY_INIT_T) libutils::get_proc(DLL_INSTANCE, ENTRY_INIT_NAME); arkkdm.dll!dll_entry_init ordinal 253 RVA 0x767c0
spice2x/avs/game.cpp:99 dll_entry_main = (ENTRY_MAIN_T) libutils::get_proc(DLL_INSTANCE, ENTRY_MAIN_NAME); arkkdm.dll!dll_entry_main ordinal 254 RVA 0x767b0
spice2x/util/libutils.cpp:128 FARPROC libutils::get_proc(HMODULE module, LPCSTR proc) {
spice2x/util/libutils.cpp:129 auto value = GetProcAddress(module, proc);
``` ```
`launcher/launcher.cpp:1191-1192` sets `avs::game::DLL_NAME = "arkkdm.dll"` once Both symbols are present in `arkkdm.dll`'s PE name-pointer table, so they are
`check_dll("arkkdm.dll")` succeeds, and `launcher/launcher.cpp:1888` makes the single top-level by-name exports rather than ordinal-only exports. The ordinals identify their
call `avs::game::entry_main()` that triggers the chain below. `entry_init`/`entry_main` even export-table entries; they do not imply an ordinal-only call.
re-resolve the proc address on every call and log `"... is hooked"` if it changed
(`avs/game.cpp:103-125`), which is defensive **name** re-resolution, not ordinal lookup.
Confirmed on the arkkdm.dll side: `objdump -p arkkdm.dll` shows exactly two ordinal/name pairs After initialization, the AVS2 runtime calls
at the tail of its export directory (ordinal base 1, Hint/Name table present — i.e. these are `arkkdm.dll!dll_entry_main`. Everything from that point through the invocation
real by-name exports, not ordinal-only): of `gameMain` is implemented inside `arkkdm.dll`.
``` ## (b) Hop 2: `arkkdm.dll` to `gameMain`
[ 253] +base[ 254] 00fd dll_entry_init
[ 254] +base[ 255] 00fe dll_entry_main
```
(Export Address Table RVAs: `dll_entry_init` = RVA `0x000767c0` → VA `0x100767c0`;
`dll_entry_main` = RVA `0x000767b0` → VA `0x100767b0`, image base `0x10000000`.)
**Hop 2 — arkkdm.dll → gamekdm.dll's `gameMain`.** This hop is **entirely internal to `arkkdm.dll` contains a two-candidate payload resolver. Its production
arkkdm.dll**; spice2x never touches it (see part (c)). Disassembling the function arkkdm.dll's candidate is `gamekdm.dll`; its test-build fallback is `arkkdmtest.dll`.
`dll_entry_main` ultimately calls (VA `0x10001340`) shows a literal `GetProcAddress` call Conceptually, the official code performs:
passing the ASCII string `"gameMain"`:
``` ```c
10001396: 68 dc 09 09 10 push 0x100909dc ; &"gameMain" HMODULE candidate = LoadLibraryA("gamekdm.dll");
1000139b: 56 push esi ; esi = HMODULE of the candidate library if (candidate == NULL) {
1000139c: ff 15 3c d1 07 10 call DWORD PTR ds:0x1007d13c ; import thunk = KERNEL32!GetProcAddress candidate = LoadLibraryA("arkkdmtest.dll");
100013a2: 85 c0 test eax,eax }
100013a4: 75 0e jne 0x100013b4 ; found -> call it (see part (b))
if (candidate != NULL) {
gameMain = GetProcAddress(candidate, "gameMain");
if (gameMain != NULL) {
gameMain(g_MainDllInfo.dllHMODULE);
}
}
``` ```
That the thunk at `0x1007d13c` really is `GetProcAddress` is independently confirmed by The actual implementation loops over the two literal module names. For each
arkkdm.dll's import directory (`objdump -p`): candidate it calls `LoadLibraryA`; after a successful load it passes the
literal string `"gameMain"` to `GetProcAddress`. It invokes only a successfully
resolved pointer.
``` This is standard Win32 dynamic linking with a production/test-build fallback.
DLL Name: KERNEL32.dll There is no custom export protocol between `arkkdm.dll` and the payload DLL.
0007d050 <none> 033f LoadLibraryW
0007d134 <none> 033c LoadLibraryA ## (c) `hInstance` is `arkkdm.dll`'s own module handle
0007d13c <none> 0245 GetProcAddress
The single argument passed to `gameMain` is not the handle returned while
loading `gamekdm.dll`. It is `arkkdm.dll`'s own `HINSTANCE` / `HMODULE`.
The value's provenance is:
1. The Windows loader calls `arkkdm.dll`'s `DllMain`.
2. On `DLL_PROCESS_ATTACH`, `DllMain` captures its `hinstDLL` argument.
3. `dll_entry_init` relays that captured value into the internal
`g_MainDllInfo.dllHMODULE` field.
4. The `dll_entry_main` path gives the `g_MainDllInfo` structure to the
internal payload resolver.
5. The resolver reads field zero, pushes that one value, and indirectly calls
the resolved `gameMain` pointer.
```text
arkkdm.dll DllMain hinstDLL
-> captured module-instance global
-> g_MainDllInfo.dllHMODULE
-> dll_entry_main payload resolver
-> gameMain(hInstance)
``` ```
and the string `"gameMain"` lives at VA `0x100909dc` in `.rdata` The adjacent diagnostic strings identify the structure as `MainDllInfo` and
(`objdump -s --start-address=0x10090870` shows `...67616d65 4d61696e 00000000...` = `"gameMain\0"` its first field as `dllHMODULE`. The initialization logic treats the value as
right after a `"gameInit\0"` string at `0x100909d0`; file-offset cross-check: `strings -a -t x set-once module identity: it stores the captured handle on the first
arkkdm.dll` independently reports `8f9dc gameMain`, and `0x100909dc − 0x1007d000 + 0x7c000 = initialization and has a warning path if a later value differs.
0x8f9dc` — the `.rdata` section's VMA-to-file-offset delta — matches exactly).
**Conclusion:** both the launcher→arkkdm.dll and arkkdm.dll→gamekdm.dll bindings are plain Consequently, `gameMain` receives the module instance assigned to
`GetProcAddress`-by-name. There is no ordinal-only export or ordinal-based call anywhere on this `arkkdm.dll`. It does not receive `gamekdm.dll`'s module handle.
path; the `(dll_entry_init, dll_entry_main)` pair happens to also carry low (253/254) sequential
ordinals in arkkdm.dll's export table, but spice2x (and arkkdm.dll's own internal resolver for
`gameMain`) always look them up by name string, never by ordinal number.
## (b) The `hInstance` argument: arkkdm.dll's own module HINSTANCE, not gamekdm.dll's ## (d) `gameMain` signature and calling convention
Tracing the single stack argument pushed into the resolved `gameMain` pointer `gameMain` is at RVA `0x9e20` / VA `0x10009e20` in `gamekdm.dll`. Its callable
(`10001340`-`100013d0`): shape is:
``` ```c
10001329: 8b 4d fc mov ecx,DWORD PTR [ebp-0x4] ; saved earlier = *(DWORD*)[struct ptr] /* cdecl; one argument */
100013b4: 8b 4d fc mov ecx,DWORD PTR [ebp-0x4] gameMain(void *hInstance);
100013b7: 51 push ecx ; the ONLY argument to gameMain
100013b8: ff d0 call eax ; eax = resolved gameMain address
``` ```
`[ebp-0x4]` was populated a few instructions earlier by dereferencing offset 0 of a The `arkkdm.dll` call site pushes exactly one argument before the indirect
caller-supplied struct pointer (`ebx`, received as this function's only parameter): call. `gameMain` reads that pointer as its first stack argument. Its return
paths use a bare `ret`, leaving argument cleanup to the caller; the caller
resets its own stack frame after the call. Those two sides agree on cdecl.
``` ## (e) Complete official binding chain
10001374: 8b 13 mov edx,DWORD PTR [ebx] ; struct->field0
10001379: 89 55 fc mov DWORD PTR [ebp-0x4],edx ```text
AVS2 runtime
-> arkkdm.dll!dll_entry_init
captures/relays arkkdm.dll's HINSTANCE
-> arkkdm.dll!dll_entry_main
-> arkkdm.dll internal candidate resolver
-> LoadLibraryA("gamekdm.dll")
fallback: LoadLibraryA("arkkdmtest.dll")
-> GetProcAddress(candidate, "gameMain")
-> gameMain(g_MainDllInfo.dllHMODULE)
``` ```
The struct passed in is a fixed global at VA `0x1014b9f8` (the only caller of this function, This establishes the two important boundaries:
`arkkdm.dll`'s exported `dll_entry_main` path, pushes it explicitly: `10002573: push
0x1014b9f8`). The `.rdata` strings right next to the code that writes this global name it
**`MainDllInfo`**, with field0 called `dllHMODULE`:
``` - AVS2 calls the official AVS2 entry export in `arkkdm.dll`.
10090884 (referenced at 10076800): "1st... MainDllInfo::setDllHMODULE : dllHMODULE %p, hModule %p\n" - `arkkdm.dll` itself loads the payload, resolves `gameMain`, and supplies its
100908c0 (referenced at 10076813): "!!!WARNNING!!! MainDllInfo::setDllHMODULE : dllHMODULE %p, hModule %p\n" own captured module instance.
```
And the code that performs this first-time set, inside arkkdm.dll's exported `dll_entry_init` ## Deferred clean-binary checks
(VA `0x100767c0`, the function `objdump -p` lists as ordinal 253):
``` The control flow and named interface above are official and derivable from the
100767eb: a1 f8 b9 14 10 mov eax,ds:0x1014b9f8 ; g_MainDllInfo.dllHMODULE (0 until first set) game binaries. Older instruction addresses, data addresses, thunk addresses,
100767f0: 85 c0 test eax,eax file offsets, raw byte sequences, and exact export totals not repeated as
100767f2: 75 13 jne 0x10076807 ; already set -> compare & warn path clean-binary facts in this document are **UNVERIFIED (pending re-check against
100767f4: a1 34 51 0f 10 mov eax,ds:0x100f5134 ; <- arkkdm.dll's own captured hInstDLL clean-release binary)**.
100767fb: a3 f8 b9 14 10 mov ds:0x1014b9f8,eax ; g_MainDllInfo.dllHMODULE = that value
```
`0x100f5134` is populated by arkkdm.dll's own `DllMain`, which this disassembly shows checking The following details do not affect the binding contract and remain deferred:
`fdwReason == DLL_PROCESS_ATTACH (1)` and, only in that case, storing its first parameter
(`hinstDLL`) there:
``` - whether `g_MainDllInfo.dllHMODULE` is reset across repeated entry calls;
10076793: 8b 45 0c mov eax,DWORD PTR [ebp+0xc] ; fdwReason (DllMain arg 2) - the purpose of surrounding generic initialization and logging guards;
10076796: 48 dec eax - a live cabinet observation of the pointer value received by `gameMain`.
10076797: 75 08 jne 0x100767a1 ; skip unless fdwReason == 1
10076799: 8b 45 08 mov eax,DWORD PTR [ebp+0x8] ; hinstDLL (DllMain arg 1)
1007679c: a3 34 51 0f 10 mov ds:0x100f5134,eax ; stash it
```
**Conclusion:** the `void* hInstance` that `gamekdm.dll`'s `gameMain(void* hInstance)` receives ## Cross-references
and logs as `gameMain hInstance = %p` is **arkkdm.dll's own `HINSTANCE`/`HMODULE`** — the handle
the Windows loader assigned to `arkkdm.dll` when it was mapped, captured once in `DllMain` on
`DLL_PROCESS_ATTACH` and handed down through the `dll_entry_init` → `g_MainDllInfo.dllHMODULE` →
`dll_entry_main` → `gameMain` chain. It is **not** `gamekdm.dll`'s own module handle (gamekdm.dll
never receives or computes its own `HMODULE` on this path) and it is **not** any
spice2x/launcher-level handle — spice2x's `avs::game::DLL_INSTANCE` (the `HINSTANCE` of
`arkkdm.dll` as seen by spice2x, set via `LoadLibraryW` at `avs/game.cpp:94`) and arkkdm.dll's
own internally-captured `hInstDLL` are the same underlying OS handle value (both are "the
HINSTANCE the loader gave arkkdm.dll"), but spice2x's copy of that value is never passed to
`gameMain` directly — arkkdm.dll re-derives and forwards its own copy independently via the
`DllMain` → `g_MainDllInfo` relay described above. The `fdwReason == 1` guard plus the
"already set" warning string (`!!!WARNNING!!! ... dllHMODULE %p, hModule %p`) show this value is
latched exactly once per process and is treated as a stable per-DLL identity handle, matching
the Win32 convention that `HINSTANCE == HMODULE` for a mapped module.
## (c) Richer-than-plain-GetProcAddress mechanism: a 2-candidate module fallback, no custom protocol - [`docs/spec/01-runtime-boot.md`](../spec/01-runtime-boot.md) — official
runtime, nine-module set, configuration, and startup summary.
spice2x's own role stops at loading `gamekdm.dll` so its hook DLL (`deahook.dll`/attached hooks) - [`docs/companion-inventory.md`](../companion-inventory.md) — clean-release
can bind to it early — it never resolves or calls `gameMain` itself: inventory and official dependency DAG.
```
spice2x/games/dea/dea.cpp:16 libutils::try_library(MODULE_PATH / "gamekdm.dll");
```
`libutils::try_library` is a bare `LoadLibraryW`/`LoadLibraryA` wrapper
(`spice2x/util/libutils.cpp:82-88`) with no accompanying `get_proc`/`GetProcAddress` call for
`gamekdm.dll` anywhere in the spice2x tree (`rg 'gameMain'` across the whole source tree matches
only an unrelated comment in `spice2x/games/we/we.cpp:137` about a different game's `gameMain`
sleeping — Winning Eleven, not DEA/KDM). All resolution and invocation of `gameMain` happens
inside **arkkdm.dll** itself, inside the function at VA `0x10001340`. `dll_entry_main`
(`100767b0`) reaches it with a plain, unconditional jump — not a call — straight into the
function at `0x100024c0` (`100767b0: jmp 0x100024c0`); that function's own code then does the
actual resolve-and-invoke, at `10002578: call 0x10001340`. (`0x10076800` is a separate,
earlier code path inside `dll_entry_init`/`DllMain`'s `MainDllInfo` bookkeeping — it only pushes
a diagnostic-log string and is not part of this call chain; likewise `0x10002440`, called later
in `0x100767b0`'s own function at `1007682f`, is a separate initialization step unrelated to the
`gameMain` resolve-and-call at `0x10002578`/`0x10001340`.)
That function is slightly richer than a single `LoadLibraryA`+`GetProcAddress` pair: it loops
over a small fixed array of **two** candidate module-name strings before giving up
(`10001369: mov edi,DWORD PTR [eax*4+0x100b7d60]` with loop bound `cmp eax,0x2`), reading them
from a `.data` pointer table:
```
.data @ 0x100b7d60: dd 0x1009032c, 0x10090338
0x1009032c -> "gamekdm.dll" (confirmed: strings -a -t x arkkdm.dll -> `8f32c gamekdm.dll`;
0x1009032c - 0x1007d000 + 0x7c000 = 0x8f32c)
0x10090338 -> "arkkdmtest.dll" (objdump -s --start-address=0x10090330: "...arkkdmtest.dll\0")
```
For each candidate it calls its own `LoadLibraryA` wrapper (`call 0x100013e0`, which itself
calls the `0x1007d134` import thunk = `LoadLibraryA`), and only on a successful load does it
call `GetProcAddress(hModule, "gameMain")` (`0x1007d13c`) and, on success, invoke the resolved
pointer with the `hInstance` argument from part (b); on failure for both candidates it returns
an error code without calling anything. The identical two-candidate loop pattern
(`gamekdm.dll` / `arkkdmtest.dll`) is reused immediately beforehand to resolve a second,
unrelated export named `"gameInit"` (VA `0x100012a0`-`0x10001338`, same `0x100b7d60` table),
which this task did not need to trace further.
**Conclusion:** the "richer than plain `GetProcAddress`" element is a small build-variant
fallback (production `gamekdm.dll` vs. a `arkkdmtest.dll` test build) baked into arkkdm.dll's own
resolver, not a custom linking/export protocol layered over `GetProcAddress` — the underlying
lookup and call are standard `LoadLibraryA` + `GetProcAddress` + indirect `call`.
## (d) `gameMain`'s calling convention: cdecl
**Calling convention: cdecl (verified, bare ret at 0x10009e91/0x10009ea5).** `gamekdm.dll`
exports exactly one symbol, `gameMain`, at RVA `0x9e20` (VA `0x10009e20` in
`/home/athapa/ghidra/gamekdm.dll`). Disassembling its full body
(`objdump -d -M intel --start-address=0x10009e20 --stop-address=0x10009eb0`) shows both of its
return paths ending in a **bare** `ret` with no immediate operand:
```
10009e8d: 5f pop edi
10009e8e: 33 c0 xor eax,eax
10009e90: 5e pop esi
10009e91: c3 ret
...
10009ea1: 5f pop edi
10009ea2: 33 c0 xor eax,eax
10009ea4: 5e pop esi
10009ea5: c3 ret
```
`gameMain` takes a single pointer argument (`hInstance`, read off `[esp+4]` at function entry:
`10009e28: mov edi,DWORD PTR [esp+0xc]` after two earlier `push`es shift the frame, equivalent to
the original `[esp+4]` at entry). A `ret` with no `N` operand pops only the return address and
leaves argument cleanup to the **caller** — the defining trait of **cdecl**, as opposed to
`stdcall`/`ret 4`, where the callee itself would pop the single 4-byte argument before
returning. Correspondingly, the call site into the resolved `gameMain` pointer (part (b), `100013b4-100013b8:
push ecx; call eax`) never issues an explicit `add esp,4` after the call to pop the argument;
instead the caller's own frame-pointer-based epilogue (`100013bf: mov esp,ebp`) resets `esp`
wholesale, discarding the pushed argument along with the rest of the local frame — the caller,
not the callee, owns stack cleanup, consistent with cdecl. (`0x10001000` is unrelated code
elsewhere in arkkdm.dll's resolver stub, not `gameMain`'s body — `gameMain` itself lives at
`0x10009e20` in `gamekdm.dll`, a different binary.)
## Unresolved / deferred points
- This was all verified statically from the Linux-hosted `objdump` disassembly and the spice2x
C++ source; no in-game Windows run was performed to confirm the live `%p` value printed by
`gameMain hInstance = %p` in `/home/athapa/ghidra/gamekdm.dll` matches arkkdm.dll's load
address at runtime (explicitly deferred/optional per task scope).
- The exact caller chain from `dll_entry_main` (`0x100767b0: jmp 0x100024c0`) into the function
at `0x100024c0`, whose own `10002578: call 0x10001340` reaches the `gameMain` resolver, was
walked instruction-by-instruction (full addresses cited above and in the evidence log) but the
surrounding static-initializer bookkeeping
(`0x1014c1e8` flag, `0x10001d20`/`0x100562bf` calls) is generic AVS runtime boilerplate
(locale/logging init guards) and was not further reverse engineered, as it does not affect the
`gameMain` binding or argument semantics.
- Whether `g_MainDllInfo.dllHMODULE` (`0x1014b9f8`) is ever reset or reused across multiple
`dll_entry_main` invocations in one process lifetime was not traced beyond the single
"set-once, warn-if-different-later" guard shown above; this task only needed the first,
steady-state value.
## Evidence
Full `objdump -d` / `-p` / `-s` / `strings` output and the matching spice2x source excerpts are
in `.omo/evidence/gamekdm-decomp-linux/task-5.log`.
+79 -104
View File
@@ -1,7 +1,7 @@
# 00 - Overview and High-Level Architecture # 00 - Overview and High-Level Architecture
This is the entry point to the full technical specification of **DanceEvolution This is the entry point to the full technical specification of **DanceEvolution
Arcade** (internal Konami codename **"Game_DaM"**, repo shorthand **KDM**) and Arcade** (official e-amusement model **KDM**) and
of the reconstruction codebase that rebuilds its main logic DLL from static and of the reconstruction codebase that rebuilds its main logic DLL from static and
dynamic analysis. Every claim here is cited to a real artifact. Where something dynamic analysis. Every claim here is cited to a real artifact. Where something
could not be checked, it is marked **UNVERIFIED**. No copyrighted creative could not be checked, it is marked **UNVERIFIED**. No copyrighted creative
@@ -20,31 +20,21 @@ the game is, the platform it runs on, the module stack, and the three
DanceEvolution Arcade (DEA) is a Konami arcade dance game driven by a Kinect DanceEvolution Arcade (DEA) is a Konami arcade dance game driven by a Kinect
sensor: the player dances in front of a depth camera and the game scores the sensor: the player dances in front of a depth camera and the game scores the
match between the tracked body pose and the choreography. The game logic lives match between the tracked body pose and the choreography. The game logic lives
in **`gamekdm.dll`**, a 3,369,104-byte PE32 (x86) DLL whose single export is in **`gamekdm.dll`**, a 3.19 MB PE32 (x86) DLL whose single export is
`gameMain` (docs/companion-inventory.md row `gamekdm.dll`). That export sits at `gameMain` (docs/companion-inventory.md, per-module table). Its previously
RVA `0x00009e20`, i.e. absolute `0x10009e20` against the image base reported per-byte size and export RVA `0x00009e20` / VA `0x10009e20` are
`0x10000000` (objdump of `gamekdm.dll`: `[ 1] 00009e20 Export RVA` / **UNVERIFIED (pending re-check against clean-release binary)**; the RVA is
`0000 gameMain`; base confirmed by `re/rvadb.json` `image_base = "0x10000000"`). retained only as a reconstruction locator, not clean-release evidence
(`re/rvadb.json`).
The "DEA" identity is corroborated by the shipped launcher chain and by the The build specified here is the clean **`KDM-2016021900`** release
spice2x integration that loads this exact DLL: spice2x's own game family for (docs/companion-inventory.md title and "What the clean release contains").
this title is `games::dea`, and its `games/dea/dea.cpp` `try_library()`-loads The official artifacts ground its DEA/KDM identity without any launcher, hook,
`gamekdm.dll` and probes `Kinect10.dll` (docs/companion-inventory.md, or emulator evidence: `prop/eamuse-config.xml` carries the e-amusement model;
"deahook.dll origin" finding). The build analyzed here is the the clean release has no `ea3-config.xml`; `arkkdm.dll` exposes the `arkKDM*`
**`KDM-2016021900`** distribution (docs/companion-inventory.md title line). API prefix; and the official file stems are `arkkdm.dll` and `gamekdm.dll`
(`contents/prop/eamuse-config.xml`, `contents/modules/arkkdm.dll`,
Within the binary, Konami's own module naming uses the **KDM** prefix (the ARK `contents/modules/gamekdm.dll`; docs/companion-inventory.md per-module table).
engine API exported by `arkkdm.dll` is `arkKDM`-prefixed, 255 plain-C exports;
docs/companion-inventory.md row `arkkdm.dll`). The hooking DLL records its
internal module name as **"DEALibacio.dll"** (docs/companion-inventory.md row
`deahook.dll`), which ties the "DEA" product name and the "KDM"/Libacio engine
naming together in one shipped artifact.
> Naming note: "Game_DaM" is the codename carried forward from prior RE notes as
> the internal project tag. The shipped artifacts verify **DEA** (product) and
> **KDM** (engine/module prefix); the literal string "Game_DaM" is treated as an
> internal codename and is **UNVERIFIED** against a specific byte offset in this
> section.
--- ---
@@ -52,87 +42,69 @@ naming together in one shipped artifact.
DEA targets **Win32 x86** and is built on Konami's **AVS2** middleware stack: DEA targets **Win32 x86** and is built on Konami's **AVS2** middleware stack:
- **AVS2 core** is `libavs-win32.dll` (517,264 B, 360 ordinal-style exports - **AVS2 core** is `libavs-win32.dll` (505.14 KB in the clean-release listing),
`XCd229cc...`), the root of the MAIN Konami middleware stack (`libafp-win32.dll the root of the official nine-module dependency graph. `libacio.dll` and
-> libavs-win32.dll`; `arkkdm.dll -> libavs-win32.dll`/`libafp-win32.dll`/ `arkkdmtest.dll` are the other shipped roots; neither imports another shipped
`ess.dll`/`libacio.dll`; `gamekdm.dll -> that stack`). Several shipped DLLs module (docs/companion-inventory.md, per-module table and dependency DAG).
are independent leaves that import no other shipped DLL instead of - **ea3** (e-amusement v3) extension is `libavs-win32-ea3.dll` (364.14 KB),
descending from it: `libacio.dll`, `libinput.dll`, `arkkdmtest.dll`, and importing `libavs-win32.dll` (docs/companion-inventory.md, dependency DAG).
`deahook.dll` each import only OS/DirectX DLLs (`objdump -p` on each, no
`DLL Name:` entry naming another shipped file; docs/companion-inventory.md
row `libavs-win32.dll`).
- **ea3** (e-amusement v3) extension is `libavs-win32-ea3.dll` (372,880 B, 139
exports), importing only `libavs-win32.dll` (same inventory, ea3 row).
- **ARK engine** is `arkkdm.dll` plus the AFP asset/graphics pipeline - **ARK engine** is `arkkdm.dll` plus the AFP asset/graphics pipeline
(`libafp-win32.dll`, 159 `afp_*` exports; `libafputils-win32.dll`, 162 (`libafp-win32.dll`, `libafputils-win32.dll`). Earlier export counts are
`afpu_*` exports). `gamekdm.dll` imports `libavs-win32.dll`, **UNVERIFIED (pending re-check against clean-release binary)**.
`gamekdm.dll` imports `libavs-win32.dll`,
`libafputils-win32.dll`, and `libafp-win32.dll` (inventory `gamekdm.dll` row). `libafputils-win32.dll`, and `libafp-win32.dll` (inventory `gamekdm.dll` row).
- **Kinect v1** is reached through `Kinect10.dll` (the Microsoft NUI v1 API). - **Kinect v1** is reached through `Kinect10.dll`, an external Microsoft
In this repo's runtime that DLL is an owner-authored shim that feeds synthetic Kinect-for-Windows NUI v1 runtime dependency named by `gamekdm.dll`'s import
frames; the game loads it as a normal dependency (`gamekdm.dll` imports table. It is not shipped in `contents/modules/` and is never a game module
`Kinect10.dll`; inventory `gamekdm.dll` and `Kinect10.dll` rows). The game (docs/companion-inventory.md, "External (non-shipped) dependencies").
only accepts a 4:3 image and runs its own skeleton selection/validity gate on
top of the published 20-joint NUI skeleton (game-internals.md §1, §2).
- **spice2x** is the arcade loader/emulation layer used to run the build off the
original cabinet. The shipped source tarballs `spice2x-master.tar.gz` and
`spicetools-master.tar.gz` under `contents/src/` are the provenance baseline
for classifying every companion DLL (docs/companion-inventory.md source line).
### Boot sequence (GAME-DIR `gamestart.bat`) ### Boot sequence (official `arkkdm.dll` entry)
The shipped `gamestart.bat` prepares NVRAM and raw-data directories, then hands The AVS2 runtime enters the official game DLL `arkkdm.dll` through its standard
off to the launcher: exports `dll_entry_init` and `dll_entry_main`. `dll_entry_main` internally
loads `gamekdm.dll` (with an `arkkdmtest.dll` test-build fallback), resolves
``` `gameMain`, and calls `gameMain(hInstance)` using `arkkdm.dll`'s captured
@launcher -k deahook.dll arkkdm.dll `HINSTANCE` (docs/companion-inventory.md, "Boot/entry into the game"). The
``` reported entry ordinals 253/254, RVAs `0x767c0`/`0x767b0`, and `gameMain` RVA
`0x9e20` are **UNVERIFIED (pending re-check against clean-release binary)**.
So the real entry is `launcher.exe` injecting `deahook.dll` (the DEALibacio ACIO
hook) and loading `arkkdm.dll` (the ARK engine), which in turn brings up the AVS2
stack and `gamekdm.dll`. The batch file also seeds `dev\nvram\coin.xml`,
`eacoin.xml`, `testmode-v.xml`, `libxml.xml` from `prop\`, and creates
`dev\raw\{bookkeeping,ranking,settings,log}` (GAME-DIR/gamestart.bat).
--- ---
## Module stack ## Module stack
The shipped build is **22 DLLs** (docs/companion-inventory.md completeness The clean release ships exactly **9 Konami modules** under `contents/modules/`
check). The IN-SCOPE Konami/middleware set is 16; the remaining 6 are ALREADY-OSS (docs/companion-inventory.md, "What the clean release contains"). Their
shims/stubs. The dependency DAG (verified acyclic by DFS over all 22 nodes; shipped-module dependency DAG is acyclic and stacks like this:
inventory "Cross-DLL dependency DAG") stacks like this, base at the bottom:
``` ```
+-----------------------------------------------+ game logic gamekdm.dll (gameMain)
loader | launcher.exe -> -k deahook.dll arkkdm.dll | (gamestart.bat) | | |
+-----------------------------------------------+ libavs libafp libafputils
| | |
game +----------------------------------------+ +-- libafp
logic | gamekdm.dll (gameMain) | 3.37 MB, 1 export
+----------------------------------------+
| | | |
engine/ arkkdm.dll libafputils libafp Kinect10.dll (NUI v1 shim)
assets (ARK/KDM) -win32.dll -win32.dll
| | |
AVS2 ext ess.dll libavs-win32-ea3.dll (e-amusement v3)
\________________|________________/
|
AVS2 base libavs-win32.dll (root; 360 exports)
peripheral: libacio.dll / libacio_mbr.dll / libinput.dll (AC-IO + HID) game entry arkkdm.dll
modules : kmd.dll / ksm.dll / kuc.dll (AVS2-family) / | | | \
OSS stubs : kbt.dll / kld.dll (bemanitools ikey), stubs/64/nv*.dll (spice2x) libavs ea3.dll ess.dll libacio libafp
| / |
+-----+ +-- libavs
test harness arkkdmtest.dll (root)
shipped roots libavs-win32.dll, libacio.dll, arkkdmtest.dll
external only Kinect10.dll (Microsoft NUI v1 runtime; not shipped)
``` ```
Key verified edges (inventory DAG, text form): `gamekdm.dll -> Kinect10.dll, The complete official set is `libavs-win32.dll`, `libavs-win32-ea3.dll`,
libavs-win32.dll, libafputils-win32.dll, libafp-win32.dll`; `arkkdm.dll -> `libafp-win32.dll`, `libafputils-win32.dll`, `ess.dll`, `libacio.dll`,
`arkkdm.dll`, `arkkdmtest.dll`, and `gamekdm.dll` (inventory "IN-SCOPE
reconstruct set"). Key shipped edges are `gamekdm.dll -> libavs-win32.dll,
libafputils-win32.dll, libafp-win32.dll`; `arkkdm.dll ->
libavs-win32.dll, libavs-win32-ea3.dll, ess.dll, libacio.dll, libafp-win32.dll`; libavs-win32.dll, libavs-win32-ea3.dll, ess.dll, libacio.dll, libafp-win32.dll`;
`libafp-win32.dll -> libavs-win32.dll`; `libavs-win32-ea3.dll -> `libafp-win32.dll -> libavs-win32.dll`; `libavs-win32-ea3.dll ->
libavs-win32.dll`. `libavs-win32.dll` is the root of the main middleware libavs-win32.dll`. `Kinect10.dll` is shown only as `gamekdm.dll`'s external
stack and a transitive ancestor of most IN-SCOPE DLLs, but not all: `libacio.dll`, Microsoft runtime import and is excluded from the nine-node graph
`libinput.dll`, `arkkdmtest.dll`, and `deahook.dll` are independent leaves that (docs/companion-inventory.md, dependency DAG).
import no other shipped DLL (see [`02-dll-architecture.md`](./02-dll-architecture.md)
dependency DAG). `gamekdm.dll` is the terminal node of the main stack.
--- ---
@@ -144,11 +116,12 @@ of mixing "how the shipped game behaves" with "what we rebuilt."
1. **The GAME** - observable product behavior and platform: what DEA does for a 1. **The GAME** - observable product behavior and platform: what DEA does for a
player, the Kinect data path, the AVS2/ARK/ea3 middleware it rides on, the player, the Kinect data path, the AVS2/ARK/ea3 middleware it rides on, the
boot chain, and the asset formats. Grounded in the shipped binaries, the official AVS2 entry path, and the asset formats. Grounded in the clean
batch file, and runtime introspection (game-internals.md §1-§5). release's binaries and `contents/{data,arkdata,prop}` trees
(docs/companion-inventory.md).
2. **The ORIGINAL binary codebase** - the shipped DLLs as reverse-engineering 2. **The ORIGINAL binary codebase** - the shipped DLLs as reverse-engineering
subjects: the 22-DLL inventory and dependency DAG, the gamekdm function/global subjects: the nine-module inventory and dependency DAG, the gamekdm function/global
map (9,728 functions in `re/rvadb.json`), and the subsystem breakdown decoded map (9,728 functions in `re/rvadb.json`), and the subsystem breakdown decoded
from Ghidra. This is "what Konami shipped," read back from disassembly. from Ghidra. This is "what Konami shipped," read back from disassembly.
@@ -166,15 +139,15 @@ this overview). Each is tagged with its primary dimension:
| # | Section | Dimension | | # | Section | Dimension |
|---|---------|-----------| |---|---------|-----------|
| 00 | [Overview and high-level architecture](./00-overview.md) (this file) | all three | | 00 | [Overview and high-level architecture](./00-overview.md) (this file) | all three |
| 01 | [Platform and AVS2/ea3/ARK middleware](./01-platform-and-middleware.md) | GAME | | 01 | [Runtime environment and official AVS2 startup](./01-runtime-boot.md) | GAME |
| 02 | [Companion DLL inventory and dependency DAG](./02-companion-dll-inventory.md) | ORIGINAL | | 02 | [Official module inventory and dependency DAG](./02-dll-architecture.md) | ORIGINAL |
| 03 | [Kinect / NUI data pipeline](./03-kinect-pipeline.md) | GAME | | 03 | [Kinect / NUI data pipeline](./03-kinect-skeleton.md) | GAME |
| 04 | [Skeleton validity gate and menu hand-cursor](./04-skeleton-and-cursor.md) | GAME / ORIGINAL | | 04 | [Skeleton validity gate and menu hand-cursor](./04-validity-cursor.md) | GAME / ORIGINAL |
| 05 | [gamekdm entry, boot, and gameMain](./05-gamekdm-entry.md) | ORIGINAL | | 05 | [Data and configuration formats](./05-data-formats.md) | GAME |
| 06 | [gamekdm subsystems](./06-gamekdm-subsystems.md) | ORIGINAL | | 06 | [gamekdm subsystems](./06-gamekdm-subsystems.md) | ORIGINAL |
| 07 | [Asset and Flash/AFP formats](./07-asset-formats.md) | GAME | | 07 | [Official companion DLL API surfaces](./07-companion-apis.md) | ORIGINAL |
| 08 | [Reconstruction codebase (src/, include/, build)](./08-reconstruction-codebase.md) | RECONSTRUCTION | | 08 | [ABI, calling conventions, and struct layouts](./08-abi-conventions.md) | ORIGINAL / RECONSTRUCTION |
| 09 | [RE workflow and tooling (Ghidra, rvadb, companions)](./09-re-workflow.md) | RECONSTRUCTION | | 09 | [Reconstruction codebase and workflow](./09-reconstruction-codebase.md) | RECONSTRUCTION |
> The companion documents these sections build on are already in the repo: > The companion documents these sections build on are already in the repo:
> `docs/companion-inventory.md` (feeds 02), `docs/provenance.md` (feeds 08), > `docs/companion-inventory.md` (feeds 02), `docs/provenance.md` (feeds 08),
@@ -195,7 +168,8 @@ already fleshed out from RE are concrete: `src/game/` holds `validity.cpp`,
`src/`/`include/` is authoritative; decompiler dumps and the `orig/` binary are `src/`/`include/` is authoritative; decompiler dumps and the `orig/` binary are
working inputs only and stay out of git (docs/provenance.md). working inputs only and stay out of git (docs/provenance.md).
The RE spine is `re/rvadb.json`: 9,728 functions (`function_count = 9728`), each The RE spine is `re/rvadb.json`: 9,728 function records (`function_count =
9728`), each
a record with `rva`, `name`, `callers`/`callees`, `globals_touched`, and a a record with `rva`, `name`, `callers`/`callees`, `globals_touched`, and a
`status` field (e.g. `FUN_10018570`, the validity transform, is present in the `status` field (e.g. `FUN_10018570`, the validity transform, is present in the
DB). This is the index every ORIGINAL-dimension section cites against. DB). This is the index every ORIGINAL-dimension section cites against.
@@ -205,8 +179,9 @@ DB). This is the index every ORIGINAL-dimension section cites against.
## How to read this spec ## How to read this spec
- A claim without a citation is a bug. Report it. - A claim without a citation is a bug. Report it.
- `file:line`, an RVA like `0x10009e20`, objdump output, or an absolute GAME-DIR - An official `contents/` artifact path, a clean-release binary result, or a
path are the acceptable evidence forms. repository evidence record explicitly marked with its verification state is
an acceptable evidence form.
- GAME-DIR for this build is the owner's local copy of `KDM-2016021900` - GAME-DIR for this build is the owner's local copy of `KDM-2016021900`
(`.../KDM-2016021900/contents`); its absolute path is redacted in committed (`.../KDM-2016021900/contents`); its absolute path is redacted in committed
docs per docs/companion-inventory.md. docs per docs/companion-inventory.md.
+143 -397
View File
@@ -1,433 +1,179 @@
# Runtime Environment & Boot/Startup Chain # Runtime Environment & Official Boot/Startup Chain
Scope: the hardware/runtime DanceEvolution Arcade (DEA, internal code KDM) runs on, and the exact Scope: the clean KDM-2016021900 release under `contents/`. This document describes
process-level chain from `GAME-DIR/gamestart.bat` through to `gamekdm.dll`'s `gameMain` export only the official AVS2-to-game path evidenced by the shipped modules and
being invoked. Every claim below is grounded in a file at the absolute `GAME-DIR` path configuration. See [`docs/re/gamemain-binding.md`](../re/gamemain-binding.md) for
(`/mnt/f/Users/Aaron Thapa/Downloads/KDM-2016021900/contents`), in `objdump` output run against the instruction-level `arkkdm.dll` binding trace and
the shipped binaries, or in the reconstructed `spice2x` C++ source archived next to them. See [`06-gamekdm-subsystems.md`](./06-gamekdm-subsystems.md) for behavior after
[`docs/re/gamemain-binding.md`](../re/gamemain-binding.md) for the full byte-level trace this `gameMain` starts.
section summarizes, and [`06-gamekdm-subsystems.md`](./06-gamekdm-subsystems.md) (sibling
section) for what happens once `gameMain` is running.
## 1. Hardware and runtime target ## 1. Runtime target
DEA is a Konami AVS2/e-Amusement ("EA3") arcade title. The data under `GAME-DIR/prop/` identifies DanceEvolution Arcade (internal model code KDM) is a 32-bit Windows AVS2 /
it as model **KDM**, destination/spec/revision **A/A/A**, data extension `2016021900` e-amusement title. Its official runtime consists of exactly nine modules in
(`GAME-DIR/prop/ea3-config.xml`, `<soft><model>KDM</model><dest>A</dest><spec>A</spec> `contents/modules/`:
<rev>A</rev><ext>2016021900</ext></soft>`). This is the standard Konami "Bemani"-style PC-based
cabinet platform (the same AVS2/EA3 runtime underlies titles such as beatmania IIDX, jubeat,
Sound Voltex — confirmed by the shared `avs::core`/`avs::ea3` layer and the sibling-game
`DLL_NAME` table in `launcher.cpp`, see §4 below), not bespoke embedded hardware: all shipped
binaries are 32-bit `pei-i386` Windows PE images (`objdump -p` on `arkkdm.dll`, `deahook.dll`,
`launcher.exe`, `gamekdm.dll` — all report `file format pei-i386`), and `gamekdm.dll` imports
`d3dx9_43.dll` and `d3d9.dll` for rendering (its import-directory DLL list, below), i.e. the game
renders through Direct3D 9 on a conventional Windows PC, not a console SoC.
Body-tracking input is a Microsoft Kinect v1, accessed through the Kinect for Windows v1 NUI API: | Module | Clean-release size | Role |
`gamekdm.dll`'s PE import directory lists `Kinect10.dll` directly (`objdump -p gamekdm.dll`: |---|---:|---|
`DLL Name: Kinect10.dll`), the v1 NUI runtime DLL name. The spice2x source confirms this at the | `libavs-win32.dll` | 505.14 KB | AVS2 core middleware |
emulation-layer attach point too — `games::dea::DEAGame::attach()` explicitly tries to load | `libavs-win32-ea3.dll` | 364.14 KB | e-amusement v3 AVS2 extension |
`"Kinect10.dll"` and, on failure, logs `"Failed to load 'Kinect10.dll'. Game will boot in Test | `libafp-win32.dll` | 1.19 MB | AFP asset, font, and graphics pipeline |
Mode. Have you installed the Kinect SDK?"` (`spice2x/games/dea/dea.cpp:19-23`, extracted from | `libafputils-win32.dll` | 165.64 KB | AFP utilities |
`GAME-DIR/src/spice2x-master.tar.gz`). This repo's own reconstruction work (`game-internals.md` | `ess.dll` | 376.14 KB | ESS e-amusement middleware |
§1) independently confirms the same binding by shimming `Kinect10.dll` with a drop-in | `libacio.dll` | 224.64 KB | ACIO cabinet-I/O protocol library |
replacement that feeds synthetic skeleton/depth/color frames to the unmodified game. | `arkkdm.dll` | 896.64 KB | KDM cabinet engine and AVS2 game entry |
| `arkkdmtest.dll` | 389.14 KB | Render/input test harness |
| `gamekdm.dll` | 3.19 MB | Main KDM game logic |
Coin/credit and cabinet I/O (coin mechs, test/service buttons, card reader) run over Konami's These sizes come from the clean-release listing, not byte measurements from an
**ACIO** serial I/O protocol, mediated by `libacio.dll`, which `arkkdm.dll` imports directly installed tree. Any older exact byte size or export count derived from an
(`objdump -p arkkdm.dll`: `DLL Name: libacio.dll`), and by the spice2x emulation layer's own installed copy is **UNVERIFIED (pending re-check against clean-release binary)**.
`acio` module — `launcher.cpp` calls `acio::attach()` / `acio::attach_icca()` when ACIO or ICCA
(card reader) support is requested (`spice2x/launcher/launcher.cpp:1770-1776`), and the archived
source ships a concrete ACIO device implementation at
`spice2x/acio/icca/icca.cpp`/`icca.h` (ICCA = the Konami card reader protocol). `arkkdm.dll` also
imports `ess.dll` with e-Amusement/PASELI-specific exports (`ess_usbkey_boot_check_license_key`,
`ess_usbkey_boot_check_account_key`, `ess_ea3_get_status`, `ess_ea3_license_agree`,
`ess_ea3_send_pp_event`, `ess_ea3_get_pp_status` — `objdump -p arkkdm.dll` import table), i.e. the
USB dongle/license-key and PASELI ("Participation"?) e-Amusement coin-service checks run through
a separate `ess.dll` module, not `arkkdm.dll` or `gamekdm.dll` code.
**UNVERIFIED:** exact cabinet model number, screen resolution/refresh, and Kinect sensor mounting `gamekdm.dll` uses Direct3D 9 and imports `Kinect10.dll`, the Microsoft Kinect
geometry are not recorded in any artifact inspected for this section. for Windows NUI v1 runtime. `Kinect10.dll` is an external platform dependency,
not a shipped game module. The same distinction applies to Windows and DirectX
import targets.
## 2. spice2x as the AVS2 emulation/compatibility layer The official shipped-module dependency graph has nine nodes:
The shipped `GAME-DIR` does not contain a real Konami `launcher.exe` paired with Konami's own ```text
AVS2 runtime DLLs in a way this reconstruction can observe directly running; instead `GAME-DIR` libavs-win32.dll (root)
ships the **spice2x** (and `spicetools`) reconstruction/compatibility source trees as reference libacio.dll (root)
material: `GAME-DIR/src/spice2x-master.tar.gz` and `GAME-DIR/src/spicetools-master.tar.gz`. These arkkdmtest.dll (root; OS multimedia/input imports only)
are open-source reimplementations of the Konami AVS2 launcher/bootstrap stack used by the libavs-win32-ea3.dll -> libavs-win32.dll
Bemani-emulation community to run e-Amusement-era arcade titles on PC without the original libafp-win32.dll -> libavs-win32.dll
network/license backend. The evidence in this section comes from the `spice2x` tree at libafputils-win32.dll -> libavs-win32.dll, libafp-win32.dll
`spice2x/` (top-level after extracting the tarball), specifically: ess.dll -> libavs-win32.dll, libavs-win32-ea3.dll
arkkdm.dll -> libavs-win32.dll, libavs-win32-ea3.dll,
- `spice2x/launcher/launcher.cpp` — the launcher's `main`-equivalent entry/orchestration. ess.dll, libacio.dll, libafp-win32.dll
- `spice2x/avs/core.cpp`, `spice2x/avs/ea3.cpp`, `spice2x/avs/game.cpp` — the three AVS2 gamekdm.dll -> libavs-win32.dll, libafp-win32.dll,
sub-bootstraps (core runtime, EA3/e-Amusement layer, game-DLL loader), each wrapping a libafputils-win32.dll
different real Konami DLL (`libavs-win32.dll`, `libavs-win32-ea3.dll`, and the game DLL itself). (+ external Kinect10.dll and DirectX)
- `spice2x/games/dea/dea.cpp`, `spice2x/games/dea/io.cpp` — the DEA-specific (KDM) game glue:
Kinect attach, button/light I/O mapping.
- `spice2x/acio/icca/icca.cpp` — ACIO card-reader (ICCA) device emulation.
`launcher.exe` in `GAME-DIR` is the **generic AVS launcher binary** that this spice2x-family
codebase reimplements/hooks, invoked exactly as `gamestart.bat` specifies (§3). It is a thin,
32-bit PE (`ImageBase 01000000`, imports only `KERNEL32.dll`, `msvcrt.dll`, `USER32.dll`,
`libavs-win32.dll`, `libavs-win32-ea3.dll` — `objdump -p launcher.exe`), consistent with its role
as a bootstrap stub whose real behavior is delegated into the AVS/EA3 DLLs it loads.
## 3. The boot chain, step by step
### 3.1 `gamestart.bat` — the top-level entry point
`GAME-DIR/gamestart.bat` is the process the cabinet (or an operator) runs to start the game:
```bat
@echo off
cd /d %~dp0
set DAMAC_VIEWER_FULLSCREEN=0
if not exist dev\nvram mkdir dev\nvram
if not exist dev\nvram\coin.xml copy prop\coin.xml dev\nvram\coin.xml
if not exist dev\nvram\eacoin.xml copy prop\eacoin.xml dev\nvram\eacoin.xml
if not exist dev\nvram\testmode-v.xml copy prop\testmode-v.xml dev\nvram\testmode-v.xml
if not exist dev\nvram\libxml.xml copy prop\libxml.xml dev\nvram\libxml.xml
if not exist dev\raw mkdir dev\raw
if not exist dev\raw\bookkeeping mkdir dev\raw\bookkeeping
if not exist dev\raw\ranking mkdir dev\raw\ranking
if not exist dev\raw\settings mkdir dev\raw\settings
if not exist dev\raw\log mkdir dev\raw\log
@launcher -k deahook.dll arkkdm.dll
``` ```
Steps: ## 2. Official AVS2 entry into `arkkdm.dll`
1. `cd /d %~dp0` — changes into `GAME-DIR` itself so every subsequent relative path (`prop\...`, The AVS2 runtime enters the game DLL through `arkkdm.dll`'s standard AVS2
`dev\...`, and the bare `launcher`/`deahook.dll`/`arkkdm.dll` names on the last line) resolves exports:
against `GAME-DIR`.
2. `DAMAC_VIEWER_FULLSCREEN=0` — sets a single environment variable before launch; its consumer
is not in any binary inspected for this section (**UNVERIFIED** which component reads it;
"DAMAC" does not appear in the spice2x source tree searched above).
3. It seeds the **AVS virtual filesystem's NVRAM device** (`dev\nvram\`) and the raw-storage tree
(`dev\raw\{bookkeeping,ranking,settings,log}`) from the `prop\` templates on first run — these
are exactly the two filesystem devices `avs-config.xml` declares (§5): `<nvram><device>
dev\nvram</device></nvram>` and `<raw><device>dev\raw</device></raw>`
(`GAME-DIR/prop/avs-config.xml`). This is a one-time persistence bootstrap, not something the
boot chain repeats on every launch once the files exist.
4. The final line launches the generic AVS launcher binary, `launcher.exe` (resolved via `PATH`/
the current directory as plain `launcher`), with `-k deahook.dll arkkdm.dll`: `-k` selects a
**hook DLL** to load before the game DLL (`deahook.dll`), and the trailing positional argument
names the **game DLL** itself (`arkkdm.dll`). This matches the hook-then-game-DLL argument
shape spice2x's own launcher option parsing expects (`launcher/launcher.cpp:1109`,
`module = libutils::try_library(hook)`, loading each `-k`-named hook before the game DLL is
resolved).
### 3.2 `launcher.exe` — AVS bootstrap orchestration | Export | By-name ordinal | RVA |
|---|---:|---:|
| `dll_entry_init` | 253 | `0x767c0` |
| `dll_entry_main` | 254 | `0x767b0` |
`launcher.exe` (PE32, image base `0x01000000`) is the process `gamestart.bat` starts. Per the The names, ordinals, and RVAs are derivable from `arkkdm.dll`'s own PE export
spice2x source it reimplements/wraps, its top-level flow (`spice2x/launcher/launcher.cpp`, directory with `objdump`. They are by-name exports; the ordinal values describe
function beginning around line 153) is, in the order evidenced by the source: their export-table entries but are not the binding mechanism.
1. Parse the `-k <hook.dll>` and positional `<game.dll>` arguments, among the launcher's broader `arkkdm.dll`'s `DllMain` captures the DLL's own `HINSTANCE` on
option set (signal/crypt/ACIO/network flags — `launcher.cpp:153-751`). `DLL_PROCESS_ATTACH`. `dll_entry_init` relays that value into the internal
2. Load each `-k`-named hook DLL via `libutils::try_library` (`launcher.cpp:1109`) — this is `g_MainDllInfo.dllHMODULE` field. The AVS2 runtime then calls
where `deahook.dll` gets loaded, **before** the game DLL. `arkkdm.dll`'s `dll_entry_main`.
3. Resolve the effective game DLL name. Because `gamestart.bat` already names `arkkdm.dll`
explicitly, the launcher's own DLL-autodetect ladder is bypassed, but the ladder's DEA-specific
branch independently confirms the association: `if (check_dll("arkkdm.dll")) { avs::game::
DLL_NAME = "arkkdm.dll"; ...; attach_dea = true; }` (`launcher.cpp:1190-1194`) — i.e. spice2x's
own code identifies `arkkdm.dll` as *the* DEA/KDM game DLL and, on recognizing it, flags that
the DEA-specific game-glue module (`games::dea::DEAGame`, §3.5) should be attached.
4. Call `avs::core::set_default_heap_size(avs::game::DLL_NAME)` (`launcher.cpp:1528`) and then, if
`attach_dea` was set, push a `new games::dea::DEAGame()` onto the active-games list
(`launcher.cpp:1582-1583`).
5. Load the EA3 (e-Amusement) layer: `avs::ea3::load_dll()` (`launcher.cpp:1703`), which loads
`libavs-win32-ea3.dll` (or `avs2-ea3.dll`/`libavs-win64-ea3.dll`) and resolves its boot/
shutdown entry points by name (§3.3 / §5). This happens **before** the core runtime is
booted: `avs::core::load_dll()` resolves the core DLL first (`launcher.cpp:1700`), then EA3
is loaded (`launcher.cpp:1703`), and only after that does the launcher boot the core runtime
(step 6, `launcher.cpp:1711`).
6. Boot the AVS core runtime: `avs::core::boot()` (`launcher.cpp:1711`), which loads
`libavs-win32.dll` (or `avs2-core.dll`/`libavs-win64.dll` depending on what is present — see
§3.3) and resolves its property/filesystem API by name.
7. Attach ACIO/ICCA device emulation if requested (`acio::attach()` / `acio::attach_icca()`,
`launcher.cpp:1770-1776`).
8. Load the actual game DLL (`arkkdm.dll`) through `avs::game::load_dll()`
(`spice2x/avs/game.cpp:72-100`, called indirectly off the game list populated in step 4), which
resolves exactly two entry points by name — `"dll_entry_init"` and `"dll_entry_main"` — via
`GetProcAddress` (`spice2x/avs/game.cpp:13-14,98-99`; see §3.4 for why this is name-based, not
ordinal).
9. Invoke `avs::game::entry_main()` (`launcher.cpp:1888` per
[`gamemain-binding.md`](../re/gamemain-binding.md)), which is the single top-level call that
triggers the chain down into `arkkdm.dll` and ultimately `gamekdm.dll`'s `gameMain` (§3.5–3.6).
Confirmed independently from the binary side: `launcher.exe`'s PE import table lists exactly ## 3. `arkkdm.dll` resolves and invokes the game payload
`KERNEL32.dll` (with `LoadLibraryA` at IAT RVA `0x00001010` and `GetProcAddress` at
`0x0000102c`), `msvcrt.dll`, `USER32.dll`, `libavs-win32.dll`, and `libavs-win32-ea3.dll`
(`objdump -p launcher.exe`) — i.e. the launcher's only AVS-layer dependencies are the 32-bit
core and EA3 DLLs, matching the `avs::core`/`avs::ea3` 32-bit DLL names spice2x tries first
(`avs/core.cpp:1486`: `DLL_NAME = "libavs-win32.dll"`; `avs/ea3.cpp:134`: `DLL_NAME =
"libavs-win32-ea3.dll"`).
### 3.3 AVS2 core + EA3 bootstrap `dll_entry_main` reaches an internal `arkkdm.dll` resolver that performs this
official sequence:
Two separate AVS2 sub-DLLs are loaded and bootstrapped by the launcher before the game DLL, each 1. Call `LoadLibraryA("gamekdm.dll")`.
via the same by-name-`GetProcAddress` pattern used throughout this chain: 2. If the production payload is unavailable, try the test-build fallback
`LoadLibraryA("arkkdmtest.dll")`.
3. Call `GetProcAddress(candidate_module, "gameMain")`.
4. Invoke the resolved function as `gameMain(hInstance)`.
- **AVS core** (`spice2x/avs/core.cpp`): tries, in order, `avs2-core.dll`, then The first successful candidate supplies `gameMain`; if neither candidate
`libavs-win64.dll` (64-bit build) or `libavs-win32.dll` (32-bit build — the variant actually supplies it, no game entry is called. This is an ordinary two-candidate
imported by `launcher.exe` per §3.2) — `avs/core.cpp:1481-1492`. It then probes which AVS `LoadLibraryA` / `GetProcAddress` fallback implemented inside `arkkdm.dll`, not
protocol-version export is present (a version-keyed obfuscated-name table, a custom linking protocol.
`IMPORT_LEGACY`/`IMPORT_AVS21360`/.../`IMPORT_AVS21730`, `avs/core.cpp:54-109`) via
`GetProcAddress(DLL_INSTANCE, IMPORTS[i].property_search) != nullptr`
(`avs/core.cpp:1513`), and resolves the entire core AVS API — filesystem (`avs_fs_*`),
property-tree (`property_*`), compression stream (`cstream_*`) — by name through that matched
table (`avs/core.cpp:1532-1653`, dozens of `libutils::get_proc<...>(DLL_INSTANCE,
IMPORTS[ver].<field>)` calls).
- **AVS EA3** (`spice2x/avs/ea3.cpp`): tries `avs2-ea3.dll`, then `libavs-win64-ea3.dll` /
`libavs-win32-ea3.dll` (`avs/ea3.cpp:128-139`), probes the same kind of versioned export table
for `boot`/`shutdown` (`avs/ea3.cpp:54-177`, legacy names `"ea3_boot"`/`"ea3_shutdown"` or
obfuscated `"XEb552d500005d"`-style names depending on AVS version), and resolves
`avs_ea3_boot_startup` / `avs_ea3_shutdown` by name (`avs/ea3.cpp:174-177`).
Both DLL sets are listed directly in `arkkdm.dll`'s own PE import table too (`objdump -p The argument is the `HINSTANCE` belonging to `arkkdm.dll`, not the handle of
arkkdm.dll`: `DLL Name: libavs-win32.dll`, `DLL Name: libavs-win32-ea3.dll`), confirming `gamekdm.dll`. Its relay is:
`arkkdm.dll` itself links against (not just transitively depends on) the AVS core and EA3 DLLs
that the launcher bootstraps first.
`avs::ea3::boot()` is also where the **`ea3-config.xml` path is selected and parsed** — see §5. ```text
arkkdm.dll DllMain(hinstDLL, DLL_PROCESS_ATTACH, ...)
### 3.4 Hop 1 — spice2x (launcher) → `arkkdm.dll` (`dll_entry_init`/`dll_entry_main`) -> captured arkkdm.dll HINSTANCE
-> g_MainDllInfo.dllHMODULE
`avs::game::load_dll()` resolves exactly two symbols out of the loaded game DLL, both by literal -> dll_entry_main's internal resolver
name string through `GetProcAddress`, never by ordinal: -> gameMain(hInstance)
```
spice2x/avs/game.cpp:13 const char ENTRY_INIT_NAME[] = "dll_entry_init";
spice2x/avs/game.cpp:14 const char ENTRY_MAIN_NAME[] = "dll_entry_main";
spice2x/avs/game.cpp:98 dll_entry_init = (ENTRY_INIT_T) libutils::get_proc(DLL_INSTANCE, ENTRY_INIT_NAME);
spice2x/avs/game.cpp:99 dll_entry_main = (ENTRY_MAIN_T) libutils::get_proc(DLL_INSTANCE, ENTRY_MAIN_NAME);
``` ```
`arkkdm.dll`'s own export directory confirms both names are real by-name exports (Hint/Name table The known `gameMain` call shape in `gamekdm.dll` is:
present, not ordinal-only), at ordinals 253/254 of its export table:
``` ```c
objdump -p arkkdm.dll: gameMain(void *hInstance); /* cdecl; return type not established here */
Export Address Table -- Ordinal Base 1
[ 253] +base[ 254] 000767c0 Export RVA
[ 254] +base[ 255] 000767b0 Export RVA
[Ordinal/Name Pointer] Table -- Ordinal Base 1
[ 253] +base[ 254] 00fd dll_entry_init
[ 254] +base[ 255] 00fe dll_entry_main
``` ```
i.e. `dll_entry_init` is at RVA `0x000767c0` (VA `0x100767c0`, image base `0x10000000`) and `gameMain` is at RVA `0x9e20` / VA `0x10009e20`, takes one pointer argument,
`dll_entry_main` is at RVA `0x000767b0` (VA `0x100767b0`). `launcher.cpp:1888` makes the single and uses the cdecl calling convention. The bare returns in its entry function
top-level call `avs::game::entry_main()`, which (after a defensive name re-resolution check that and the caller-owned stack cleanup establish cdecl.
logs `"dll_entry_main is hooked"` if the resolved address changed, `avs/game.cpp:115-124`) calls
the resolved `dll_entry_main` pointer — i.e. `0x100767b0` in the shipped `arkkdm.dll`.
### 3.5 `deahook.dll`'s role ## 4. Official configuration and content roots
`deahook.dll` is loaded by the launcher's `-k deahook.dll` hook mechanism **before** Official assets and configuration all live under `contents/`:
`arkkdm.dll` resolution (§3.2 step 2), but it is not part of the `gameMain` resolution chain
itself. Its own PE export table carries a single dummy symbol —
`objdump -p deahook.dll`: `[Ordinal/Name Pointer] Table -- Ordinal Base 1: [0] +base[1] 0000
?dummy@@YGHXZ` (name `DEALibacio.dll`, `Name 00015052 DEALibacio.dll` in the export directory) —
and its import table pulls in only `USER32.dll` and a conventional `KERNEL32.dll` set including
`GetProcAddress`, `LoadLibraryA`, `CreateThread`, `VirtualProtect` (`objdump -p deahook.dll`).
The `VirtualProtect`/`CreateThread`/`GetAsyncKeyState` import combination is consistent with an
inline API-hooking DLL (it patches/intercepts calls in the already-loaded process rather than
exporting a conventional API), matching its name ("DEA hook"). Per
[`gamemain-binding.md`](../re/gamemain-binding.md), `deahook.dll` is "not involved in the
`gameMain` resolution itself" — that entire second hop happens inside `arkkdm.dll`'s own code
(§3.6).
### 3.6 Hop 2 — `arkkdm.dll` → `gamekdm.dll`'s `gameMain` - `contents/data/{arc,bgmov,bm2d,dal,data,font,movie,sound}`
- `contents/arkdata/{ark/*,arkkdm/*}`
- `contents/prop/`
This hop is entirely internal to `arkkdm.dll`; spice2x never touches `gameMain` directly (an `rg The clean-release configuration set in `contents/prop/` is:
'gameMain'` across the whole spice2x source tree matches only an unrelated comment about a
different Bemani title in `games/we/we.cpp:137`). `arkkdm.dll`'s `dll_entry_main`
(`0x100767b0`) jumps into an internal resolver function at VA `0x10001340` that:
1. Loops over a fixed 2-entry candidate module-name table at `.data` address `0x100b7d60` - `avs-config.xml`
(`dd 0x1009032c, 0x10090338`), pointing at the ASCII strings `"gamekdm.dll"` and - `ark-config.xml`
`"arkkdmtest.dll"` — i.e. production builds load `gamekdm.dll`, with `arkkdmtest.dll` as a - `ark-config_nopp.xml`
test-build fallback. - `eamuse-config.xml`
2. For each candidate, calls its own `LoadLibraryA` wrapper, and only on a successful load calls - `ess-config.xml`
`GetProcAddress(hModule, "gameMain")` via the import thunk at `0x1007d13c` (confirmed as - `card_allow.bin`
`KERNEL32.dll!GetProcAddress` by `arkkdm.dll`'s import directory: `0007d13c <none> 0245 - `coin.xml`
GetProcAddress`). - `eacoin.xml`
3. On success, invokes the resolved `gameMain` function pointer with a single argument (§3.7). - `share-config.xml`
- `testmode-v.xml`
``` ### `avs-config.xml`
10001396: 68 dc 09 09 10 push 0x100909dc ; &"gameMain"
1000139b: 56 push esi ; esi = HMODULE of the candidate library This is the AVS2 core configuration. It defines the virtual-filesystem devices,
1000139c: ff 15 3c d1 07 10 call DWORD PTR ds:0x1007d13c ; = KERNEL32!GetProcAddress resource limits, logging, networking, threading, and time settings used by the
100013a2: 85 c0 test eax,eax runtime beneath the game modules.
100013a4: 75 0e jne 0x100013b4 ; found -> call it
### `eamuse-config.xml`
This is the e-amusement configuration shipped by the clean release. It carries
the title identity and e-amusement runtime settings consumed by the official
stack.
### `ark-config.xml`
This contains `arkkdm.dll`-specific options, including logging, USB-key,
e-amusement coin, and participation settings.
### `ess-config.xml`
This configures the official `ess.dll` e-amusement middleware used by
`arkkdm.dll`.
## 5. Startup summary
The official startup boundary documented here is:
```text
AVS2 runtime
-> arkkdm.dll!dll_entry_init
-> arkkdm.dll!dll_entry_main
-> LoadLibraryA("gamekdm.dll")
fallback: LoadLibraryA("arkkdmtest.dll")
-> GetProcAddress(..., "gameMain")
-> gameMain(arkkdm.dll HINSTANCE)
``` ```
`gamekdm.dll`'s own export table independently confirms `gameMain` is its sole export and that it Every transition after AVS2 enters `arkkdm.dll` is evidenced by
is exported **by name only** (ordinal 1, but the project's own convention per `objdump -p `arkkdm.dll`'s own exports, imports, strings, and disassembly. Exact addresses
gamekdm.dll` lists it under the `[Ordinal/Name Pointer] Table` as `[0] +base[1] 0000 gameMain`), from older installed-copy analysis other than the official values stated above
with no accompanying `dll_entry_init`/`dll_entry_main` pair — `gamekdm.dll` is the pure "game remain **UNVERIFIED (pending re-check against clean-release binary)**.
logic" payload DLL, `arkkdm.dll` is the AVS-facing glue DLL that hosts it.
### 3.7 `gameMain`'s signature and calling convention
`gameMain` is exported at RVA `0x9e20` (VA `0x10009e20`, image base `0x10000000`) in
`gamekdm.dll`. Disassembly of its full body (`objdump -d -M intel --start-address=0x10009e20
--stop-address=0x10009eb0`) shows both return paths ending in a bare `ret` (no immediate
operand), e.g.:
```
10009e8d: 5f pop edi
10009e8e: 33 c0 xor eax,eax
10009e90: 5e pop esi
10009e91: c3 ret
```
A bare `ret` (vs. `ret 4`/`stdcall`) means the **caller**, not the callee, is responsible for
popping the single pushed argument — the defining trait of the **cdecl** calling convention.
This matches the call site in `arkkdm.dll` (`100013b4-100013b8: push ecx; call eax`), which never
issues an explicit `add esp,4` after the call; the caller's frame-pointer epilogue
(`mov esp,ebp` at `100013bf`) discards the pushed argument as part of resetting the whole local
frame, which is exactly what cdecl predicts and `stdcall` would not need.
The single argument is `void* hInstance`. Tracing it back (`gamemain-binding.md` part (b)):
it is **`arkkdm.dll`'s own `HINSTANCE`/`HMODULE`** — the handle the Windows loader assigned to
`arkkdm.dll` when it was mapped, captured once in `arkkdm.dll`'s `DllMain` on
`DLL_PROCESS_ATTACH` (`fdwReason == 1`, stored to a global at VA `0x100f5134`,
`10076799-1007679c`) and relayed through a global struct, `g_MainDllInfo` at VA `0x1014b9f8`
(named via adjacent `.rdata` diagnostic strings `"MainDllInfo::setDllHMODULE : dllHMODULE %p,
hModule %p\n"`), which `dll_entry_init` (`0x100767c0`) latches on first call and
`dll_entry_main`'s resolver (`0x10001340`) reads back out as the value pushed into `gameMain`. It
is **not** `gamekdm.dll`'s own module handle — `gamekdm.dll` never computes or receives its own
`HMODULE` on this path — and it is not any spice2x/launcher-level handle passed directly; spice2x's
`avs::game::DLL_INSTANCE` and `arkkdm.dll`'s internally captured `hInstDLL` happen to be the same
underlying OS handle value, but `arkkdm.dll` re-derives and forwards its own independently
captured copy rather than receiving spice2x's.
## 4. Game-DLL identification: `arkkdm.dll` as the KDM/DEA marker
spice2x's launcher identifies which Bemani title it is booting by probing for each title's
characteristic game DLL filename in the cabinet's install directory (`check_dll(name)` calls
chained through `launcher.cpp:1115-1496`, e.g. `bm2dx.dll` for beatmania IIDX, `jubeat.dll` for
jubeat, `popn22.dll` for pop'n music 22, etc.). The DEA/KDM branch is:
```
spice2x/launcher/launcher.cpp:1190-1194
// DEA
if (check_dll("arkkdm.dll")) {
avs::game::DLL_NAME = "arkkdm.dll";
...
attach_dea = true;
}
```
This is the authoritative confirmation, independent of `gamestart.bat`'s explicit argument, that
`arkkdm.dll` is *the* canonical AVS game DLL name for DanceEvolution Arcade within the spice2x
compatibility layer, and that recognizing it is what causes the DEA-specific game-glue object
(`games::dea::DEAGame`, §1/§3.2 step 4) — which owns the Kinect10.dll attach and the DEA
button/light I/O map in `spice2x/games/dea/io.cpp` — to be constructed.
## 5. `ea3-config.xml` and `avs-config.xml`
Both files live at `GAME-DIR/prop/` and are consumed during AVS/EA3 bootstrap (§3.3), **before**
`gameMain` is ever reached — they configure the AVS2 runtime and the e-Amusement identity/network
layer that `gamekdm.dll` then runs on top of, not `gamekdm.dll` itself directly.
### `avs-config.xml` — AVS core runtime configuration
Parsed by `avs::core::boot()` (the AVS core DLL located/bootstrapped in §3.3). Its sections,
read directly from `GAME-DIR/prop/avs-config.xml`:
- `<fs>` — declares the AVS virtual filesystem's **devices**: `<root><device>.</device>` (the
content root), `<nvram><device>dev\nvram</device></nvram>` with block-storage options
(`sz_block=768,nr_block=128,nr_mirror=4`), and `<raw><device>dev\raw</device></raw>`. These are
exactly the two directories `gamestart.bat` pre-seeds from `prop\` templates (§3.1 step 3),
confirming `gamestart.bat`'s NVRAM/raw bootstrap is preparing the backing store this config
mounts. Also sets filesystem resource limits: `<nr_mountpoint>256</nr_mountpoint>`,
`<nr_filedesc>256</nr_filedesc>`.
- `<time><gmt_offset>32400</gmt_offset></time>` — 32400 seconds = UTC+9 (Japan Standard Time),
the cabinet's configured timezone offset.
- `<log>` — logging sinks and levels: `level=all`, console enabled, file logging enabled with
rotation (`rotate=1`, `gen=10` generations), network logging (`netsci`/`netlog`) disabled.
- `<net>` — socket/protocol pool sizing (`nr_protocol=8`, `nr_socket=16`) and enables raw sockets
plus the `lz77sock`/`multisock` AVS network transports.
- `<thread>` — AVS kernel object pool sizing: up to 100 threads, 50 semaphores, 512 mutexes, 64
events.
- `<sntp><ea_on>0</ea_on>` — NTP time sync is explicitly disabled (a commented-out Shift-JIS note
in the file explains why in Japanese: time changing on boot was considered undesirable), with a
fallback `pool.ntp.org` server address present but inert while `ea_on=0`.
### `ea3-config.xml` — e-Amusement (EA3) identity, network, and coin/credit configuration
Parsed by `avs::ea3::boot()` (§3.3) — the file-selection logic in the spice2x source confirms
`prop/ea3-config.xml` (this exact path) is the primary candidate checked before any fallback
name (`avs::ea3::boot`, `spice2x/avs/ea3.cpp:180-194`: `else if
(fileutils::file_exists("prop/ea3-config.xml")) { ea3_config_name = "prop/ea3-config.xml"; }`),
and the property tree is read via `avs::core::config_read(ea3_config_name, 0x40000)`
(`avs/ea3.cpp:209`). Contents of `GAME-DIR/prop/ea3-config.xml`:
- `<id>` — `<pcbid>`/`<softid>` placeholders, both all-zero 21-character strings in the shipped
file (`00000000000000000000`); spice2x independently defaults these same fields when absent
(`avs/ea3.cpp:247-258`, hardcoded fallback `"0100DEADBEEF"`/`"012199999999"`), confirming this
section is the per-cabinet hardware/software identity block the EA3 network layer uses to
authenticate against Konami's e-Amusement backend.
- `<soft>` — the model/dest/spec/rev/ext tuple identifying the title build (`KDM`/`A`/`A`/`A`/
`2016021900`, §1).
- `<timezone>32400</timezone>` and `<encoding>SHIFT_JIS</encoding>` — same UTC+9 convention as
`avs-config.xml`; text data in this config layer is Shift-JIS encoded.
- `<network>` — `<ssl>0</ssl>` (no TLS), `<services>http://localhost:8080/</services>` (the EA3
"services" base URL the e-Amusement RPC layer targets — `http://localhost:8080/` in this
shipped copy implies a local service-emulation endpoint rather than Konami's real backend, as
expected for an archived/offline cabinet image), `<sz_xrpc_buf>102400</sz_xrpc_buf>` (XRPC
buffer size), `<url_slash>1</url_slash>`.
- `<eacoin>` — PASELI (Konami's cashless payment system) configuration: `<enable>1</enable>`,
a `<control_ref>/eacoin/enable</control_ref>` pointer into `eacoin.xml`'s property tree
(another `prop/` file, mirrored to `dev/nvram/eacoin.xml` by `gamestart.bat`), and
`<nr_vslot>2</nr_vslot>` (number of virtual eacoin slots).
- `<pos>` — physical coin-mechanism configuration: `<nr_coinslot>1</nr_coinslot>` (one physical
coin slot), `<nr_article>2</nr_article>`, `income_delay`/`income_maxdelay` timing, and a large
`<coin>` sub-tree mapping each in-game credit-consuming action (game start `p1s01a1`→
`game.s`, continue `p1s02a1`→`game.c`, join `p1s03a1`→`game.s.join`, numbered item purchases
`p1s05a1`…`p1s2Na1`→`game.i.NN`, etc.) to a `coin.xml`-referenced credit path
(`/coin/start`, `/coin/continue`, `/coin/join`, `/coin/itemN`) via `type="consume"` /
`type="throw"` event descriptors. This is how coin-mech hardware events (routed through
`coin.xml`, which `gamestart.bat` also seeds into `dev/nvram/`) become in-game credit state the
AVS property tree exposes to `gamekdm.dll`.
### `ark-config.xml` — `arkkdm.dll`-specific options
A third, smaller config also lives at `GAME-DIR/prop/ark-config.xml` and is specific to the
`arkkdm.dll` glue layer (not AVS core/EA3): `<loglevel>disable</loglevel>` (comment: log output
level, one of system/debug/information/warning/error/disable), `<nousbkey>0</nousbkey>` (comment:
set non-zero to disable USB key/dongle use — ties to the `ess_usbkey_boot_check_*` exports
`arkkdm.dll` imports from `ess.dll`, §1), `<eacoin>1</eacoin>` (comment: set to 0 if e-Amusement
coin functionality is unavailable), and `<participation>1</participation>` (comment: set to 0 if
"Participation" — the PASELI-era term for network play — is unsupported).
## Cross-references ## Cross-references
- [`docs/re/gamemain-binding.md`](../re/gamemain-binding.md) — full instruction-level trace of - [`docs/re/gamemain-binding.md`](../re/gamemain-binding.md) — detailed
the `GetProcAddress` resolution and `hInstance` argument this section summarizes in §3.4–3.7. `arkkdm.dll` resolver and `hInstance` trace.
- [`06-gamekdm-subsystems.md`](./06-gamekdm-subsystems.md) — what `gameMain` does once invoked - [`docs/companion-inventory.md`](../companion-inventory.md) — authoritative
(sibling section). clean-release module inventory and nine-node dependency DAG.
- [`game-internals.md`](../../game-internals.md) — Kinect10.dll NUI shim and the reconstruction's - [`06-gamekdm-subsystems.md`](./06-gamekdm-subsystems.md) — behavior after
own Kinect-emulation findings referenced in §1. `gameMain` begins.
## Unresolved / deferred points
- The consumer of `gamestart.bat`'s `DAMAC_VIEWER_FULLSCREEN` environment variable was not found
in any binary or source file inspected for this section — **UNVERIFIED**.
- Exact cabinet/monitor hardware specifications (resolution, panel type, speaker configuration)
are not recorded in any artifact inspected here — **UNVERIFIED**.
- Whether the real, non-spice2x Konami `launcher.exe`/AVS runtime differs in any behaviorally
significant way from the spice2x reimplementation used as evidence in §3.2–3.3 was not checked
against a Konami-original reference implementation (none was available); this section documents
the shipped `launcher.exe` PE import surface directly where possible (§3.2) and relies on
spice2x source as the best available account of the surrounding orchestration logic otherwise.
+121 -178
View File
@@ -1,229 +1,169 @@
# DLL Architecture and Module Dependency Graph # DLL Architecture and Module Dependency Graph
This section documents the shipped module set for `KDM-2016021900`, classifies This section documents exactly **9 Konami modules** shipped under
each DLL (Konami-authored and in reconstruction scope, OS/runtime import `contents/modules/` in the clean `KDM-2016021900` release. All 9 are in
target, or already-open-source), and derives the cross-DLL dependency DAG reconstruction scope. External platform runtimes are import targets only.
directly from each file's PE import table. It reconciles with and extends The inventory and cross-DLL dependency DAG follow the
[`../companion-inventory.md`](../companion-inventory.md), the Task T13 [official-scope contract](../../.omo/scope/official-scope.md) and the corrected
inventory deliverable that performed the original classification pass; the [`companion-inventory.md`](../companion-inventory.md).
counts and edges below were independently re-derived in this session against
the same game directory to confirm that inventory still holds.
Evidence method: `objdump -p` run against every `.dll` under Evidence basis: module sizes come from the clean-release listing in the
`GAME-DIR = "/mnt/f/Users/Aaron Thapa/Downloads/KDM-2016021900/contents"` contract's "Official modules" table. The shipped-module topology follows the
(including `contents/modules/` and `contents/stubs/64/`), using the companion inventory's "Cross-module dependency DAG" and the contract's
i686-w64-mingw32 cross `objdump` for the 19 PE32 (32-bit) files and the host "Official dependency graph", which describe the official modules' PE imports.
`/usr/bin/objdump` for the 3 PE32+ (x86-64) files under `stubs/64/` that the This revision does not claim a new `objdump` run. Earlier measurements came
32-bit toolchain cannot parse (`format: pei-i386` vs `pei-x86-64` reported by from a possibly contaminated install; any retained export counts are
`objdump -p` for each). `find GAME-DIR -iname '*.dll'` returns exactly 22 **UNVERIFIED (pending re-check against clean-release binary)**. Exact byte
files; this reconciles with the companion inventory's stated 22-file count sizes and RVAs from that install are not used here.
(`docs/companion-inventory.md:18-20`).
## Scope classification ## Scope classification
- **IN-SCOPE** — Konami-authored game/middleware code targeted for - **IN-SCOPE** — Konami-authored game/middleware code targeted for
decompilation and reconstruction. decompilation and reconstruction: all 9 modules in the table below.
- **REUSE OS** — a Win32/DirectX/CRT system DLL that is only ever an import - **REUSE OS** — a Win32/DirectX/CRT system DLL that is only ever an import
target (never shipped as a file under `contents/`): `KERNEL32.dll`, target (never shipped as a file under `contents/`): `KERNEL32.dll`,
`USER32.dll`, `GDI32.dll`, `ADVAPI32.dll`, `SHELL32.dll`, `ole32.dll`, `USER32.dll`, `GDI32.dll`, `ADVAPI32.dll`, `SHELL32.dll`, `ole32.dll`,
`WS2_32.dll`, `WINMM.dll`, `IMM32.dll`, `DINPUT8.dll`, `DSOUND.dll`, `WS2_32.dll`, `WINMM.dll`, `IMM32.dll`, `DINPUT8.dll`, `DSOUND.dll`,
`IPHLPAPI.DLL`, `PSAPI.DLL`, `msvcrt.dll`/`MSVCR80.dll`, `OLEAUT32.dll`, `IPHLPAPI.DLL`, `PSAPI.DLL`, `msvcrt.dll`/`MSVCR80.dll`, `OLEAUT32.dll`,
`dbghelp.dll`, `HID.DLL`, `SETUPAPI.dll`, `d3d9.dll`, `d3dx9_43.dll`. `dbghelp.dll`, `HID.DLL`, `SETUPAPI.dll`, `d3d9.dll`, `d3dx9_43.dll`.
- **ALREADY-OSS** — the shipped file is itself a build of already-open-source - **EXTERNAL RUNTIME** — `Kinect10.dll`, the Microsoft Kinect-for-Windows
tooling (bemanitools or spice2x/spicetools stub) or the owner's own Kinect NUI v1 runtime required by `gamekdm.dll`'s import table. It is supplied by
SDK redistribution shim, so no reconstruction work applies to it. the platform, not shipped in `contents/modules/` and not in the
reconstruction set. See the companion inventory's
[external dependencies](../companion-inventory.md#external-non-shipped-dependencies--referenced-only-never-part-of-the-game).
## Per-DLL table (all 22 shipped files) ## Per-DLL table (all 9 shipped Konami modules)
Size and export count ("named exports" = the `[Name Pointer/Ordinal] Table` Each DLL below resides in `contents/modules/`. Sizes and roles follow the
entry count from each file's `objdump -p` Export Table header) were measured contract's clean-release table and the companion inventory's
directly against `GAME-DIR` in this session and match the companion [per-module table](../companion-inventory.md#per-module-table-contentsmodules).
inventory's per-file figures exactly (`docs/companion-inventory.md:45-66`), Named-export counts are retained solely as historical measurements, not
except where noted. verified clean-release facts; each requires a new check against its official
binary. No new export counts have been inferred from the listing sizes.
| DLL | Size (bytes) | Scope | Named exports | Role | | DLL | Size (clean release listing) | Scope | Named exports (historical) | Role |
|---|---|---|---|---| |---|---|---|---|---|
| `gamekdm.dll` | 3,369,104 | IN-SCOPE | 1 (`gameMain`) | Main KDM game-logic DLL; the primary reconstruction target. Single entry point `gameMain`, export RVA `0x00009e20` confirmed by both `objdump -p` (`Export RVA ... 00009e20 ... gameMain`, run against `GAME-DIR/gamekdm.dll`) and `re/rvadb.json`'s `functions` entry for `gameMain` (`rva: "0x00009e20"`), i.e. absolute VA `0x10009e20` under the documented image base `0x10000000` (`re/rvadb.json: image_base`). `rvadb.json` records `function_count: 9728` for this module (`re/rvadb.json: function_count`). | | `libavs-win32.dll` | 505.14 KB | IN-SCOPE | 360 — UNVERIFIED (pending re-check against clean-release binary) | AVS2 core middleware: property-tree configuration, virtual filesystem and threading; base of the main middleware stack. |
| `arkkdm.dll` | 827,024 | IN-SCOPE | 255 | Core "ARK" Konami game-engine middleware (`arkAFP*`/`arkKDM*`-prefixed API); sits between AVS2 and the game/test DLLs. | | `libavs-win32-ea3.dll` | 364.14 KB | IN-SCOPE | 139 — UNVERIFIED (pending re-check against clean-release binary) | E-amusement v3 AVS2 extension for network, identity and coin economy. |
| `arkkdmtest.dll` | 398,480 | IN-SCOPE | 1 (`gameMain`) | Standalone Konami render/input test harness; links D3D9/D3DX9/DINPUT8/DSOUND/GDI32/SHELL32/USER32 directly, bypassing the AVS2 layer entirely. | | `libafp-win32.dll` | 1.19 MB | IN-SCOPE | 159 — UNVERIFIED (pending re-check against clean-release binary) | AFP asset/font/graphics pipeline used by ARK. |
| `deahook.dll` | 93,696 | IN-SCOPE (author unresolved) | 1 (C++-mangled `?dummy@@YGHXZ`) | Minimal ACIO-layer key-hook DLL; PE export-directory internal module name is `DEALibacio.dll` (`Name ... DEALibacio.dll` in `objdump -p` Export Tables), imports only `GetAsyncKeyState` (USER32) plus CRT/kernel32 startup. Not matched to spice2x/spicetools source. | | `libafputils-win32.dll` | 165.64 KB | IN-SCOPE | 162 — UNVERIFIED (pending re-check against clean-release binary) | AFP utilities directly above `libafp-win32.dll`. |
| `ess.dll` | 385,168 | IN-SCOPE | 209 | Konami ESS middleware (`ess_binarydata_*`, `ess_bookkeeping_*`); e-amusement bookkeeping/networking, links AVS2 + WS2_32/IPHLPAPI/PSAPI. | | `ess.dll` | 376.14 KB | IN-SCOPE | 209 — UNVERIFIED (pending re-check against clean-release binary) | ESS e-amusement shop/server middleware; depends on AVS2 and its ea3 extension. |
| `kbt.dll` | 7,680 | ALREADY-OSS | 6 | bemanitools "ikey" security-dongle stub (`bt_fcheck_*`, `k_bt000{1,2}`); identified by embedded PDB path `d:\bemanitools\stubs\objfre_wxp_x86\i386\stubs.pdb`. | | `libacio.dll` | 224.64 KB | IN-SCOPE | 44 — UNVERIFIED (pending re-check against clean-release binary) | ACIO cabinet I/O protocol library; root with only USER32/KERNEL32 imports. |
| `kld.dll` | 7,680 | ALREADY-OSS | 6 | Byte-identical bemanitools stub to `kbt.dll` (same export set, same embedded PDB path). | | `arkkdm.dll` | 896.64 KB | IN-SCOPE | 255 — UNVERIFIED (pending re-check against clean-release binary) | ARK/KDM cabinet game engine and AVS2 game-DLL entry; loads and calls `gamekdm.dll`. |
| `kmd.dll` | 128,656 | IN-SCOPE | 1 (`k_md0001`) | Konami "md" module (debug/memory-dump); imports `dbghelp.dll` + AVS2 + `MSVCR80.dll`. | | `arkkdmtest.dll` | 389.14 KB | IN-SCOPE | 1 — UNVERIFIED (pending re-check against clean-release binary) | ARK/KDM render/input test harness; exports `gameMain`; imports OS D3D9/DINPUT8/DSOUND/GDI32/SHELL32/USER32 without AVS2. |
| `ksm.dll` | 169,616 | IN-SCOPE | 111 | Konami "sm" module (`k_sm0001`, `ssm_array_*`); imports AVS2/AVS2-ea3 plus unshipped Konami-family `kdu.dll`/`kmp.dll`/`kma.dll`. | | `gamekdm.dll` | 3.19 MB | IN-SCOPE | 1 — UNVERIFIED (pending re-check against clean-release binary) | Main KDM game logic; exports `gameMain`; primary reconstruction target. |
| `kuc.dll` | 128,656 | IN-SCOPE | 4 | Small Konami "uc" module (`DllStart`, `k_uc0001`, `k_uc0004`, `k_uc0005`); same AVS2 + unshipped kdu/kmp/kma dependency pattern as `ksm.dll`. |
| `libacio.dll` | 65,536 | IN-SCOPE | 44 | Konami AC-IO (cabinet peripheral protocol) library, all `ac_io_*` exports; imports only `USER32.dll`+`KERNEL32.dll` (leaf). |
| `libacio_mbr.dll` | 14,336 | IN-SCOPE | 47 | AC-IO variant for a different cabinet I/O board revision; imports `libinput.dll` and `libavs-win32.dll` in addition to msvcrt/KERNEL32. |
| `libafp-win32.dll` | 1,246,864 | IN-SCOPE | 159 | Konami "AFP" asset/graphics pipeline library (`afp_*`), consumed by `arkkdm.dll`, `libafputils-win32.dll`, and `gamekdm.dll`. Imports only `libavs-win32.dll`+`KERNEL32.dll`. |
| `libafputils-win32.dll` | 169,616 | IN-SCOPE | 162 | AFP utility layer (`afpu_*`) directly above `libafp-win32.dll` in the chain; imports `libavs-win32.dll` + `libafp-win32.dll` + `KERNEL32.dll`. |
| `libavs-win32-ea3.dll` | 372,880 | IN-SCOPE | 139 | AVS2 "ea3" (e-amusement v3) extension module; ordinal-only export names (`XE592acd...`); imports only `KERNEL32.dll` + `libavs-win32.dll`. |
| `libavs-win32.dll` | 517,264 | IN-SCOPE | 360 | AVS2 (Application/Audio-Visual System v2) — Konami's core middleware runtime and the root of the MAIN middleware stack (not every shipped DLL depends on it — `libacio.dll`, `libinput.dll`, `arkkdmtest.dll`, and `deahook.dll` are independent leaves); ordinal-only export names (`XCd229cc...`); imports only `KERNEL32.dll`/`WS2_32.dll`/`WINMM.dll`/`IPHLPAPI.DLL` (no shipped-DLL imports). |
| `libinput.dll` | 38,400 | IN-SCOPE | 51 | e-amusement HID input-config driver (`eam_*`); imports `HID.DLL`/`SETUPAPI.dll` to talk to real cabinet hardware. Leaf (no shipped-DLL imports). |
| `modules/libacio.dll` | 65,536 | IN-SCOPE | 44 | Byte-identical duplicate of top-level `libacio.dll`, kept under `modules/` for the AC-IO module loader. |
| `Kinect10.dll` | 951,731 | ALREADY-OSS | 25 (Named-Pointer table `0x19`; Export Address Table itself reports `0x1d`=29 ordinal slots, 3 of which are unnamed/forwarder gaps per `objdump -p`) | Owner's Kinect SDK redistribution shim (`NuiCamera*`/`NuiCreate*`/`NuiSkeleton*`); imports only `KERNEL32.dll`/`msvcrt.dll`/`OLEAUT32.dll`/`WINMM.DLL`. Not Konami game logic. |
| `stubs/64/nvEncodeAPI64.dll` | 12,800 | ALREADY-OSS | 2 | PE32+ spice2x NVENC stub (`NvEncodeAPICreateInstance`/`NvEncodeAPIGetMaxSupportedVersion`); x86-64 (`format: pei-x86-64`). |
| `stubs/64/nvcuda.dll` | 13,824 | ALREADY-OSS | 21 | PE32+ spice2x CUDA driver-API stub (`cu*`, all returning `CUDA_ERROR_NOT_SUPPORTED`). |
| `stubs/64/nvcuvid.dll` | 13,312 | ALREADY-OSS | 13 | PE32+ spice2x NVCUVID stub (`cuvid*`, all returning `CUDA_ERROR_NOT_SUPPORTED`). |
All 22 files export plain-C symbol tables with the single exception of
`deahook.dll`'s one C++-mangled no-op export; no DLL in the set *imports* a
C++-mangled symbol (`docs/companion-inventory.md:68-70`, independently
confirmed by inspecting every `DLL Name:`/import entry in this session's
`objdump -p` run).
## Cross-DLL dependency DAG ## Cross-DLL dependency DAG
Edges below are restricted to import-table entries where the imported DLL The shipped-module DAG has exactly **9 nodes and 14 edges**. Each solid edge
name matches another file actually present under `GAME-DIR` (OS DLLs such as points from an importing module to a shipped dependency, following the
`KERNEL32.dll` and unshipped Konami-family DLLs such as `kdu.dll`/`kmp.dll`/ [canonical graph](../companion-inventory.md#cross-module-dependency-dag-9-nodes-verified-acyclic).
`kma.dll`, which `ksm.dll` and `kuc.dll` import but which are not shipped in OS/DirectX imports are outside this DAG. The dashed edge from `gamekdm.dll`
this build, are excluded from the graph). Each edge was read directly from to `Kinect10.dll` is an external Microsoft NUI runtime dependency; its endpoint
`objdump -p`'s `DLL Name:` lines for the dependent file against `GAME-DIR`: is an annotation, not a tenth shipped-module node.
``` ```
libavs-win32.dll (root — zero shipped-DLL imports) libavs-win32.dll (root)
libacio.dll, libinput.dll (roots — leaves) libacio.dll (root; imports USER32/KERNEL32 only)
modules/libacio.dll (root; duplicate of libacio.dll) arkkdmtest.dll (root; imports OS D3D9/DINPUT8/DSOUND/GDI32/SHELL32/USER32 only)
deahook.dll, arkkdmtest.dll (roots — only OS/DirectX imports) libavs-win32-ea3.dll -> libavs-win32.dll
Kinect10.dll, kbt.dll, kld.dll, stubs/64/nv*.dll (roots — ALREADY-OSS leaves) libafp-win32.dll -> libavs-win32.dll
libafputils-win32.dll -> libavs-win32.dll, libafp-win32.dll
libavs-win32-ea3.dll -> libavs-win32.dll ess.dll -> libavs-win32.dll, libavs-win32-ea3.dll
libafp-win32.dll -> libavs-win32.dll arkkdm.dll -> libavs-win32.dll, libavs-win32-ea3.dll, ess.dll, libacio.dll, libafp-win32.dll
kmd.dll -> libavs-win32.dll gamekdm.dll -> libavs-win32.dll, libafp-win32.dll, libafputils-win32.dll
ess.dll -> libavs-win32.dll, libavs-win32-ea3.dll (+ external Kinect10.dll, d3d9/d3dx9)
ksm.dll -> libavs-win32.dll, libavs-win32-ea3.dll
kuc.dll -> libavs-win32.dll, libavs-win32-ea3.dll
libacio_mbr.dll -> libinput.dll, libavs-win32.dll
libafputils-win32.dll -> libavs-win32.dll, libafp-win32.dll
arkkdm.dll -> libavs-win32.dll, libavs-win32-ea3.dll, ess.dll, libacio.dll, libafp-win32.dll
gamekdm.dll -> Kinect10.dll, libavs-win32.dll, libafputils-win32.dll, libafp-win32.dll
``` ```
```mermaid ```mermaid
graph TD graph TD
Kinect10_dll(("Kinect10.dll")) libavs_win32_dll["libavs-win32.dll"]
arkkdm_dll["arkkdm.dll"] libavs_win32_ea3_dll["libavs-win32-ea3.dll"]
arkkdmtest_dll["arkkdmtest.dll"]
deahook_dll["deahook.dll"]
ess_dll["ess.dll"]
gamekdm_dll["gamekdm.dll"]
kmd_dll["kmd.dll"]
ksm_dll["ksm.dll"]
kuc_dll["kuc.dll"]
libacio_dll["libacio.dll"]
libacio_mbr_dll["libacio_mbr.dll"]
libafp_win32_dll["libafp-win32.dll"] libafp_win32_dll["libafp-win32.dll"]
libafputils_win32_dll["libafputils-win32.dll"] libafputils_win32_dll["libafputils-win32.dll"]
libavs_win32_ea3_dll["libavs-win32-ea3.dll"] ess_dll["ess.dll"]
libavs_win32_dll["libavs-win32.dll"] libacio_dll["libacio.dll"]
libinput_dll["libinput.dll"] arkkdm_dll["arkkdm.dll"]
arkkdmtest_dll["arkkdmtest.dll"]
gamekdm_dll["gamekdm.dll"]
kinect(("Kinect10.dll (external MS NUI runtime)"))
libavs_win32_ea3_dll --> libavs_win32_dll
libafp_win32_dll --> libavs_win32_dll
libafputils_win32_dll --> libavs_win32_dll
libafputils_win32_dll --> libafp_win32_dll
ess_dll --> libavs_win32_dll
ess_dll --> libavs_win32_ea3_dll
arkkdm_dll --> libavs_win32_dll arkkdm_dll --> libavs_win32_dll
arkkdm_dll --> libavs_win32_ea3_dll arkkdm_dll --> libavs_win32_ea3_dll
arkkdm_dll --> ess_dll arkkdm_dll --> ess_dll
arkkdm_dll --> libacio_dll arkkdm_dll --> libacio_dll
arkkdm_dll --> libafp_win32_dll arkkdm_dll --> libafp_win32_dll
ess_dll --> libavs_win32_dll
ess_dll --> libavs_win32_ea3_dll
gamekdm_dll --> Kinect10_dll
gamekdm_dll --> libavs_win32_dll gamekdm_dll --> libavs_win32_dll
gamekdm_dll --> libafputils_win32_dll
gamekdm_dll --> libafp_win32_dll gamekdm_dll --> libafp_win32_dll
kmd_dll --> libavs_win32_dll gamekdm_dll --> libafputils_win32_dll
ksm_dll --> libavs_win32_dll gamekdm_dll -.external.-> kinect
ksm_dll --> libavs_win32_ea3_dll
kuc_dll --> libavs_win32_dll
kuc_dll --> libavs_win32_ea3_dll
libacio_mbr_dll --> libinput_dll
libacio_mbr_dll --> libavs_win32_dll
libafp_win32_dll --> libavs_win32_dll
libafputils_win32_dll --> libavs_win32_dll
libafputils_win32_dll --> libafp_win32_dll
libavs_win32_ea3_dll --> libavs_win32_dll
``` ```
This 22-edge, 22-node graph was re-verified acyclic by depth-first-search in The internal graph is acyclic. A dependency-first topological order, matching
this session (traversal from every node terminates with no back-edge), the the companion inventory's [reconstruction order](../companion-inventory.md#reconstruction-order-topological-acyclic),
same result the companion inventory reports (`docs/companion-inventory.md: is `libavs-win32.dll`, `libavs-win32-ea3.dll`, `ess.dll`, `libacio.dll`,
"Verified acyclic by DFS over all 22 nodes"`). `libafp-win32.dll`, `libafputils-win32.dll`, `arkkdm.dll`, `arkkdmtest.dll`,
then `gamekdm.dll`.
Runtime loading is separate from these PE import edges: the official
`arkkdm.dll` exports `dll_entry_init` / `dll_entry_main` for AVS2.
Its `dll_entry_main` uses `LoadLibraryA("gamekdm.dll")` with an
`"arkkdmtest.dll"` test-build fallback, resolves `gameMain` with
`GetProcAddress`, and calls `gameMain(hInstance)` (cdecl). The argument is
`arkkdm.dll`'s own `HINSTANCE`, captured in `DllMain` and relayed through
`g_MainDllInfo.dllHMODULE`. These facts are sourced to the official
`arkkdm.dll` in the contract's "Official boot/entry" and the companion
inventory's [boot/entry section](../companion-inventory.md#bootentry-into-the-game-official-from-arkkdmdll).
### `libavs-win32.dll` as the AVS2 base ### `libavs-win32.dll` as the AVS2 base
`libavs-win32.dll` is the only node with zero shipped-DLL imports and is the `libavs-win32.dll` is the base of the main middleware stack, with zero
root of the main middleware stack, but it is **not** a transitive ancestor of shipped-module imports. Six other modules import it directly:
every other IN-SCOPE DLL: 10 of the other 15 IN-SCOPE modules import it `libavs-win32-ea3.dll`, `libafp-win32.dll`, `libafputils-win32.dll`, `ess.dll`,
directly (`arkkdm.dll`, `ess.dll`, `kmd.dll`, `ksm.dll`, `kuc.dll`, `arkkdm.dll`, and `gamekdm.dll`. The remaining two modules, `libacio.dll` and
`libacio_mbr.dll`, `libafp-win32.dll`, `libafputils-win32.dll`, `arkkdmtest.dll`, also have zero shipped-module imports. Thus AVS2 is one of
`libavs-win32-ea3.dll`, `gamekdm.dll`), while the remaining 5 — `arkkdmtest.dll`, three roots, not a dependency of every module, as shown by the canonical
`deahook.dll`, `libacio.dll`, `libinput.dll`, and `modules/libacio.dll` — are graph's explicit edges.
independent leaves that import no shipped DLL at all, confirmed per-file in
the `objdump -p` import-table dump above (see also the "roots — leaves"/
"roots — only OS/DirectX imports" lines in the dependency DAG above).
### `libafp -> libavs` edge ### `libafp -> libavs` edge
`libafp-win32.dll`'s only shipped-DLL import is `libavs-win32.dll` (its full `libafp-win32.dll`'s only shipped-module import is `libavs-win32.dll`, as
import-DLL set, read from `objdump -p GAME-DIR/libafp-win32.dll`, is just recorded in both authoritative dependency graphs. It is consumed by
`libavs-win32.dll` + `KERNEL32.dll`), confirming the `libafp->libavs` edge `libafputils-win32.dll`, `arkkdm.dll`, and `gamekdm.dll`.
named in the task brief and matching the companion inventory's row for this
file (`docs/companion-inventory.md:58`).
### `gamekdm -> all` edge ### `gamekdm` dependencies
`gamekdm.dll`'s PE import table (`objdump -p GAME-DIR/gamekdm.dll`, `DLL `gamekdm.dll` imports three shipped modules: `libavs-win32.dll`,
Name:` entries) lists 16 DLLs total: `d3dx9_43.dll`, `Kinect10.dll`, `libafp-win32.dll`, and `libafputils-win32.dll`. It does not depend on every
`d3d9.dll`, `libavs-win32.dll`, `libafputils-win32.dll`, `KERNEL32.dll`, shipped module. Its external dependencies include `Kinect10.dll` (Microsoft
`USER32.dll`, `GDI32.dll`, `ADVAPI32.dll`, `SHELL32.dll`, `ole32.dll`, NUI v1) and OS DirectX `d3d9.dll`/`d3dx9_43.dll`, as documented in the
`WS2_32.dll`, `WINMM.dll`, `IMM32.dll`, `DINPUT8.dll`, `libafp-win32.dll`. contract and companion inventory. Those runtimes are supplied by the
Restricted to shipped DLLs, that is `Kinect10.dll` (ALREADY-OSS tier), platform and do not enlarge the nine-module reconstruction set.
`libavs-win32.dll` (AVS2 base tier), and `libafputils-win32.dll` +
`libafp-win32.dll` (AFP tier) — `gamekdm.dll` is the only shipped DLL whose
import set spans every other dependency tier, matching the `gamekdm->all`
description in the task brief and the companion inventory's equivalent
finding (`docs/companion-inventory.md:195-199`).
This edge set is independently corroborated at the function-call-graph level:
`re/rvadb.json`'s per-function `external_callees` field (populated for all
9,728 reconstructed `gamekdm.dll` functions) names exactly the same 16 import
DLLs as actual call targets, with call-site counts of `LIBAVS-WIN32.DLL`: 595,
`LIBAFP-WIN32.DLL`: 96, `LIBAFPUTILS-WIN32.DLL`: 13, `KINECT10.DLL`: 5 (plus
`KERNEL32.DLL`: 1799 and the remaining OS DLLs), confirming the PE
import-table edges are actually exercised by `gameMain`'s call graph rather
than being present-but-unused linker artifacts.
## Reconciliation with `companion-inventory.md` ## Reconciliation with `companion-inventory.md`
The companion inventory (`docs/companion-inventory.md`) already performed The corrected [companion inventory](../companion-inventory.md) and the
this classification and DAG derivation as Task T13 and additionally resolves [official-scope contract](../../.omo/scope/official-scope.md) define this
ambiguous cases this section only summarizes: chapter's evidence boundary:
- **`deahook.dll` authorship** is explicitly marked unresolved there (not - Exactly 9 modules under `contents/modules/` are shipped, Konami-authored,
provably Konami, only provably *not* spice2x/spicetools, per full-text grep and IN-SCOPE; the table uses their clean-release listing sizes.
of both shipped OSS source tarballs — `docs/companion-inventory.md:240-263`) - The internal DAG reproduces the canonical 9 nodes and 14 edges. The
— this section inherits that "author unresolved" caveat rather than explicitly external `gamekdm.dll` to `Kinect10.dll` NUI runtime edge is
asserting Konami authorship. excluded from those counts.
- **`kbt.dll`/`kld.dll`** are classified ALREADY-OSS there via an embedded - `libacio.dll` and `arkkdmtest.dll` are independent roots alongside AVS2.
bemanitools PDB path and a disassembled `k_bt0002` body that is a bare The explicit topology controls here; the companion inventory's prose
`ret` rather than the spice2x `stubs.cpp` implementation calling AVS2 an ancestor of every module overstates that topology.
(`docs/companion-inventory.md:51-52`) — not independently re-disassembled - Historical export counts remain **UNVERIFIED (pending re-check against clean-release binary)**.
in this pass, taken as given from that prior finding. They are not new measurements of the official artifacts; clean-release
- **`ksm.dll`/`kuc.dll`** import three further Konami-family DLLs binary re-checks remain necessary before relying on them.
(`kdu.dll`, `kmp.dll`, `kma.dll`) that are **not shipped** in this game
directory (`docs/companion-inventory.md:97-100`); these are intentionally
excluded from the dependency graph above as unverifiable (no artifact to
cite), consistent with the companion inventory's own exclusion rationale.
- Every size and named-export count in the per-DLL table above matches the
companion inventory's figures exactly on independent re-measurement in
this session, with the sole clarification that `Kinect10.dll`'s Export
Address Table header reports 29 ordinal slots (`0x1d`) against 25 named
exports (`0x19`) — the inventory's "25 export(s)" figure is the named
count, which this section also uses as the canonical "export count" metric
throughout the table for consistency across files.
No IN-SCOPE/ALREADY-OSS/REUSE-OS classification in the companion inventory This chapter presents the corrected official inventory at spec level.
was altered by this re-derivation; this section exists as the spec-level
presentation of that same evidence base for the DLL-architecture chapter of
the full technical spec.
## See also ## See also
@@ -237,5 +177,8 @@ the full technical spec.
- [`./09-reconstruction-codebase.md`](./09-reconstruction-codebase.md) — how - [`./09-reconstruction-codebase.md`](./09-reconstruction-codebase.md) — how
the IN-SCOPE set above maps onto the reconstruction codebase's build the IN-SCOPE set above maps onto the reconstruction codebase's build
targets. targets.
- [`../companion-inventory.md`](../companion-inventory.md) — the full Task - [`../companion-inventory.md`](../companion-inventory.md) — the corrected
T13 inventory this section reconciles with and summarizes. clean-release inventory this section reconciles with and summarizes.
- [`../../.omo/scope/official-scope.md`](../../.omo/scope/official-scope.md) —
authoritative official-game scope, listing sizes, dependency graph and
binary-integrity caveat.
+26 -11
View File
@@ -2,11 +2,19 @@
## Scope and address convention ## Scope and address convention
The documented integration delivers a 20-joint skeleton through a replacement `gamekdm.dll`'s own import table statically imports `Kinect10.dll`
`Kinect10.dll`, after which gamekdm performs selection/validation and feeds (`re/importlibs/Kinect10.def`), Microsoft's external Kinect-for-Windows
the menu cursor system (`game-internals.md:15-24`). NUI v1 runtime — not a module shipped in `contents/modules/`, but an
The companion tracker publishes synthetic depth, color, and skeleton data external dependency gamekdm.dll's import table requires and which a real
through shared memory to that shim (`game-internals.md:7-10`). cabinet satisfies from the installed Kinect runtime
[`../../.omo/scope/official-scope.md`](../../.omo/scope/official-scope.md).
This reconstruction's own test shim stands in for that runtime off-cabinet:
it delivers a 20-joint skeleton through the same `Kinect10.dll` import
surface, after which gamekdm performs selection/validation and feeds the
menu cursor system (`game-internals.md:15-24`). The reconstruction's own
test tracker publishes synthetic depth, color, and skeleton data through
shared memory to that shim (`game-internals.md:7-10`); this synthetic data
path is part of the reconstruction's test harness, not the shipped game.
See [the overview](./00-overview.md), [companion APIs](./07-companion-apis.md), See [the overview](./00-overview.md), [companion APIs](./07-companion-apis.md),
and [the reconstruction codebase](./09-reconstruction-codebase.md). and [the reconstruction codebase](./09-reconstruction-codebase.md).
@@ -33,7 +41,14 @@ vma: Ordinal Hint Member-Name Bound-To
002181e4 22 <none> <none> 002181e4 22 <none> <none>
``` ```
The companion shim pins those ordinals to `NuiGetSensorCount` (5), This import block is read from the official `gamekdm.dll` binary's own PE
import table. `Kinect10.dll` is Microsoft's external Kinect-for-Windows
NUI v1 runtime, not a module shipped in `contents/modules/`; gamekdm.dll's
import table requires it, and on a cabinet it is satisfied by the installed
Kinect runtime, never by a game-shipped file
[`../../.omo/scope/official-scope.md`](../../.omo/scope/official-scope.md).
The reconstruction's own test shim pins those ordinals to `NuiGetSensorCount` (5),
`NuiCreateSensorByIndex` (6), `NuiCreateSensorByIndex` (6),
`NuiImageGetColorPixelCoordinatesFromDepthPixel` (9), `NuiImageGetColorPixelCoordinatesFromDepthPixel` (9),
`NuiTransformSmooth` (20), and `NuiSetDeviceStatusCallback` (22) `NuiTransformSmooth` (20), and `NuiSetDeviceStatusCallback` (22)
@@ -61,7 +76,7 @@ not that gamekdm calls every entry (`re/importlibs/Kinect10.def:8-34`).
| Skeleton selection/orientation | `NuiSkeletonSetTrackedSkeletons`, `NuiSkeletonCalculateBoneOrientations` | `re/importlibs/Kinect10.def:31-32` | | Skeleton selection/orientation | `NuiSkeletonSetTrackedSkeletons`, `NuiSkeletonCalculateBoneOrientations` | `re/importlibs/Kinect10.def:31-32` |
| Other | `NuiGetAudioSource`, `NuiCreateCoordinateMapperFromParameters`, `NuiCreateDepthFilter` | `re/importlibs/Kinect10.def:30,33-34` | | Other | `NuiGetAudioSource`, `NuiCreateCoordinateMapperFromParameters`, `NuiCreateDepthFilter` | `re/importlibs/Kinect10.def:30,33-34` |
The companion interface declares initialization, image-stream, skeleton, and The reconstruction's test-shim interface declares initialization, image-stream, skeleton, and
elevation methods on `INuiSensor` as well as providing flat exports; the elevation methods on `INuiSensor` as well as providing flat exports; the
game's reconstructed elevation routine specifically calls a sensor interface game's reconstructed elevation routine specifically calls a sensor interface
pointer. Thus absence from the five flat imports does not establish absence pointer. Thus absence from the five flat imports does not establish absence
@@ -228,7 +243,7 @@ the successful-Get branch (`src/game/nui_elevation.cpp:19-22`).
## Depth-to-skeleton projection ## Depth-to-skeleton projection
The companion mapping implementation uses `kDepthProjectionScale = 3.501e-3f`. The reconstruction's test-shim mapping implementation uses `kDepthProjectionScale = 3.501e-3f`.
The RE notes identify this with the nominal inverse focal-length constant The RE notes identify this with the nominal inverse focal-length constant
and report Kinect-compatible projection; that historical compatibility and report Kinect-compatible projection; that historical compatibility
claim is not a fresh physical-sensor measurement here claim is not a fresh physical-sensor measurement here
@@ -332,9 +347,9 @@ The unchanged hip explains unchanged candidate-position math; it does not
prove limb changes are irrelevant to the sentinel-gravity orientation branch, prove limb changes are irrelevant to the sentinel-gravity orientation branch,
which explicitly examines limbs (`game-internals.md:31-36`). which explicitly examines limbs (`game-internals.md:31-36`).
Arm gain defaults are `3.2` horizontally and `2.6` vertically; the companion Arm gain defaults are `3.2` horizontally and `2.6` vertically; the
calibration document gives environment overrides precedence over saved reconstruction's test-shim calibration document gives environment overrides
calibration and then defaults precedence over saved calibration and then defaults
(`/home/athapa/kinect/docs/calibration.md:25-39`). (`/home/athapa/kinect/docs/calibration.md:25-39`).
The menu hand-cursor mapping is attributed by the RE notes to the Flash/Natal The menu hand-cursor mapping is attributed by the RE notes to the Flash/Natal
runtime; detailed cursor handling belongs with runtime; detailed cursor handling belongs with
+39 -113
View File
@@ -1,15 +1,19 @@
# 05 — Data Formats # 05 — Data Formats
Game-directory layout, configuration formats, the AVS2 filesystem/property-tree Game-directory layout, configuration formats, the AVS2 filesystem/property-tree
model, and the asset container formats found by direct inspection of model, and the asset container formats of the clean KDM-2016021900
`GAME-DIR = /mnt/f/Users/Aaron Thapa/Downloads/KDM-2016021900/contents`. All `contents/` release (`GAME-DIR`). All paths below are relative to `contents/` unless marked
paths below are absolute game-dir paths unless marked otherwise. No otherwise. No
copyrighted asset content (audio/video/lyrics/art) is reproduced; only file copyrighted asset content (audio/video/lyrics/art) is reproduced; only file
structure, headers, and extension inventories are described. structure, headers, and extension inventories are described.
See also: [00-overview.md](./00-overview.md), [01-runtime-boot.md](./01-runtime-boot.md), See also: [00-overview.md](./00-overview.md), [01-runtime-boot.md](./01-runtime-boot.md),
[07-companion-apis.md](./07-companion-apis.md). [07-companion-apis.md](./07-companion-apis.md).
The release layout follows the [official scope contract](../../.omo/scope/official-scope.md).
Historical XML excerpts, asset counts, byte sizes, header bytes, offsets, and
binary-derived observations below are UNVERIFIED (pending re-check against clean-release binary).
## 1. Top-level game-dir layout ## 1. Top-level game-dir layout
``` ```
@@ -17,12 +21,10 @@ contents/
├── data/ game assets (sound, 2D/animation, fonts, textures, movies, dal manifests) ├── 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) ├── 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) ├── prop/ AVS2 property-tree config XML (device defaults, shipped with the install)
├── modules/ loadable companion DLLs (I/O driver) └── modules/ nine shipped Konami modules
├── api/ Spice2x-style SpiceAPI client bindings, not Konami-original
└── dev/ AVS2 virtual device backing store (`nvram`, `raw`) — runtime state
``` ```
Verified directory listings (`find GAME-DIR/{data,arkdata,prop,modules,api,dev} -maxdepth 2`): The clean-release listing records:
- `data/arc/`, `data/arc/2d/`, `data/bm2d/`, `data/dal/`, `data/dal/2d/`, - `data/arc/`, `data/arc/2d/`, `data/bm2d/`, `data/dal/`, `data/dal/2d/`,
`data/data/`, `data/font/`, `data/sound/`, `data/bgmov/` — asset trees. `data/data/`, `data/font/`, `data/sound/`, `data/bgmov/` — asset trees.
@@ -30,24 +32,11 @@ Verified directory listings (`find GAME-DIR/{data,arkdata,prop,modules,api,dev}
`arkdata/arkkdm/{ea3license,qc,sound,testmode}` — ARK/KDM-specific assets, `arkdata/arkkdm/{ea3license,qc,sound,testmode}` — ARK/KDM-specific assets,
e.g. `arkdata/arkkdm/ea3license/license1.dds`, e.g. `arkdata/arkkdm/ea3license/license1.dds`,
`arkdata/arkkdm/qc/zero.bin`, `arkdata/arkkdm/sound/{seteq.def,setvolume.def}`. `arkdata/arkkdm/qc/zero.bin`, `arkdata/arkkdm/sound/{seteq.def,setvolume.def}`.
- `prop/` contains exactly: `app-config.xml`, `ark-config.xml`, - `prop/` contains `ark-config.xml`, `ark-config_nopp.xml`, `avs-config.xml`,
`avs-config.xml`, `card_allow.bin`, `coin.xml`, `ea3-config.xml`, `card_allow.bin`, `coin.xml`, `eacoin.xml`, `eamuse-config.xml`,
`eacoin.xml`, `ess-config.xml`, `libxml.xml`, `share-config.xml`, `ess-config.xml`, `share-config.xml`, and `testmode-v.xml`.
`testmode-v.xml` (11 files, all at `prop/` top level — no subdirectories). - `modules/` contains exactly the nine Konami modules listed in
- `modules/` contains a single file, `modules/libacio.dll` (the I/O-board [docs/companion-inventory.md](../companion-inventory.md).
driver companion; see [07-companion-apis.md](./07-companion-apis.md)).
- `api/` holds five SpiceAPI language bindings (`arduino/`, `cpp/`, `dart/`,
`lua/`, `python/`) plus `api/lua/boot_iidx_tt_lights.lua`,
`api/python/spiceremote.py`. These are a third-party (spice2x project)
client toolkit bundled with the install, not part of Konami's original
AVS2/gamekdm data model — [docs/companion-inventory.md:100](../companion-inventory.md).
- `dev/nvram/` holds the AVS2 NVRAM-device XML snapshot: `bookkeep0.xml`,
`bookkeep1.xml`, `bookkeep2.xml`, `clock.xml`, `coin.xml`,
`ea3-config.xml`, `eacoin.xml`, `keepalive.xml`, `libxml.xml`,
`testmode-v.xml`, `testmode-v.crc`. `dev/raw/` holds raw-device
subdirectories `bookkeeping/`, `fscache/`, `ranking/`, `settings/`, `log/`
— runtime write targets for the `nvram`/`raw` AVS2 filesystem devices
described in §3.
## 2. `prop/` configuration XML — structure ## 2. `prop/` configuration XML — structure
@@ -60,62 +49,17 @@ node model gamekdm and the AVS2 runtime manipulate in memory and that ships
binary-encoded inside the e-amusement network protocol binary-encoded inside the e-amusement network protocol
([07-companion-apis.md:62](./07-companion-apis.md)). ([07-companion-apis.md:62](./07-companion-apis.md)).
### 2.1 `ea3-config.xml` — e-amusement v3 client config ### 2.1 `eamuse-config.xml` — e-amusement client config
Root `<ea3>`. Verified structure (`prop/ea3-config.xml`, line numbers from a The clean release supplies `prop/eamuse-config.xml`.
direct `grep`): Its detailed XML structure has not yet been re-checked
against the clean-release file and is therefore UNVERIFIED (pending re-check
```xml against clean-release binary).
<ea3>
<id>
<pcbid __type="str">00000000000000000000</pcbid> <!-- ea3-config.xml:4 -->
<softid __type="str">00000000000000000000</softid> <!-- ea3-config.xml:5 -->
</id>
<soft>
<model __type="str">KDM</model> <!-- ea3-config.xml:9 -->
<dest __type="str">A</dest>
<spec __type="str">A</spec>
<rev __type="str">A</rev>
<ext __type="str">2016021900</ext> <!-- ea3-config.xml:13: matches install dir name KDM-2016021900 -->
</soft>
<timezone __type="s32">32400</timezone> <!-- ea3-config.xml:16: +9:00 (JST) -->
<encoding>SHIFT_JIS</encoding> <!-- ea3-config.xml:18 -->
<format>binary</format> <!-- ea3-config.xml:19: wire encoding for ea3 RPC -->
<network>
<sz_xrpc_buf __type="u32">102400</sz_xrpc_buf>
<ssl __type="bool">0</ssl>
<services __type="str">http://localhost:8080/</services> <!-- ea3-config.xml:23 -->
<url_slash __type="bool">1</url_slash>
</network>
<eacoin> ... </eacoin> <!-- ea3-config.xml:28-37: PASELI/eacoin service params -->
<pos>
<coin>
<slot1> ... <event __type="str">coin.i</event> ... </slot1> <!-- ea3-config.xml:56-69 -->
<service> ... <event __type="str">service.p</event> ... </service> <!-- ea3-config.xml:71-80 -->
<p1s01a1> ... <event __type="str">game.s</event> ... </p1s01a1> <!-- ea3-config.xml:87-98, article/credit mapping -->
<!-- p1s02a1..p1s16a1: one <article>/<event>/<credit_ref> block per
coin-pool article slot, mapping coin events to credit refs such as
/coin/start, /coin/continue, /coin/join, /coin/item1..12
(ea3-config.xml:99-203) -->
</coin>
</pos>
</ea3>
```
`<model>KDM</model>` (ea3-config.xml:9) is the e-amusement model code for
DanceEvolution Arcade; `<ext>2016021900</ext>` (ea3-config.xml:13) is the data
version stamp, matching the install directory name `KDM-2016021900` in
GAME-DIR's parent path. The `<pos><coin>` block defines a table of named
*article* nodes (`p1s01a1`..`p1s16a1` per-player) each binding a `type`
(`throw`/`consume`), an `article` index, an `event` string the coin-handling
code raises, a `player_ref` property-tree pointer, and a `credit_ref`
property-tree pointer the consume resolves against — this is the on-disk
form of the coin/credit event routing table gamekdm/ARK read through the
AVS2 property API.
### 2.2 `avs-config.xml` — AVS2 runtime config ### 2.2 `avs-config.xml` — AVS2 runtime config
Root `<config>`. Verified structure (`prop/avs-config.xml`): Historical structure attributed to `prop/avs-config.xml` (subject to the
clean-release caveat above), root `<config>`:
```xml ```xml
<config> <config>
@@ -167,43 +111,27 @@ open-file-descriptor table respectively.
### 2.3 Other `prop/*.xml` files (by name, structure not fully enumerated here) ### 2.3 Other `prop/*.xml` files (by name, structure not fully enumerated here)
- `app-config.xml`, `ark-config.xml`, `coin.xml`, `eacoin.xml`, - `ark-config.xml`, `ark-config_nopp.xml`, `coin.xml`, `eacoin.xml`,
`ess-config.xml`, `share-config.xml`, `testmode-v.xml`, `libxml.xml` — same `eamuse-config.xml`, `ess-config.xml`, `share-config.xml`, and
typed-attribute XML dialect as §2.1/§2.2 (`<tag __type="...">value</tag>`), `testmode-v.xml` are the remaining shipped configuration files.
one file per subsystem (ARK engine, ESS sound library, coin/eacoin `prop/card_allow.bin` is the only non-XML file in `prop/`; its contents are
defaults, test-mode flags, XML-library-internal state). `prop/card_allow.bin` UNVERIFIED.
is the only non-XML file in `prop/`; its contents were not decoded for this
section (card-reader allow-list — UNVERIFIED format).
- `dev/nvram/*.xml` mirror the same leaf names (`bookkeep0..2.xml`,
`clock.xml`, `coin.xml`, `ea3-config.xml`, `eacoin.xml`, `keepalive.xml`,
`libxml.xml`, `testmode-v.xml`) — these are the **runtime** property-tree
snapshots the AVS2 `nvram` device persists, as opposed to `prop/`'s
**shipped defaults**; `dev/nvram/testmode-v.crc` is a checksum sidecar for
`testmode-v.xml`.
## 3. AVS2 filesystem + property-tree model ## 3. AVS2 filesystem + property-tree model
Evidence base: `prop/avs-config.xml` (§2.2), `re/avs/property_node.h`, 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 `re/avs/recon_avs_harness.cpp`, `re/avs/prove_t14.py`, and the exported
symbol inventory in `docs/companion-inventory.md` (`libavs-win32.dll`, 360 module inventory in [docs/companion-inventory.md](../companion-inventory.md)
ordinal-style exports, zero shipped-DLL dependencies — the AVS2 base (`libavs-win32.dll`, zero shipped-DLL dependencies — the AVS2 base companion;
companion; `libavs-win32-ea3.dll`, 139 exports, the e-amusement-v3 `libavs-win32-ea3.dll`, the e-amusement-v3 extension). Historical export
extension — [docs/companion-inventory.md:60-61](../companion-inventory.md)). counts are UNVERIFIED (pending re-check against clean-release binary).
- **Virtual filesystem.** AVS2 multiplexes named *devices* under mount - **Virtual filesystem.** AVS2's configuration declares named devices and
points declared in `avs-config.xml`'s `<fs>` block: a `root` device over mount points. The exact runtime backing trees observed in a contaminated
the game-dir tree, an `nvram` device (block-structured, mirrored, backing install are UNVERIFIED (pending re-check against clean-release binary).
`dev/nvram/`) for small persistent key-value/XML state, and a `raw` device
(backing `dev/raw/`) for larger unstructured runtime data (log files,
bookkeeping counters, ranking caches, settings blobs — all observed as
real subdirectories of `dev/raw/`). `nr_mountpoint=256`/`nr_filedesc=256`
size the VFS's internal tables.
- **Property tree.** Every `*-config.xml` in `prop/` and `dev/nvram/` is the - **Property tree.** Every `*-config.xml` in `prop/` and `dev/nvram/` is the
textual serialization of an AVS2 *property* object: a typed, path-addressed textual serialization of an AVS2 *property* object: a typed, path-addressed
tree (`/coin/slot1/player`, `/eacoin/enable`, etc. — literal path strings tree. Each leaf node carries a type tag (`str`/`u8`/`u16`/
appear as `*_ref` leaf values inside `ea3-config.xml`, e.g.
`<player_ref __type="str">/coin/player1/ref_slotid</player_ref>`,
ea3-config.xml:64). Each leaf node carries a type tag (`str`/`u8`/`u16`/
`u32`/`s32`/`bool`) matching the C scalar types the AVS2 property API `u32`/`s32`/`bool`) matching the C scalar types the AVS2 property API
reads/writes — the reconstruction's `re/avs/property_node.h` declares 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`), accessors following this documented AVS2 C API (`re/avs/property_node.h:1-3`),
@@ -214,13 +142,11 @@ extension — [docs/companion-inventory.md:60-61](../companion-inventory.md)).
the property tree is not merely a config-loading convention but a typed 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`. in-memory data structure with its own ABI inside `libavs-win32.dll`.
- gamekdm/ARK read the property tree through `libavs-win32.dll` (AVS2 base) - gamekdm/ARK read the property tree through `libavs-win32.dll` (AVS2 base)
and `libavs-win32-ea3.dll` (ea3 extension); `ea3-config.xml`'s `<pos><coin>` and `libavs-win32-ea3.dll` (e-amusement v3 extension).
article table (§2.1) is a concrete example of gamekdm-level data stored and
resolved as property-tree paths (`credit_ref`, `player_ref`).
- `prop/avs-config.xml:1` — root tag is `<config>`, not `<ea3>` or `<avs>`: - `prop/avs-config.xml:1` — root tag is `<config>`, not `<ea3>` or `<avs>`:
this file configures the AVS2 kernel itself (filesystem, logging, this file configures the AVS2 kernel itself (filesystem, logging,
networking, threading, SNTP), distinct from `ea3-config.xml` which networking, threading, SNTP), distinct from `eamuse-config.xml` which
configures the e-amusement-v3 client layer running on top of it. configures the e-amusement client layer running on top of it.
## 4. Archive / container formats (by inspection) ## 4. Archive / container formats (by inspection)
@@ -263,9 +189,9 @@ 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 `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 (`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. compressed or obfuscated/encrypted header rather than a plaintext TOC.
`game-internals.md:146` records that the external pip package `ifstools` `game-internals.md` records that the external pip package `ifstools`
(pure-Python) successfully extracts `data/bm2d/*.ifs` into an `afp/<name>` (pure-Python) successfully extracts `data/bm2d/*.ifs` into an `afp/<name>`
Flash-asset tree, and `game-internals.md:54-55` states the menu UI (including Flash-asset tree, and `game-internals.md` states the menu UI (including
the cursor sprite) is compiled Flash packed inside these `.ifs` archives. the cursor sprite) is compiled Flash packed inside these `.ifs` archives.
`rvadb.json` contains dozens of `.ifs` path-format strings referenced by `rvadb.json` contains dozens of `.ifs` path-format strings referenced by
gamekdm (e.g. `"value": "jk_%s_v0.ifs"` at `re/rvadb.json:175117`, gamekdm (e.g. `"value": "jk_%s_v0.ifs"` at `re/rvadb.json:175117`,
+124 -493
View File
@@ -1,18 +1,20 @@
# 07 — Companion DLL API Surfaces # 07 — Companion DLL API Surfaces
This section documents the exported API surface and role of every in-scope This section documents the exported API surface and role of the **eight
Konami companion DLL that `gamekdm.dll` depends on, directly or transitively, official companion DLLs** shipped beside `gamekdm.dll` in the clean
per the reconstruct set locked in [`../companion-inventory.md`](../companion-inventory.md). KDM-2016021900 `contents/modules/` release. The complete official module set
Export lists are taken from `re/importlibs/*.def` (gendef output over the is the nine modules in [`../companion-inventory.md`](../companion-inventory.md):
owner's binaries, regenerated by `tools/gen_importlibs.sh` — see these eight companions plus `gamekdm.dll`. The authoritative scope contract is
[`../companion-conventions.md`](../companion-conventions.md)) and [`../../.omo/scope/official-scope.md`](../../.omo/scope/official-scope.md).
cross-checked directly against `objdump -p` on the shipped DLLs at
`GAME-DIR = /mnt/f/Users/Aaron Thapa/Downloads/KDM-2016021900/contents`. Export and dependency claims below are grounded in the companion export/import
Calling-convention and binding evidence (cdecl/stdcall, by-name vs. ordinal, tables recorded under `re/importlibs/` and the clean-release module topology
`--kill-at`) lives in `../companion-conventions.md` and is not repeated here in the inventory. Earlier `objdump` observations from a possibly contaminated
except where it affects how an export is named. No creative game assets are install are not used as game evidence. Any byte-exact export count, ordinal,
reproduced; only C API surfaces, struct-layout fragments already captured in RVA, or size which has not been re-checked against a clean-release binary is
`re/avs/avs_structdb.json`, and file-format roles are described. **UNVERIFIED (pending re-check against clean-release binary)**. No community
launcher, hook, emulator, stub, or non-release module belongs to this API
surface.
Cross-links: [`./00-overview.md`](./00-overview.md), Cross-links: [`./00-overview.md`](./00-overview.md),
[`./08-abi-conventions.md`](./08-abi-conventions.md), [`./08-abi-conventions.md`](./08-abi-conventions.md),
@@ -20,510 +22,139 @@ Cross-links: [`./00-overview.md`](./00-overview.md),
## libavs-win32.dll — AVS2 base middleware ## libavs-win32.dll — AVS2 base middleware
**Role:** root of the Konami dependency DAG. Every other IN-SCOPE companion **Role:** root of the official dependency DAG. It supplies the AVS2
(`arkkdm.dll`, `ess.dll`, `libacio_mbr.dll`, `libafp-win32.dll`, property-tree configuration store, virtual filesystem, and
`libafputils-win32.dll`, `kmd.dll`, `ksm.dll`, `kuc.dll`, thread/mutex/event primitives used by the shipped modules
`libavs-win32-ea3.dll`) imports it; it imports only `KERNEL32.dll`, [`../companion-inventory.md`](../companion-inventory.md).
`WS2_32.dll`, `WINMM.dll`, `IPHLPAPI.DLL` (`objdump -p` on
`GAME-DIR/libavs-win32.dll`, DLL Name block). It is the Konami "Application/
Audio-Visual System v2" runtime: property-tree configuration store, AVS
filesystem abstraction (mounted archives, not raw `fopen`), and the
thread/mutex/event primitives every other companion is built on.
**Export surface:** `re/importlibs/libavs-win32.def` lists **360 named **Export surface:** `re/importlibs/libavs-win32.def` records named,
exports**, all vendor-obfuscated hash tokens of the form hash-obfuscated `XCd229cc...` exports. Its recorded count, ordinal mapping,
`XCd229cc0000fb`..`XCd229cc00016c` (`re/importlibs/libavs-win32.def:9-368`). and token-to-semantic mapping are **UNVERIFIED (pending re-check against
`objdump -p GAME-DIR/libavs-win32.dll` confirms 360 real export-table names clean-release binary)** unless separately supported by a clean export table.
in this same `XCd229cc...` form (reconstruction proxy header One reconstruction mapping is documented in
`re/avs/libavs-win32.def:9-18` forwards each token 1:1, ordinal-preserving, `re/avs/property_node.h`, `re/avs/property_node.cpp`, and
to `libavs-win32_orig.dll`). **None of the 360 exports carry a readable C `re/avs/avs_structdb.json`: token `XCd229cc000083` is reconstructed as
symbol in the shipped binary** — the vendor stripped/obfuscated the AVS2 `avs::property_node_datasize`. That reconstruction is an interpretation of
export name table for this build, unlike every other companion in this the official export and recorded code evidence, not a claim that an external
inventory, which all ship plain, readable C names. compatibility project is part of the game.
Because the export table itself gives no semantic names, the mapping from
hash token to AVS2 C function is done by behavior, not by name recovery:
Ghidra analysis of `libavs-win32.dll` (project `avsproj.gpr`,
`/home/athapa/ghidra/avsproj.gpr`) plus a semantic match against the
documented AVS2 API in the shipped open-source companion trees
(`GAME-DIR/src/spice2x-master.tar.gz:spice2x/avs/core.h` and
`GAME-DIR/src/spicetools-master.tar.gz:spicetools/avs/core.h`, both present
under `GAME-DIR/src`). `spice2x/avs/core.h` declares the AVS2 property-node
C API by name (`property_search`, `property_create`, `property_node_create`,
`property_node_remove`, `property_node_refer`, `property_node_read`,
`property_node_write`, `property_node_datasize`, `property_node_type`,
`property_node_has`, `property_node_is_array`, `property_node_clone`,
`property_node_query_stat`, `property_get_attribute_{bool,u32,s32}`,
`property_node_get_attribute_{bool,u32,s32}`, `property_psmap_export`/
`_import`, `property_lock_flag`/`unlock_flag`/`set_flag`, `property_clear`,
`property_destroy`), the AVS filesystem API (`avs_fs_open`, `avs_fs_close`,
`avs_fs_read`, `avs_fs_lseek`, `avs_fs_fstat`, `avs_fs_lstat`,
`avs_fs_mount`, `avs_fs_copy`, `avs_fs_dump_mountpoint`, `avs_fs_opendir`/
`readdir`/`closedir`, typed `avs_file_t`), and `boot()`/`shutdown()` entry
points — this is the semantic API spice2x links against via its own
hash-token resolution table (a `property_search`-keyed struct of `const
char *` tokens in `core.h`, confirming spice2x faces the identical
hash-obfuscated export problem against this vendor build).
One concrete recovery is proven end-to-end in this codebase:
`re/avs/property_node.h` and `re/avs/property_node.cpp` reconstruct AVS2
ordinal 153 / export token `XCd229cc000083`, RVA `0x0000bdf0`, as
`avs::property_node_datasize(const PropertyNodeDatasizeView*)` — a 24-bit
field read split across `+0x2c` (u16) and `+0x2e` (u8) inside the
`property_node` struct, matched against the disassembly
(`movzx eax,[node+0x2e]; shl eax,0x10; movzx edx,word [node+0x2c]; or
eax,edx; ret`) and the struct layout recorded in `re/avs/avs_structdb.json`.
This is the pattern to repeat for the remaining 359 tokens: Ghidra
decompilation of each `XCd229cc...` stub against the `avsproj.gpr` database,
cross-named against `core.h`'s declared signatures.
Two of the 368 lines in the `.def` carry a gendef caveat — `XCd229cc0000e6`
and `XCd229cc000041` are annotated "Check!!! Couldn't determine function
argument count. Function doesn't return." (`re/importlibs/libavs-win32.def:363,367`),
i.e. gendef's heuristic disassembler could not find a `ret` on the
fall-through path (likely a `longjmp`/fatal-log/`ExitProcess` style
noreturn routine), consistent with AVS2's documented fatal-log-on-null-node
behavior noted for `property_node_datasize`'s null path in
`re/avs/property_node.h:24`.
## libavs-win32-ea3.dll — AVS2 e-amusement v3 extension ## libavs-win32-ea3.dll — AVS2 e-amusement v3 extension
**Role:** AVS2 "ea3" (e-amusement v3) extension module layered directly on **Role:** the shipped AVS2 e-amusement v3 extension. In the official graph it
top of the base AVS2 runtime; consumed by `arkkdm.dll`, `ess.dll`, depends on `libavs-win32.dll` and is used by `ess.dll` and `arkkdm.dll`
`ksm.dll`, `kuc.dll`. `objdump -p GAME-DIR/libavs-win32-ea3.dll` shows its [`../companion-inventory.md`](../companion-inventory.md).
only DLL-Name imports are `KERNEL32.dll` and `libavs-win32.dll` — it has no
network/CRT dependency of its own, it rides entirely on the base AVS2
runtime for sockets and filesystem.
**Export surface:** `re/importlibs/libavs-win32-ea3.def` lists **139 named **Export surface:** `re/importlibs/libavs-win32-ea3.def` records a distinct
exports** (`re/importlibs/libavs-win32-ea3.def:9-147`), all vendor hash hash-token export family, `XE592acd...`. The recorded export count and all
tokens in the sibling form `XE592acd000000`..`XE592acd000092` — a different token-to-semantic mappings are **UNVERIFIED (pending re-check against
hash prefix from the base AVS2 DLL's `XCd229cc...` tokens, confirming these clean-release binary)**. The module's network/bootstrap role follows the
are a distinct, separately-obfuscated export table rather than a shared one; official dependency graph and its relation to the shipped ESS middleware;
`objdump -p` on `GAME-DIR/libavs-win32-ea3.dll` independently reports **139** it does not rely on any emulator header or launcher source.
names in the `[Ordinal/Name Pointer] Table`, matching the `.def` count
exactly. Same build/vendor toolchain as the base AVS2 DLL (identical gendef
banner, identical obfuscation style), per `docs/companion-conventions.md`'s
"same vendor build... same export-naming scheme" note.
Semantic naming source: `GAME-DIR/src/spice2x-master.tar.gz:spice2x/avs/ea3.h`
declares the EA3-layer C surface this module backs —
`avs_ea3_boot_startup`, `avs_ea3_shutdown`, plus `avs::ea3::boot(unsigned
short easrv_port, bool easrv_maint, bool easrv_smart)` /
`avs::ea3::shutdown()` wrapper functions and `avs::ea3::load_dll()`, backed
by settings fields (`CFG_PATH`, `BOOTSTRAP_PATH`, `PCBID_CUSTOM`,
`SOFTID_CUSTOM`, `URL_CUSTOM`, `EA3_BOOT_URL`, `EA3_BOOT_PCBID`) that match
the e-amusement network-bootstrap role implied by `ess.dll`'s own
`ess_ea3_*` exports (below). No per-token hash-to-name mapping has been
completed for this module in this codebase; treat the 139 tokens as
UNVERIFIED pending the same Ghidra-plus-`ea3.h`-signature-match pass applied
to `property_node_datasize` above.
## arkkdm.dll — ARK engine (KDM build) ## arkkdm.dll — ARK engine (KDM build)
**Role:** the Konami "ARK" cabinet-game engine instantiated for this title **Role:** the official ARK/KDM cabinet-game engine and AVS2 game-DLL entry.
(`arkKDM` prefix = ARK + KDM). `gamekdm.dll` is the title's actual render/ It imports the shipped AVS2, EA3, ESS, ACIO, and AFP modules
gameplay logic, but ARK is the layer underneath it providing credit/coin [`../companion-inventory.md`](../companion-inventory.md). Its official
handling, card I/O orchestration, networking/matching, event logging, `dll_entry_main` path loads `gamekdm.dll` (with `arkkdmtest.dll` as a
threading primitives, heap management, and the AFP (Flash-like) rendering test-build fallback), resolves `gameMain`, and calls it; this is derived from
entry points — i.e. the reusable arcade-cabinet framework Konami built once the official `arkkdm.dll` artifact, not a launcher or hook
and reused across ARK-family titles. `objdump -p GAME-DIR/arkkdm.dll` [`../../.omo/scope/official-scope.md`](../../.omo/scope/official-scope.md).
imports `libavs-win32.dll`, `libavs-win32-ea3.dll`, `ess.dll`,
`libacio.dll`, `libafp-win32.dll` plus Win32 OS DLLs
(`USER32`/`KERNEL32`/`IMM32`/`GDI32`/`WINMM`) — it sits directly above the
AVS2/ESS/ACIO/AFP stack and below `gamekdm.dll` in the dependency chain
(`docs/companion-inventory.md`'s DAG).
**Export surface:** `re/importlibs/arkkdm.def` lists **255 named, plain-C **Export surface:** `re/importlibs/arkkdm.def` records readable `arkAFP*`,
exports** (`re/importlibs/arkkdm.def:9-263`), all readable symbols — `arkKDM*`, `arkCardManager*`, `arkEACoin*`, `arkEvent*`, `arkFile*`,
`arkAFP*`, `arkKDM*`, `arkCardManager*`, `arkEACoin*`, `arkEntryFlow*`, `arkHeap*`, `arkMutex*`, `arkNetwork*`, `arkSemaphore*`, and `arkThread*`
`arkEvent*`, `arkFile*`, `arkHeap*`, `arkMutex*`, `arkNetwork*`, families, together with `dll_entry_init` and `dll_entry_main`. The exact
`arkSemaphore*`, `arkThread*`. `objdump -p` on `GAME-DIR/arkkdm.dll` count, ordinals, and any per-export calling-convention conclusion remain
confirms the export directory's internal module name is `arkKDM.dll` and **UNVERIFIED (pending re-check against clean-release binary)** where based on
reports **255** names in `[Ordinal/Name Pointer] Table`, matching the the earlier contaminated binary rather than a clean export table.
`.def` count. Unlike AVS2/AVS2-ea3, **no export is hash-obfuscated** — ARK's
own export table is fully named.
Export families and roles, grouped by prefix (every function below is a The families describe ARK-level AFP rendering, cabinet credit/card/coin
literal export name from `re/importlibs/arkkdm.def`): orchestration, file I/O, synchronization, heap management, network/matching,
event logging, and KDM-specific controls. They are an API classification from
the official export table; they do not establish a direct `gamekdm.dll`
import for every service.
- **AFP rendering (`arkAFP*`)** — `arkAFPBoot`, `arkAFPLayerCreate`/ ## libafp-win32.dll + libafputils-win32.dll — AFP graphics pipeline
`Destroy`/`Draw`/`Play`/`Stop`/`SetPosition`/`Update`,
`arkAFPMovieClipCreate`/`Destroy`/`LoadBitmap`, `arkAFPPackageCreate`/
`Destroy`/`GetStreamCount`/`GetStreamInformation`,
`arkAFPGetProperty{S32,S8,String}` / `arkAFPSetProperty{S32,S8,String}`,
`arkAFPReadPropertyXML`/`RemovePropertyXML`,
`arkAFPSetRenderCallbackFunctions`, `arkAFPGetHeapStatistics`,
`arkAFPTraceSetting`. This is a thin ARK-level wrapper over the separate
`libafp-win32.dll` `afp_*` C API (below) — `arkAFPBoot` is the
calling-convention proof point in `docs/companion-conventions.md`
(`ret 0x4`, stdcall).
- **Credit / coin / EA-coin (`arkConfirmCredit`, `arkConsumeCredit`,
`arkExpireCredit*`, `arkGetCoinCount`, `arkGetCreditCount`,
`arkEACoin{Consume,Expire,GetStatus,QueryBalance,QueryExtra,
QueryLastNotch,QueryPrice,QuerySessionState}`)** — cabinet
coin-mech/e-amusement-coin economy, backed by `ess.dll`'s parallel
`ess_credit_*`/`ess_eacoin_*` surface.
- **Card manager (`arkCardManagerConvCard[Wait]`,
`arkCardManagerGetPlayList[Wait]`)** — IC-card read/play-data retrieval,
the ARK-level counterpart to `ess_cardmng_*` and `ac_io_icca_*` (below).
- **File I/O (`arkFileOpen`/`Close`/`Read`/`Write`/`Seek`/`BlockRead`/
`Mount`/`Umount`/`ConvertPath`/`DumpMountpoint`)** — ARK's own
mount/file-handle layer over AVS2's filesystem primitives.
- **Threading/sync (`arkThreadCreate`/`Destroy`/`Exit`/`SelfId`/`Signal`/
`Sleep`/`Wait`, `arkMutexCreate`/`Destroy`/`Signal`/`Wait`,
`arkCondCreate`/`Destroy`/`Signal`/`Broadcast`/`Wait`,
`arkSemaphoreCreate`/`Destroy`/`Signal`/`Wait`,
`arkEventCreate`/`Destroy`/`Signal`/`ISignal`/`Wait`)** — ARK's primitive
wrappers, consistent with `docs/companion-conventions.md`'s identification
of AVS2 as the underlying thread/mutex/event provider.
- **Heap (`arkHeapBoot`/`Shutdown`/`Allocate`/`Free`/`Freesize`/`Malloc`/
`Realloc`/`Reallocate`/`GetStatistics`/`ClearStatistics`/`Debug`)** — a
custom sized-heap allocator exposed to the game DLL.
- **Networking (`arkNetworkTCP*`, `arkNetworkUDP*`,
`arkNetworkMatching{Query,Request,Reset}[Wait]`,
`arkNetworkGetLocationConnectList[Wait]`, `arkNetworkGetProperty[Wait]`)**
— raw TCP/UDP socket wrappers plus the e-amusement "matching" (online
multiplayer/leaderboard pairing) protocol, layered above `ess.dll`'s own
`ess_net_*`/`ess_matching_*` exports.
- **Event logging (`arkCoreEventLogRequestEventData`/`GameEnd`/`GameStart`/
`Otdemo`/`Transition`)** — telemetry hooks mirroring
`ess_eventlog_request_*`.
- **KDM-title-specific (`arkKDM*`)** — `arkKDMInitialize`/`Terminate`/
`Update`/`Draw`, `arkKDMChangeLED`/`ChangeLEDColor`/`ChangeLEDPattern`/
`ResetLED` (cabinet lighting), `arkKDMGet10Key`/`GetLeft`/`GetRight`/
`GetStart` (raw cabinet button state), `arkKDMGetEAPass`,
`arkKDMGetServerMessage[Value]`, `arkKDMGetSoundOptionsSoundVolumeInAttract`,
`arkKDMGetGameOptionsLanguage`, `arkKDMGetLicenceKeyVersion` — the
title-specific slice of ARK that `gamekdm.dll` actually calls into for
cabinet I/O and LED control (the lighting/IO surface `gamekdm.dll` does
not reach directly through AVS2 or AC-IO).
- **Module entry points (`dll_entry_init`, `dll_entry_main`)** — the ARK
module bootstrap pair, distinct from the DllMain Windows loader entry.
4 exports carry gendef's noreturn caveat (same heuristic as AVS2's two **Role (`libafp-win32.dll`):** shipped AFP asset/font/graphics pipeline,
flagged tokens): `arkKDMGet10Key`, `arkKDMGetEAPass`, `arkKDMGetLeft`, depending on AVS2. Both `arkkdm.dll` and `gamekdm.dll` use the AFP layer in
`arkKDMGetRight`, `arkSetIOCoinBlockerOff` (`re/importlibs/arkkdm.def:180, the official dependency graph.
181,183,185,241`).
`arkKDMGetRanking@20` is the sole export with a `stdcall`-decorated name in **Export surface (`libafp-win32.dll`):**
the `.def` whose true stdcall-ness is directly confirmed in `re/importlibs/libafp-win32.def` records readable `afp_*` exports covering
`docs/companion-conventions.md` via `arkAFPBoot`'s disassembly (`ret 0x4` player lifecycle, layer and movie-clip management, matrix math, rendering,
at file offset `0x100527ca`); the DLL's own export table stores the name stream/package loading, property nodes, and input forwarding. Its exact
**undecorated** (no `@N`), so the reconstruction import library strips the export count and byte-level table details are **UNVERIFIED (pending re-check
`@N` with `--kill-at` to bind correctly (same section). against clean-release binary)**.
## libafp-win32.dll + libafputils-win32.dll — AFP Flash-like player **Role (`libafputils-win32.dll`):** shipped AFP utility layer directly above
AVS2 and AFP, providing package/asset introspection
[`../companion-inventory.md`](../companion-inventory.md).
**Role (`libafp-win32.dll`):** Konami's "AFP" vector/sprite rendering **Export surface (`libafputils-win32.dll`):**
engine — a Flash-like runtime for pre-authored movie-clip/layer assets `re/importlibs/libafputils-win32.def` records readable `afpu_*` exports for
(`.afp`/package format), used by both `arkkdm.dll` (via the `arkAFP*` package lifecycle; font, image, shape, layout, group, and texture metadata;
wrapper layer above) and directly by `gamekdm.dll` NGP package data; binary swapping; and render statistics. Its exact export
(`docs/companion-inventory.md`'s DAG: `gamekdm.dll -> libafp-win32.dll`). count and byte-level table details are **UNVERIFIED (pending re-check against
`objdump -p GAME-DIR/libafp-win32.dll` shows it imports only clean-release binary)**.
`libavs-win32.dll` + `KERNEL32.dll` — AFP itself has no AVS2-ea3, ESS, or
ACIO dependency; it is a pure rendering/asset layer.
**Export surface (`libafp-win32.dll`):** `re/importlibs/libafp-win32.def` ## ess.dll — e-amusement middleware
lists **159 named, plain-C exports**, all `afp_*` prefixed
(`re/importlibs/libafp-win32.def:9-167`); `objdump -p` independently reports
**159** names, matching. Families: layer lifecycle (`afp_layer_create[_with_
property]`/`destroy[_all/_level]`/`play`/`stop`/`set_position`/
`set_attribute`/`set_color`/`set_matrix`/`set_mask`/`set_priority`/
`call_function`), movie-clip management (`afp_mc_create`/`destroy`/
`load_bitmap[_from_info]`/`load_movie`/`attach_movie`/`get_param`/
`set_param`/`refer`/`search`/`traversal`), matrix math
(`afp_matrix{_init,_identity,_mult,_mult_point,_inverse,_rotate,_scale,
_translate,...}` and `afp_matrix44_*`), rendering (`afp_render[_all]`,
`afp_render_layer`/`group`/`get_layer`/`get_stream`), stream/package
loading (`afp_stream_create[_call]`/`destroy[_all/_level]`/`get_info`/
`symbol_get_param`), property/XML nodes (`afp_property_node_write`,
`afp_layer_property_node_write`, `afp_touch_property_node`), input
forwarding (`afp_keyboard_status`, `afp_mouse_status`, `afp_mouse_wheel`,
`afp_layer_set_keyboard_status`/`set_mouse_status`/`set_mouse_wheel`), and
lifecycle (`afp_boot`, `afp_shutdown`, `afp_get_version`,
`afp_set_log_{fatal,info,warning}`, `afp_set_policy`,
`afp_set_shape_accuracy`, `afp_memory_debug`/`get_info`,
`afp_verbose_state`). This is the C API `arkAFP*` (above) wraps 1:1 in
spirit — e.g. `arkAFPLayerCreate` ↔ `afp_layer_create`,
`arkAFPLayerDraw` ↔ (render path through `afp_render_layer`).
**Role (`libafputils-win32.dll`):** a utilities layer one tier above **Role:** the official e-amusement service layer over AVS2 and EA3. It
`libafp-win32.dll`, providing package/asset introspection (font, image, supplies the card/account, credit/eAmusement-coin, networking/matching,
shape, layout, texture metadata lookup) without owning the render loop event-log, and player-data services consumed through `arkkdm.dll`
itself. `objdump -p GAME-DIR/libafputils-win32.dll` imports [`../companion-inventory.md`](../companion-inventory.md).
`libavs-win32.dll` + `libafp-win32.dll` + `KERNEL32.dll` — it depends on
both AVS2 and the base AFP player, consistent with
`docs/companion-inventory.md`'s `libafputils-win32.dll -> libavs-win32.dll,
libafp-win32.dll` edge.
**Export surface (`libafputils-win32.dll`):** `re/importlibs/libafputils-win32.def` **Export surface:** `re/importlibs/ess.def` records readable `ess_*` exports
lists **162 named, plain-C exports**, all `afpu_*` prefixed for card management, credit, eAmusement coin, EA3 session handling,
(`re/importlibs/libafputils-win32.def:9-170`); `objdump -p` independently filesystem access, facility metadata, event logging, TCP/UDP and matching,
reports **162** names, matching. Families: package lifecycle player data, ranking, logging, and license/security operations. The exact
(`afpu_boot`/`shutdown`/`new_package`/`destroy_package[_all/_from_id/ export count, forwarded-export claims, and ordinal details are
_just_level/_level]`), asset-table lookups across font/image/shape/layout/ **UNVERIFIED (pending re-check against clean-release binary)** where they
group/texture (`afpu_get_{font,image,shape,layout,group,texture}_ derive from the contaminated-install observation.
{id,info,name,nr}[_from_index][_at_package]`), font-library entry points
(`afpu_fontlib_entry`, `afpu_fontlib_multi_entry[_ngp]`,
`afpu_fontlib_get_code_info[_debug][_from_index]`,
`afpu_fontlib_get_font_{id,info}`, `afpu_fontlib_retire_by_{level,package}`,
`afpu_fontlib_set_{font_reuse,level,get_bitmap_info_func}`), the "NGP"
package-container format (`afpu_ngp_read[_info]`, `afpu_ngp_mount_package_
read[_info]`, `afpu_ngp_mounttable_*`, `afpu_ngp_packagelist_*`,
`afpu_ngp_texture_get_{compress,filter,format,wrap}[_string]`,
`afpu_ngp_layout_get_{center,flip,rotation}[_string]`), binary swap/
endianness helpers for geo/texture data (`afpu_bin_geo_swap_data`,
`afpu_bin_texture_swap_{all,header,raw_data}`, `afpu_package_swap_{core_
data,data,variant_nr}`), and rendering-stat helpers
(`afpu_render_debug`/`get_count`/`flash_buf`/`init_debug_info`). This is
primarily an offline/debug introspection API over the same package format
`libafp-win32.dll` renders at runtime.
## ess.dll — Enterprise Shop/Server (e-amusement middleware) ## libacio.dll — ACIO arcade I/O
**Role:** Konami's e-amusement client-side service layer — card/account **Role:** the official ACIO amusement-cabinet I/O protocol library. It is a
management, credit and eAmusement-coin economy, bookkeeping, network root in the shipped-module graph and imports only OS libraries there
matching, event logging, and player-data save/load/inheritance over the [`../companion-inventory.md`](../companion-inventory.md).
network. `objdump -p GAME-DIR/ess.dll` imports `libavs-win32.dll`,
`libavs-win32-ea3.dll`, `KERNEL32.dll`, `USER32.dll`, `WS2_32.dll`,
`IPHLPAPI.DLL`, `PSAPI.DLL` — it sits directly on both AVS2 tiers plus raw
Winsock, consistent with its being the networking/account middleware
`arkkdm.dll` calls into for its own `arkCardManager*`/`arkEACoin*`/
`arkNetwork*` wrappers. Per `docs/companion-conventions.md`, `ess.dll` is
**not** called directly through `gamekdm.dll`'s own IAT (no `ess.dll`
import block in `gamekdm.dll`) — `gamekdm.dll` reaches ESS functionality
only indirectly, through `arkkdm.dll`.
**Export surface:** `re/importlibs/ess.def` lists **209 named, plain-C **Export surface:** `re/importlibs/libacio.def` records readable `ac_io_*`
exports** (`re/importlibs/ess.def:9-217`), prefixed `ess_*`; `objdump -p` exports for session lifecycle, BMPU button/coin/LED control, ICCA card-reader
independently reports **209** names, matching. Families: card management control, and cabinet LED operations. The exact count and all byte-level
(`ess_cardmng_bindmodel[_wait]`, `cardactivate[_wait]`, export-table details are **UNVERIFIED (pending re-check against clean-release
`conv_cardnumber[_wait]`, `getplaylist[_wait]`, `inquire[_wait]`, binary)**. This section deliberately makes no API or dependency claim for
`playerlogin[_wait]`/`playerlogout[_wait]`), credit (`ess_credit_coin_throw`, other ACIO variants, input libraries, security stubs, or non-release Konami
`confirm`, `consume[_expired[_playtype]]`, `get_status`, `get_option[_wait]`, DLLs.
`reset`, `service`, `update_option[_wait]`), eAmusement coin
(`ess_eacoin_{abort,checkin,checkout,consume,reload,reauth,...}` and a large
`ess_eacoin_query_*` status-probe family), e-amusement v3 session
(`ess_ea3_download_pause`, `get_limit_time`, `get_pp_status`, `get_status`,
`license_agree`, `send_pp_event`), filesystem (`ess_fs_open[_r/_w]`,
`close`, `read`, `write`, `lseek`, `fgets`, `fprintf`, `mount`,
`unmount` — flagged by gendef "return value is from ord 57 in
libavs-win32.dll", i.e. `ess_fs_unmount` is a thin tail-call forward into
AVS2's own unmount ordinal, `re/importlibs/ess.def:145`), facility/location
metadata (`ess_facility_get_location_*`, `get_portfw_*`, `get_share_url_*`),
event logging (`ess_eventlog_request_{error,eventdata,game_end,game_start,
init,otdemo,testmode,transition}`), networking (`ess_net_tcp_*`,
`ess_net_udp_*`, `ess_matching_{query,request,reset}[_wait]`,
`ess_net_location_connection_list_get[_wait]`), player data
(`ess_playerdata_{inheritance,load,save}[_wait]`), ranking/score
(`ess_ranking_get[_wait]`, `ess_score_rank_get[_wait]`), logging
(`ess_log_{change_func,change_level,change_target,debug,error,fatal,info,
warning}`), and license/security (`ess_usbkey_boot_check_{account,license}_
key`, `ess_usbkey_demoloop_check_{account,license}_key`). Two exports
forward directly into `WS2_32.dll` ordinal 116 per gendef's flag
(`ess_net_tcp_finalize`, `ess_net_udp_finalize` — `re/importlibs/ess.def:182,191`,
both annotated "return value is from ord 116 in WS2_32.dll" — i.e.
`WSACleanup`). No export in `ess.dll` is hash-obfuscated.
## libacio.dll + libacio_mbr.dll — ACIO arcade I/O ## arkkdmtest.dll — ARK/KDM render and input test harness
**Role (`libacio.dll`):** Konami's AC-IO (amusement-cabinet I/O) protocol **Role:** a shipped ARK/KDM render-and-input test harness which exports
library — the serial/RS-232-class driver talking to the cabinet's coin `gameMain`. It is a root in the shipped graph and uses OS D3D9/DINPUT8/DSOUND/
mech, button/LED PCB ("BMPU"), and IC-card reader ("ICCA") boards. GDI32/SHELL32/USER32 imports only
`objdump -p GAME-DIR/libacio.dll` imports only `USER32.dll` + [`../companion-inventory.md`](../companion-inventory.md).
`KERNEL32.dll` — a leaf in the dependency DAG, no AVS2 dependency.
`docs/companion-inventory.md` notes this is the real library spice2x's
`acio.cpp` `LoadLibraryA()`-loads and hooks at runtime rather than
reimplementing, confirming it is Konami's original cabinet-I/O binary, not
a community shim.
**Export surface (`libacio.dll`):** `re/importlibs/libacio.def` lists **44 **Export surface:** the clean-release listing establishes its `gameMain`
named, plain-C exports** (`re/importlibs/libacio.def:9-52`), prefixed role. Any additional count, ordinal, or byte-level export claim is
`ac_io_*`; `objdump -p` independently reports **44** names, matching. **UNVERIFIED (pending re-check against clean-release binary)** until a
Families: session lifecycle (`ac_io_begin[_get_status]`, `ac_io_reset`, clean-release export table is captured.
`ac_io_update`, `ac_io_is_active[2]`/`is_active_device`,
`ac_io_set_soft_watch_dog`/`soft_watch_dog_on`, `ac_io_get_version`/
`get_rs232c_status`), BMPU (button/coin PCB) control
(`ac_io_bmpu_control_{1p,2p}_start_led_{on,off}`,
`ac_io_bmpu_control_coin_blocker_{open,close}`,
`ac_io_bmpu_control_led_bright`, `ac_io_bmpu_{lock,unlock}_coincounter`,
`ac_io_bmpu_current_coinstock`/`consume_coinstock`,
`ac_io_bmpu_set_outport_led`/`set_output_mode`/`init_outport`,
`ac_io_bmpu_get_{control_status_buffer,softwareid,systemid}`,
`ac_io_bmpu_update_control_status_buffer`, and a security-plug (secplug)
check sub-family `ac_io_bmpu_req_secplug_{check_isfinished,
check_softwareplug,check_systemplug,missing_check[_isfinished]}`), ICCA
(IC-card reader) control (`ac_io_icca_cardunit_init[_isfinished]`,
`ac_io_icca_device_control_iccard_power_supply_{on,off}`,
`ac_io_icca_device_control_isfinished`, `ac_io_icca_get_status`,
`ac_io_icca_get_uid_felica`, `ac_io_icca_req_uid[_isfinished]`), and a
Dance-cabinet-specific LED helper (`ac_io_hdxs_led_set_pattern`). No export
is hash-obfuscated; the `_isfinished` suffix pattern throughout marks this
as an asynchronous polling API (issue a request, poll `*_isfinished` until
true), consistent with real-hardware serial-command latency.
**Role (`libacio_mbr.dll`):** a variant AC-IO build for a different ## Naming-convention summary across official companions
cabinet/IO-board revision ("MBR"). `objdump -p GAME-DIR/libacio_mbr.dll`
imports `msvcrt.dll`, `KERNEL32.dll`, `libinput.dll`, `libavs-win32.dll` —
unlike the base `libacio.dll`, this variant both depends on AVS2 and on the
`libinput.dll` HID layer (below), per
`docs/companion-inventory.md`'s `libacio_mbr.dll -> libinput.dll,
libavs-win32.dll` edge.
**Export surface (`libacio_mbr.dll`):** `objdump -p | DLL | Export naming recorded in repository evidence | Status |
GAME-DIR/libacio_mbr.dll` reports **47 named, plain-C exports** |---|---|---|
(`ac_io_*`), a superset pattern of `libacio.dll`'s 44: it keeps | `libavs-win32.dll` | `XCd229cc...` hash tokens | Semantic mapping and byte counts require clean re-check |
`ac_io_begin`/`ac_io_begin_get_status`/`ac_io_get_rs232c_status`/ | `libavs-win32-ea3.dll` | `XE592acd...` hash tokens | Semantic mapping and byte counts require clean re-check |
`ac_io_get_version`/`ac_io_is_active[2]`/`ac_io_is_active_device`/ | `arkkdm.dll` | readable `ark*` families | Byte-level table details require clean re-check |
`ac_io_reset`/`ac_io_set_soft_watch_dog`/`ac_io_soft_watch_dog_on`/ | `libafp-win32.dll` | readable `afp_*` families | Byte-level table details require clean re-check |
`ac_io_update`, adds an explicit `ac_io_end`/`ac_io_end_get_status` pair | `libafputils-win32.dll` | readable `afpu_*` families | Byte-level table details require clean re-check |
(absent from `libacio.dll`'s export list), replaces the BMPU family with an | `ess.dll` | readable `ess_*` families | Byte-level table details require clean re-check |
`ac_io_hbhi_*` card-dispenser control family | `libacio.dll` | readable `ac_io_*` families | Byte-level table details require clean re-check |
(`ac_io_hbhi_req_carddispenser_{disburse,get_status,init}[_isfinished]`) | `arkkdmtest.dll` | `gameMain` role from clean listing | Further table details require clean re-check |
and an `ac_io_kfca_*` button/coin-blocker/LED family mirroring the base
`ac_io_bmpu_*` family's shape (`ac_io_kfca_control_button_led`,
`control_coin_blocker_{open,close}`, `control_led_bright`,
`current_coinstock`, `{lock,unlock}_coincounter`,
`get_control_status_buffer`, `req_volume_control`, `set_watchdog_time`,
`update_control_status_buffer`), an expanded `ac_io_hdxs_*` LED family
(`get_control_status_buffer`, `led_scroll`, `led_set_pattern`,
`led_set_rgb_mask`, `update_control_status_buffer`), and an expanded ICCA
family adding `ac_io_icca_crypt_init`, `get_keep_alive_error`,
`is_felica`, `send_keep_alive_packet`, `workflow`. This DLL was not present
in `re/importlibs/` at the time of this section's authoring (no
`libacio_mbr.def` was generated); the export list above is read directly
from `objdump -p` against `GAME-DIR/libacio_mbr.dll` and is otherwise
UNVERIFIED against any `.def`/Ghidra reconstruction artifact in this
codebase.
## The k* input libraries + libinput.dll The two AVS2 tiers are the only official companions documented here with
hash-token names. All claims in this table concern the official companion
**`libinput.dll` — role:** the real HID input abstraction layer: card-slot/ set only; `Kinect10.dll` is instead Microsoft's external Kinect-for-Windows
keypad/sensor configuration persistence (`eam_config_load`/`save`) and a NUI v1 runtime imported by `gamekdm.dll`, not a companion or shipped module
generic multi-device "HID stub" + input-mapper framework [`../companion-inventory.md`](../companion-inventory.md).
(`hid_mgr_*`/`hid_stub_*`, `mapper_*`) that lets a game bind logical
buttons/analog axes to physical HID controls and light outputs.
`objdump -p GAME-DIR/libinput.dll` imports `msvcrt.dll`, `KERNEL32.dll`,
`USER32.dll`, `HID.DLL`, `SETUPAPI.dll`, `SHELL32.dll` — it talks to real
HID hardware via `SETUPAPI`/`HID.DLL`, which `docs/companion-inventory.md`
uses as its evidence this is a genuine Konami cabinet-input driver and not
a spice2x emulation shim. Export surface (from `objdump -p`, 51 names,
prefix `eam_*`/`hid_mgr_*`/`hid_stub_*`/`mapper_*`/`input_*`): config
(`eam_config_load`/`save`, `eam_get_alt_10k`, `eam_get_autogen`,
`eam_get_card_path`, `eam_get_keypad[_device]`, `eam_get_sensor`,
`eam_is_dirty`/`is_muxed`, `eam_clear_dirty`, `eam_read_card`,
`eam_set_alt_10k`/`set_autogen`/`set_card_path`/`set_keypad_device`), HID
stub enumeration (`hid_mgr_get_first_stub`/`get_named_stub`/`lock`/
`unlock`, `hid_stub_get_{controls,device_usage,lights,name,value}`,
`hid_stub_{is_attached,next,set_light,update}`), input-mapper binding
(`mapper_add_{analog_,}binding`, `mapper_add_lightbind`,
`mapper_config_load`/`save`, `mapper_del_{analog_,}binding`/`lightbind`,
`mapper_get_analog_{control_no,hid,pos,sensitivity}`,
`mapper_get_{bindings,last_buttons,lightbinds}`,
`mapper_is_analog_relative`, `mapper_set_{analog_sensitivity,
next_lights}`, `mapper_update`), and lifecycle (`input_init`/`fini`,
`input_set_loggers`). This export list is read directly from `objdump -p`
against `GAME-DIR/libinput.dll`; no `.def` for it existed under
`re/importlibs/` at authoring time.
**`kbt.dll` / `kld.dll` — role:** these are **ALREADY-OSS**, not Konami
originals — `docs/companion-inventory.md` identifies both as **bemanitools**
(djhackersdev/bemanitools) "ikey" security-dongle stub builds, proven by an
embedded CodeView PDB path `d:\bemanitools\stubs\objfre_wxp_x86\i386\
stubs.pdb` at file offset `0x55b` in both files, plus `k_bt0002`
disassembling to a bare `ret` at RVA `0x11d7` rather than the real
callback-invoking implementation. `objdump -p` on both confirms an
identical **6-export, plain-C** surface: `bt_fcheck_finish`,
`bt_fcheck_init`, `bt_fcheck_main`, `bt_get_ikey_status`, `k_bt0001`,
`k_bt0002` — a dongle presence-check API (`k_bt0001`/`k_bt0002` are the
vendor-numbered dongle-protocol entry points `bt_fcheck_*` wrap). Both
import only `msvcrt.dll` + `KERNEL32.dll`. Documented here for surface
completeness; neither is a reconstruction target (ALREADY-OSS, excluded
from the reconstruct set per the inventory).
**`kmd.dll` — role:** a single-export Konami "md" module ("memory-dump"/
debug, name UNVERIFIED beyond its own export token).
`objdump -p GAME-DIR/kmd.dll` imports `dbghelp.dll`, `libavs-win32.dll`,
`KERNEL32.dll`, `MSVCR80.dll` and exports exactly one plain-C symbol,
`k_md0001`. The `dbghelp.dll` import (Windows symbol/stack-walking API) is
consistent with a crash-dump or diagnostics module, but that role is
otherwise UNVERIFIED — a single opaque numbered export gives no further
semantic signal without decompiling it (companion Ghidra project
`kmdproj.gpr` exists at `/home/athapa/ghidra/kmdproj.gpr` for this purpose,
not yet exploited for this section).
**`ksm.dll` — role:** Konami "sm" session/security-manager module backing
a "SSM" (secure session manager / signed-player-record) subsystem — array/
repository/certificate primitives for signed player records ("SPR") and
ticket/token records ("TPR") plus an XRPC client used for the account/
matching protocol. `objdump -p GAME-DIR/ksm.dll` imports `kdu.dll`,
`kmp.dll`, `kma.dll` (further Konami AVS2-family modules **not shipped** in
this game directory, noted as external dependencies in
`docs/companion-inventory.md`), plus `libavs-win32.dll`,
`libavs-win32-ea3.dll`, `KERNEL32.dll`, `MSVCR80.dll`. Export surface (from
`objdump -p`, **111 names**): a generic reference-counted array container
(`ssm_array_{add,element_array,element_size,find,fix,free,get,guillotine,
inc_reference,new,num,reference_count,remove,replace,set,swap,truncate}`),
a repository/manager pair for account-session records
(`ssm_manager_{free,get_repository,inc_reference,lease_account_session,new,
release_account_session}`, `ssm_repository_{delete_entry_by_{index,ssmid},
dprint,entry_*,enum_entries,find_entry_by_ssmid,fprint,free,get_entry_num,
inc_reference,open,print,read_entry_by_{index,ssmid},set_limit,truncate,
update_entry,verify}`), signed-player-record handling
(`ssm_spr_{add_cert,create,dprint,free,get_binary,get_pr,
get_signing_time,get_ssmid[_cstr],inc_reference,init_creation,
is_signature_equals,load_from_binary,new,print,reencode,verify}`), a
"TPR" ticket/token-record variant mirroring the SPR shape
(`ssm_tpr_{create,dprint,free,get_binary,get_content[_info],get_spr,
inc_reference,init_creation,load_from_binary,new,print,verify}`), a
protocol-response ("pr_client") helper set
(`ssm_pr_client_{accept_response,create_request,free,get_ecoin_response,
get_ssmid_in_response,inc_reference,new}`), certificate memory management
(`ssm_mes_{free,inc_reference}_pcert`), system bootstrap
(`ssm_system_{finalize,get_functions,get_manager,get_repository,
initialize[_ex]}`), and XRPC client plumbing
(`ssm_xrpc_common_{add_module,apply}`,
`ssm_xrpc_request_get_{esid[_1],status[_1]}`), plus one opaque vendor
entry `k_sm0001` exported at ordinal 88 ahead of the named `ssm_*` block
(`objdump -p` ordinal/name table: `[87] ... 0000 k_sm0001`, i.e. it is
ordinal 1, hint-ordered last). No `.def` existed for this DLL under
`re/importlibs/` at authoring time; export list is read directly from
`objdump -p`.
**`kuc.dll` — role:** a small Konami "uc" module. `objdump -p
GAME-DIR/kuc.dll` imports `kdu.dll`, `kmp.dll`, `kma.dll` (same unshipped
Konami-family dependency pattern as `ksm.dll`) plus `libavs-win32.dll`,
`libavs-win32-ea3.dll`, `KERNEL32.dll`, `MSVCR80.dll`. Export surface: only
**4 names** — `DllStart`, `k_uc0001`, `k_uc0004`, `k_uc0005`. Semantic role
is UNVERIFIED beyond the module prefix; the gap in numbered exports
(`0001`, `0004`, `0005` — `0002`/`0003` absent) suggests the module exposes
a sparse subset of a larger shared "k_*" vendor entry-point convention also
seen in `kbt.dll`/`kld.dll`/`kmd.dll`/`ksm.dll`.
## Naming-convention summary across all companions
| DLL | Named exports | Hash-obfuscated? | Convention |
|---|---|---|---|
| `libavs-win32.dll` | 360 | **yes**, all 360 (`XCd229cc...`) | cdecl, by name |
| `libavs-win32-ea3.dll` | 139 | **yes**, all 139 (`XE592acd...`) | cdecl, by name |
| `arkkdm.dll` | 255 | no | stdcall, by name (`--kill-at`) |
| `libafp-win32.dll` | 159 | no | cdecl, by name |
| `libafputils-win32.dll` | 162 | no | cdecl, by name |
| `ess.dll` | 209 | no | cdecl, by name |
| `libacio.dll` | 44 | no | cdecl, by name |
| `libacio_mbr.dll` | 47 | no | UNVERIFIED (no `.def`/convention evidence captured yet) |
| `libinput.dll` | 51 | no | UNVERIFIED (no `.def`/convention evidence captured yet) |
| `kbt.dll` / `kld.dll` | 6 each | no | UNVERIFIED (bemanitools stub, out of reconstruct scope) |
| `kmd.dll` | 1 | no | UNVERIFIED |
| `ksm.dll` | 111 | no | UNVERIFIED |
| `kuc.dll` | 4 | no | UNVERIFIED |
Only the two AVS2 tiers (`libavs-win32.dll`, `libavs-win32-ea3.dll`) use
vendor hash-token export names; every other Konami-original companion in
this inventory exports plain, readable C symbol names. The two "UNVERIFIED"
convention rows above have export surfaces confirmed directly from
`objdump -p` but lack the `.def`/IAT-disassembly calling-convention proof
that `docs/companion-conventions.md` provides for the other DLLs — a
follow-up pass through `tools/gen_importlibs.sh` plus one IAT call-site
disassembly per DLL (the method documented there) would close that gap.
+13 -6
View File
@@ -22,6 +22,12 @@ RVAs read like `0x10023af0` and the RVA database (`re/rvadb.json`, 9728
functions) stores each function's address relative to that base functions) stores each function's address relative to that base
(`docs/conventions.md`, "Function naming"). (`docs/conventions.md`, "Function naming").
> **Clean-release caveat.** Any RVA, IAT address, export ordinal, or file-byte
> offset below that was measured from an earlier install is UNVERIFIED (pending
> re-check against clean-release binary). The official module topology is the
> nine shipped modules in `contents/modules/`; `Kinect10.dll` is an external
> Microsoft NUI runtime dependency of `gamekdm.dll`, not a companion module.
The floating-point model is x87 with 80-bit intermediates, matching VS2010 SP1 The floating-point model is x87 with 80-bit intermediates, matching VS2010 SP1
x86's default. It is detected, not assumed: x87 opcodes (`fld`, `fmul`, `fstp`, x86's default. It is detected, not assumed: x87 opcodes (`fld`, `fmul`, `fstp`,
`fadd`, ...) in the validity-gate disasm mean x87 and a `-mfpmath=387` build; `fadd`, ...) in the validity-gate disasm mean x87 and a `-mfpmath=387` build;
@@ -74,16 +80,17 @@ esp,N`) is cdecl; a callee returning `ret N` with no caller fixup is stdcall
| DLL | Convention | Evidence (from `docs/companion-conventions.md`) | `--kill-at` | | DLL | Convention | Evidence (from `docs/companion-conventions.md`) | `--kill-at` |
|---|---|---|---| |---|---|---|---|
| libavs-win32.dll | cdecl | IAT `0x102183cc` etc.; callers emit `add esp,N` after the call | no | | libavs-win32.dll | cdecl | caller-cleanup call-site evidence; IAT address UNVERIFIED (pending re-check against clean-release binary) | no |
| libavs-win32-ea3.dll | cdecl | same vendor build / export-naming scheme as libavs-win32 | no | | libavs-win32-ea3.dll | cdecl | same vendor build / export-naming scheme as libavs-win32 | no |
| libafp-win32.dll | cdecl | IAT `0x10218304` (`afp_display_layer`); caller pops its own arg | no | | libafp-win32.dll | cdecl | caller-cleanup call-site evidence; IAT address UNVERIFIED (pending re-check against clean-release binary) | no |
| libafputils-win32.dll | cdecl (logger entry points cdecl-varargs) | IAT `0x10218394/98/9c`; one push per call, no callee `ret N` reliance | no | | libafputils-win32.dll | cdecl (logger entry points cdecl-varargs) | caller-cleanup call-site evidence; IAT addresses UNVERIFIED (pending re-check against clean-release binary) | no |
| ess.dll | cdecl | not called via gamekdm's IAT; plain undecorated C exports, no `@N` | no | | ess.dll | cdecl | not called via gamekdm's IAT; plain undecorated C exports, no `@N` | no |
| arkkdm.dll | stdcall | export ordinal 2, `arkAFPBoot`, RVA `0x52790`; `ret 0x4` at file offset `0x100527ca` | yes | | arkkdm.dll | stdcall | `arkAFPBoot` evidence is UNVERIFIED (pending re-check against clean-release binary) | yes |
| libacio.dll | cdecl | not called via gamekdm's IAT; undecorated plain-C exports | no | | libacio.dll | cdecl | not called via gamekdm's IAT; undecorated plain-C exports | no |
| Kinect10.dll | stdcall | IAT `0x102181d4` etc.; callee `ret N`, no caller `add esp` cleanup (MS Kinect for Windows SDK v1.x) | yes | | Kinect10.dll (external Microsoft NUI runtime) | stdcall | external-import call-site evidence; IAT address UNVERIFIED (pending re-check against clean-release binary) | yes |
All companions bind by name except Kinect10, which is imported by ordinal in The shipped-module imports listed above bind by name. The external Kinect10
runtime is imported by ordinal in
gamekdm's import table but exported by name in the DLL (`NuiInitialize`, ...) gamekdm's import table but exported by name in the DLL (`NuiInitialize`, ...)
plus one `NONAME` ordinal-1 export. `--kill-at` strips dlltool's guessed `@N` plus one `NONAME` ordinal-1 export. `--kill-at` strips dlltool's guessed `@N`
stdcall decoration so the import binds to the DLL's real undecorated export stdcall decoration so the import binds to the DLL's real undecorated export
+25 -14
View File
@@ -16,6 +16,11 @@ Scope note: the reconstruction is early. The canonical RVA database carries
'verified': 1})`). The three-function proven slice is tracked through a separate 'verified': 1})`). The three-function proven slice is tracked through a separate
evidence overlay (`re/pure-slice-status.json`), not the canonical statuses. evidence overlay (`re/pure-slice-status.json`), not the canonical statuses.
Release scope follows [the official inventory](../companion-inventory.md):
exactly nine Konami modules in `contents/modules/`. Historical RVAs, byte
sequences, image hashes, and import/export details below are
UNVERIFIED (pending re-check against clean-release binary).
## 1. Repository layout ## 1. Repository layout
Top level of the checkout (`ls` of `/home/athapa/kdm-re`): Top level of the checkout (`ls` of `/home/athapa/kdm-re`):
@@ -93,14 +98,20 @@ Output is `build/gamekdm.dll`, a PE32 (i386) DLL (`docs/pipeline.md` section 4).
### Companion import libraries ### Companion import libraries
The reconstruction links against MinGW import libs derived from the game's own The reconstruction links against MinGW import libs derived from the game's own
companion DLLs. `tools/gen_importlibs.sh` runs `gendef` then shipped modules, plus the external Kinect10.dll NUI runtime gamekdm imports.
`i686-w64-mingw32-dlltool` for each in-scope companion `tools/gen_importlibs.sh` runs `gendef` then `i686-w64-mingw32-dlltool` for the
(`libavs-win32`, `libafp-win32`, `ess`, `arkkdm`, `libacio`, `Kinect10`, and seven shipped modules in its current map (`libavs-win32`, `libavs-win32-ea3`,
others in its `CONV` map) and writes `re/importlibs/lib<name>.dll.a`. The two `libafp-win32`, `libafputils-win32`, `ess`, `arkkdm`, `libacio`) plus the
stdcall companions (`arkkdm`, `Kinect10`) get `--kill-at`; the cdecl ones do not, external `Kinect10` dependency, and writes `re/importlibs/lib<name>.dll.a`.
because killing the `@N` decoration on a cdecl import would mislabel its ABI The two stdcall entries, `arkkdm` and the external `Kinect10`, get `--kill-at`;
(`tools/gen_importlibs.sh` header comment and `CONV` table). The `.def` files are the cdecl shipped modules do not, because their names have no `@N` decoration
committed; the `.dll.a` archives are gitignored and regenerated. to strip (`tools/gen_importlibs.sh` header comment
and `CONV` table). The `.def` files are committed; the `.dll.a` archives are
gitignored and regenerated.
The current script expects all inputs in one directory. That assumption does
not match the clean release: Konami modules reside in `contents/modules/`,
while Microsoft supplies the external NUI runtime separately.
### PURE build modes and the coverage gate ### PURE build modes and the coverage gate
@@ -147,14 +158,14 @@ with a single pointer arg, matched from the original's bare `ret`
(`gamemain.cpp:17-19`). Only KERNEL32 and msvcrt symbols are touched, giving (`gamemain.cpp:17-19`). Only KERNEL32 and msvcrt symbols are touched, giving
the rebuilt proxy/slice DLL a clean KERNEL32+msvcrt import table — this is the the rebuilt proxy/slice DLL a clean KERNEL32+msvcrt import table — this is the
reconstruction's own minimal-proxy shape, not a match to the original's import reconstruction's own minimal-proxy shape, not a match to the original's import
table. The original `gamekdm.dll` imports 16 DLLs total: its own companion table. The original `gamekdm.dll` imports its shipped Konami middleware
Konami middleware (`libavs-win32.dll`, `libafp-win32.dll`, (`libavs-win32.dll`, `libafp-win32.dll`, `libafputils-win32.dll`), the
`libafputils-win32.dll`), the Kinect shim (`Kinect10.dll`), Direct3D external Microsoft NUI runtime (`Kinect10.dll`), Direct3D
(`d3d9.dll`, `d3dx9_43.dll`), and a conventional Win32 OS set (`KERNEL32.dll`, (`d3d9.dll`, `d3dx9_43.dll`), and a conventional Win32 OS set (`KERNEL32.dll`,
`USER32.dll`, `GDI32.dll`, `ADVAPI32.dll`, `SHELL32.dll`, `ole32.dll`, `USER32.dll`, `GDI32.dll`, `ADVAPI32.dll`, `SHELL32.dll`, `ole32.dll`,
`WS2_32.dll`, `WINMM.dll`, `IMM32.dll`, `DINPUT8.dll`) — not msvcrt, since its `WS2_32.dll`, `WINMM.dll`, `IMM32.dll`, `DINPUT8.dll`) — not msvcrt, since its
statically linked CRT imports zero C/C++ runtime DLLs (`objdump -p statically linked CRT imports zero C/C++ runtime DLLs. The exact imported-DLL
GAME-DIR/gamekdm.dll | grep 'DLL Name'`, 16 entries). Because the count is UNVERIFIED (pending re-check against clean-release binary). Because the
original is resolved lazily, the rebuilt DLL loads on its own as a valid smoke original is resolved lazily, the rebuilt DLL loads on its own as a valid smoke
test with no original present (`docs/pipeline.md` section 5c). test with no original present (`docs/pipeline.md` section 5c).
@@ -273,7 +284,7 @@ cluster and coordinate shared struct layouts through single-owner headers in
`docs/cutover.md` is explicit that the build mechanism exists but the game `docs/cutover.md` is explicit that the build mechanism exists but the game
cutover does not. The three T11 routines have differential evidence; the rest of cutover does not. The three T11 routines have differential evidence; the rest of
`re/rvadb.json` is nowhere near 100% verified coverage, and a slice smoke test `re/rvadb.json` is nowhere near 100% verified coverage, and a slice smoke test
cannot authorize deployment. Full Windows/spice2x QA, on an isolated install with cannot authorize deployment. Full cabinet/original-binary runtime QA, on an isolated install with
a known-good hybrid kept for rollback, is the gated final milestone, and any a known-good hybrid kept for rollback, is the gated final milestone, and any
failing item, unresolved indirect target, stub, or original-binary dependency failing item, unresolved indirect target, stub, or original-binary dependency
keeps cutover incomplete. The pure build must never silently load an original DLL keeps cutover incomplete. The pure build must never silently load an original DLL
+41 -39
View File
@@ -6,12 +6,15 @@ under the internal engine/module codename **KDM**, and of the `kdm-re`
reconstruction codebase that rebuilds its main logic DLL, `gamekdm.dll`, from reconstruction codebase that rebuilds its main logic DLL, `gamekdm.dll`, from
static and dynamic analysis. Every claim in every section below is grounded in 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` a cited artifact — a `file:line`, an RVA such as `0x10009e20`, `objdump`
output, or an absolute `GAME-DIR` path — and anything that could not be output from a clean-release binary, or an official `contents/` artifact path —
checked is marked `UNVERIFIED` rather than asserted. `GAME-DIR` for the build 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** analyzed throughout this spec is the owner's local copy of **KDM-2016021900**
(`.../KDM-2016021900/contents`), and `re/rvadb.json` is the shared RVA (`.../KDM-2016021900/contents`): `data/`, `arkdata/`, `prop/`, and exactly nine
function database (`function_count = 9728`, `image_base = "0x10000000"`, DLLs in `modules/` (docs/companion-inventory.md, "What the clean release
confirmed directly by reading that file in this repository). No copyrighted contains"). `re/rvadb.json` is the shared reconstruction locator database;
its per-binary addresses are **UNVERIFIED (pending re-check against
clean-release binary)**. No copyrighted
creative asset (song audio, video, lyrics, or art) is reproduced anywhere in creative asset (song audio, video, lyrics, or art) is reproduced anywhere in
this spec; only file formats, code structure, and behavior are described. this spec; only file formats, code structure, and behavior are described.
@@ -19,26 +22,21 @@ this spec; only file formats, code structure, and behavior are described.
| # | Section | Summary | | # | Section | Summary |
|---|---------|---------| |---|---------|---------|
| 00 | [Overview and high-level architecture](./00-overview.md) | What DEA is, the AVS2/ARK/Kinect platform stack, the `gamestart.bat` boot chain, the 22-DLL module stack, and the three-dimension (GAME / ORIGINAL / RECONSTRUCTION) organizing structure this whole spec follows. | | 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; the exact process chain from `gamestart.bat` through `launcher.exe`, `deahook.dll`, and `arkkdm.dll` to `gamekdm.dll`'s `gameMain` export, including its cdecl calling convention and `hInstance` argument; `avs-config.xml`/`ea3-config.xml`/`ark-config.xml` contents. | | 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) | Per-DLL classification (IN-SCOPE / REUSE-OS / ALREADY-OSS) of all 22 shipped DLLs, sizes and export counts from `objdump -p`, and the full cross-DLL dependency DAG (verified acyclic), reconciled against `docs/companion-inventory.md`. | | 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 `Kinect10.dll` NUI v1 boundary gamekdm statically imports, the `NuiThread`/`hid::Natal` skeleton-ingest functions and their RVAs, depth-to-skeleton coordinate projection math, and how a replacement Kinect shim feeds synthetic frames into the unmodified game. | | 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. | | 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) | Game-directory layout (`data/`, `arkdata/`, `prop/`, `dev/`), the AVS2 property-tree/filesystem model, the typed-attribute `prop/*.xml` config dialect, and the asset container formats (`.arc`, `.ifs`, `.dal`, `.xwb`/`.xsb`, `.dds`, `.kbf`, `.wmv`) identified by direct inspection. | | 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). | | 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 C API of every in-scope companion DLL `gamekdm.dll` depends on directly or transitively — `libavs-win32.dll` (AVS2 base, hash-obfuscated exports), `libavs-win32-ea3.dll`, `arkkdm.dll` (ARK/KDM engine), `libafp-win32.dll`/`libafputils-win32.dll` (AFP/Flash renderer), `ess.dll`, `libacio.dll`/`libacio_mbr.dll`, `libinput.dll`, and the `k*` modules. | | 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. | | 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`). | | 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`) All ten section files (`00-overview.md` through `09-reconstruction-codebase.md`)
exist in this repository and were read in full to produce the summaries above; exist in this repository. This index and §00's specification map use the real,
none are missing. Note: §00's own "Specification map" table uses placeholder on-disk filenames. Stale links elsewhere are document defects rather than
filenames (e.g. `01-platform-and-middleware.md`, `08-libavs.md`) that do not alternate section names.
match the files actually shipped under `docs/spec/`; §§06–09 likewise
cross-link to `07-companion-dlls.md`/`08-libavs.md` rather than the real
`07-companion-apis.md`/`08-abi-conventions.md`. This index uses the real,
on-disk filenames throughout; the stale in-body links in 00/06/07/08/09 are a
known inconsistency, noted here rather than silently worked around.
## The three dimensions ## The three dimensions
@@ -48,7 +46,7 @@ the structure §00 establishes:
| Dimension | What it covers | Primary sections | | 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 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 shipped DLLs as reverse-engineering subjects: the 22-DLL inventory and dependency DAG, the `gamekdm.dll` function/subsystem map (`re/rvadb.json`, 9,728 functions), companion export surfaces, and the binary-level ABI/struct facts recovered from disassembly. | 00, 02, 06, 07, 08 | | **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 | | **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 Section 00 spans all three (it is the entry point); 01, 03, 04, 05 are
@@ -60,18 +58,21 @@ are ORIGINAL; 08 bridges ORIGINAL (the facts being matched) and RECONSTRUCTION
## Glossary ## Glossary
- **DEA** — DanceEvolution Arcade, the shipped product name (confirmed by the - **DEA** — DanceEvolution Arcade, the product specified by the official
spice2x game-family identifier `games::dea` and `deahook.dll`'s internal KDM release artifacts: the e-amusement model in `prop/eamuse-config.xml`,
export-directory module name `DEALibacio.dll`; see [00](./00-overview.md)). the `arkKDM*` API prefix, and the `arkkdm.dll`/`gamekdm.dll` file stems
- **KDM** — Konami's internal model/engine code for this title. Appears as (see [00](./00-overview.md)).
the e-amusement `<model>KDM</model>` in `ea3-config.xml`, as the `arkKDM*` - **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 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)). name stems (see [01](./01-runtime-boot.md), [07](./07-companion-apis.md)).
- **gamekdm(.dll)** — the main game-logic DLL (3,369,104 bytes, one export, - **gamekdm(.dll)** — the main game-logic DLL (3.19 MB in the clean-release
`gameMain`). The primary reconstruction target of this entire project listing; exports `gameMain`). The prior 3,369,104-byte value is **UNVERIFIED
(pending re-check against clean-release binary)**. It is the primary target
(see [00](./00-overview.md), [06](./06-gamekdm-subsystems.md)). (see [00](./00-overview.md), [06](./06-gamekdm-subsystems.md)).
- **gameMain** — `gamekdm.dll`'s sole export, RVA `0x00009e20` / absolute VA - **gameMain** — `gamekdm.dll`'s sole export, RVA `0x00009e20` / absolute VA
`0x10009e20`, `cdecl`, taking one `void* hInstance` argument that is `0x10009e20` (**UNVERIFIED (pending re-check against clean-release
binary)**), `cdecl`, taking one `void* hInstance` argument that is
`arkkdm.dll`'s own `HINSTANCE` (not `gamekdm.dll`'s), relayed through `arkkdm.dll`'s own `HINSTANCE` (not `gamekdm.dll`'s), relayed through
`arkkdm.dll`'s internal `g_MainDllInfo` struct (see `arkkdm.dll`'s internal `g_MainDllInfo` struct (see
[01](./01-runtime-boot.md) §3.7). [01](./01-runtime-boot.md) §3.7).
@@ -81,14 +82,15 @@ are ORIGINAL; 08 bridges ORIGINAL (the facts being matched) and RECONSTRUCTION
in-scope DLL (see [07](./07-companion-apis.md)). in-scope DLL (see [07](./07-companion-apis.md)).
- **ea3** — "e-Amusement v3," the Konami network/identity/coin-economy - **ea3** — "e-Amusement v3," the Konami network/identity/coin-economy
extension layered on AVS2 (`libavs-win32-ea3.dll`), configured by extension layered on AVS2 (`libavs-win32-ea3.dll`), configured by
`prop/ea3-config.xml` (see [05](./05-data-formats.md)). `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 - **ARK** — Konami's reusable arcade-cabinet game-engine framework
(`arkkdm.dll` in this build, i.e. "ARK instantiated for KDM"): credit/coin (`arkkdm.dll` in this build, i.e. "ARK instantiated for KDM"): credit/coin
handling, card I/O, networking, threading, heap management, and the handling, card I/O, networking, threading, heap management, and the
`arkAFP*` rendering wrapper over AFP (see [07](./07-companion-apis.md)). `arkAFP*` rendering wrapper over AFP (see [07](./07-companion-apis.md)).
- **ACIO** — Konami's amusement-cabinet serial I/O protocol for coin mechs, - **ACIO** — Konami's amusement-cabinet serial I/O protocol for coin mechs,
button/LED boards, and card readers, implemented by `libacio.dll` / button/LED boards, and card readers, implemented by the official
`libacio_mbr.dll` (see [07](./07-companion-apis.md)). `libacio.dll` (see [07](./07-companion-apis.md)).
- **PhIZ** — the body-relative, reach-normalized hand-to-cursor mapping used - **PhIZ** — the body-relative, reach-normalized hand-to-cursor mapping used
by the Flash/Natal menu runtime inside `libafp-win32.dll`; `gamekdm.dll` by the Flash/Natal menu runtime inside `libafp-win32.dll`; `gamekdm.dll`
never writes the cursor position itself, it only reads it (see never writes the cursor position itself, it only reads it (see
@@ -98,7 +100,9 @@ are ORIGINAL; 08 bridges ORIGINAL (the facts being matched) and RECONSTRUCTION
`name`, `callers`/`callees`, `globals_touched`, and a reconstruction `name`, `callers`/`callees`, `globals_touched`, and a reconstruction
`status` (`orig`/`reimpl`/`stub`/`verified`), keyed against `status` (`orig`/`reimpl`/`stub`/`verified`), keyed against
`image_base = "0x10000000"` (independently confirmed in this session by `image_base = "0x10000000"` (independently confirmed in this session by
reading the file directly; see [09](./09-reconstruction-codebase.md)). reading the file directly; its addresses remain **UNVERIFIED (pending
re-check against clean-release binary)**; see
[09](./09-reconstruction-codebase.md)).
- **Differential (Unicorn differential)** — the verification method in - **Differential (Unicorn differential)** — the verification method in
`tools/unicorn_diff/` that emulates the real routine inside the shipping `tools/unicorn_diff/` that emulates the real routine inside the shipping
`gamekdm.dll` under Unicorn (oracle) and runs the compiled C++ `gamekdm.dll` under Unicorn (oracle) and runs the compiled C++
@@ -144,18 +148,16 @@ are ORIGINAL; 08 bridges ORIGINAL (the facts being matched) and RECONSTRUCTION
disassembly listing in one of the sections above should be treated as disassembly listing in one of the sections above should be treated as
unestablished. unestablished.
- **Deferred items**, named explicitly rather than silently dropped, per - **Deferred items**, named explicitly rather than silently dropped, per
section: cabinet hardware specifics and the `DAMAC_VIEWER_FULLSCREEN` section: cabinet hardware specifics ([01](./01-runtime-boot.md)); clean-
environment variable's consumer ([01](./01-runtime-boot.md)); full release re-verification of byte-exact export counts and RVAs for the nine
hash-token-to-name recovery for `libavs-win32.dll`'s 360 and official modules ([02](./02-dll-architecture.md),
`libavs-win32-ea3.dll`'s 139 obfuscated exports beyond the one proven [07](./07-companion-apis.md)); the
(`property_node_datasize`), and calling-convention proof for
`libacio_mbr.dll`/`libinput.dll` ([07](./07-companion-apis.md)); the
`.arc`/`.ifs` internal entry-table layouts ([05](./05-data-formats.md)); `.arc`/`.ifs` internal entry-table layouts ([05](./05-data-formats.md));
`FUN_10018570`'s full re-decompilation and the cursor path `FUN_10018570`'s full re-decompilation and the cursor path
(`FUN_1007fbf0`/`FUN_101d84c0`/`DAT_103d2bb8`), neither of which has a (`FUN_1007fbf0`/`FUN_101d84c0`/`DAT_103d2bb8`), neither of which has a
reconstruction yet ([04](./04-validity-cursor.md)); the remaining 9,467 reconstruction yet ([04](./04-validity-cursor.md)); the remaining 9,467
unclassified `gamekdm.dll` functions ([06](./06-gamekdm-subsystems.md)); unclassified `gamekdm.dll` functions ([06](./06-gamekdm-subsystems.md));
and full Windows/spice2x cutover QA, which the project treats as and full Windows cabinet-runtime cutover QA, which the project treats as
deliberately gated and incomplete ([09](./09-reconstruction-codebase.md) §6). deliberately gated and incomplete ([09](./09-reconstruction-codebase.md) §6).
- **A claim without a citation is a bug.** Every section inherits this rule - **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 from [00-overview.md](./00-overview.md); report any uncited claim found in
+17 -90
View File
@@ -1,31 +1,30 @@
# DanceEvolution Arcade (DEA / `gamekdm.dll`) — game internals & RE jumpstart # DanceEvolution Arcade (DEA / `gamekdm.dll`) — game internals & RE jumpstart
Everything reverse-engineered about how DEA consumes the emulated Kinect, plus a Everything reverse-engineered about how DEA consumes the Microsoft NUI runtime, plus a
jump‑start so another agent can continue a full RE/decompilation **without jump‑start so another agent can continue a full RE/decompilation **without
redoing this work**. All gamekdm addresses use image base `0x10000000`. redoing this work**. All gamekdm addresses use image base `0x10000000`.
The emulator presents an ordinary webcam as a Kinect v1: the native tracker Scope is the nine Konami modules in `contents/modules/` and the official
(`tracker-native/`, MediaPipe/BlazePose + ONNX) publishes a synthetic assets/configuration in `contents/`, as listed in
depth/color/skeleton frame over a shared‑memory contract, and the Windows NUI [docs/companion-inventory.md](docs/companion-inventory.md).
shim (`fallback/windows-nui/`, a drop‑in `Kinect10.dll`) serves it to the game. `Kinect10.dll` is only an external Microsoft NUI v1 runtime dependency of
We never modify any game file. `gamekdm.dll`, supplied by the platform.
The addresses, layouts, constants, and disassembly observations below are
historical leads for `contents/modules/gamekdm.dll` and
`contents/modules/libafp-win32.dll`: UNVERIFIED (pending re-check against clean-release binary).
--- ---
## 1. How DEA consumes the Kinect ## 1. How DEA consumes the Kinect
- DEA loads `Kinect10.dll` (MS NUI v1 API). Our shim implements that ABI and - `gamekdm.dll` imports the external Microsoft `Kinect10.dll` NUI v1 API.
feeds the game our frames. The game's own NUI stack computes nothing extra for The game runs skeleton selection/validation and a Flash menu cursor (below).
the skeleton — we publish the 20‑joint skeleton directly; the game *does* run - The historical live-manager address is `*(gamekdm+0x3cf1b4)`.
its own selection/validation and a Flash menu cursor on top (below).
- Resolution: the game only accepts a **4:3** image. The tracker enforces 4:3
(`PopulateResolutions` filters to 4:3; depth/color are 640×480).
- The in‑process introspection tool (section 5) reads the game's live manager at
`*(gamekdm+0x3cf1b4)` — this is how everything below was discovered.
## 2. Skeleton rendering & the selection/validity gate *(solved)* ## 2. Skeleton rendering & the selection/validity gate *(solved)*
For the in‑game skeleton to render, our candidate skeleton must pass the game's For the in‑game skeleton to render, a candidate skeleton must pass the game's
orientation/validity gate, decoded from `gamekdm`: orientation/validity gate, decoded from `gamekdm`:
- `FUN_10018570` builds a gravity/floor‑relative transform `M`. If the gravity - `FUN_10018570` builds a gravity/floor‑relative transform `M`. If the gravity
@@ -38,12 +37,8 @@ orientation/validity gate, decoded from `gamekdm`:
`P1 = (-px, py + m13, -pz + m14)` (no perspective divide) and accepts only if `P1 = (-px, py + m13, -pz + m14)` (no perspective divide) and accepts only if
`P1` is within `0.05` of the box `[A-B, A+B]` where `A = DAT_103d3230 = `P1` is within `0.05` of the box `[A-B, A+B]` where `A = DAT_103d3230 =
(0,1,0)`, `B = (1.22, 1, 0.675)` → box x∈[-1.22,1.22], y∈[0,2], z∈[-0.675, (0,1,0)`, `B = (1.22, 1, 0.675)` → box x∈[-1.22,1.22], y∈[0,2], z∈[-0.675,
0.675]. `m14 = 2.5` matches our published `z0`; `m13` is taken straight from 0.675]. `m13` is taken straight from
the skeleton frame's `vFloorClipPlane.w`. the skeleton frame's `vFloorClipPlane.w`.
- **The fix** (`sensor.cpp BuildSkeletonFrame`): publish all 20 joints as
`TRACKED`, `vNormalToGravity = {0,1,0,0}`, and **`vFloorClipPlane = {0,1,0,
1.0 - hip.y}`** so `P1.y = hip.y + (1 - hip.y) = 1.0` (box centre) every frame.
This auto‑centres the candidate and the skeleton renders. (Commit `36035cc`.)
## 3. The menu hand‑cursor (Flash/`afp` PhIZ) *(solved)* ## 3. The menu hand‑cursor (Flash/`afp` PhIZ) *(solved)*
@@ -63,64 +58,12 @@ This one is *not* in any DLL — it lives in the game's Flash runtime:
- **No gamekdm code writes the cursor from the hand** (no `afp_mc_set_param` - **No gamekdm code writes the cursor from the hand** (no `afp_mc_set_param`
with `0x1008`; 53 decompiled menu AS scripts reference no hand/cursor/natal). with `0x1008`; 53 decompiled menu AS scripts reference no hand/cursor/natal).
The hand→cursor PhIZ is inside the Flash/Natal runtime — a body‑relative, The hand→cursor PhIZ is inside the Flash/Natal runtime — a body‑relative,
reach‑normalised mapping we can't modify. The only lever is **our skeleton**. reach‑normalised mapping.
- **Root causes & fixes** (all shim‑side, `BuildSkeletonFrame`; no tracker
rebuild needed):
1. **Handedness.** Our projection is byte‑identical to a real Kinect's
`NuiTransformDepthImageToSkeleton` (`kDepthProjectionScale = 3.501e-3 =
NUI_CAMERA_DEPTH_NOMINAL_INVERSE_FOCAL_LENGTH_IN_PIXELS`). But the tracker
mirrors the camera (selfie view, like a real Kinect's mirrored depth
image), and **mirroring swaps MediaPipe's L/R labels** (verified: a
mirrored frame's `RIGHT_WRIST.x ≈ 1 - LEFT_WRIST.x` of the normal frame).
So the shim swaps L/R joints back (`kSwap[]`) → the player's right hand
lands in `HAND_RIGHT` with +x relative to `SHOULDER_CENTER`, matching real
Kinect recordings (`HAND_R - SHOULDER_CENTER.x ∈ [-0.35, +0.86]`).
2. **Reach compression.** Measured against real Kinect v1 recordings (UTKinect
`waveHands` + MSR arm‑waves; see section 6), MediaPipe reports the hand
~**1.6× (x) / 1.3× (y)** *closer* to the shoulder than a real Kinect does
(scale‑invariant, shoulder‑width‑normalised — a genuine joint‑placement
difference), so one arm only covered part of the screen. The shim amplifies
each arm outward from its shoulder by `kArmGainX / kArmGainY` (tuned to
**3.2 / 2.6** empirically for full coverage without over‑sensitivity). The
hip/center‑of‑mass is left untouched, so the validity box stays centred.
## 4. Two‑player ## 4. Two‑player
- **The game supports 2P**: dual cursor slots (`CUR1`/`CUR2` above), - **The game supports 2P**: dual cursor slots (`CUR1`/`CUR2` above),
`NuiSkeletonSetTrackedSkeletons([id0, id1])`, and NUI's 6 skeleton slots. `NuiSkeletonSetTrackedSkeletons([id0, id1])`, and NUI's 6 skeleton slots.
- **The emulator does not** (yet): it's single‑person end‑to‑end — the contract
carries one `SkeletonFrame`, the shim fills only `SkeletonData[0]`, and the
tracker runs single‑person BlazePose. `tracker-native/build/two_person_probe`
is the reproducible Linux evidence: it composes a 24-frame two-person
prominence sequence from the committed `testdata/sample_rgb.bin`, drives the
shipping `PoseEstimator::acquire`/`run` policy, and prints the selected
nose/hip x-region every frame. The 2026-11-27 run emitted exactly one tracked
skeleton in all 24 frames; the ROI held A while B overtook it, then switched
to B at frame 14, and back to A at frame 22 (two identity switches, no loss).
- **Experimental CUR2 probe (off by default):** setting `KINECT_SHIM_2P=1`
makes `BuildSkeletonFrame` copy slot 0 to `SkeletonData[1]`, offset it
horizontally, and assign a distinct tracking ID. It is deliberately not a
claim of real 2P (both slots are the same pose and depth player mask). With
the variable unset or not exactly `1`, slot 1 remains `NOT_TRACKED`; slot 0's
hip and `Position` remain byte-identical. The env read + decision + fill live
in one shared `PopulateSecondSkeletonFromEnv` that both the production
`BuildSkeletonFrame` and the `two_person_shim_probe` host unit call, so the
probe asserts the real shipping gate (unset/`0`/empty/`2` -> off, `1` -> on,
on->off transition, slot-0 bytes unchanged) over the real environment
variable. This only permits an in-game check
whether DEA lights `CUR2`. Real 2P still needs a multi-person pose stage and
a two-skeleton tracker contract.
## 5. Debug tooling: in‑process game introspection
Because the shim runs inside `gamekdm.dll`, it can read the game's live memory.
`sensor.cpp DumpGameDisplayState()` dumps the manager, the skeleton‑selection
state, the validity matrix/box, and the live cursor; the per‑frame `handcur:`
log pairs our published joints with the live cursor value. Both are gated behind
`constexpr bool kShimDebug` (`sensor.cpp`, default **false**). Flip it true,
rebuild, and watch `kinect_shim.log` (`game-introspect` / `game-skel[1-4]` /
`game-cursor` / `handcur` lines). This is the method that cracked §2 and §3 —
reimplement the game's math in Python from a single dump, don't guess.
## 6. RE / decompilation jump‑start (for a fresh agent) ## 6. RE / decompilation jump‑start (for a fresh agent)
@@ -160,26 +103,10 @@ Everything you need to continue without redoing the groundwork:
so next step is `libafp-win32.dll` (Ghidra project `afpproj`, already analysed) so next step is `libafp-win32.dll` (Ghidra project `afpproj`, already analysed)
around its `flash.ui.MouseCursor` / pointer handling. around its `flash.ui.MouseCursor` / pointer handling.
### Real‑Kinect reference data (for calibrating our skeleton)
- UTKinect‑Action3D: RGB (1.79G) + synced 20‑joint skeletons (3.3M) +
`actionLabel.txt`, `https://cvrc.ece.utexas.edu/KinectDatasets/` (`RGB.zip`,
`joints.zip`). Joint order = NUI (HIP_CENTER=0 … HAND_R=11 … FOOT_R=19);
real‑world metres. `waveHands` frames are a clean hand sweep.
- MSR‑Action3D `MSRAction3DSkeletonReal3D` (github `Mabdou11/Activity-
Recognition-skeleton-datasets`): `a01`=high‑arm‑wave, `a02`=horizontal‑arm‑
wave. Compare `HAND_R - SHOULDER_CENTER` (shoulder‑width‑normalised) against
our published joints to re‑derive the reach gains.
### Can't run the game here ### Can't run the game here
Wine is not installed and the build is an 8.2 GB spice2x arcade build needing Wine is not installed and the real cabinet/original-binary runtime needs
DirectX + a real camera — iterate with the build→deploy→playtest loop, not an DirectX + a real camera — iterate with the build→deploy→playtest loop, not an
emulator. Deep‑low RE subagents repeatedly failed on this (armed a monitor and emulator. Deep‑low RE subagents repeatedly failed on this (armed a monitor and
exited, then hit a 429 at ~2.1M tokens) — do the game RE directly with the local exited, then hit a 429 at ~2.1M tokens) — do the game RE directly with the local
Ghidra setup. Ghidra setup.
## 7. Top remaining latency lever
Inference is now multi‑threaded (ONNX intra‑op, `pose_estimator.cpp`). The
biggest further win is a **GPU execution provider (DirectML)**: swap the
`onnxruntime-win-x64` CPU binary for `onnxruntime-directml` and
`so.AppendExecutionProvider_DML(0)`. Also optional: a short fixed camera
exposure (cuts sensor lag + motion blur, needs good lighting).