mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-27 12:39:49 +01:00
apply smart dlc
This commit is contained in:
1 parent
9236c54b4b
commit
41fb822571
6 files changed
+19
-21
No files matched your search
@@ -128,9 +128,13 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: bun install
|
run: bun install
|
||||||
|
|
||||||
- name: Download Client
|
- name: Download client
|
||||||
run: bun run download-client
|
run: bun run download-client
|
||||||
|
|
||||||
|
- name: Download SmartDLC
|
||||||
|
if: ${{ inputs.client_provider == 'steam' }}
|
||||||
|
run: bun run download-smart-dlc
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: bun run --bun build
|
run: bun run --bun build
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
"build-protos": "cd packages/scripts && bun run build-protos",
|
"build-protos": "cd packages/scripts && bun run build-protos",
|
||||||
"record-performance": "cd packages/scripts && bun run record-performance",
|
"record-performance": "cd packages/scripts && bun run record-performance",
|
||||||
"download-client": "cd packages/scripts && bun run download-client",
|
"download-client": "cd packages/scripts && bun run download-client",
|
||||||
|
"download-smart-dlc": "cd packages/scripts && bun run download-smart-dlc",
|
||||||
"clean-astro": "rm -rf packages/website/.astro packages/website/node_modules/.astro packages/website/node_modules/.vite",
|
"clean-astro": "rm -rf packages/website/.astro packages/website/node_modules/.astro packages/website/node_modules/.vite",
|
||||||
"vfs": "cd packages/scripts && bun run vfs"
|
"vfs": "cd packages/scripts && bun run vfs"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
"build-protos": "bun src/protos.ts",
|
"build-protos": "bun src/protos.ts",
|
||||||
"record-performance": "bun src/recordPerformance/index.ts",
|
"record-performance": "bun src/recordPerformance/index.ts",
|
||||||
"download-client": "bun src/downloadClient/index.ts",
|
"download-client": "bun src/downloadClient/index.ts",
|
||||||
|
"download-smart-dlc": "bun src/downloadSmartDLC/index.ts",
|
||||||
"vfs": "bun src/vfs/index.ts"
|
"vfs": "bun src/vfs/index.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
+7
-16
@@ -2,9 +2,10 @@ import { dvp } from "@blitzkit/closed";
|
|||||||
import { assertSecret } from "@blitzkit/core";
|
import { assertSecret } from "@blitzkit/core";
|
||||||
import { mkdir, writeFile } from "fs/promises";
|
import { mkdir, writeFile } from "fs/promises";
|
||||||
import { parse as parsePath } from "path";
|
import { parse as parsePath } from "path";
|
||||||
import ProgressBar from "progress";
|
|
||||||
import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
|
import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
|
||||||
import { PATCHES_ROOT, vfs } from "./buildAssets/constants";
|
import { vfs } from "../vfs/vfs";
|
||||||
|
|
||||||
|
const CLIENT_DIR = assertSecret(import.meta.env.CLIENT_DIR);
|
||||||
|
|
||||||
const versionTextFile = await vfs.text(`Data/version.txt`);
|
const versionTextFile = await vfs.text(`Data/version.txt`);
|
||||||
const currentVersion = versionTextFile
|
const currentVersion = versionTextFile
|
||||||
@@ -40,27 +41,17 @@ while (true) {
|
|||||||
)}`,
|
)}`,
|
||||||
).then((response) => response.arrayBuffer());
|
).then((response) => response.arrayBuffer());
|
||||||
const files = await dvp(dvpm, dvpd);
|
const files = await dvp(dvpm, dvpd);
|
||||||
const bar = new ProgressBar(
|
|
||||||
`Patching ${files.length} files :bar`,
|
|
||||||
files.length,
|
|
||||||
);
|
|
||||||
|
|
||||||
for (const { path, data } of files) {
|
for (const { path, data } of files) {
|
||||||
console.log(`Patching "${path}"...`);
|
console.log(`Patching "${path}"...`);
|
||||||
|
|
||||||
const { dir } = parsePath(path);
|
const { dir } = parsePath(path);
|
||||||
|
|
||||||
try {
|
await mkdir(`${CLIENT_DIR}/Data/${dir}`, { recursive: true });
|
||||||
await mkdir(`${PATCHES_ROOT}/Data/${dir}`, { recursive: true });
|
|
||||||
} catch (error) {
|
|
||||||
console.warn(`Failed to make directory "${dir}"`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const buffer = Buffer.from(data);
|
const buffer = Buffer.from(data);
|
||||||
|
|
||||||
await writeFile(`${PATCHES_ROOT}/Data/${path}`, new Uint8Array(buffer));
|
await writeFile(`${CLIENT_DIR}/Data/${path}`, new Uint8Array(buffer));
|
||||||
|
|
||||||
bar.tick();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("patches done for patch");
|
console.log("patches done for patch");
|
||||||
@@ -86,10 +77,10 @@ while (true) {
|
|||||||
const patchedContent = stringifyYaml(patchedStrings);
|
const patchedContent = stringifyYaml(patchedStrings);
|
||||||
console.log("stringified");
|
console.log("stringified");
|
||||||
|
|
||||||
await mkdir(`${PATCHES_ROOT}/Data/Strings`, { recursive: true });
|
await mkdir(`${CLIENT_DIR}/Data/Strings`, { recursive: true });
|
||||||
console.log("mkdir");
|
console.log("mkdir");
|
||||||
await writeFile(
|
await writeFile(
|
||||||
`${PATCHES_ROOT}/Data/Strings/en.yaml`,
|
`${CLIENT_DIR}/Data/Strings/en.yaml`,
|
||||||
new Uint8Array(Buffer.from(patchedContent)),
|
new Uint8Array(Buffer.from(patchedContent)),
|
||||||
);
|
);
|
||||||
console.log("file");
|
console.log("file");
|
||||||
@@ -1,7 +1,4 @@
|
|||||||
import { assertSecret } from "@blitzkit/core";
|
import { vfs } from "./vfs";
|
||||||
import { LocalVFS } from "@blitzkit/core/src/blitzkit/vfs/local";
|
|
||||||
|
|
||||||
export const vfs = new LocalVFS(assertSecret(import.meta.env.CLIENT_DIR));
|
|
||||||
|
|
||||||
const command = Bun.argv[2];
|
const command = Bun.argv[2];
|
||||||
const path = Bun.argv[3];
|
const path = Bun.argv[3];
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
import { assertSecret } from "@blitzkit/core";
|
||||||
|
import { LocalVFS } from "@blitzkit/core/src/blitzkit/vfs/local";
|
||||||
|
|
||||||
|
export const vfs = new LocalVFS(assertSecret(import.meta.env.CLIENT_DIR));
|
||||||
Reference in new issue
Block a user