# DLL Architecture and Module Dependency Graph This section documents exactly **9 Konami modules** shipped under `contents/modules/` in the clean `KDM-2016021900` release. All 9 are in reconstruction scope. External platform runtimes are import targets only. The inventory and cross-DLL dependency DAG follow the [official-scope contract](../../.omo/scope/official-scope.md) and the corrected [`companion-inventory.md`](../companion-inventory.md). Evidence basis: module sizes come from the clean-release listing in the contract's "Official modules" table. The shipped-module topology follows the companion inventory's "Cross-module dependency DAG" and the contract's "Official dependency graph", which describe the official modules' PE imports. This revision does not claim a new `objdump` run. ## Scope classification - **IN-SCOPE** — Konami-authored game/middleware code targeted for decompilation and reconstruction: all 9 modules in the table below. - **REUSE OS** — a Win32/DirectX/CRT system DLL that is only ever an import target (never shipped as a file under `contents/`): `KERNEL32.dll`, `USER32.dll`, `GDI32.dll`, `ADVAPI32.dll`, `SHELL32.dll`, `ole32.dll`, `WS2_32.dll`, `WINMM.dll`, `IMM32.dll`, `DINPUT8.dll`, `DSOUND.dll`, `IPHLPAPI.DLL`, `PSAPI.DLL`, `msvcrt.dll`/`MSVCR80.dll`, `OLEAUT32.dll`, `dbghelp.dll`, `HID.DLL`, `SETUPAPI.dll`, `d3d9.dll`, `d3dx9_43.dll`. - **EXTERNAL RUNTIME** — `Kinect10.dll`, the Microsoft Kinect-for-Windows NUI v1 runtime required by `gamekdm.dll`'s import table. It is supplied by 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 9 shipped Konami modules) Each DLL below resides in `contents/modules/`. Sizes and roles follow the contract's clean-release table and the companion inventory's [per-module table](../companion-inventory.md#per-module-table-contentsmodules). | DLL | Size (clean release listing) | Scope | Named exports | Role | |---|---|---|---|---| | `libavs-win32.dll` | 505.14 KB | IN-SCOPE | 360 | AVS2 core middleware: property-tree configuration, virtual filesystem and threading; base of the main middleware stack. | | `libavs-win32-ea3.dll` | 364.14 KB | IN-SCOPE | 139 | E-amusement v3 AVS2 extension for network, identity and coin economy. | | `libafp-win32.dll` | 1.19 MB | IN-SCOPE | 159 | AFP asset/font/graphics pipeline used by ARK. | | `libafputils-win32.dll` | 165.64 KB | IN-SCOPE | 162 | AFP utilities directly above `libafp-win32.dll`. | | `ess.dll` | 376.14 KB | IN-SCOPE | 209 | ESS e-amusement shop/server middleware; depends on AVS2 and its ea3 extension. | | `libacio.dll` | 224.64 KB | IN-SCOPE | 44 | ACIO cabinet I/O protocol library; root with only USER32/KERNEL32 imports. | | `arkkdm.dll` | 896.64 KB | IN-SCOPE | 255 | ARK/KDM cabinet game engine and AVS2 game-DLL entry; loads and calls `gamekdm.dll`. | | `arkkdmtest.dll` | 389.14 KB | IN-SCOPE | 1 | ARK/KDM render/input test harness; exports `gameMain`; imports OS D3D9/DINPUT8/DSOUND/GDI32/SHELL32/USER32 without AVS2. | | `gamekdm.dll` | 3.19 MB | IN-SCOPE | 1 | Main KDM game logic; exports `gameMain`; primary reconstruction target. | ## Cross-DLL dependency DAG The shipped-module DAG has exactly **9 nodes and 14 edges**. Each solid edge points from an importing module to a shipped dependency, following the [canonical graph](../companion-inventory.md#cross-module-dependency-dag-9-nodes-verified-acyclic). OS/DirectX imports are outside this DAG. The dashed edge from `gamekdm.dll` to `Kinect10.dll` is an external Microsoft NUI runtime dependency; its endpoint is an annotation, not a tenth shipped-module node. ``` libavs-win32.dll (root) libacio.dll (root; imports USER32/KERNEL32 only) arkkdmtest.dll (root; imports OS D3D9/DINPUT8/DSOUND/GDI32/SHELL32/USER32 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, d3d9/d3dx9) ``` ```mermaid graph TD libavs_win32_dll["libavs-win32.dll"] libavs_win32_ea3_dll["libavs-win32-ea3.dll"] libafp_win32_dll["libafp-win32.dll"] libafputils_win32_dll["libafputils-win32.dll"] ess_dll["ess.dll"] libacio_dll["libacio.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_ea3_dll arkkdm_dll --> ess_dll arkkdm_dll --> libacio_dll arkkdm_dll --> libafp_win32_dll gamekdm_dll --> libavs_win32_dll gamekdm_dll --> libafp_win32_dll gamekdm_dll --> libafputils_win32_dll gamekdm_dll -.external.-> kinect ``` The internal graph is acyclic. A dependency-first topological order, matching the companion inventory's [reconstruction order](../companion-inventory.md#reconstruction-order-topological-acyclic), is `libavs-win32.dll`, `libavs-win32-ea3.dll`, `ess.dll`, `libacio.dll`, `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` is the base of the main middleware stack, with zero shipped-module imports. Six other modules import it directly: `libavs-win32-ea3.dll`, `libafp-win32.dll`, `libafputils-win32.dll`, `ess.dll`, `arkkdm.dll`, and `gamekdm.dll`. The remaining two modules, `libacio.dll` and `arkkdmtest.dll`, also have zero shipped-module imports. Thus AVS2 is one of three roots, not a dependency of every module, as shown by the canonical graph's explicit edges. ### `libafp -> libavs` edge `libafp-win32.dll`'s only shipped-module import is `libavs-win32.dll`, as recorded in both authoritative dependency graphs. It is consumed by `libafputils-win32.dll`, `arkkdm.dll`, and `gamekdm.dll`. ### `gamekdm` dependencies `gamekdm.dll` imports three shipped modules: `libavs-win32.dll`, `libafp-win32.dll`, and `libafputils-win32.dll`. It does not depend on every shipped module. Its external dependencies include `Kinect10.dll` (Microsoft NUI v1) and OS DirectX `d3d9.dll`/`d3dx9_43.dll`, as documented in the contract and companion inventory. Those runtimes are supplied by the platform and do not enlarge the nine-module reconstruction set. ## Reconciliation with `companion-inventory.md` The corrected [companion inventory](../companion-inventory.md) and the [official-scope contract](../../.omo/scope/official-scope.md) define this chapter's evidence boundary: - Exactly 9 modules under `contents/modules/` are shipped, Konami-authored, and IN-SCOPE; the table uses their clean-release listing sizes. - The internal DAG reproduces the canonical 9 nodes and 14 edges. The explicitly external `gamekdm.dll` to `Kinect10.dll` NUI runtime edge is excluded from those counts. - `libacio.dll` and `arkkdmtest.dll` are independent roots alongside AVS2. The explicit topology controls here; the companion inventory's prose calling AVS2 an ancestor of every module overstates that topology. This chapter presents the corrected official inventory at spec level. ## See also - [`./00-overview.md`](./00-overview.md) — spec overview and scope. - [`./01-runtime-boot.md`](./01-runtime-boot.md) — process boot sequence that loads this module set. - [`./07-companion-apis.md`](./07-companion-apis.md) — per-DLL API surface detail for the companion (non-`gamekdm`) modules listed here. - [`./08-abi-conventions.md`](./08-abi-conventions.md) — calling-convention and linkage conventions used across these module boundaries. - [`./09-reconstruction-codebase.md`](./09-reconstruction-codebase.md) — how the IN-SCOPE set above maps onto the reconstruction codebase's build targets. - [`../companion-inventory.md`](../companion-inventory.md) — the corrected 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, and dependency graph.