madden-franchise 3.2.1 → 3.2.3
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 +1 -0
- package/package.json +1 -1
- package/scripts/sinthros-table3.js +30 -0
- package/strategies/common/table/FranchiseTableStrategy.js +31 -2
- package/strategies/common/table3Field/FranchiseTable3FieldStrategy.js +1 -1
- package/strategies/franchise/m19/M19TableStrategy.js +1 -0
- package/strategies/franchise/m20/M20TableStrategy.js +1 -0
- package/strategies/franchise/m24/M24TableStrategy.js +1 -0
package/FranchiseFileTable.js
CHANGED
|
@@ -502,6 +502,7 @@ class FranchiseFileTable extends EventEmitter {
|
|
|
502
502
|
// if the record contains any string values, point the string values to
|
|
503
503
|
// their correct offsets
|
|
504
504
|
this.strategy.recalculateStringOffsets(this, object);
|
|
505
|
+
this.strategy.recalculateBlobOffsets(this, object);
|
|
505
506
|
|
|
506
507
|
// Delete the empty record entry because it is no longer empty
|
|
507
508
|
this.emptyRecords.delete(object.index);
|
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
|
|
|
@@ -59,4 +64,28 @@ FranchiseTableStrategy.recalculateStringOffsets = (table, record) => {
|
|
|
59
64
|
});
|
|
60
65
|
};
|
|
61
66
|
|
|
67
|
+
FranchiseTableStrategy.recalculateBlobOffsets = (table, record) => {
|
|
68
|
+
// First, calculate length allocated per record in table2
|
|
69
|
+
const byteLengthPerRecord = table.offsetTable.filter((offsetEntry) => {
|
|
70
|
+
return offsetEntry.type === 'binaryblob';
|
|
71
|
+
}).reduce((accum, cur) => {
|
|
72
|
+
return accum + cur.maxLength + 2; // +2 bytes for size, which is not considered in max length.
|
|
73
|
+
}, 0);
|
|
74
|
+
|
|
75
|
+
// Then, go through each string field sorted by offset index, and assign offsets to the table2 fields
|
|
76
|
+
let runningOffset = 0;
|
|
77
|
+
|
|
78
|
+
record.fieldsArray.filter((field) => {
|
|
79
|
+
return field.offset.type === 'binaryblob';
|
|
80
|
+
}).sort((a, b) => {
|
|
81
|
+
return a.offset.index - b.offset.index;
|
|
82
|
+
}).forEach((field) => {
|
|
83
|
+
if (field.thirdTableField) {
|
|
84
|
+
field.thirdTableField.offset = (record.index * byteLengthPerRecord) + runningOffset;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
runningOffset += field.offset.maxLength;
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
|
|
62
91
|
module.exports = FranchiseTableStrategy;
|
|
@@ -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
|
|
|
@@ -10,5 +10,6 @@ M19TableStrategy.getTable2BinaryData = FranchiseTableStrategy.getTable2BinaryDat
|
|
|
10
10
|
M19TableStrategy.getTable3BinaryData = FranchiseTableStrategy.getTable2BinaryData;
|
|
11
11
|
M19TableStrategy.getMandatoryOffsets = FranchiseTableStrategy.getMandatoryOffsets;
|
|
12
12
|
M19TableStrategy.recalculateStringOffsets = FranchiseTableStrategy.recalculateStringOffsets;
|
|
13
|
+
M19TableStrategy.recalculateBlobOffsets = FranchiseTableStrategy.recalculateBlobOffsets;
|
|
13
14
|
|
|
14
15
|
module.exports = M19TableStrategy;
|
|
@@ -10,5 +10,6 @@ M20TableStrategy.getTable2BinaryData = FranchiseTableStrategy.getTable2BinaryDat
|
|
|
10
10
|
M20TableStrategy.getTable3BinaryData = FranchiseTableStrategy.getTable2BinaryData;
|
|
11
11
|
M20TableStrategy.getMandatoryOffsets = FranchiseTableStrategy.getMandatoryOffsets;
|
|
12
12
|
M20TableStrategy.recalculateStringOffsets = FranchiseTableStrategy.recalculateStringOffsets;
|
|
13
|
+
M20TableStrategy.recalculateBlobOffsets = FranchiseTableStrategy.recalculateBlobOffsets;
|
|
13
14
|
|
|
14
15
|
module.exports = M20TableStrategy;
|
|
@@ -11,5 +11,6 @@ M24TableStrategy.getTable2BinaryData = FranchiseTableStrategy.getTable2BinaryDat
|
|
|
11
11
|
M24TableStrategy.getTable3BinaryData = FranchiseTableStrategy.getTable2BinaryData;
|
|
12
12
|
M24TableStrategy.getMandatoryOffsets = FranchiseTableStrategy.getMandatoryOffsets;
|
|
13
13
|
M24TableStrategy.recalculateStringOffsets = FranchiseTableStrategy.recalculateStringOffsets;
|
|
14
|
+
M24TableStrategy.recalculateBlobOffsets = FranchiseTableStrategy.recalculateBlobOffsets;
|
|
14
15
|
|
|
15
16
|
module.exports = M24TableStrategy;
|