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.
5.0 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.
Binary facts
The verified binary facts 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.
Open behavioral questions
The following details do not affect the binding contract:
- 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.