mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
Merge branch 'preview'
This commit is contained in:
commit
2c66e79daf
8 files changed
+34
-40
No files matched your search
@@ -46,13 +46,13 @@ export function readDVPL(buffer: Buffer) {
|
||||
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');
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { readFile } from 'fs/promises';
|
||||
import { DATA_COMPRESSED } from '../../buildAssets/constants';
|
||||
import { readDVPL } from './readDVPL';
|
||||
|
||||
export async function readDVPLFile(file: string) {
|
||||
if (DATA_COMPRESSED && !file.endsWith('.dvpl')) {
|
||||
return readDVPL(await readFile(`${file}.dvpl`));
|
||||
}
|
||||
const path = `${file}${file.endsWith('.dvpl') ? '' : '.dvpl'}`;
|
||||
const content = await readFile(path);
|
||||
const dvpl = readDVPL(content);
|
||||
|
||||
return readFile(file);
|
||||
return dvpl;
|
||||
}
|
||||
@@ -10,7 +10,7 @@ export async function readTexture(path: string, mutation?: TextureMutation) {
|
||||
const resolvedTexturePath = isDds
|
||||
? ddsTexturePath
|
||||
: ddsTexturePath.replace('.dds', '.pvr');
|
||||
const decompressedDvpl = await readDVPLFile(resolvedTexturePath);
|
||||
const decompressedDvpl = await readDVPLFile(`${resolvedTexturePath}.dvpl`);
|
||||
|
||||
const raw = isDds
|
||||
? await new DdsReadStream(decompressedDvpl.buffer as ArrayBuffer).dds()
|
||||
@@ -75,4 +75,5 @@ export async function readTexture(path: string, mutation?: TextureMutation) {
|
||||
default:
|
||||
return await sharp(raw.data, { raw }).jpeg().toBuffer();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user