Locate what the native LocalMP modules need from data
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.
This commit is contained in:
1 parent
fdf859c4c9
commit
ddec5c59c0
36 files changed
+3318
-91
No files matched your search
@@ -20,7 +20,7 @@ export function registerIpcHandlers(): void {
|
||||
electron: process.versions.electron,
|
||||
systemLocale: app.getLocale(),
|
||||
userDataPath: app.getPath('userData'),
|
||||
supportedGameVersions: recordedGameVersions(resources.versionRecords),
|
||||
supportedGameVersions: recordedGameVersions(resources.patches),
|
||||
};
|
||||
});
|
||||
handle('app:listBackgrounds', async () => {
|
||||
@@ -65,7 +65,7 @@ export function registerIpcHandlers(): void {
|
||||
handle('install:getRecord', async () => ({ record: await readInstallRecord(), defaultDataPath: defaultDataPath() }));
|
||||
handle('install:listFeatures', () => {
|
||||
const resources = resourcePaths();
|
||||
return patchFeatures(resources.exePatches, resources.guiPatches).map((feature) => ({ ...feature, patchIds: [...feature.patchIds] }));
|
||||
return patchFeatures(resources.patches).map((feature) => ({ ...feature, patchIds: [...feature.patchIds] }));
|
||||
});
|
||||
|
||||
handle('settings:get', () => getSettings());
|
||||
|
||||
@@ -21,7 +21,7 @@ export async function inspectGameFolder(path: string): Promise<GameFolderInspect
|
||||
path,
|
||||
missingFiles,
|
||||
version: missingFiles.includes(GAME_FILES.executable) ? null : await readVersion(join(path, GAME_FILES.executable)),
|
||||
verifiedVersions: recordedGameVersions(resources.versionRecords),
|
||||
verifiedVersions: recordedGameVersions(resources.patches),
|
||||
inSteamLibrary: isInSteamLibrary(path),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -14,8 +14,7 @@ export function checkPatches(stockFolder: string, dataFolder: string): Promise<P
|
||||
const request: PatchCheckRequest = {
|
||||
stockFolder,
|
||||
dataFolder,
|
||||
exePatches: resources.exePatches,
|
||||
guiPatches: resources.guiPatches,
|
||||
patches: resources.patches,
|
||||
networkHookLibrary: resources.networkHookLibrary,
|
||||
};
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
@@ -2,14 +2,12 @@ import { join, resolve } from 'node:path';
|
||||
import { app } from 'electron';
|
||||
|
||||
/**
|
||||
* Where the launcher finds what it ships besides its own code: the patch definitions, the version
|
||||
* records and the network hook library. In development they are this repository's folders.
|
||||
* Where the launcher finds what it ships besides its own code: the patch set (exe, GUI and native
|
||||
* definitions and version records, @wto/patcher patch-set.ts) and the network hook library. In development they are this repository's folders.
|
||||
*/
|
||||
export interface ResourcePaths {
|
||||
readonly exePatches: string;
|
||||
readonly guiPatches: string;
|
||||
/** One record per adapted game version (@wto/patcher version-record.ts). */
|
||||
readonly versionRecords: string;
|
||||
/** Root of the patch set. */
|
||||
readonly patches: string;
|
||||
/** wto_ws.dll, built by native/wto-net/build.ps1. */
|
||||
readonly networkHookLibrary: string;
|
||||
}
|
||||
@@ -22,9 +20,7 @@ export function resourcePaths(): ResourcePaths {
|
||||
// The app path is apps/launcher; the repository is two levels up.
|
||||
const repository = resolve(app.getAppPath(), '..', '..');
|
||||
return {
|
||||
exePatches: join(repository, 'patches', 'exe'),
|
||||
guiPatches: join(repository, 'patches', 'gui'),
|
||||
versionRecords: join(repository, 'patches', 'versions'),
|
||||
patches: join(repository, 'patches'),
|
||||
networkHookLibrary: join(repository, 'build', 'native', 'wto_ws.dll'),
|
||||
};
|
||||
}
|
||||
@@ -6,8 +6,8 @@ export interface PatchCheckRequest {
|
||||
readonly stockFolder: string;
|
||||
/** The local server's data folder: its store tuning names the packs that get bundle GUIDs. */
|
||||
readonly dataFolder: string;
|
||||
readonly exePatches: string;
|
||||
readonly guiPatches: string;
|
||||
/** Root of the patch set (@wto/patcher patch-set.ts). */
|
||||
readonly patches: string;
|
||||
readonly networkHookLibrary: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,13 +27,12 @@ function checkPatches(request: PatchCheckRequest): PatchCheck {
|
||||
const build = buildGameCopy({
|
||||
stock: readStockGameFiles(request.stockFolder),
|
||||
port: CHECK_PORT,
|
||||
exePatches: request.exePatches,
|
||||
guiPatches: request.guiPatches,
|
||||
patches: request.patches,
|
||||
networkHookLibrary: readFileSync(request.networkHookLibrary),
|
||||
multiVehiclePackIds: multiVehiclePackIds(request.dataFolder, () => undefined),
|
||||
placeholderDecals: true,
|
||||
});
|
||||
const failures = [...build.exePatches.failures, ...build.guiPatches.failures];
|
||||
const failures = [...build.exePatches.failures, ...build.guiPatches.failures, ...build.nativeModules.failures];
|
||||
return {
|
||||
exePatchesReady: build.exePatches.applied.length,
|
||||
guiPatchesReady: build.guiPatches.applied.length,
|
||||
|
||||
@@ -262,6 +262,8 @@
|
||||
"K-Kill, assist and capture scoring": "Kill, assist and capture scoring",
|
||||
"K-Additional vehicles": "Additional vehicles",
|
||||
"K-Scoreboard": "Scoreboard",
|
||||
"K-Chat and radio": "Chat and radio",
|
||||
"K-Nuclear bomb": "Nuclear bomb",
|
||||
"L-Debriefing": "Battle results",
|
||||
"L-Battle awards": "Battle awards"
|
||||
},
|
||||
|
||||
@@ -262,6 +262,8 @@
|
||||
"K-Kill, assist and capture scoring": "击杀、助攻与占点计分",
|
||||
"K-Additional vehicles": "补充载具",
|
||||
"K-Scoreboard": "计分板",
|
||||
"K-Chat and radio": "聊天与无线电",
|
||||
"K-Nuclear bomb": "核弹",
|
||||
"L-Debriefing": "战后结算",
|
||||
"L-Battle awards": "战斗嘉奖"
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user