Require explicit accounts and register GUI script edits

Reject game requests whose token or account hint cannot be resolved
and require a valid explicit user ID for web mutations. Remove the
entitlement action without a verified client call site.

Register the loopback store URL script edit and require a unique match
during pack construction. Type checking and patch loading passed.
In-game acceptance is pending.
This commit is contained in:
N0VAN0M4LY committed 2026-11-25 08:08:29 +08:00
1 parent 929e4b1e78
commit 58241a513f
10 files changed
+131 -62

No files matched your search

+12 -8
View File
@@ -3,11 +3,12 @@
* files of the game copy.
*
* node packages/build/src/cli.ts --game <stock game folder> --out <game copy folder> --port <n>
* [--patches exe-patches] [--native build/native] [--verbose]
* [--patches exe-patches] [--gui-patches gui-patches]
* [--native build/native] [--verbose]
*
* Writes <out>/char.vromfs.bin, <out>/aces.vromfs.bin, <out>/win64/aces.exe and the network
* hook library the patched executable loads (<out>/win64/wto_ws.dll from --native, built by
* native/wto-net/build.ps1, and its settings wto_ws.cfg). The stock folder is only read.
* Writes <out>/char.vromfs.bin, <out>/aces.vromfs.bin, <out>/gui.vromfs.bin, <out>/win64/aces.exe
* and the network hook library the patched executable loads (<out>/win64/wto_ws.dll from --native,
* built by native/wto-net/build.ps1, and its settings wto_ws.cfg). The stock folder is only read.
* The launcher will run the same steps at every launch, with the port the player chose.
*/
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
@@ -28,12 +29,13 @@ function main(): number {
out: { type: 'string' },
port: { type: 'string' },
patches: { type: 'string', default: 'exe-patches' },
'gui-patches': { type: 'string' },
native: { type: 'string', default: join('build', 'native') },
verbose: { type: 'boolean', default: false },
},
});
if (!values.game || !values.out || !values.port) {
console.error('usage: cli.ts --game <stock game folder> --out <game copy folder> --port <n> [--patches exe-patches] [--native build/native] [--verbose]');
console.error('usage: cli.ts --game <stock game folder> --out <game copy folder> --port <n> [--patches exe-patches] [--gui-patches gui-patches] [--native build/native] [--verbose]');
return 2;
}
assertWritableCopy(values.game, values.out);
@@ -64,12 +66,12 @@ function main(): number {
console.log(`settings.blk: ${mainPack.addresses.length} address(es) now point to ${endpoint.host}:${endpoint.port}`);
for (const change of mainPack.addresses) console.log(` ${change.path}: ${change.before} -> ${change.after}`);
const guiPack = rebuildGuiPack(readFileSync(join(values.game, GAME_FILES.guiPack)), endpoint);
console.log('gui.vromfs.bin: local URLs bypass external SSO redirect');
const guiPack = rebuildGuiPack(readFileSync(join(values.game, GAME_FILES.guiPack)), endpoint, values['gui-patches']);
console.log(`gui.vromfs.bin: ${guiPack.applied.length} GUI patch(es) applied (${guiPack.applied.map((p) => p.id).join(', ')})`);
writeOutput(values.out, GAME_FILES.charPack, charPack.pack);
writeOutput(values.out, GAME_FILES.mainPack, mainPack.pack);
writeOutput(values.out, GAME_FILES.guiPack, guiPack);
writeOutput(values.out, GAME_FILES.guiPack, guiPack.pack);
writeOutput(values.out, GAME_FILES.executable, executable.executable);
const executableFolder = dirname(GAME_FILES.executable);
writeOutput(values.out, join(executableFolder, NETWORK_HOOK_LIBRARY), readFileSync(hookLibraryPath));
@@ -81,6 +83,8 @@ function main(): number {
function writeOutput(folder: string, relativePath: string, content: Uint8Array): void {
const path = join(folder, relativePath);
mkdirSync(dirname(path), { recursive: true });
// Unlink before writing so a read-only target file or a hardlink to the stock folder is
// replaced with a fresh file instead of failing with EPERM or mutating the link target.
rmSync(path, { force: true });
writeFileSync(path, content);
console.log(`wrote ${path}`);