@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.cjs
CHANGED
|
@@ -636,7 +636,7 @@ const parseArchiveIndex = (buffer, cKey) => {
|
|
|
636
636
|
const keySize = buffer.readUInt8(versionOffset + KEY_SIZE_OFFSET);
|
|
637
637
|
const numElements = buffer.readUInt32LE(versionOffset + NUM_ELEMENTS_OFFSET);
|
|
638
638
|
const footerChecksum = buffer.toString("hex", versionOffset + CHECKSUM_OFFSET);
|
|
639
|
-
assert__default(version === 1, `Invalid version: ${version.toString()} in ${cKey}`);
|
|
639
|
+
assert__default(version === 1, `Invalid archive index version: ${version.toString()} in ${cKey}`);
|
|
640
640
|
const entrySize = keySize + offsetBytes + sizeBytes;
|
|
641
641
|
const blockSize = blockSizeKB * 1024;
|
|
642
642
|
const numBlocks = footerOffset / (blockSize + keySize + checksumSize);
|
|
@@ -936,15 +936,28 @@ const parseRootFile = (inputBuffer, eKey, cKey) => {
|
|
|
936
936
|
const firstEntry = buffer.readUInt32LE(4);
|
|
937
937
|
const newFormat = firstEntry < 100;
|
|
938
938
|
const headerSize = newFormat ? firstEntry : 12;
|
|
939
|
+
const version = newFormat ? buffer.readUInt32LE(8) : 0;
|
|
939
940
|
const totalFileCount = newFormat ? buffer.readUInt32LE(12) : firstEntry;
|
|
940
941
|
const namedFileCount = newFormat ? buffer.readUInt32LE(16) : buffer.readUInt32LE(8);
|
|
942
|
+
assert__default(version >= 0 && version <= 2, `Invalid root version: ${version.toString()}`);
|
|
941
943
|
const allowNonNamedFiles = totalFileCount !== namedFileCount;
|
|
942
944
|
let pointer = headerSize;
|
|
943
945
|
while (pointer < buffer.byteLength) {
|
|
944
946
|
const numRecords = buffer.readUInt32LE(pointer);
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
947
|
+
let contentFlags = 0;
|
|
948
|
+
let localeFlags = 0;
|
|
949
|
+
if (version >= 2) {
|
|
950
|
+
localeFlags = buffer.readUInt32LE(pointer + 4);
|
|
951
|
+
const contentFlags1 = buffer.readUInt32LE(pointer + 8);
|
|
952
|
+
const contentFlags2 = buffer.readUInt32LE(pointer + 12);
|
|
953
|
+
const contentFlags3 = buffer.readUInt8(pointer + 16);
|
|
954
|
+
contentFlags = contentFlags1 | contentFlags2 | contentFlags3 << 17;
|
|
955
|
+
pointer += 17;
|
|
956
|
+
} else {
|
|
957
|
+
contentFlags = buffer.readUInt32LE(pointer + 4);
|
|
958
|
+
localeFlags = buffer.readUInt32LE(pointer + 8);
|
|
959
|
+
pointer += 12;
|
|
960
|
+
}
|
|
948
961
|
const fileDataIDs = [];
|
|
949
962
|
let currFileDataID = -1;
|
|
950
963
|
for (let i = 0; i < numRecords; i += 1) {
|
|
@@ -1097,6 +1110,7 @@ class WDCReader {
|
|
|
1097
1110
|
hotfixes = /* @__PURE__ */ new Map();
|
|
1098
1111
|
constructor(buffer, blocks = [], adb) {
|
|
1099
1112
|
const magic = buffer.readUInt32BE(0);
|
|
1113
|
+
const version = buffer.readUInt32LE(4);
|
|
1100
1114
|
const fieldCount = buffer.readUInt32LE(140);
|
|
1101
1115
|
const recordSize = buffer.readUInt32LE(144);
|
|
1102
1116
|
const tableHash = buffer.readUInt32LE(152);
|
|
@@ -1108,7 +1122,8 @@ class WDCReader {
|
|
|
1108
1122
|
const commonDataSize = buffer.readUInt32LE(192);
|
|
1109
1123
|
const palletDataSize = buffer.readUInt32LE(196);
|
|
1110
1124
|
const sectionCount = buffer.readUInt32LE(200);
|
|
1111
|
-
assert__default(magic === WDC5_MAGIC, `Invalid magic: ${magic.toString(16).padStart(8, "0")}`);
|
|
1125
|
+
assert__default(magic === WDC5_MAGIC, `Invalid WDC5 magic: ${magic.toString(16).padStart(8, "0")}`);
|
|
1126
|
+
assert__default(version === 5, `Invalid WDC5 version: ${version.toString()}`);
|
|
1112
1127
|
this.tableHash = tableHash;
|
|
1113
1128
|
this.layoutHash = layoutHash;
|
|
1114
1129
|
this.locale = locale;
|