The LocalMP modules of wto_ws.dll scanned for 42 functions at start-up and used about a hundred structure offsets compiled in as constants, so a game update could move a field without anything noticing. Their needs are now definitions under patches/native/<module>.jsonc, resolved by the patcher when it builds the game copy, the same way exe patches are located: - Locate methods: "string_ref" finds code by the string it loads (optionally with a pattern around the lea, to read the field a scoreboard row stores under that name), and "within" searches a short pattern inside the function of a site located before it (function ranges from the exception directory). - Each module lists its sites (functions, globals, call targets and the instructions whose captures give structure offsets), its features and the modules it requires. A module whose sites are not all found is reported like an unavailable patch, with the modules depending on it. - The resolved values go into wto_ws.cfg as native.<site>[.<capture>] lines, with the executable's PE time stamp and image size so the library can refuse values resolved for another build. - Version records include the native module variants and values. - Patch-set folders: the patcher, the scripts and the launcher take the root of a patch set (exe, gui, native, versions) instead of separate folders. - New feature tags K-Chat and radio and K-Nuclear bomb in both language packs. The library still scans by itself; reading these values is the next change. Checked: root and launcher type checks; all 10 modules resolve on 2.61.0.37, where the 239 values equal what the drafting tool read with a disassembler, and on 2.61.0.43, where every structure offset is unchanged except the GameSaveData HUD event queue (0xae8 -> 0xb18); build-game-copy from 2.61.0.37 into a temporary folder writes the values into wto_ws.cfg.
24 lines
1.1 KiB
TypeScript
24 lines
1.1 KiB
TypeScript
/**
|
|
* The network hook library in the game copy: the exe patch
|
|
* online/network-hook-library makes aces.exe load win64/wto_ws.dll, which reads its settings
|
|
* from win64/wto_ws.cfg: the local server port, and the values its LocalMP modules need from the
|
|
* executable (native/native-settings.ts). Both files are written next to the executable; the DLL
|
|
* is built from native/wto-net (build.ps1).
|
|
*/
|
|
import type { PeImage } from '@wto/exepatch';
|
|
import { nativeSettingsLines } from '../native/native-settings.ts';
|
|
import type { LocalEndpoint } from './local-endpoint.ts';
|
|
|
|
export const NETWORK_HOOK_LIBRARY = 'wto_ws.dll';
|
|
const SETTINGS = 'wto_ws.cfg';
|
|
|
|
/** `stock` is the unpatched executable the native values were resolved against. */
|
|
export function networkHookSettings(
|
|
endpoint: LocalEndpoint,
|
|
stock: PeImage,
|
|
nativeValues: ReadonlyMap<string, number>,
|
|
): { name: string; content: Uint8Array } {
|
|
const lines = [`port=${endpoint.port}`, ...nativeSettingsLines(stock, nativeValues)];
|
|
return { name: SETTINGS, content: new TextEncoder().encode(`${lines.join('\n')}\n`) };
|
|
}
|