madden-franchise 3.1.1 → 3.2.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/FranchiseFileField.js +21 -1
- package/FranchiseFileTable.js +49 -4
- package/FranchiseFileTable3Field.js +92 -0
- package/package.json +1 -1
- package/scripts/scratchpad.js +30 -16
- package/strategies/StrategyPicker.js +5 -0
- package/strategies/common/header/m19/M19TableHeaderStrategy.js +2 -1
- package/strategies/common/header/m20/M20TableHeaderStrategy.js +2 -1
- package/strategies/common/header/m24/M24TableHeaderStrategy.js +15 -0
- package/strategies/common/table/FranchiseTableStrategy.js +3 -1
- package/strategies/common/table3Field/FranchiseTable3FieldStrategy.js +24 -0
- package/strategies/franchise/m19/M19Strategy.js +3 -1
- package/strategies/franchise/m19/M19TableStrategy.js +1 -0
- package/strategies/franchise/m20/M20Strategy.js +3 -1
- package/strategies/franchise/m20/M20TableStrategy.js +1 -0
- package/strategies/franchise/m24/M24Strategy.js +12 -0
- package/strategies/franchise/m24/M24Table3FieldStrategy.js +9 -0
- package/strategies/franchise/m24/M24TableStrategy.js +15 -0
- package/strategies/franchise-common/m19/M19FTCStrategy.js +3 -1
- package/strategies/franchise-common/m19/M19FTCTableStrategy.js +1 -0
- package/strategies/franchise-common/m20/M20FTCStrategy.js +3 -1
- package/strategies/franchise-common/m20/M20FTCTableStrategy.js +1 -0
package/FranchiseFileField.js
CHANGED
|
@@ -2,6 +2,7 @@ const { BitView } = require('bit-buffer');
|
|
|
2
2
|
|
|
3
3
|
const utilService = require('./services/utilService');
|
|
4
4
|
const FranchiseFileTable2Field = require('./FranchiseFileTable2Field');
|
|
5
|
+
const FranchiseFileTable3Field = require('./FranchiseFileTable3Field');
|
|
5
6
|
|
|
6
7
|
class FranchiseFileField {
|
|
7
8
|
constructor(key, value, offset, parent) {
|
|
@@ -16,6 +17,11 @@ class FranchiseFileField {
|
|
|
16
17
|
this.secondTableField = new FranchiseFileTable2Field(this._recordBuffer.readUInt32BE(offset.offset / 8), offset.maxLength);
|
|
17
18
|
this.secondTableField.fieldReference = this;
|
|
18
19
|
}
|
|
20
|
+
|
|
21
|
+
if (offset.valueInThirdTable) {
|
|
22
|
+
this.thirdTableField = new FranchiseFileTable3Field(this._recordBuffer.readUInt32BE(offset.offset / 8), offset.maxLength);
|
|
23
|
+
this.thirdTableField.fieldReference = this;
|
|
24
|
+
}
|
|
19
25
|
};
|
|
20
26
|
|
|
21
27
|
get key () {
|
|
@@ -64,7 +70,18 @@ class FranchiseFileField {
|
|
|
64
70
|
|
|
65
71
|
if (this.offset.valueInSecondTable) {
|
|
66
72
|
this.secondTableField.value = value.toString();
|
|
67
|
-
}
|
|
73
|
+
}
|
|
74
|
+
else if (this.offset.valueInThirdTable) {
|
|
75
|
+
if (typeof value === 'object') {
|
|
76
|
+
const newVal = JSON.stringify(value);
|
|
77
|
+
this._value = newVal;
|
|
78
|
+
this.thirdTableField.value = newVal;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
this.thirdTableField.value = value.toString();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
68
85
|
let actualValue;
|
|
69
86
|
|
|
70
87
|
if (this.offset.isReference) {
|
|
@@ -214,6 +231,9 @@ class FranchiseFileField {
|
|
|
214
231
|
if (offset.valueInSecondTable) {
|
|
215
232
|
return this.secondTableField.value;
|
|
216
233
|
}
|
|
234
|
+
else if (offset.valueInThirdTable) {
|
|
235
|
+
return this.thirdTableField.value;
|
|
236
|
+
}
|
|
217
237
|
else if (offset.enum) {
|
|
218
238
|
const enumUnformattedValue = utilService.dec2bin(this.unformattedValue.getBits(this.offset.offset, this.offset.length), offset.enum._maxLength);
|
|
219
239
|
|
package/FranchiseFileTable.js
CHANGED
|
@@ -2,6 +2,7 @@ const EventEmitter = require('events').EventEmitter;
|
|
|
2
2
|
const utilService = require('./services/utilService');
|
|
3
3
|
const FranchiseFileRecord = require('./FranchiseFileRecord');
|
|
4
4
|
const FranchiseFileTable2Field = require('./FranchiseFileTable2Field');
|
|
5
|
+
const FranchiseFileTable3Field = require('./FranchiseFileTable3Field');
|
|
5
6
|
|
|
6
7
|
class FranchiseFileTable extends EventEmitter {
|
|
7
8
|
constructor(data, offset, gameYear, strategy, settings) {
|
|
@@ -21,6 +22,7 @@ class FranchiseFileTable extends EventEmitter {
|
|
|
21
22
|
this.isChanged = false;
|
|
22
23
|
this.records = [];
|
|
23
24
|
this.table2Records = [];
|
|
25
|
+
this.table3Records = [];
|
|
24
26
|
this.arraySizes = [];
|
|
25
27
|
this.emptyRecords = new Map();
|
|
26
28
|
this._settings = settings;
|
|
@@ -52,22 +54,31 @@ class FranchiseFileTable extends EventEmitter {
|
|
|
52
54
|
};
|
|
53
55
|
|
|
54
56
|
updateBuffer() {
|
|
55
|
-
// need to check table2 data first because it may change offsets of the legit records.
|
|
56
|
-
|
|
57
|
+
// need to check table2 & table3 data first because it may change offsets of the legit records.
|
|
58
|
+
let table2Data = this.strategy.getTable2BinaryData(this.table2Records, this.data.slice(this.header.table2StartIndex));
|
|
59
|
+
let table3Data = this.strategy.getTable3BinaryData(this.table3Records, this.data.slice(this.header.table3StartIndex));
|
|
57
60
|
|
|
58
61
|
// update table2 length and table total length in table header (only if records have been read)
|
|
59
62
|
if (this.recordsRead) {
|
|
60
63
|
let table2DataLength = 0;
|
|
64
|
+
let table3DataLength = 0;
|
|
61
65
|
|
|
62
66
|
// Get length of all table2Data sub arrays
|
|
63
67
|
table2Data.forEach((arr) => {
|
|
64
68
|
table2DataLength += arr.length;
|
|
65
69
|
});
|
|
66
70
|
|
|
71
|
+
table3Data.forEach((arr) => {
|
|
72
|
+
table3DataLength += arr.length;
|
|
73
|
+
});
|
|
74
|
+
|
|
67
75
|
this.header.table2Length = table2DataLength;
|
|
68
76
|
this.header.tableTotalLength = this.header.table1Length + this.header.table2Length;
|
|
69
77
|
|
|
78
|
+
this.header.table3Length = table3DataLength;
|
|
79
|
+
|
|
70
80
|
this.data.writeUInt32BE(this.header.table2Length , this.header.offsetStart - 44);
|
|
81
|
+
this.data.writeUInt32BE(this.header.table3Length, this.header.offsetStart - 40);
|
|
71
82
|
this.data.writeUInt32BE(this.header.tableTotalLength, this.header.offsetStart - 24);
|
|
72
83
|
}
|
|
73
84
|
|
|
@@ -103,8 +114,19 @@ class FranchiseFileTable extends EventEmitter {
|
|
|
103
114
|
}
|
|
104
115
|
|
|
105
116
|
bufferArrays.push(this.data.slice(currentOffset, this.header.table2StartIndex));
|
|
117
|
+
|
|
118
|
+
if (!this.recordsRead && this.header.hasSecondTable && table2Data.length === 0) {
|
|
119
|
+
table2Data = this.data.slice(this.header.table2StartIndex);
|
|
120
|
+
}
|
|
121
|
+
|
|
106
122
|
bufferArrays = bufferArrays.concat(table2Data);
|
|
107
123
|
|
|
124
|
+
if (!this.recordsRead && this.header.hasThirdTable && table3Data.length === 0) {
|
|
125
|
+
table3Data = this.data.slice(this.header.table3StartIndex);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
bufferArrays = bufferArrays.concat(table3Data);
|
|
129
|
+
|
|
108
130
|
this.data = Buffer.concat(bufferArrays);
|
|
109
131
|
};
|
|
110
132
|
|
|
@@ -196,6 +218,7 @@ class FranchiseFileTable extends EventEmitter {
|
|
|
196
218
|
this.isChanged = false;
|
|
197
219
|
this.records = [];
|
|
198
220
|
this.table2Records = [];
|
|
221
|
+
this.table3Records = [];
|
|
199
222
|
this.arraySizes = [];
|
|
200
223
|
this.emptyRecords = new Map();
|
|
201
224
|
|
|
@@ -231,7 +254,8 @@ class FranchiseFileTable extends EventEmitter {
|
|
|
231
254
|
'name': `${this.name.substring(0, this.name.length - 2)}${i}`,
|
|
232
255
|
'offset': i * 32,
|
|
233
256
|
'type': this.name.substring(0, this.name.length - 2),
|
|
234
|
-
'valueInSecondTable': false
|
|
257
|
+
'valueInSecondTable': false,
|
|
258
|
+
'valueInThirdTable': false,
|
|
235
259
|
}
|
|
236
260
|
|
|
237
261
|
offset.isReference = !offset.enum && (offset.type[0] == offset.type[0].toUpperCase() || offset.type.includes('[]')) ? true : false,
|
|
@@ -269,6 +293,10 @@ class FranchiseFileTable extends EventEmitter {
|
|
|
269
293
|
this._parseTable2Values(this.data, this.header, this.records);
|
|
270
294
|
}
|
|
271
295
|
|
|
296
|
+
if (this.header.hasThirdTable) {
|
|
297
|
+
this._parseTable3Values(this.data, this.header, this.records);
|
|
298
|
+
}
|
|
299
|
+
|
|
272
300
|
this.emptyRecords = this._parseEmptyRecords();
|
|
273
301
|
|
|
274
302
|
this.records.forEach((record, index) => {
|
|
@@ -380,6 +408,22 @@ class FranchiseFileTable extends EventEmitter {
|
|
|
380
408
|
});
|
|
381
409
|
});
|
|
382
410
|
};
|
|
411
|
+
|
|
412
|
+
_parseTable3Values(data, header, records) {
|
|
413
|
+
const that = this;
|
|
414
|
+
const thirdTableData = data.slice(header.table3StartIndex);
|
|
415
|
+
|
|
416
|
+
records.forEach((record) => {
|
|
417
|
+
const fieldsReferencingThirdTable = record.fieldsArray.filter((field) => { return field.thirdTableField; });
|
|
418
|
+
|
|
419
|
+
fieldsReferencingThirdTable.forEach((field) => {
|
|
420
|
+
field.thirdTableField.unformattedValue = that.strategyBase.table3Field.getInitialUnformattedValue(field, thirdTableData);
|
|
421
|
+
field.thirdTableField.strategy = that.strategyBase.table3Field;
|
|
422
|
+
that.table3Records.push(field.thirdTableField);
|
|
423
|
+
field.thirdTableField.parent = that;
|
|
424
|
+
});
|
|
425
|
+
});
|
|
426
|
+
};
|
|
383
427
|
|
|
384
428
|
_changeRecordBuffers(index, emptyRecordReference) {
|
|
385
429
|
this._setBufferToEmptyRecordReference(index, emptyRecordReference);
|
|
@@ -514,7 +558,7 @@ class FranchiseFileTable extends EventEmitter {
|
|
|
514
558
|
this.emit('change');
|
|
515
559
|
}
|
|
516
560
|
}
|
|
517
|
-
else if (object instanceof FranchiseFileTable2Field) {
|
|
561
|
+
else if (object instanceof FranchiseFileTable2Field || object instanceof FranchiseFileTable3Field) {
|
|
518
562
|
object.isChanged = true;
|
|
519
563
|
|
|
520
564
|
// When a table2 field changes, we need to check if the record is empty. If so, we need to mark it as not empty.
|
|
@@ -636,6 +680,7 @@ function readOffsetTable(data, schema, header) {
|
|
|
636
680
|
'type': (minValue < 0 || maxValue < 0) ? 's_' + attribute.type : attribute.type,
|
|
637
681
|
'isReference': !attribute.enum && (attribute.type[0] == attribute.type[0].toUpperCase() || attribute.type.includes('[]') || attribute.type === 'record') ? true : false,
|
|
638
682
|
'valueInSecondTable': header.hasSecondTable && attribute.type === 'string',
|
|
683
|
+
'valueInThirdTable': header.hasThirdTable && attribute.type === 'binaryblob',
|
|
639
684
|
'isSigned': minValue < 0 || maxValue < 0,
|
|
640
685
|
'minValue': minValue,
|
|
641
686
|
'maxValue': maxValue,
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const EventEmitter = require('events').EventEmitter;
|
|
2
|
+
const utilService = require('./services/utilService');
|
|
3
|
+
|
|
4
|
+
class FranchiseFileTable3Field {
|
|
5
|
+
constructor (index, maxLength, parent) {
|
|
6
|
+
this._value = '';
|
|
7
|
+
this.rawIndex = index;
|
|
8
|
+
this.isChanged = false;
|
|
9
|
+
this.maxLength = maxLength;
|
|
10
|
+
this.fieldReference = null;
|
|
11
|
+
this.lengthAtLastSave = null;
|
|
12
|
+
this._unformattedValue = null;
|
|
13
|
+
this.index = index;
|
|
14
|
+
this._offset = this.index;
|
|
15
|
+
this._parent = parent;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
get unformattedValue () {
|
|
19
|
+
return this._unformattedValue;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
set unformattedValue (value) {
|
|
23
|
+
this._unformattedValue = value;
|
|
24
|
+
|
|
25
|
+
if (this.lengthAtLastSave === null) {
|
|
26
|
+
this.lengthAtLastSave = getLengthOfUnformattedValue(this._unformattedValue);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
this._value = null;
|
|
30
|
+
if (this._parent) {
|
|
31
|
+
this._parent.onEvent('change', this);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
get value () {
|
|
36
|
+
if (this._value === null) {
|
|
37
|
+
this._value = this._strategy.getFormattedValueFromUnformatted(this._unformattedValue);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return this._value;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
set value (value) {
|
|
44
|
+
this._value = value;
|
|
45
|
+
this._unformattedValue = this._strategy.setUnformattedValueFromFormatted(value, this.maxLength);
|
|
46
|
+
|
|
47
|
+
if (this.lengthAtLastSave === null) {
|
|
48
|
+
this.lengthAtLastSave = getLengthOfUnformattedValue(this._unformattedValue);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
this._parent.onEvent('change', this);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
get hexData () {
|
|
55
|
+
return this._unformattedValue;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
get strategy () {
|
|
59
|
+
return this._strategy;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
set strategy (strategy) {
|
|
63
|
+
this._strategy = strategy;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
get offset () {
|
|
67
|
+
return this._offset;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
set offset (offset) {
|
|
71
|
+
this._offset = offset;
|
|
72
|
+
this.index = offset;
|
|
73
|
+
|
|
74
|
+
if (this.fieldReference) {
|
|
75
|
+
this.fieldReference.unformattedValue.setBits(this.fieldReference.offset.offset, offset, 32);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
get parent() {
|
|
80
|
+
return this._parent;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
set parent(parent) {
|
|
84
|
+
this._parent = parent;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
module.exports = FranchiseFileTable3Field;
|
|
89
|
+
|
|
90
|
+
function getLengthOfUnformattedValue(value) {
|
|
91
|
+
return value.length;
|
|
92
|
+
};
|
package/package.json
CHANGED
package/scripts/scratchpad.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const zlib = require('zlib');
|
|
3
|
+
|
|
1
4
|
const FranchiseFile = require('../FranchiseFile');
|
|
2
5
|
const utilService = require('../services/utilService');
|
|
3
6
|
|
|
4
|
-
const franchisePath = 'C:\\Users\\Matt\\
|
|
7
|
+
const franchisePath = 'C:\\Users\\Matt\\Documents\\Madden NFL 24\\saves\\CAREER-FANTASY';
|
|
5
8
|
const ftcPath = 'D:\\Projects\\Madden 24\\FTCs\\franchise-league-binary.FTC';
|
|
6
9
|
const schemaPath = 'C:\\Users\\Matt\\AppData\\Roaming\\madden-franchise-editor\\schemas\\M24_144_6.gz';
|
|
7
10
|
|
|
@@ -15,24 +18,35 @@ const schemaPath = 'C:\\Users\\Matt\\AppData\\Roaming\\madden-franchise-editor\\
|
|
|
15
18
|
};
|
|
16
19
|
|
|
17
20
|
const file = new FranchiseFile(franchisePath, {
|
|
18
|
-
schemaOverride: {
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
+
// schemaOverride: {
|
|
22
|
+
// path: schemaPath
|
|
23
|
+
// }
|
|
21
24
|
});
|
|
22
25
|
|
|
23
|
-
const ftc = new FranchiseFile(ftcPath, {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
});
|
|
26
|
+
// const ftc = new FranchiseFile(ftcPath, {
|
|
27
|
+
// schemaOverride: {
|
|
28
|
+
// path: schemaPath
|
|
29
|
+
// }
|
|
30
|
+
// });
|
|
28
31
|
|
|
29
|
-
await Promise.all([franchiseFileLoadPromise(file), franchiseFileLoadPromise(ftc)]);
|
|
32
|
+
// await Promise.all([franchiseFileLoadPromise(file), franchiseFileLoadPromise(ftc)]);
|
|
30
33
|
|
|
31
|
-
const tableToFind = file.getTableById(4227);
|
|
32
|
-
await tableToFind.readRecords();
|
|
34
|
+
// const tableToFind = file.getTableById(4227);
|
|
35
|
+
// await tableToFind.readRecords();
|
|
36
|
+
|
|
37
|
+
// const college = tableToFind.records[2].getFieldByKey('College');
|
|
38
|
+
// const collegeVal = utilService.bin2dec(college.value);
|
|
39
|
+
// const ref = ftc.getReferenceFromAssetId(collegeVal);
|
|
40
|
+
// console.log(ref);
|
|
41
|
+
|
|
42
|
+
await franchiseFileLoadPromise(file);
|
|
43
|
+
|
|
44
|
+
const table3s = file.tables.filter((table) => { return table.header.data1Pad4 > 0; });
|
|
45
|
+
table3s.forEach((table) => { console.log(`${table.header.tableId} - ${table.name}`)});
|
|
33
46
|
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
47
|
+
const buf = fs.readFileSync('D:\\Projects\\Madden 24\\franchise\\characterVisualIsolated.dat');
|
|
48
|
+
const test = zlib.gunzipSync(buf.subarray(2));
|
|
49
|
+
// fs.writeFileSync('D:\\Projects\\Madden 24\\franchise\\characterVisualUnzipped.dat', test);
|
|
50
|
+
const test2 = zlib.gzipSync(test);
|
|
51
|
+
console.log(test2);
|
|
38
52
|
})();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const Constants = require('../Constants');
|
|
2
2
|
const M19Strategy = require('./franchise/m19/M19Strategy');
|
|
3
3
|
const M20Strategy = require('./franchise/m20/M20Strategy');
|
|
4
|
+
const M24Strategy = require('./franchise/m24/M24Strategy');
|
|
4
5
|
const M19FTCStrategy = require('./franchise-common/m19/M19FTCStrategy');
|
|
5
6
|
const M20FTCStrategy = require('./franchise-common/m20/M20FTCStrategy');
|
|
6
7
|
|
|
@@ -13,8 +14,12 @@ StrategyPicker.pick = (type) => {
|
|
|
13
14
|
return M19Strategy;
|
|
14
15
|
case 20:
|
|
15
16
|
case 21:
|
|
17
|
+
case 22:
|
|
18
|
+
case 23:
|
|
16
19
|
default:
|
|
17
20
|
return M20Strategy;
|
|
21
|
+
case 24:
|
|
22
|
+
return M24Strategy;
|
|
18
23
|
}
|
|
19
24
|
}
|
|
20
25
|
else {
|
|
@@ -99,7 +99,8 @@ M19TableHeaderStrategy.parseHeader = (data) => {
|
|
|
99
99
|
'recordWords': data2RecordWords,
|
|
100
100
|
'recordCapacity': data2RecordCapacity,
|
|
101
101
|
'numMembers': data2IndexEntries,
|
|
102
|
-
'nextRecordToUse': nextRecordToUse
|
|
102
|
+
'nextRecordToUse': nextRecordToUse,
|
|
103
|
+
'hasThirdTable': false
|
|
103
104
|
};
|
|
104
105
|
};
|
|
105
106
|
|
|
@@ -108,7 +108,8 @@ M20TableHeaderStrategy.parseHeader = (data) => {
|
|
|
108
108
|
'recordWords': data2RecordWords,
|
|
109
109
|
'recordCapacity': data2RecordCapacity,
|
|
110
110
|
'numMembers': data2IndexEntries,
|
|
111
|
-
'nextRecordToUse': nextRecordToUse
|
|
111
|
+
'nextRecordToUse': nextRecordToUse,
|
|
112
|
+
'hasThirdTable': false
|
|
112
113
|
};
|
|
113
114
|
};
|
|
114
115
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const M20TableHeaderStrategy = require("../m20/M20TableHeaderStrategy");
|
|
2
|
+
|
|
3
|
+
let M24TableHeaderStrategy = {};
|
|
4
|
+
|
|
5
|
+
M24TableHeaderStrategy.parseHeader = (data) => {
|
|
6
|
+
let header = M20TableHeaderStrategy.parseHeader(data);
|
|
7
|
+
|
|
8
|
+
header.table3Length = header.data1Pad3;
|
|
9
|
+
header.hasThirdTable = header.table3Length > 0;
|
|
10
|
+
header.table3StartIndex = header.table2StartIndex + header.table2Length;
|
|
11
|
+
|
|
12
|
+
return header;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
module.exports = M24TableHeaderStrategy;
|
|
@@ -24,7 +24,9 @@ FranchiseTableStrategy.getTable2BinaryData = (table2Records, fullTable2Buffer) =
|
|
|
24
24
|
currentOffset = recordOffset + recordHexData.length;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
if (table2Records.length > 0) {
|
|
28
|
+
table2Data.push(fullTable2Buffer.slice(currentOffset));
|
|
29
|
+
}
|
|
28
30
|
|
|
29
31
|
return table2Data;
|
|
30
32
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const zlib = require('zlib');
|
|
2
|
+
|
|
3
|
+
let FranchiseTable3FieldStrategy = {};
|
|
4
|
+
|
|
5
|
+
FranchiseTable3FieldStrategy.getInitialUnformattedValue = (field, data) => {
|
|
6
|
+
return data.slice(field.thirdTableField.index, (field.thirdTableField.index + field.offset.maxLength + 2));
|
|
7
|
+
// extend maxLength + 2 because the first 2 bytes are the size of the zipped data
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
FranchiseTable3FieldStrategy.getFormattedValueFromUnformatted = (unformattedValue) => {
|
|
11
|
+
return zlib.gunzipSync(unformattedValue.subarray(2)).toString(); // first 2 bytes are the size of the zipped data, so skip those.
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
FranchiseTable3FieldStrategy.setUnformattedValueFromFormatted = (formattedValue, maxLength) => {
|
|
15
|
+
let zippedData = zlib.gzipSync(formattedValue);
|
|
16
|
+
let padding = Buffer.alloc(maxLength - zippedData.length); // table3s all have the same length and are zero padded to the end.
|
|
17
|
+
|
|
18
|
+
let sizeBuf = Buffer.alloc(2);
|
|
19
|
+
sizeBuf.writeUInt16LE(zippedData.length);
|
|
20
|
+
|
|
21
|
+
return Buffer.concat([sizeBuf, zippedData, padding]);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
module.exports = FranchiseTable3FieldStrategy;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
const M19FileStrategy = require('./M19FileStrategy');
|
|
2
2
|
const M19TableStrategy = require('./M19TableStrategy');
|
|
3
3
|
const M19Table2FieldStrategy = require('./M19Table2FieldStrategy');
|
|
4
|
+
const M24Table3Strategy = require('../m24/M24Table3FieldStrategy');
|
|
4
5
|
|
|
5
6
|
module.exports = {
|
|
6
7
|
'name': 'M19Strategy',
|
|
7
8
|
'file': M19FileStrategy,
|
|
8
9
|
'table': M19TableStrategy,
|
|
9
|
-
'table2Field': M19Table2FieldStrategy
|
|
10
|
+
'table2Field': M19Table2FieldStrategy,
|
|
11
|
+
'table3Field': M24Table3Strategy
|
|
10
12
|
};
|
|
@@ -7,6 +7,7 @@ M19TableStrategy.parseHeader = M19TableHeaderStrategy.parseHeader;
|
|
|
7
7
|
M19TableStrategy.parseHeaderAttributesFromSchema = M19TableHeaderStrategy.parseHeaderAttributesFromSchema;
|
|
8
8
|
|
|
9
9
|
M19TableStrategy.getTable2BinaryData = FranchiseTableStrategy.getTable2BinaryData;
|
|
10
|
+
M19TableStrategy.getTable3BinaryData = FranchiseTableStrategy.getTable2BinaryData;
|
|
10
11
|
M19TableStrategy.getMandatoryOffsets = FranchiseTableStrategy.getMandatoryOffsets;
|
|
11
12
|
M19TableStrategy.recalculateStringOffsets = FranchiseTableStrategy.recalculateStringOffsets;
|
|
12
13
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
const M20FileStrategy = require('./M20FileStrategy');
|
|
2
2
|
const M20TableStrategy = require('./M20TableStrategy');
|
|
3
3
|
const M20Table2FieldStrategy = require('./M20Table2FieldStrategy');
|
|
4
|
+
const M24Table3FieldStrategy = require('../m24/M24Table3FieldStrategy');
|
|
4
5
|
|
|
5
6
|
module.exports = {
|
|
6
7
|
'name': 'M20Strategy',
|
|
7
8
|
'file': M20FileStrategy,
|
|
8
9
|
'table': M20TableStrategy,
|
|
9
|
-
'table2Field': M20Table2FieldStrategy
|
|
10
|
+
'table2Field': M20Table2FieldStrategy,
|
|
11
|
+
'table3Field': M24Table3FieldStrategy
|
|
10
12
|
};
|
|
@@ -7,6 +7,7 @@ M20TableStrategy.parseHeader = M20TableHeaderStrategy.parseHeader;
|
|
|
7
7
|
M20TableStrategy.parseHeaderAttributesFromSchema = M20TableHeaderStrategy.parseHeaderAttributesFromSchema;
|
|
8
8
|
|
|
9
9
|
M20TableStrategy.getTable2BinaryData = FranchiseTableStrategy.getTable2BinaryData;
|
|
10
|
+
M20TableStrategy.getTable3BinaryData = FranchiseTableStrategy.getTable2BinaryData;
|
|
10
11
|
M20TableStrategy.getMandatoryOffsets = FranchiseTableStrategy.getMandatoryOffsets;
|
|
11
12
|
M20TableStrategy.recalculateStringOffsets = FranchiseTableStrategy.recalculateStringOffsets;
|
|
12
13
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const M20FileStrategy = require('../m20/M20FileStrategy');
|
|
2
|
+
const M24TableStrategy = require('./M24TableStrategy');
|
|
3
|
+
const M20Table2FieldStrategy = require('../m20/M20Table2FieldStrategy');
|
|
4
|
+
const M24Table3FieldStrategy = require('./M24Table3FieldStrategy');
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
'name': 'M24Strategy',
|
|
8
|
+
'file': M20FileStrategy,
|
|
9
|
+
'table': M24TableStrategy,
|
|
10
|
+
'table2Field': M20Table2FieldStrategy,
|
|
11
|
+
'table3Field': M24Table3FieldStrategy
|
|
12
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const FranchiseTable3FieldStrategy = require('../../common/table3Field/FranchiseTable3FieldStrategy');
|
|
2
|
+
|
|
3
|
+
let M24Table3Strategy = {};
|
|
4
|
+
|
|
5
|
+
M24Table3Strategy.getInitialUnformattedValue = FranchiseTable3FieldStrategy.getInitialUnformattedValue;
|
|
6
|
+
M24Table3Strategy.getFormattedValueFromUnformatted = FranchiseTable3FieldStrategy.getFormattedValueFromUnformatted;
|
|
7
|
+
M24Table3Strategy.setUnformattedValueFromFormatted = FranchiseTable3FieldStrategy.setUnformattedValueFromFormatted;
|
|
8
|
+
|
|
9
|
+
module.exports = M24Table3Strategy;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const FranchiseTableStrategy = require('../../common/table/FranchiseTableStrategy');
|
|
2
|
+
const M20TableHeaderStrategy = require('../../common/header/m20/M20TableHeaderStrategy');
|
|
3
|
+
const M24TableHeaderStrategy = require('../../common/header/m24/M24TableHeaderStrategy');
|
|
4
|
+
|
|
5
|
+
let M24TableStrategy = {};
|
|
6
|
+
|
|
7
|
+
M24TableStrategy.parseHeader = M24TableHeaderStrategy.parseHeader;
|
|
8
|
+
M24TableStrategy.parseHeaderAttributesFromSchema = M20TableHeaderStrategy.parseHeaderAttributesFromSchema;
|
|
9
|
+
|
|
10
|
+
M24TableStrategy.getTable2BinaryData = FranchiseTableStrategy.getTable2BinaryData;
|
|
11
|
+
M24TableStrategy.getTable3BinaryData = FranchiseTableStrategy.getTable2BinaryData;
|
|
12
|
+
M24TableStrategy.getMandatoryOffsets = FranchiseTableStrategy.getMandatoryOffsets;
|
|
13
|
+
M24TableStrategy.recalculateStringOffsets = FranchiseTableStrategy.recalculateStringOffsets;
|
|
14
|
+
|
|
15
|
+
module.exports = M24TableStrategy;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
const M19FTCFileStrategy = require('./M19FTCFileStrategy');
|
|
2
2
|
const M19FTCTableStrategy = require('./M19FTCTableStrategy');
|
|
3
3
|
const M19FTCTable2FieldStrategy = require('./M19FTCTable2FieldStrategy');
|
|
4
|
+
const M24Table3Strategy = require('../../franchise/m24/M24Table3FieldStrategy');
|
|
4
5
|
|
|
5
6
|
module.exports = {
|
|
6
7
|
'name': 'M19FTCStrategy',
|
|
7
8
|
'file': M19FTCFileStrategy,
|
|
8
9
|
'table': M19FTCTableStrategy,
|
|
9
|
-
'table2Field': M19FTCTable2FieldStrategy
|
|
10
|
+
'table2Field': M19FTCTable2FieldStrategy,
|
|
11
|
+
'table3Field': M24Table3Strategy
|
|
10
12
|
};
|
|
@@ -7,6 +7,7 @@ M19FTCTableStrategy.parseHeader = M19TableHeaderStrategy.parseHeader;
|
|
|
7
7
|
M19FTCTableStrategy.parseHeaderAttributesFromSchema = M19TableHeaderStrategy.parseHeaderAttributesFromSchema;
|
|
8
8
|
|
|
9
9
|
M19FTCTableStrategy.getTable2BinaryData = FTCTableStrategy.getTable2BinaryData;
|
|
10
|
+
M19FTCTableStrategy.getTable3BinaryData = FTCTableStrategy.getTable2BinaryData;
|
|
10
11
|
M19FTCTableStrategy.getMandatoryOffsets = FTCTableStrategy.getMandatoryOffsets;
|
|
11
12
|
M19FTCTableStrategy.recalculateStringOffsets = () => {};
|
|
12
13
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
const M20FTCFileStrategy = require('./M20FTCFileStrategy');
|
|
2
2
|
const M20FTCTableStrategy = require('./M20FTCTableStrategy');
|
|
3
3
|
const M20FTCTable2FieldStrategy = require('./M20FTCTable2FieldStrategy');
|
|
4
|
+
const M24Table3Strategy = require('../../franchise/m24/M24Table3FieldStrategy');
|
|
4
5
|
|
|
5
6
|
module.exports = {
|
|
6
7
|
'name': 'M20FTCStrategy',
|
|
7
8
|
'file': M20FTCFileStrategy,
|
|
8
9
|
'table': M20FTCTableStrategy,
|
|
9
|
-
'table2Field': M20FTCTable2FieldStrategy
|
|
10
|
+
'table2Field': M20FTCTable2FieldStrategy,
|
|
11
|
+
'table3Field': M24Table3Strategy
|
|
10
12
|
};
|
|
@@ -7,6 +7,7 @@ M20FTCTableStrategy.parseHeader = M20TableHeaderStrategy.parseHeader;
|
|
|
7
7
|
M20FTCTableStrategy.parseHeaderAttributesFromSchema = M20TableHeaderStrategy.parseHeaderAttributesFromSchema;
|
|
8
8
|
|
|
9
9
|
M20FTCTableStrategy.getTable2BinaryData = FTCTableStrategy.getTable2BinaryData;
|
|
10
|
+
M20FTCTableStrategy.getTable3BinaryData = FTCTableStrategy.getTable2BinaryData;
|
|
10
11
|
M20FTCTableStrategy.getMandatoryOffsets = FTCTableStrategy.getMandatoryOffsets;
|
|
11
12
|
M20FTCTableStrategy.recalculateStringOffsets = () => {};
|
|
12
13
|
|