madden-franchise 3.2.2 → 3.2.4
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/FranchiseFileTable.js
CHANGED
|
@@ -56,7 +56,11 @@ class FranchiseFileTable extends EventEmitter {
|
|
|
56
56
|
updateBuffer() {
|
|
57
57
|
// need to check table2 & table3 data first because it may change offsets of the legit records.
|
|
58
58
|
let table2Data = this.strategy.getTable2BinaryData(this.table2Records, this.data.slice(this.header.table2StartIndex));
|
|
59
|
-
let table3Data =
|
|
59
|
+
let table3Data = [];
|
|
60
|
+
|
|
61
|
+
if (this.header.table3StartIndex) {
|
|
62
|
+
table3Data = this.strategy.getTable3BinaryData(this.table3Records, this.data.slice(this.header.table3StartIndex));
|
|
63
|
+
}
|
|
60
64
|
|
|
61
65
|
// update table2 length and table total length in table header (only if records have been read)
|
|
62
66
|
if (this.recordsRead) {
|
package/package.json
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const zlib = require('zlib');
|
|
3
|
+
|
|
4
|
+
const FranchiseFile = require('../FranchiseFile');
|
|
5
|
+
|
|
6
|
+
const franchisePath = 'D:\\Projects\\Madden 24\\franchise\\sinthros-issue-table3\\CAREER-M24Target';
|
|
7
|
+
const savePath = 'D:\\Projects\\Madden 24\\franchise\\sinthros-issue-table3\\CAREER-VIS';
|
|
8
|
+
|
|
9
|
+
(async () => {
|
|
10
|
+
function franchiseFileLoadPromise(file) {
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
file.on('ready', () => {
|
|
13
|
+
resolve();
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const file = new FranchiseFile(franchisePath);
|
|
19
|
+
await franchiseFileLoadPromise(file);
|
|
20
|
+
|
|
21
|
+
const characterVisuals = file.getTableByUniqueId(1429178382);
|
|
22
|
+
await characterVisuals.readRecords();
|
|
23
|
+
|
|
24
|
+
for (let row = 0; row < characterVisuals.header.recordCapacity; row++) {
|
|
25
|
+
characterVisuals.records[row]['RawData'] = JSON.parse('{}');
|
|
26
|
+
characterVisuals.records[row].empty();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
await file.save(savePath);
|
|
30
|
+
})();
|
|
@@ -14,10 +14,15 @@ FranchiseTableStrategy.getTable2BinaryData = (table2Records, fullTable2Buffer) =
|
|
|
14
14
|
|
|
15
15
|
if (i > 0 && recordOffset === 0) {
|
|
16
16
|
// this case is true for the last few rows with no data in them. They reference the first table2 value.
|
|
17
|
-
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const preData = fullTable2Buffer.slice(currentOffset, recordOffset);
|
|
21
|
+
|
|
22
|
+
if (preData.length > 0) {
|
|
23
|
+
table2Data.push(preData);
|
|
18
24
|
}
|
|
19
25
|
|
|
20
|
-
table2Data.push(fullTable2Buffer.slice(currentOffset, recordOffset));
|
|
21
26
|
const recordHexData = record.hexData;
|
|
22
27
|
table2Data.push(recordHexData);
|
|
23
28
|
|
|
@@ -64,7 +69,7 @@ FranchiseTableStrategy.recalculateBlobOffsets = (table, record) => {
|
|
|
64
69
|
const byteLengthPerRecord = table.offsetTable.filter((offsetEntry) => {
|
|
65
70
|
return offsetEntry.type === 'binaryblob';
|
|
66
71
|
}).reduce((accum, cur) => {
|
|
67
|
-
return accum + cur.maxLength;
|
|
72
|
+
return accum + cur.maxLength + 2; // +2 bytes for size, which is not considered in max length.
|
|
68
73
|
}, 0);
|
|
69
74
|
|
|
70
75
|
// Then, go through each string field sorted by offset index, and assign offsets to the table2 fields
|
|
@@ -7,7 +7,7 @@ FranchiseTable3FieldStrategy.getZlibDataStartIndex = (unformattedValue) => {
|
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
FranchiseTable3FieldStrategy.getInitialUnformattedValue = (field, data) => {
|
|
10
|
-
return data.slice(field.thirdTableField.index, (field.thirdTableField.index + field.offset.maxLength + 2));
|
|
10
|
+
return data.slice(field.thirdTableField.index, (field.thirdTableField.index + field.offset.maxLength + 2));
|
|
11
11
|
// extend maxLength + 2 because the first 2 bytes are the size of the zipped data
|
|
12
12
|
};
|
|
13
13
|
|