10 grounded sections (overview, runtime/boot, DLL architecture, Kinect/skeleton, validity+cursor, data formats, gamekdm subsystem map, companion APIs, ABI/structs, reconstruction codebase) + master index, mined from the RVA DB / Ghidra / game dir / reconstructed slices. Independently grounding-reviewed (13/20 sample resolved on first pass; 7 contradicted claims then corrected and re-verified).
211 lines
12 KiB
Markdown
211 lines
12 KiB
Markdown
# gamekdm.dll Subsystem Map
|
|
|
|
An RVA-anchored partition of `gamekdm.dll` into functional subsystems. All
|
|
addresses are RVAs relative to image base `0x10000000` (`re/rvadb.json:
|
|
image_base`); absolute VA = RVA + base. The module holds `function_count` =
|
|
**9728** functions (`re/rvadb.json`). This is a *representative* map: each
|
|
subsystem lists 8-15 functions chosen as entry points or distinctive workers,
|
|
not an exhaustive per-function catalog. Citations are RVAs verified present in
|
|
`re/rvadb.json`; semantics come from the committed Ghidra dumps under
|
|
`/home/athapa/ghidra/*.out`, the recovered source paths and class names in the
|
|
DLL's string table, and `game-internals.md`.
|
|
|
|
## Method and confidence
|
|
|
|
The DLL ships almost fully stripped: of 9728 functions only ~364 carry a real
|
|
name, and `owning_module_guess` is `unknown` for 9711 (the rest are CRT/EH
|
|
thunks and four `D3DX9_43.DLL` imports). Subsystems were therefore seeded from
|
|
three evidence sources, strongest first: (1) `strref`/`StatusCB` labels in the
|
|
Ghidra dumps and the game's own recovered source paths embedded as strings
|
|
(`..\Game_DaM\...`, `..\Renderer\...`, `..\src\mm\...`, `Source\BM2D\...`) and
|
|
C++ class names (`NuiThread::`, `mm::Emitter`, `CAudioWrap::`, `BM2D::`); (2)
|
|
the retained `ark*` export-name string table; (3) call-graph adjacency plus
|
|
shared writes to the same mutable globals. A function was assigned only when a
|
|
name/string anchor matched, or when >=2 of its graph neighbours already belong
|
|
to one subsystem *and* it writes a global that subsystem owns. Everything else
|
|
is left unclassified rather than guessed (see coverage note).
|
|
|
|
## Game-state manager — the live manager at `*(gamekdm+0x3cf1b4)`
|
|
|
|
The central per-frame object. `DAT_103cf1b4` holds its pointer and is read by 53
|
|
functions; it carries the NUI thread handle, the skeleton frame at `+0x1a0`, the
|
|
requested/selected tracking IDs at `+0x15f0`/`+0x1684`, and the synthetic-mode
|
|
flag at `+0x17f4` (layout in `include/gk/structs/manager.h`, `gk::LiveManager`).
|
|
`FUN_1000fa20` (0x0000fa20) is the frame-commit path: it drains the NUI worker,
|
|
copies tracking IDs into the manager, and signals the frame event;
|
|
`FUN_10010030` (0x00010030) diffs the committed vs requested subsystem mask at
|
|
`+0xc`/`+0x10` and starts/stops skeleton tracking. State-query helpers
|
|
`FUN_10013220` (0x00013220), `FUN_10013290` (0x00013290), `FUN_100132d0`
|
|
(0x000132d0), `FUN_10013310` (0x00013310) and `FUN_10013330` (0x00013330) read
|
|
manager fields for callers; `FUN_10019850` (0x00019850) and `FUN_100198f0`
|
|
(0x000198f0) are its update drivers. Key global: `DAT_103cf1b4`. See
|
|
[./03-kinect-skeleton.md](./03-kinect-skeleton.md).
|
|
|
|
## Kinect / skeleton — NuiThread and hid::Natal
|
|
|
|
The NUI consumer thread and skeleton ingest. `FUN_1000f0a0` (0x0000f0a0,
|
|
`NuiThread::updateFrame`), `FUN_1000f300` (0x0000f300, `NuiThread::updateSkeleton`)
|
|
and `FUN_1000f400` (0x0000f400, `NuiThread::updateStream`) are the three
|
|
per-frame NUI pumps; `FUN_1000ebd0` (0x0000ebd0, `StatusCB`) and `FUN_1000ecc0`
|
|
(0x0000ecc0, `CreateSensor`) own sensor lifecycle; `FUN_100103d0` (0x000103d0,
|
|
`hid::Natal::copySkeleton`) and `FUN_100122d0` (0x000122d0,
|
|
`HidNatalNuiThread_win32.cpp`) move skeleton data into the manager.
|
|
`FUN_100100d0` (0x000100d0, `TransformSmooth`) smooths joints and `FUN_10019c30`
|
|
(0x00019c30, `ColorCoord`) maps depth to colour space. `FUN_10004e40`
|
|
(0x00004e40, `[$CameraImage]`) and `FUN_100076f0` (0x000076f0, `noCamera`) handle
|
|
the camera-image/no-camera cases; `FUN_1000ef50` (0x0000ef50) is a worker in the
|
|
same cluster. Globals: `DAT_103cf1b4`, `DAT_103d2d90`. Full treatment in
|
|
[./03-kinect-skeleton.md](./03-kinect-skeleton.md).
|
|
|
|
## Validity gate — candidate filter and gravity transform
|
|
|
|
Decides whether a candidate skeleton renders. `FUN_10018570` (0x00018570) builds
|
|
the gravity/floor-relative matrix `DAT_103d4a80` (reading gravity at
|
|
`manager+0x2c`); `FUN_101799b0` (0x001799b0) is its 16-float matrix multiply.
|
|
`FUN_100e4140` (0x000e4140) is the per-slot validity filter, calling
|
|
`FUN_101ab6d0` (0x001ab6d0) for the box-distance metric, itself built from the
|
|
clamp `FUN_101ab640` (0x001ab640) and `FUN_101ab5b0` (0x001ab5b0). `DAT_103d3230`
|
|
holds the box's center point plus a separate half-extent value (not box
|
|
corners — `src/game/box_distance.cpp:7-16`, `game-internals.md:37-42`) and is
|
|
initialised by `FUN_100e4a80` (0x000e4a80); nearest-candidate selection runs
|
|
in `FUN_100e46d0` (0x000e46d0) and
|
|
`FUN_100e47d0` (0x000e47d0), feeding slot assignment `FUN_100e4540` (0x000e4540);
|
|
`FUN_100182a0` (0x000182a0) is a sibling transform helper. Globals:
|
|
`DAT_103d3230`, `DAT_103d4a80`, `DAT_103e29b0`, `DAT_103d18e8`. This is the
|
|
subject of [./04-validity-cursor.md](./04-validity-cursor.md).
|
|
|
|
## Menu cursor — afp hand cursor and OK-button snapping
|
|
|
|
The Flash/afp menu cursor state machine. `FUN_1007e330` (0x0007e330) is the
|
|
cursor/selection state machine; `FUN_1007fbf0` (0x0007fbf0) does OK-button
|
|
hit-testing (`_but_ok_1p_usr`, threshold `dist² < 0x1fa4`); `FUN_10080360`
|
|
(0x00080360) reads the `_icon_1p_usr` button icons; `FUN_1007f0a0` (0x0007f0a0)
|
|
and `FUN_100800e0` (0x000800e0) are helper branches. The cursor coordinate is
|
|
read through `afp_mc_get_param(_,0x1008)` in `FUN_101d84c0` (0x001d84c0) and
|
|
`FUN_101d78e0` (0x001d78e0); `FUN_101d71e0` (0x001d71e0) resolves a movie-clip by
|
|
name. BM2D ownership is bracketed by `FUN_10084750` (0x00084750,
|
|
`BM2DWrapper:AcquireOwnership`) and `FUN_100847e0` (0x000847e0,
|
|
`BM2DWrapper:ReleaseOwnership`). Global: cursor-controller `DAT_103d2bb8` (read
|
|
by 55 functions). See [./04-validity-cursor.md](./04-validity-cursor.md).
|
|
|
|
## Scoring — judge counts, combo, and HUD numerals
|
|
|
|
`FUN_10072a30` (0x00072a30) formats the `SCORE` / `JUDGE(PE,GR,GO,BO)` debug
|
|
line and owns the per-player judge tallies; `FUN_10073be0` (0x00073be0) drives
|
|
the `score_00000001_usr`..`score_10000000_usr` / `hi_score_usr` numeral sprites,
|
|
with `FUN_100741e0` (0x000741e0) and `FUN_10074d30` (0x00074d30) its HUD
|
|
siblings. `FUN_10088740` (0x00088740) loads `data/arc/combo_1p.arc`;
|
|
`FUN_100a93a0` (0x000a93a0) animates the `combo_01_usr` digits and `FUN_100a6d50`
|
|
(0x000a6d50) the `wipe_usr` transition. `FUN_100bc8a0` (0x000bc8a0) reads the
|
|
shop-area network option feeding result upload. Globals: `DAT_103d28c0`,
|
|
`DAT_102f2258`.
|
|
|
|
## Song / chart flow — selection, resources, and DanceStream
|
|
|
|
Song/chart lifecycle. `FUN_10023b40` (0x00023b40) loads `song_resources.rlist` /
|
|
`song_character_params.plist`; `FUN_1002adb0` (0x0002adb0) parses
|
|
`song_params.plist` and reports `Unknown song`. `FUN_1001b740` (0x0001b740) and
|
|
`FUN_1001fad0` (0x0001fad0) build the `song_` catalogue; `FUN_1001c070`
|
|
(0x0001c070) resolves `data/song/` paths and `FUN_1001fc40` (0x0001fc40) applies
|
|
`songpatch_` overrides. The playfield stream generator is `FUN_100b69e0`
|
|
(0x000b69e0, `DanceStreamManager_Generator.cpp`) and the procedural note model is
|
|
`FUN_100d31a0` (0x000d31a0, `p_ds_Model.cpp`). The `ark*Sequence*` export strings
|
|
(`arkSetSequenceNumber`, `arkGetSequenceNoteCount`) are the chart-playback API
|
|
surface. See [./05-data-formats.md](./05-data-formats.md) for the on-disk
|
|
`.rlist`/`.plist` formats.
|
|
|
|
## D3D9 render — Renderer_dx9 and the Gs scene graph
|
|
|
|
The DirectX 9 renderer (`..\Renderer\Renderer_dx9.cpp`) plus the `Gs` scene-graph
|
|
layer. Post-process filters each have their own function: `FUN_100fd140`
|
|
(0x000fd140, `ColorFilter_dx9`), `FUN_10100c30` (0x00100c30, `GodRay`),
|
|
`FUN_100fc980`/`FUN_100fd4c0`/`FUN_10101680` (0x000fc980 / 0x000fd4c0 /
|
|
0x00101680, `render_color` targets) and the `sys_copy` blit chain
|
|
`FUN_100ff880`/`FUN_10100240`/`FUN_10102c20`. `FUN_100e9450` (0x000e9450) sets
|
|
`audience_color`; `FUN_100292a0` (0x000292a0) sets the
|
|
`primary_directional_light_direction`; `FUN_100f4590` (0x000f4590) and
|
|
`FUN_100f77e0` (0x000f77e0) are scene-graph node workers. External edges confirm
|
|
`D3D9.DLL` (7 call sites) and `D3DX9_43.DLL`. Globals: `DAT_103d2d0c`,
|
|
`DAT_103d2d14`, `DAT_103d24e0`.
|
|
|
|
## Movie — DirectShow demo/tutorial playback
|
|
|
|
Full-motion video via DirectShow. `FUN_1003e330` (0x0003e330) loads
|
|
`data/movie/demo_movie` (`AC_movie`); `FUN_10041b30` (0x00041b30) plays
|
|
`data/movie/_demo_tuto.wmv` (`TutoMovie`, from `HowToDemoSequence.cpp`);
|
|
`FUN_10057890` (0x00057890) is the `DEMO MOVIE` attract hook. The DirectShow
|
|
graph builder `FUN_101c26f0` (0x001c26f0) instantiates the `MPEG-2 Splitter`
|
|
filter, guarded by `FUN_101c2380` (0x001c2380). RTTI names confirm the C++
|
|
namespace `me::movie::impl::DShow`/`DShowPlayer`/`MemRenderer`. `OLE32.DLL`
|
|
(`CoCreateInstance`, 43 edges) is the COM backing. Global: `DAT_103d1d48`.
|
|
|
|
## Particle — mm (MahoroMagic) effect engine
|
|
|
|
The `mm::` effect/particle engine (`..\src\mm\MahoroMagic.cpp`,
|
|
`mmEmitterGroup.cpp`, `mmModel.cpp`), the largest classified cluster.
|
|
`FUN_100862d0`..`FUN_10086790` (0x000862d0, 0x000863f0, 0x00086510, 0x00086650,
|
|
0x00086790) are the `mm::stl::allocator` / handle-table constructors for
|
|
`Emitter`/`Particle`/`PresetInfo`; `FUN_101682c0`..`FUN_10168820` (0x001682c0,
|
|
0x00168630, 0x00168820) and `FUN_10167800`/`FUN_10167a60` (0x00167800 /
|
|
0x00167a60) are preset-bin readers and model-instancing workers (`FailedTexture`).
|
|
`FUN_1008ace0` (0x0008ace0) and `FUN_100c4ba0` (0x000c4ba0) are update/display
|
|
drivers (`EMITTER_UPDATE` / `EMITTER_DISPLAY`, `Cloth Update Particle`). Globals:
|
|
`DAT_103e5f34`, `DAT_103e5f88`.
|
|
|
|
## Sound / mm — CAudioWrap over XACT3/XAudio2
|
|
|
|
Audio built on XACT3/XAudio2 (`CSd::`, `CKsd::`, `CAudioWrap::`,
|
|
`SoundHeapManager::`, `CCtrlBlk::`, `CWorkMan::`). `FUN_100d9e50` (0x000d9e50,
|
|
`CKsd::Init`) and `FUN_100db340` (0x000db340, `SoundHeapManager` /
|
|
`FileManager`) own init and the sound heap; `FUN_100dae20` (0x000dae20) creates
|
|
the request-queue mutex; `FUN_100dcae0`/`FUN_100dcb80`/`FUN_100dcbe0` (0x000dcae0
|
|
/ 0x000dcb80 / 0x000dcbe0) are `CCtrlBlk::RequestPlay/RequestPrepare/PreparedPlay`;
|
|
`FUN_100dce20` (0x000dce20) calls `XAudio2Create`; `FUN_100dbee0` (0x000dbee0)
|
|
wraps `CMutex::UnLock`. `FUN_1005e840` (0x0005e840) triggers `se_kuma_elev_up`
|
|
SE. The retained `ark*Sound*` exports (`createSound`, `playSoundBGM`,
|
|
`setSoundVolume`) are the public API. `WINMM.DLL` provides 32 edges. Globals:
|
|
`DAT_103d1840`, `DAT_103e2764`.
|
|
|
|
## UI — BM2D 2D layer system and bitmap fonts
|
|
|
|
The BM2D 2D compositor (`Source\BM2D\*.cpp`) and bitmap-font text.
|
|
`FUN_101d8330` (0x001d8330, `BM2D_LayerBase.cpp`) manages layers;
|
|
`FUN_101d8de0` (0x001d8de0, `BM2D_LinePrim.cpp`) emits line primitives;
|
|
`FUN_101d9180`/`FUN_101d91e0`/`FUN_101d9250` (0x001d9180 / 0x001d91e0 /
|
|
0x001d9250, `BM2D_Utility.cpp`) build user shapes. Text rendering is
|
|
`FUN_10135880` (0x00135880, `BmpfontSimpleString::render`) with line parsing in
|
|
`FUN_1013ca00`/`FUN_1013cad0` (0x0013ca00 / 0x0013cad0,
|
|
`BmpfontSimpleString::parseLines`). `FUN_101d9e80` (0x001d9e80) bridges to
|
|
`afputils`. `LIBAFP-WIN32.DLL` (96 edges) backs the Flash layer. See
|
|
[./07-companion-apis.md](./07-companion-apis.md).
|
|
|
|
## Boot / entry — gameMain and CRT startup
|
|
|
|
Module and game entry. `entry` (0x001dd76b) -> `___DllMainCRTStartup`
|
|
(0x001dd675) with `___security_init_cookie` (0x001e4f5b) is the PE/CRT bring-up.
|
|
The single game export is `gameMain` (0x00009e20, confirmed by `objdump -p` and
|
|
`re/rvadb.json`, absolute VA `0x10009e20`); it runs `FUN_100029a0` (0x000029a0),
|
|
which binds the `arkKDMInitialize`/`arkKDMUpdate` entry points via
|
|
`GetProcAddress`, and `FUN_10009b40` (0x00009b40) / `FUN_10009a00` (0x00009a00),
|
|
the subsystem bring-up fan-out (`arkHeapBoot`, `arkNetworkTCPInitialize`). AVS2
|
|
is reached through `LIBAVS-WIN32.DLL` (595 edges). See
|
|
[./01-runtime-boot.md](./01-runtime-boot.md) and
|
|
[./02-dll-architecture.md](./02-dll-architecture.md).
|
|
|
|
## Coverage note
|
|
|
|
This map assigns **261 of 9728** functions (~2.7%) to a named subsystem: 226
|
|
seed functions anchored by a name, string, source-path, or the known
|
|
hand-verified RVAs from `game-internals.md`, plus 35 added by conservative
|
|
call-graph + shared-global expansion. The remaining **9467** functions (~97.3%)
|
|
are left **unclassified** — this is expected for a near-fully-stripped 3.3 MB
|
|
DLL where only ~364 functions retain any symbol and 9711 report an `unknown`
|
|
owning module. The unclassified bulk is dominated by compiler/EH boilerplate
|
|
(2123 `Unwind@*`, 169 `Catch_All@*` thunks) and un-anchored leaf helpers that
|
|
carry no string, name, or distinctive global to attribute them safely. The
|
|
classified set deliberately favours precision over recall: a function is mapped
|
|
only on positive evidence, so the per-subsystem RVAs above are reliable entry
|
|
points even though the long tail stays open. Deepening coverage requires
|
|
targeted decompilation (the `/home/athapa/ghidra` project, `game-internals.md`
|
|
§6), not further name/string inference.
|