mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-05 08:50:38 +01:00
it wasn't pretty but i got it to run!
This commit is contained in:
1 parent
830bde1169
commit
6f238a2b58
8 files changed
+131
-936
No files matched your search
@@ -15,7 +15,6 @@ export * from "./normalizeExtra";
|
||||
export * from "./normalizeIds";
|
||||
export * from "./permanentSkills";
|
||||
export * from "./rating";
|
||||
export * from "./readDVPL";
|
||||
export * from "./regions";
|
||||
export * from "./regionSubdomainToRegion";
|
||||
export * from "./regionToRegionSubdomain";
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
import { crc32 } from "crc";
|
||||
import { decompressBlock } from "lz4js";
|
||||
|
||||
/**
|
||||
* Thanks Maddoxkkm! Modified heavily to be modern.
|
||||
* https://github.com/Maddoxkkm/dvpl_converter/
|
||||
*/
|
||||
export function readDVPL(buffer: Buffer) {
|
||||
const footerBuffer = buffer.subarray(buffer.length - 20, buffer.length);
|
||||
|
||||
if (
|
||||
footerBuffer.toString("utf8", 16, 20) !== "DVPL" ||
|
||||
footerBuffer.length !== 20
|
||||
) {
|
||||
throw new SyntaxError("Invalid DVPL footer");
|
||||
}
|
||||
|
||||
const footerData = {
|
||||
oSize: footerBuffer.readUInt32LE(0),
|
||||
cSize: footerBuffer.readUInt32LE(4),
|
||||
crc32: footerBuffer.readUInt32LE(8),
|
||||
type: footerBuffer.readUInt32LE(12),
|
||||
};
|
||||
const targetBlock = buffer.subarray(0, buffer.length - 20);
|
||||
|
||||
if (targetBlock.length !== footerData.cSize) {
|
||||
throw new RangeError("DVPL size mismatch");
|
||||
}
|
||||
if (crc32(targetBlock) !== footerData.crc32) {
|
||||
throw new TypeError("DVPL CRC32 mismatch");
|
||||
}
|
||||
|
||||
if (footerData.type === 0) {
|
||||
if (!(footerData.oSize === footerData.cSize && footerData.type === 0)) {
|
||||
throw new RangeError("DVPL type and size mismatch");
|
||||
}
|
||||
|
||||
return targetBlock;
|
||||
} else if (footerData.type === 1 || footerData.type === 2) {
|
||||
const source = new Uint8Array(targetBlock);
|
||||
const destination = new Uint8Array(footerData.oSize);
|
||||
const decompressedSize = decompressBlock(
|
||||
source,
|
||||
destination,
|
||||
0,
|
||||
source.length,
|
||||
0
|
||||
);
|
||||
|
||||
if (decompressedSize !== footerData.oSize) {
|
||||
throw new RangeError(
|
||||
`Decompressed DVPL size mismatch (${decompressedSize} vs ${footerData.oSize})`
|
||||
);
|
||||
}
|
||||
|
||||
return Buffer.from(destination);
|
||||
} else {
|
||||
throw new SyntaxError("Unknown DVPL format");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export function assertSecret(secret?: string) {
|
||||
if (!secret) {
|
||||
throw new Error("Secret is not defined");
|
||||
}
|
||||
|
||||
return secret;
|
||||
}
|
||||
@@ -1,22 +1,23 @@
|
||||
export * from "./assertSecret";
|
||||
export * from "./availableProvisions";
|
||||
export * from "./coefficient";
|
||||
export * from "./createDefaultProvisions";
|
||||
export * from "./createDefaultSkills";
|
||||
export * from "./degressiveStat";
|
||||
export * from "./emblemURL";
|
||||
export * from "./eventManager";
|
||||
export * from "./getTimeDaysAgo";
|
||||
export * from "./isExplosive";
|
||||
export * from "./metaSortTank";
|
||||
export * from "./normalizeBoundingBox";
|
||||
export * from "./patientFetchJSON";
|
||||
export * from "./progressiveStat";
|
||||
export * from "./resolveDpm";
|
||||
export * from "./resolvePenetrationCoefficient";
|
||||
export * from "./romanize";
|
||||
export * from "./sum";
|
||||
export * from "./unionBoundingBox";
|
||||
export * from "./uniqueGuns";
|
||||
export * from "./unwrapBlitzkitResponse";
|
||||
export * from "./votes";
|
||||
export * from "./createDefaultProvisions";
|
||||
export * from "./metaSortTank";
|
||||
export * from "./romanize";
|
||||
export * from "./youtubers";
|
||||
@@ -32,16 +32,18 @@ public partial class GameInterface
|
||||
public HashSet<string> files;
|
||||
public int textureChunks;
|
||||
|
||||
readonly string textureCache;
|
||||
|
||||
public GameInterface(string directory, string map, string temp, int textureChunks)
|
||||
{
|
||||
provider = new(directory, map, temp);
|
||||
files = [.. provider.Files.Keys];
|
||||
|
||||
this.textureChunks = textureChunks;
|
||||
this.textureCache = $"{temp}textures.json";
|
||||
}
|
||||
|
||||
readonly Dictionary<string, (int, string)> texturePaths = [];
|
||||
readonly string textureCache = $"{temp}textures.json";
|
||||
|
||||
[GeneratedRegex(@"\+ClientDiscoveryBindingSources\s*=\s*\(Type=\w+,URL=""(.+)""\)")]
|
||||
private static partial Regex DiscoveryRegex();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { assertSecret } from "@blitzkit/core";
|
||||
import type { GameInterface } from "@blitzkit/game";
|
||||
import { clientUnmounted } from "./unmounted";
|
||||
import { api } from "../api/dynamic";
|
||||
import { assertDiscoveryTag } from "./assertDiscoveryTag";
|
||||
import { clientUnmounted } from "./unmounted";
|
||||
|
||||
let _game: GameInterface | null = null;
|
||||
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
cd packages/website-ue
|
||||
bun run dev
|
||||
bun run --bun dev
|
||||
Reference in new issue
Block a user