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.
5.8 KiB
gamekdm.dll gameMain binding and hInstance provenance
Scope: the official binding path from the AVS2 runtime's entry into
arkkdm.dll to the call of gamekdm.dll's exported gameMain. The evidence
described here comes from the official game modules' PE metadata, strings, and
disassembly.
Integrity boundary
Earlier reverse engineering used an installed tree whose arkkdm.dll,
libacio.dll, and gamekdm.dll byte sizes may differ from the clean
KDM-2016021900 release. Therefore, any exact byte count, export count, or
address from that installed copy which is not part of the clean-binary facts
listed below is UNVERIFIED (pending re-check against clean-release binary).
No new numeric values are inferred in this document.
The clean-binary facts retained here are:
arkkdm.dllexportsdll_entry_initby name at ordinal 253, RVA0x767c0.arkkdm.dllexportsdll_entry_mainby name at ordinal 254, RVA0x767b0.gamekdm.dllexportsgameMainat RVA0x9e20/ VA0x10009e20.gameMainis cdecl and takes onevoid *argument.
(a) Hop 1: AVS2 runtime to arkkdm.dll
The AVS2 runtime enters arkkdm.dll through its standard AVS2 entry exports:
arkkdm.dll!dll_entry_init ordinal 253 RVA 0x767c0
arkkdm.dll!dll_entry_main ordinal 254 RVA 0x767b0
Both symbols are present in arkkdm.dll's PE name-pointer table, so they are
by-name exports rather than ordinal-only exports. The ordinals identify their
export-table entries; they do not imply an ordinal-only call.
After initialization, the AVS2 runtime calls
arkkdm.dll!dll_entry_main. Everything from that point through the invocation
of gameMain is implemented inside arkkdm.dll.
(b) Hop 2: arkkdm.dll to gameMain
arkkdm.dll contains a two-candidate payload resolver. Its production
candidate is gamekdm.dll; its test-build fallback is arkkdmtest.dll.
Conceptually, the official code performs:
HMODULE candidate = LoadLibraryA("gamekdm.dll");
if (candidate == NULL) {
candidate = LoadLibraryA("arkkdmtest.dll");
}
if (candidate != NULL) {
gameMain = GetProcAddress(candidate, "gameMain");
if (gameMain != NULL) {
gameMain(g_MainDllInfo.dllHMODULE);
}
}
The actual implementation loops over the two literal module names. For each
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.
There is no custom export protocol between arkkdm.dll and the payload DLL.
(c) hInstance is arkkdm.dll's own module handle
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:
- The Windows loader calls
arkkdm.dll'sDllMain. - On
DLL_PROCESS_ATTACH,DllMaincaptures itshinstDLLargument. dll_entry_initrelays that captured value into the internalg_MainDllInfo.dllHMODULEfield.- The
dll_entry_mainpath gives theg_MainDllInfostructure to the internal payload resolver. - The resolver reads field zero, pushes that one value, and indirectly calls
the resolved
gameMainpointer.
arkkdm.dll DllMain hinstDLL
-> captured module-instance global
-> g_MainDllInfo.dllHMODULE
-> dll_entry_main payload resolver
-> gameMain(hInstance)
The adjacent diagnostic strings identify the structure as MainDllInfo and
its first field as dllHMODULE. The initialization logic treats the value as
set-once module identity: it stores the captured handle on the first
initialization and has a warning path if a later value differs.
Consequently, gameMain receives the module instance assigned to
arkkdm.dll. It does not receive gamekdm.dll's module handle.
(d) gameMain signature and calling convention
gameMain is at RVA 0x9e20 / VA 0x10009e20 in gamekdm.dll. Its callable
shape is:
/* cdecl; one argument */
gameMain(void *hInstance);
The arkkdm.dll call site pushes exactly one argument before the indirect
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
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)
This establishes the two important boundaries:
- AVS2 calls the official AVS2 entry export in
arkkdm.dll. arkkdm.dllitself loads the payload, resolvesgameMain, and supplies its own captured module instance.
Deferred clean-binary checks
The control flow and named interface above are official and derivable from the game binaries. Older instruction addresses, data addresses, thunk addresses, file offsets, raw byte sequences, and exact export totals not repeated as clean-binary facts in this document are UNVERIFIED (pending re-check against clean-release binary).
The following details do not affect the binding contract and remain deferred:
- whether
g_MainDllInfo.dllHMODULEis reset across repeated entry calls; - the purpose of surrounding generic initialization and logging guards;
- a live cabinet observation of the pointer value received by
gameMain.
Cross-references
docs/spec/01-runtime-boot.md— official runtime, nine-module set, configuration, and startup summary.docs/companion-inventory.md— clean-release inventory and official dependency DAG.