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

174 lines
6.1 KiB
Markdown

# Runtime Environment & Official Boot/Startup Chain
Scope: the clean KDM-2016021900 release under `contents/`. This document describes
only the official AVS2-to-game path evidenced by the shipped modules and
configuration. See [`docs/re/gamemain-binding.md`](../re/gamemain-binding.md) for
the instruction-level `arkkdm.dll` binding trace and
[`06-gamekdm-subsystems.md`](./06-gamekdm-subsystems.md) for behavior after
`gameMain` starts.
## 1. Runtime target
DanceEvolution Arcade (internal model code KDM) is a 32-bit Windows AVS2 /
e-amusement title. Its official runtime consists of exactly nine modules in
`contents/modules/`:
| Module | Clean-release size | Role |
|---|---:|---|
| `libavs-win32.dll` | 505.14 KB | AVS2 core middleware |
| `libavs-win32-ea3.dll` | 364.14 KB | e-amusement v3 AVS2 extension |
| `libafp-win32.dll` | 1.19 MB | AFP asset, font, and graphics pipeline |
| `libafputils-win32.dll` | 165.64 KB | AFP utilities |
| `ess.dll` | 376.14 KB | ESS e-amusement middleware |
| `libacio.dll` | 224.64 KB | ACIO cabinet-I/O protocol library |
| `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 |
`gamekdm.dll` uses Direct3D 9 and imports `Kinect10.dll`, the Microsoft Kinect
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.
The official shipped-module dependency graph has nine nodes:
```text
libavs-win32.dll (root)
libacio.dll (root)
arkkdmtest.dll (root; OS multimedia/input imports only)
libavs-win32-ea3.dll -> libavs-win32.dll
libafp-win32.dll -> libavs-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
gamekdm.dll -> libavs-win32.dll, libafp-win32.dll,
libafputils-win32.dll
(+ external Kinect10.dll and DirectX)
```
## 2. Official AVS2 entry into `arkkdm.dll`
The AVS2 runtime enters the game DLL through `arkkdm.dll`'s standard AVS2
exports:
| Export | By-name ordinal | RVA |
|---|---:|---:|
| `dll_entry_init` | 253 | `0x767c0` |
| `dll_entry_main` | 254 | `0x767b0` |
The names, ordinals, and RVAs are derivable from `arkkdm.dll`'s own PE export
directory with `objdump`. They are by-name exports; the ordinal values describe
their export-table entries but are not the binding mechanism.
`arkkdm.dll`'s `DllMain` captures the DLL's own `HINSTANCE` on
`DLL_PROCESS_ATTACH`. `dll_entry_init` relays that value into the internal
`g_MainDllInfo.dllHMODULE` field. The AVS2 runtime then calls
`arkkdm.dll`'s `dll_entry_main`.
## 3. `arkkdm.dll` resolves and invokes the game payload
`dll_entry_main` reaches an internal `arkkdm.dll` resolver that performs this
official sequence:
1. Call `LoadLibraryA("gamekdm.dll")`.
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)`.
The first successful candidate supplies `gameMain`; if neither candidate
supplies it, no game entry is called. This is an ordinary two-candidate
`LoadLibraryA` / `GetProcAddress` fallback implemented inside `arkkdm.dll`, not
a custom linking protocol.
The argument is the `HINSTANCE` belonging to `arkkdm.dll`, not the handle of
`gamekdm.dll`. Its relay is:
```text
arkkdm.dll DllMain(hinstDLL, DLL_PROCESS_ATTACH, ...)
-> captured arkkdm.dll HINSTANCE
-> g_MainDllInfo.dllHMODULE
-> dll_entry_main's internal resolver
-> gameMain(hInstance)
```
The known `gameMain` call shape in `gamekdm.dll` is:
```c
gameMain(void *hInstance); /* cdecl; return type not established here */
```
`gameMain` is at RVA `0x9e20` / VA `0x10009e20`, takes one pointer argument,
and uses the cdecl calling convention. The bare returns in its entry function
and the caller-owned stack cleanup establish cdecl.
## 4. Official configuration and content roots
Official assets and configuration all live under `contents/`:
- `contents/data/{arc,bgmov,bm2d,dal,data,font,movie,sound}`
- `contents/arkdata/{ark/*,arkkdm/*}`
- `contents/prop/`
The clean-release configuration set in `contents/prop/` is:
- `avs-config.xml`
- `ark-config.xml`
- `ark-config_nopp.xml`
- `eamuse-config.xml`
- `ess-config.xml`
- `card_allow.bin`
- `coin.xml`
- `eacoin.xml`
- `share-config.xml`
- `testmode-v.xml`
### `avs-config.xml`
This is the AVS2 core configuration. It defines the virtual-filesystem devices,
resource limits, logging, networking, threading, and time settings used by the
runtime beneath the game modules.
### `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)
```
Every transition after AVS2 enters `arkkdm.dll` is evidenced by
`arkkdm.dll`'s own exports, imports, strings, and disassembly.
## Cross-references
- [`docs/re/gamemain-binding.md`](../re/gamemain-binding.md) — detailed
`arkkdm.dll` resolver and `hInstance` trace.
- [`docs/companion-inventory.md`](../companion-inventory.md) — authoritative
clean-release module inventory and nine-node dependency DAG.
- [`06-gamekdm-subsystems.md`](./06-gamekdm-subsystems.md) — behavior after
`gameMain` begins.