@rhyster/wow-casc-dbc 2.8.3 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +20 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +20 -5
- package/dist/index.mjs.map +1 -1
- package/dist/parsers/rootFile.d.ts.map +1 -1
- package/dist/wdc.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/parsers/archiveIndex.ts +1 -1
- package/src/parsers/rootFile.ts +21 -4
- package/src/wdc.ts +3 -2
package/dist/index.mjs
CHANGED
|
@@ -624,7 +624,7 @@ const parseArchiveIndex = (buffer, cKey) => {
|
|
|
624
624
|
const keySize = buffer.readUInt8(versionOffset + KEY_SIZE_OFFSET);
|
|
625
625
|
const numElements = buffer.readUInt32LE(versionOffset + NUM_ELEMENTS_OFFSET);
|
|
626
626
|
const footerChecksum = buffer.toString("hex", versionOffset + CHECKSUM_OFFSET);
|
|
627
|
-
assert(version === 1, `Invalid version: ${version.toString()} in ${cKey}`);
|
|
627
|
+
assert(version === 1, `Invalid archive index version: ${version.toString()} in ${cKey}`);
|
|
628
628
|
const entrySize = keySize + offsetBytes + sizeBytes;
|
|
629
629
|
const blockSize = blockSizeKB * 1024;
|
|
630
630
|
const numBlocks = footerOffset / (blockSize + keySize + checksumSize);
|
|
@@ -924,15 +924,28 @@ const parseRootFile = (inputBuffer, eKey, cKey) => {
|
|
|
924
924
|
const firstEntry = buffer.readUInt32LE(4);
|
|
925
925
|
const newFormat = firstEntry < 100;
|
|
926
926
|
const headerSize = newFormat ? firstEntry : 12;
|
|
927
|
+
const version = newFormat ? buffer.readUInt32LE(8) : 0;
|
|
927
928
|
const totalFileCount = newFormat ? buffer.readUInt32LE(12) : firstEntry;
|
|
928
929
|
const namedFileCount = newFormat ? buffer.readUInt32LE(16) : buffer.readUInt32LE(8);
|
|
930
|
+
assert(version >= 0 && version <= 2, `Invalid root version: ${version.toString()}`);
|
|
929
931
|
const allowNonNamedFiles = totalFileCount !== namedFileCount;
|
|
930
932
|
let pointer = headerSize;
|
|
931
933
|
while (pointer < buffer.byteLength) {
|
|
932
934
|
const numRecords = buffer.readUInt32LE(pointer);
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
935
|
+
let contentFlags = 0;
|
|
936
|
+
let localeFlags = 0;
|
|
937
|
+
if (version >= 2) {
|
|
938
|
+
localeFlags = buffer.readUInt32LE(pointer + 4);
|
|
939
|
+
const contentFlags1 = buffer.readUInt32LE(pointer + 8);
|
|
940
|
+
const contentFlags2 = buffer.readUInt32LE(pointer + 12);
|
|
941
|
+
const contentFlags3 = buffer.readUInt8(pointer + 16);
|
|
942
|
+
contentFlags = contentFlags1 | contentFlags2 | contentFlags3 << 17;
|
|
943
|
+
pointer += 17;
|
|
944
|
+
} else {
|
|
945
|
+
contentFlags = buffer.readUInt32LE(pointer + 4);
|
|
946
|
+
localeFlags = buffer.readUInt32LE(pointer + 8);
|
|
947
|
+
pointer += 12;
|
|
948
|
+
}
|
|
936
949
|
const fileDataIDs = [];
|
|
937
950
|
let currFileDataID = -1;
|
|
938
951
|
for (let i = 0; i < numRecords; i += 1) {
|
|
@@ -1085,6 +1098,7 @@ class WDCReader {
|
|
|
1085
1098
|
hotfixes = /* @__PURE__ */ new Map();
|
|
1086
1099
|
constructor(buffer, blocks = [], adb) {
|
|
1087
1100
|
const magic = buffer.readUInt32BE(0);
|
|
1101
|
+
const version = buffer.readUInt32LE(4);
|
|
1088
1102
|
const fieldCount = buffer.readUInt32LE(140);
|
|
1089
1103
|
const recordSize = buffer.readUInt32LE(144);
|
|
1090
1104
|
const tableHash = buffer.readUInt32LE(152);
|
|
@@ -1096,7 +1110,8 @@ class WDCReader {
|
|
|
1096
1110
|
const commonDataSize = buffer.readUInt32LE(192);
|
|
1097
1111
|
const palletDataSize = buffer.readUInt32LE(196);
|
|
1098
1112
|
const sectionCount = buffer.readUInt32LE(200);
|
|
1099
|
-
assert(magic === WDC5_MAGIC, `Invalid magic: ${magic.toString(16).padStart(8, "0")}`);
|
|
1113
|
+
assert(magic === WDC5_MAGIC, `Invalid WDC5 magic: ${magic.toString(16).padStart(8, "0")}`);
|
|
1114
|
+
assert(version === 5, `Invalid WDC5 version: ${version.toString()}`);
|
|
1100
1115
|
this.tableHash = tableHash;
|
|
1101
1116
|
this.layoutHash = layoutHash;
|
|
1102
1117
|
this.locale = locale;
|