Files
WT-Offline/packages/patcher/src/network/network-hook.ts
T
N0VAN0M4LY fb7d07f4f9
Launcher release / release (push) Waiting to run
feat(launcher): add About log export shortcut and runtime logging toggle
Add a quick ZIP log export button to the About page (also bundling the latest embedded browser -browser.log while excluding player saves) and add a runtime logging toggle under Settings -> Diagnostics that controls launcher file logs, local server traffic logs, and wto_ws.log via log=0 in wto_ws.cfg. Update the v0.1.2 release note accordingly.
2026-12-02 17:41:49 +08:00

29 lines
1.2 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>,
options?: { readonly loggingEnabled?: boolean },
): { name: string; content: Uint8Array } {
const lines = [
`port=${endpoint.port}`,
...(options?.loggingEnabled === false ? ['log=0'] : []),
...nativeSettingsLines(stock, nativeValues),
];
return { name: SETTINGS, content: new TextEncoder().encode(`${lines.join('\n')}\n`) };
}