@etothepii/satisfactory-file-parser 0.0.31 → 0.0.33

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.
Files changed (50) hide show
  1. package/LICENCE.md +20 -20
  2. package/README.md +112 -112
  3. package/build/index.d.ts +5 -1
  4. package/build/index.js +7 -7
  5. package/build/parser/byte/binary-operable.interface.d.ts +6 -0
  6. package/build/parser/byte/binary-operable.interface.js +12 -0
  7. package/build/parser/byte/binary-readable.interface.d.ts +22 -0
  8. package/build/parser/byte/binary-readable.interface.js +12 -0
  9. package/build/parser/byte/byte-reader.class.d.ts +11 -9
  10. package/build/parser/byte/byte-reader.class.js +23 -15
  11. package/build/parser/error/parser.error.d.ts +6 -0
  12. package/build/parser/error/parser.error.js +13 -1
  13. package/build/parser/satisfactory/blueprint/blueprint-reader.d.ts +3 -2
  14. package/build/parser/satisfactory/blueprint/blueprint-writer.js +1 -1
  15. package/build/parser/satisfactory/objects/DataFields.d.ts +34 -6
  16. package/build/parser/satisfactory/objects/DataFields.js +86 -3
  17. package/build/parser/satisfactory/objects/ObjectReference.d.ts +2 -2
  18. package/build/parser/satisfactory/objects/Property.d.ts +72 -72
  19. package/build/parser/satisfactory/objects/Property.js +24 -23
  20. package/build/parser/satisfactory/objects/SaveComponent.d.ts +8 -5
  21. package/build/parser/satisfactory/objects/SaveComponent.js +2 -2
  22. package/build/parser/satisfactory/objects/SaveEntity.d.ts +9 -4
  23. package/build/parser/satisfactory/objects/SaveEntity.js +2 -2
  24. package/build/parser/satisfactory/objects/SaveObject.d.ts +9 -4
  25. package/build/parser/satisfactory/objects/SaveObject.js +3 -3
  26. package/build/parser/satisfactory/save/asynchronous-level.class.d.ts +9 -0
  27. package/build/parser/satisfactory/save/asynchronous-level.class.js +76 -0
  28. package/build/parser/satisfactory/save/level.class.d.ts +5 -5
  29. package/build/parser/satisfactory/save/level.class.js +6 -6
  30. package/build/parser/satisfactory/save/save-reader.d.ts +4 -13
  31. package/build/parser/satisfactory/save/save-reader.js +17 -72
  32. package/build/parser/satisfactory/structs/util.types.d.ts +7 -7
  33. package/build/parser/satisfactory/structs/util.types.js +10 -10
  34. package/build/parser/stream/byte-stream-reader.class.d.ts +57 -0
  35. package/build/parser/stream/byte-stream-reader.class.js +251 -0
  36. package/build/parser/stream/json-stream-state-writer.d.ts +12 -0
  37. package/build/parser/stream/json-stream-state-writer.js +28 -0
  38. package/build/parser/stream/json-stream-writable.d.ts +20 -0
  39. package/build/parser/stream/json-stream-writable.js +93 -0
  40. package/build/parser/stream/json-stream-writer.d.ts +22 -0
  41. package/build/parser/stream/json-stream-writer.js +137 -0
  42. package/build/parser/stream/save-stream-json-stringifier.d.ts +6 -0
  43. package/build/parser/stream/save-stream-json-stringifier.js +43 -0
  44. package/build/parser/stream/save-stream-reader.class.d.ts +15 -0
  45. package/build/parser/stream/save-stream-reader.class.js +131 -0
  46. package/build/parser/stream/save-stream-writer.class.d.ts +22 -0
  47. package/build/parser/stream/save-stream-writer.class.js +115 -0
  48. package/build/parser/stream/stream-level.class.d.ts +12 -0
  49. package/build/parser/stream/stream-level.class.js +113 -0
  50. package/package.json +3 -1
@@ -4,20 +4,22 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./Property"], factory);
7
+ define(["require", "exports", "../structs/util.types", "./Property"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.DataFields = void 0;
13
+ const util_types_1 = require("../structs/util.types");
13
14
  const Property_1 = require("./Property");
14
15
  class DataFields {
15
16
  constructor() {
16
17
  this.properties = [];
18
+ this.specialProperties = {};
17
19
  this.trailingData = [];
18
20
  this.shouldBeNulled = false;
19
21
  }
20
- static Parse(length, reader, buildVersion) {
22
+ static Parse(length, reader, buildVersion, typePath) {
21
23
  const start = reader.getBufferPosition();
22
24
  const fields = new DataFields();
23
25
  if (length === 0) {
@@ -33,11 +35,58 @@
33
35
  let int1 = reader.readInt32();
34
36
  if (int1 !== 0) {
35
37
  }
38
+ fields.specialProperties = DataFields.ParseAdditionalSpecialProperties(reader, typePath, start + length - reader.getBufferPosition() - 4);
36
39
  const end = reader.getBufferPosition();
37
40
  let remainingBytes = start + length - end;
38
41
  fields.trailingData = Array.from(reader.readBytes(remainingBytes));
39
42
  return fields;
40
43
  }
44
+ static ParseAdditionalSpecialProperties(reader, typePath, remainingLen) {
45
+ let property;
46
+ switch (typePath) {
47
+ case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk1/Build_ConveyorBeltMk1.Build_ConveyorBeltMk1_C':
48
+ case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk2/Build_ConveyorBeltMk2.Build_ConveyorBeltMk2_C':
49
+ case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk3/Build_ConveyorBeltMk3.Build_ConveyorBeltMk3_C':
50
+ case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk4/Build_ConveyorBeltMk4.Build_ConveyorBeltMk4_C':
51
+ case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk5/Build_ConveyorBeltMk5.Build_ConveyorBeltMk5_C':
52
+ case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk1/Build_ConveyorLiftMk1.Build_ConveyorLiftMk1_C':
53
+ case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk2/Build_ConveyorLiftMk2.Build_ConveyorLiftMk2_C':
54
+ case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk3/Build_ConveyorLiftMk3.Build_ConveyorLiftMk3_C':
55
+ case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk4/Build_ConveyorLiftMk4.Build_ConveyorLiftMk4_C':
56
+ case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk5/Build_ConveyorLiftMk5.Build_ConveyorLiftMk5_C':
57
+ property = {};
58
+ break;
59
+ case '/Game/FactoryGame/Buildable/Factory/PowerLine/Build_PowerLine.Build_PowerLine_C':
60
+ case '/Game/FactoryGame/Events/Christmas/Buildings/PowerLineLights/Build_XmassLightsLine.Build_XmassLightsLine_C':
61
+ property = {
62
+ source: Property_1.ObjectProperty.ReadValue(reader),
63
+ target: Property_1.ObjectProperty.ReadValue(reader)
64
+ };
65
+ if (remainingLen >= 24) {
66
+ property.sourceTranslation = (0, util_types_1.ParseVec3)(reader);
67
+ property.targetTranslation = (0, util_types_1.ParseVec3)(reader);
68
+ }
69
+ break;
70
+ case '/Game/FactoryGame/Character/Player/BP_PlayerState.BP_PlayerState_C':
71
+ property = {};
72
+ property.flag = reader.readByte();
73
+ switch (property.flag) {
74
+ case 248:
75
+ const eos = reader.readString();
76
+ property.eosData = reader.readString();
77
+ break;
78
+ case 25:
79
+ break;
80
+ default:
81
+ break;
82
+ }
83
+ break;
84
+ default:
85
+ property = {};
86
+ break;
87
+ }
88
+ return property;
89
+ }
41
90
  static ParseProperty(reader, buildVersion, propertyName) {
42
91
  let currentProperty = {};
43
92
  if (currentProperty.name === 'None') {
@@ -131,15 +180,49 @@
131
180
  }
132
181
  return currentProperty;
133
182
  }
134
- static Serialize(writer, fields, buildVersion) {
183
+ static Serialize(writer, fields, buildVersion, typePath) {
135
184
  for (const property of fields.properties) {
136
185
  writer.writeString(property.name);
137
186
  DataFields.SerializeProperty(writer, property, property.name, buildVersion);
138
187
  }
139
188
  writer.writeString('None');
140
189
  writer.writeInt32(0);
190
+ DataFields.SerializeAdditionalSpecialProperties(writer, typePath, fields.specialProperties);
141
191
  writer.writeBytesArray(fields.trailingData);
142
192
  }
193
+ static SerializeAdditionalSpecialProperties(writer, typePath, property) {
194
+ switch (typePath) {
195
+ case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk1/Build_ConveyorBeltMk1.Build_ConveyorBeltMk1_C':
196
+ case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk2/Build_ConveyorBeltMk2.Build_ConveyorBeltMk2_C':
197
+ case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk3/Build_ConveyorBeltMk3.Build_ConveyorBeltMk3_C':
198
+ case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk4/Build_ConveyorBeltMk4.Build_ConveyorBeltMk4_C':
199
+ case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk5/Build_ConveyorBeltMk5.Build_ConveyorBeltMk5_C':
200
+ case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk1/Build_ConveyorLiftMk1.Build_ConveyorLiftMk1_C':
201
+ case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk2/Build_ConveyorLiftMk2.Build_ConveyorLiftMk2_C':
202
+ case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk3/Build_ConveyorLiftMk3.Build_ConveyorLiftMk3_C':
203
+ case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk4/Build_ConveyorLiftMk4.Build_ConveyorLiftMk4_C':
204
+ case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk5/Build_ConveyorLiftMk5.Build_ConveyorLiftMk5_C':
205
+ break;
206
+ case '/Game/FactoryGame/Buildable/Factory/PowerLine/Build_PowerLine.Build_PowerLine_C':
207
+ case '/Game/FactoryGame/Events/Christmas/Buildings/PowerLineLights/Build_XmassLightsLine.Build_XmassLightsLine_C':
208
+ Property_1.ObjectProperty.SerializeValue(writer, property.source);
209
+ Property_1.ObjectProperty.SerializeValue(writer, property.target);
210
+ break;
211
+ case '/Game/FactoryGame/Character/Player/BP_PlayerState.BP_PlayerState_C':
212
+ writer.writeByte(property.flag);
213
+ switch (property.flag) {
214
+ case 248:
215
+ writer.writeString('EOS');
216
+ writer.writeString(property.eosData);
217
+ break;
218
+ case 25:
219
+ break;
220
+ default:
221
+ break;
222
+ }
223
+ break;
224
+ }
225
+ }
143
226
  static SerializeProperty(writer, property, propertyName, buildVersion) {
144
227
  writer.writeString(property.ueType);
145
228
  const lenIndicator = writer.getBufferPosition();
@@ -1,9 +1,9 @@
1
- import { ByteReader } from "../../byte/byte-reader.class";
1
+ import { BinaryReadable } from "../../byte/binary-readable.interface";
2
2
  import { ByteWriter } from "../../byte/byte-writer.class";
3
3
  export declare class ObjectReference {
4
4
  levelName: string;
5
5
  pathName: string;
6
6
  constructor(levelName: string, pathName: string);
7
- static Parse(reader: ByteReader): ObjectReference;
7
+ static Parse(reader: BinaryReadable): ObjectReference;
8
8
  static Serialize(writer: ByteWriter, ref: ObjectReference): void;
9
9
  }
@@ -1,5 +1,5 @@
1
- import { ByteReader } from "../../byte/byte-reader.class";
2
- import { SaveWriter } from "../save/save-writer";
1
+ import { ByteWriter } from "../../..";
2
+ import { BinaryReadable } from "../../byte/binary-readable.interface";
3
3
  import { col4, vec3, vec4 } from "../structs/util.types";
4
4
  import { ObjectReference } from "./ObjectReference";
5
5
  export type Properties = {
@@ -20,19 +20,19 @@ export declare abstract class BasicProperty extends AbstractBaseProperty {
20
20
  constructor(type: string, ueType: string, guidInfo: GUID, index?: number);
21
21
  }
22
22
  export type GUID = undefined | Uint8Array;
23
- export declare const ParseGUID: (reader: ByteReader) => GUID;
24
- export declare const SerializeGUID: (writer: SaveWriter, guid: GUID) => void;
23
+ export declare const ParseGUID: (reader: BinaryReadable) => GUID;
24
+ export declare const SerializeGUID: (writer: ByteWriter, guid: GUID) => void;
25
25
  export type OverheadResult = {
26
26
  overhead: number;
27
27
  };
28
28
  export declare class BoolProperty extends BasicProperty {
29
29
  value: boolean;
30
30
  constructor(value: boolean, ueType?: string, guidInfo?: GUID, index?: number);
31
- static Parse(reader: ByteReader, ueType: string, index?: number): BoolProperty;
32
- static ReadValue(reader: ByteReader): boolean;
31
+ static Parse(reader: BinaryReadable, ueType: string, index?: number): BoolProperty;
32
+ static ReadValue(reader: BinaryReadable): boolean;
33
33
  static CalcOverhead(property: BoolProperty): number;
34
- static Serialize(writer: SaveWriter, property: BoolProperty): void;
35
- static SerializeValue(writer: SaveWriter, value: boolean): void;
34
+ static Serialize(writer: ByteWriter, property: BoolProperty): void;
35
+ static SerializeValue(writer: ByteWriter, value: boolean): void;
36
36
  }
37
37
  export type BytePropertyValue = {
38
38
  type: string;
@@ -41,92 +41,92 @@ export type BytePropertyValue = {
41
41
  export declare class ByteProperty extends BasicProperty {
42
42
  value: BytePropertyValue;
43
43
  constructor(value: BytePropertyValue, ueType?: string, guidInfo?: GUID, index?: number);
44
- static Parse(reader: ByteReader, ueType: string, index?: number): ByteProperty;
45
- static ReadValue(reader: ByteReader): number;
44
+ static Parse(reader: BinaryReadable, ueType: string, index?: number): ByteProperty;
45
+ static ReadValue(reader: BinaryReadable): number;
46
46
  static CalcOverhead(property: ByteProperty): number;
47
- static Serialize(writer: SaveWriter, property: ByteProperty): void;
48
- static SerializeValue(writer: SaveWriter, value: number): void;
47
+ static Serialize(writer: ByteWriter, property: ByteProperty): void;
48
+ static SerializeValue(writer: ByteWriter, value: number): void;
49
49
  }
50
50
  export declare class Int8Property extends BasicProperty {
51
51
  value: number;
52
52
  constructor(value: number, ueType?: string, guidInfo?: GUID, index?: number);
53
- static Parse(reader: ByteReader, ueType: string, index?: number): Int8Property;
54
- static ReadValue(reader: ByteReader): number;
53
+ static Parse(reader: BinaryReadable, ueType: string, index?: number): Int8Property;
54
+ static ReadValue(reader: BinaryReadable): number;
55
55
  static CalcOverhead(property: Int8Property): number;
56
- static Serialize(writer: SaveWriter, property: Int8Property): void;
57
- static SerializeValue(writer: SaveWriter, value: number): void;
56
+ static Serialize(writer: ByteWriter, property: Int8Property): void;
57
+ static SerializeValue(writer: ByteWriter, value: number): void;
58
58
  }
59
59
  export declare class Uint8Property extends BasicProperty {
60
60
  value: number;
61
61
  constructor(value: number, ueType?: string, guidInfo?: GUID, index?: number);
62
- static Parse(reader: ByteReader, ueType: string, index?: number): Uint8Property;
63
- static ReadValue(reader: ByteReader): number;
62
+ static Parse(reader: BinaryReadable, ueType: string, index?: number): Uint8Property;
63
+ static ReadValue(reader: BinaryReadable): number;
64
64
  static CalcOverhead(property: Uint8Property): number;
65
- static Serialize(writer: SaveWriter, property: Uint8Property): void;
66
- static SerializeValue(writer: SaveWriter, value: number): void;
65
+ static Serialize(writer: ByteWriter, property: Uint8Property): void;
66
+ static SerializeValue(writer: ByteWriter, value: number): void;
67
67
  }
68
68
  export declare class Int32Property extends BasicProperty {
69
69
  value: number;
70
70
  constructor(value: number, ueType?: string, guidInfo?: GUID, index?: number);
71
- static Parse(reader: ByteReader, ueType: string, index?: number): Int32Property;
72
- static ReadValue(reader: ByteReader): number;
71
+ static Parse(reader: BinaryReadable, ueType: string, index?: number): Int32Property;
72
+ static ReadValue(reader: BinaryReadable): number;
73
73
  static CalcOverhead(property: Int32Property): number;
74
- static Serialize(writer: SaveWriter, property: Int32Property): void;
75
- static SerializeValue(writer: SaveWriter, value: number): void;
74
+ static Serialize(writer: ByteWriter, property: Int32Property): void;
75
+ static SerializeValue(writer: ByteWriter, value: number): void;
76
76
  }
77
77
  export declare class Uint32Property extends BasicProperty {
78
78
  value: number;
79
79
  constructor(value: number, ueType?: string, guidInfo?: GUID, index?: number);
80
- static Parse(reader: ByteReader, ueType: string, index?: number): Uint32Property;
81
- static ReadValue(reader: ByteReader): number;
80
+ static Parse(reader: BinaryReadable, ueType: string, index?: number): Uint32Property;
81
+ static ReadValue(reader: BinaryReadable): number;
82
82
  static CalcOverhead(property: Uint32Property): number;
83
- static Serialize(writer: SaveWriter, property: Uint32Property): void;
84
- static SerializeValue(writer: SaveWriter, value: number): void;
83
+ static Serialize(writer: ByteWriter, property: Uint32Property): void;
84
+ static SerializeValue(writer: ByteWriter, value: number): void;
85
85
  }
86
86
  export declare class Int64Property extends BasicProperty {
87
87
  value: string;
88
88
  constructor(value: string, ueType?: string, guidInfo?: GUID, index?: number);
89
- static Parse(reader: ByteReader, ueType: string, index?: number): Int64Property;
90
- static ReadValue(reader: ByteReader): string;
89
+ static Parse(reader: BinaryReadable, ueType: string, index?: number): Int64Property;
90
+ static ReadValue(reader: BinaryReadable): string;
91
91
  static CalcOverhead(property: Int64Property): number;
92
- static Serialize(writer: SaveWriter, property: Int64Property): void;
93
- static SerializeValue(writer: SaveWriter, value: string): void;
92
+ static Serialize(writer: ByteWriter, property: Int64Property): void;
93
+ static SerializeValue(writer: ByteWriter, value: string): void;
94
94
  }
95
95
  export declare class FloatProperty extends BasicProperty {
96
96
  value: number;
97
97
  constructor(value: number, ueType?: string, guidInfo?: GUID, index?: number);
98
- static Parse(reader: ByteReader, ueType: string, index?: number): FloatProperty;
98
+ static Parse(reader: BinaryReadable, ueType: string, index?: number): FloatProperty;
99
99
  static CalcOverhead(property: FloatProperty): number;
100
- static ReadValue(reader: ByteReader): number;
101
- static Serialize(writer: SaveWriter, property: FloatProperty): void;
102
- static SerializeValue(writer: SaveWriter, value: number): void;
100
+ static ReadValue(reader: BinaryReadable): number;
101
+ static Serialize(writer: ByteWriter, property: FloatProperty): void;
102
+ static SerializeValue(writer: ByteWriter, value: number): void;
103
103
  }
104
104
  export declare class DoubleProperty extends BasicProperty {
105
105
  value: number;
106
106
  constructor(value: number, ueType?: string, guidInfo?: GUID, index?: number);
107
- static Parse(reader: ByteReader, ueType: string, index?: number): DoubleProperty;
108
- static ReadValue(reader: ByteReader): number;
107
+ static Parse(reader: BinaryReadable, ueType: string, index?: number): DoubleProperty;
108
+ static ReadValue(reader: BinaryReadable): number;
109
109
  static CalcOverhead(property: DoubleProperty): number;
110
- static Serialize(writer: SaveWriter, property: DoubleProperty): void;
111
- static SerializeValue(writer: SaveWriter, value: number): void;
110
+ static Serialize(writer: ByteWriter, property: DoubleProperty): void;
111
+ static SerializeValue(writer: ByteWriter, value: number): void;
112
112
  }
113
113
  export declare class StrProperty extends BasicProperty {
114
114
  value: string;
115
115
  constructor(value: string, ueType?: string, guidInfo?: GUID, index?: number);
116
- static Parse(reader: ByteReader, ueType: string, index?: number): StrProperty;
117
- static ReadValue(reader: ByteReader): string;
116
+ static Parse(reader: BinaryReadable, ueType: string, index?: number): StrProperty;
117
+ static ReadValue(reader: BinaryReadable): string;
118
118
  static CalcOverhead(property: StrProperty): number;
119
- static Serialize(writer: SaveWriter, property: StrProperty): void;
120
- static SerializeValue(writer: SaveWriter, value: string): void;
119
+ static Serialize(writer: ByteWriter, property: StrProperty): void;
120
+ static SerializeValue(writer: ByteWriter, value: string): void;
121
121
  }
122
122
  export declare class ObjectProperty extends BasicProperty {
123
123
  value: ObjectReference;
124
124
  constructor(value: ObjectReference, ueType?: string, guidInfo?: GUID, index?: number);
125
- static Parse(reader: ByteReader, ueType: string, index?: number): ObjectProperty;
126
- static ReadValue(reader: ByteReader): ObjectReference;
125
+ static Parse(reader: BinaryReadable, ueType: string, index?: number): ObjectProperty;
126
+ static ReadValue(reader: BinaryReadable): ObjectReference;
127
127
  static CalcOverhead(property: ObjectProperty): number;
128
- static Serialize(writer: SaveWriter, property: ObjectProperty): void;
129
- static SerializeValue(writer: SaveWriter, value: {
128
+ static Serialize(writer: ByteWriter, property: ObjectProperty): void;
129
+ static SerializeValue(writer: ByteWriter, value: {
130
130
  levelName: string;
131
131
  pathName: string;
132
132
  }): void;
@@ -140,11 +140,11 @@ export declare class EnumProperty extends BasicProperty {
140
140
  name: string;
141
141
  value: string;
142
142
  }, ueType?: string, guidInfo?: GUID, index?: number);
143
- static Parse(reader: ByteReader, ueType: string, index?: number): EnumProperty;
144
- static ReadValue(reader: ByteReader): string;
143
+ static Parse(reader: BinaryReadable, ueType: string, index?: number): EnumProperty;
144
+ static ReadValue(reader: BinaryReadable): string;
145
145
  static CalcOverhead(property: EnumProperty): number;
146
- static Serialize(writer: SaveWriter, property: EnumProperty): void;
147
- static SerializeValue(writer: SaveWriter, value: string): void;
146
+ static Serialize(writer: ByteWriter, property: EnumProperty): void;
147
+ static SerializeValue(writer: ByteWriter, value: string): void;
148
148
  }
149
149
  export type TextPropertyValue = {
150
150
  flags: number;
@@ -165,11 +165,11 @@ export type TextPropertyValue = {
165
165
  export declare class TextProperty extends BasicProperty {
166
166
  value: TextPropertyValue;
167
167
  constructor(value: TextPropertyValue, ueType?: string, guidInfo?: GUID, index?: number);
168
- static Parse(reader: ByteReader, ueType: string, index?: number): TextProperty;
169
- static ParseValue(reader: ByteReader): TextPropertyValue;
168
+ static Parse(reader: BinaryReadable, ueType: string, index?: number): TextProperty;
169
+ static ParseValue(reader: BinaryReadable): TextPropertyValue;
170
170
  static CalcOverhead(property: TextProperty): number;
171
- static Serialize(writer: SaveWriter, property: TextProperty): void;
172
- static SerializeValue(writer: SaveWriter, value: TextPropertyValue): void;
171
+ static Serialize(writer: ByteWriter, property: TextProperty): void;
172
+ static SerializeValue(writer: ByteWriter, value: TextPropertyValue): void;
173
173
  }
174
174
  export type BasicMultipleStructPropertyValue = {
175
175
  values: any;
@@ -213,11 +213,11 @@ export declare class StructProperty extends AbstractBaseProperty {
213
213
  unk3?: number;
214
214
  unk4?: number;
215
215
  constructor(subtype: string, ueType?: string, index?: number, guid?: number);
216
- static Parse(reader: ByteReader, ueType: string, index: number, size: number): StructProperty;
217
- static ParseValue(reader: ByteReader, subtype: string, size: number): GENERIC_STRUCT_PROPERTY_VALUE;
216
+ static Parse(reader: BinaryReadable, ueType: string, index: number, size: number): StructProperty;
217
+ static ParseValue(reader: BinaryReadable, subtype: string, size: number): GENERIC_STRUCT_PROPERTY_VALUE;
218
218
  static CalcOverhead(property: StructProperty): number;
219
- static Serialize(writer: SaveWriter, property: StructProperty): void;
220
- static SerializeValue(writer: SaveWriter, subtype: string, value: GENERIC_STRUCT_PROPERTY_VALUE): void;
219
+ static Serialize(writer: ByteWriter, property: StructProperty): void;
220
+ static SerializeValue(writer: ByteWriter, subtype: string, value: GENERIC_STRUCT_PROPERTY_VALUE): void;
221
221
  }
222
222
  export type ArrayPropertyStructValueFields = {
223
223
  allStructType: string;
@@ -233,17 +233,17 @@ export declare class ArrayProperty<T> extends BasicProperty {
233
233
  values: T[];
234
234
  structValueFields?: ArrayPropertyStructValueFields | undefined;
235
235
  constructor(subtype: string, values: T[], ueType?: string, index?: number, structValueFields?: ArrayPropertyStructValueFields | undefined);
236
- static Parse(reader: ByteReader, ueType: string, index: number, propertyName: string): ArrayProperty<any>;
236
+ static Parse(reader: BinaryReadable, ueType: string, index: number, propertyName: string): ArrayProperty<any>;
237
237
  static CalcOverhead(property: ArrayProperty<any>): number;
238
- static Serialize(writer: SaveWriter, property: ArrayProperty<any>, propertyName: string): void;
238
+ static Serialize(writer: ByteWriter, property: ArrayProperty<any>, propertyName: string): void;
239
239
  }
240
240
  export declare class SetProperty<T> extends BasicProperty {
241
241
  subtype: string;
242
242
  values: T[];
243
243
  constructor(subtype: string, values: T[], ueType: string, index: number);
244
- static Parse(reader: ByteReader, ueType: string, index: number, propertyName: string): SetProperty<any>;
244
+ static Parse(reader: BinaryReadable, ueType: string, index: number, propertyName: string): SetProperty<any>;
245
245
  static CalcOverhead(property: SetProperty<any>): number;
246
- static Serialize(writer: SaveWriter, property: SetProperty<any>): void;
246
+ static Serialize(writer: ByteWriter, property: SetProperty<any>): void;
247
247
  }
248
248
  export declare class MapProperty extends BasicProperty {
249
249
  keyType: string;
@@ -258,13 +258,13 @@ export declare class MapProperty extends BasicProperty {
258
258
  value: any;
259
259
  }[];
260
260
  constructor(keyType: string, valueType: string, ueType: string, index: number);
261
- static Parse(reader: ByteReader, propertyName: string, buildVersion: number, size: number, ueType?: string, index?: number): MapProperty;
261
+ static Parse(reader: BinaryReadable, propertyName: string, buildVersion: number, size: number, ueType?: string, index?: number): MapProperty;
262
262
  static CalcOverhead(property: MapProperty): number;
263
- static Serialize(writer: SaveWriter, property: MapProperty): void;
263
+ static Serialize(writer: ByteWriter, property: MapProperty): void;
264
264
  }
265
- export declare const ParseDynamicStructData: (reader: ByteReader, buildVersion: number, type: string) => DynamicStructPropertyValue;
266
- export declare const SerializeDynamicStructData: (writer: SaveWriter, buildVersion: number, data: DynamicStructPropertyValue) => void;
267
- export declare const ReadFINNetworkTrace: (reader: ByteReader) => any;
268
- export declare const SerializeFINNetworkTrace: (writer: SaveWriter, obj: any) => void;
269
- export declare const ReadFINLuaProcessorStateStorage: (reader: ByteReader, size: number) => any;
270
- export declare const SerializeFINLuaProcessorStateStorage: (writer: SaveWriter, stateStorage: any) => void;
265
+ export declare const ParseDynamicStructData: (reader: BinaryReadable, buildVersion: number, type: string) => DynamicStructPropertyValue;
266
+ export declare const SerializeDynamicStructData: (writer: ByteWriter, buildVersion: number, data: DynamicStructPropertyValue) => void;
267
+ export declare const ReadFINNetworkTrace: (reader: BinaryReadable) => any;
268
+ export declare const SerializeFINNetworkTrace: (writer: ByteWriter, obj: any) => void;
269
+ export declare const ReadFINLuaProcessorStateStorage: (reader: BinaryReadable, size: number) => any;
270
+ export declare const SerializeFINLuaProcessorStateStorage: (writer: ByteWriter, stateStorage: any) => void;
@@ -233,7 +233,7 @@
233
233
  return new Int64Property(value, ueType, guidInfo, index);
234
234
  }
235
235
  static ReadValue(reader) {
236
- return reader.readLong().toString();
236
+ return reader.readInt64().toString();
237
237
  }
238
238
  static CalcOverhead(property) {
239
239
  return 1;
@@ -261,7 +261,7 @@
261
261
  return 1;
262
262
  }
263
263
  static ReadValue(reader) {
264
- return reader.readFloat();
264
+ return reader.readFloat32();
265
265
  }
266
266
  static Serialize(writer, property) {
267
267
  (0, exports.SerializeGUID)(writer, property.guidInfo);
@@ -547,8 +547,8 @@
547
547
  value = {
548
548
  root: reader.readString(),
549
549
  instanceName: reader.readString(),
550
- offset: reader.readFloat(),
551
- forward: reader.readFloat()
550
+ offset: reader.readFloat32(),
551
+ forward: reader.readFloat32()
552
552
  };
553
553
  break;
554
554
  case 'TimerHandle':
@@ -568,14 +568,14 @@
568
568
  break;
569
569
  case 'FluidBox':
570
570
  value = {
571
- value: reader.readFloat()
571
+ value: reader.readFloat32()
572
572
  };
573
573
  break;
574
574
  case 'SlateBrush':
575
575
  value = reader.readString();
576
576
  break;
577
577
  case 'DateTime':
578
- value = reader.readLong().toString();
578
+ value = reader.readInt64().toString();
579
579
  break;
580
580
  case 'FINNetworkTrace':
581
581
  value = (0, exports.ReadFINNetworkTrace)(reader);
@@ -587,8 +587,8 @@
587
587
  break;
588
588
  case 'FICFrameRange':
589
589
  value = {
590
- begin: reader.readLong().toString(),
591
- end: reader.readLong().toString(),
590
+ begin: reader.readInt64().toString(),
591
+ end: reader.readInt64().toString(),
592
592
  };
593
593
  break;
594
594
  default:
@@ -704,35 +704,35 @@
704
704
  const elementCount = reader.readInt32();
705
705
  switch (subtype) {
706
706
  case "FloatProperty":
707
- property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(e => FloatProperty.ReadValue(reader)), ueType, index);
707
+ property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => FloatProperty.ReadValue(reader)), ueType, index);
708
708
  break;
709
709
  case "BoolProperty":
710
- property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(e => BoolProperty.ReadValue(reader)), ueType, index);
710
+ property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => BoolProperty.ReadValue(reader)), ueType, index);
711
711
  break;
712
712
  case "IntProperty":
713
- property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(e => Int32Property.ReadValue(reader)), ueType, index);
713
+ property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => Int32Property.ReadValue(reader)), ueType, index);
714
714
  break;
715
715
  case "Int64Property":
716
- property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(e => Int64Property.ReadValue(reader)), ueType, index);
716
+ property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => Int64Property.ReadValue(reader)), ueType, index);
717
717
  break;
718
718
  case "DoubleProperty":
719
- property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(e => DoubleProperty.ReadValue(reader)), ueType, index);
719
+ property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => DoubleProperty.ReadValue(reader)), ueType, index);
720
720
  break;
721
721
  case "ByteProperty":
722
- property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(e => ByteProperty.ReadValue(reader)), ueType, index);
722
+ property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => ByteProperty.ReadValue(reader)), ueType, index);
723
723
  break;
724
724
  case "StrProperty":
725
- property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(e => StrProperty.ReadValue(reader)), ueType, index);
725
+ property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => StrProperty.ReadValue(reader)), ueType, index);
726
726
  break;
727
727
  case "EnumProperty":
728
- property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(e => EnumProperty.ReadValue(reader)), ueType, index);
728
+ property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => EnumProperty.ReadValue(reader)), ueType, index);
729
729
  break;
730
730
  case "TextProperty":
731
- property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(e => TextProperty.ParseValue(reader)), ueType, index);
731
+ property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => TextProperty.ParseValue(reader)), ueType, index);
732
732
  break;
733
733
  case "InterfaceProperty":
734
734
  case "ObjectProperty":
735
- property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(e => ObjectProperty.ReadValue(reader)), ueType, index);
735
+ property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => ObjectProperty.ReadValue(reader)), ueType, index);
736
736
  break;
737
737
  case "StructProperty":
738
738
  const name = reader.readString();
@@ -759,7 +759,7 @@
759
759
  innerStructValueFields.allUnk4 = allUnk4;
760
760
  }
761
761
  const before = reader.getBufferPosition();
762
- const maArr = new Array(elementCount).fill(0).map(e => {
762
+ const maArr = new Array(elementCount).fill(0).map(() => {
763
763
  const struct = new StructProperty(allStructType, type, allIndex, allGuid);
764
764
  struct.value = StructProperty.ParseValue(reader, allStructType, binarySize);
765
765
  return struct;
@@ -852,17 +852,17 @@
852
852
  let property;
853
853
  switch (subtype) {
854
854
  case "IntProperty":
855
- property = new SetProperty(subtype, new Array(elementCount).fill(0).map(e => Int32Property.ReadValue(reader)), ueType, index);
855
+ property = new SetProperty(subtype, new Array(elementCount).fill(0).map(() => Int32Property.ReadValue(reader)), ueType, index);
856
856
  break;
857
857
  case "ObjectProperty":
858
- property = new SetProperty(subtype, new Array(elementCount).fill(0).map(e => ObjectProperty.ReadValue(reader)), ueType, index);
858
+ property = new SetProperty(subtype, new Array(elementCount).fill(0).map(() => ObjectProperty.ReadValue(reader)), ueType, index);
859
859
  break;
860
860
  case "NameProperty":
861
- property = new SetProperty(subtype, new Array(elementCount).fill(0).map(e => StrProperty.ReadValue(reader)), ueType, index);
861
+ property = new SetProperty(subtype, new Array(elementCount).fill(0).map(() => StrProperty.ReadValue(reader)), ueType, index);
862
862
  break;
863
863
  case "StructProperty":
864
864
  if (propertyName === 'mRemovalLocations') {
865
- property = new SetProperty(subtype, new Array(elementCount).fill(0).map(e => (0, util_types_1.ParseVec3)(reader)), ueType, index);
865
+ property = new SetProperty(subtype, new Array(elementCount).fill(0).map(() => (0, util_types_1.ParseVec3)(reader)), ueType, index);
866
866
  }
867
867
  break;
868
868
  default:
@@ -932,6 +932,7 @@
932
932
  const data = {
933
933
  type, properties: {}
934
934
  };
935
+ const pos = reader.getBufferPosition();
935
936
  let propertyName = reader.readString();
936
937
  while (propertyName !== 'None') {
937
938
  const property = DataFields_1.DataFields.ParseProperty(reader, buildVersion, propertyName);
@@ -1,8 +1,11 @@
1
- import { ByteReader } from "../../byte/byte-reader.class";
1
+ import { BinaryReadable } from "../../byte/binary-readable.interface";
2
2
  import { ByteWriter } from "../../byte/byte-writer.class";
3
- import { SaveObject } from "./SaveObject";
3
+ import { SaveObject, SaveObjectHeader } from "./SaveObject";
4
4
  export declare const isSaveComponent: (obj: any) => obj is SaveComponent;
5
- export declare class SaveComponent extends SaveObject {
5
+ export interface SaveComponentHeader extends SaveObjectHeader {
6
+ parentEntityName: string;
7
+ }
8
+ export declare class SaveComponent extends SaveObject implements SaveComponentHeader {
6
9
  typePath: string;
7
10
  rootObject: string;
8
11
  instanceName: string;
@@ -10,7 +13,7 @@ export declare class SaveComponent extends SaveObject {
10
13
  static readonly TypeID = 0;
11
14
  readonly type = "SaveComponent";
12
15
  constructor(typePath: string, rootObject: string, instanceName: string, parentEntityName?: string);
13
- static ParseHeader(reader: ByteReader, obj: SaveComponent): void;
16
+ static ParseHeader(reader: BinaryReadable, obj: SaveComponent): void;
14
17
  static SerializeHeader(writer: ByteWriter, component: SaveComponent): void;
15
- static ParseData(component: SaveComponent, length: number, reader: ByteReader, buildVersion: number): void;
18
+ static ParseData(component: SaveComponent, length: number, reader: BinaryReadable, buildVersion: number, typePath: string): void;
16
19
  }
@@ -32,8 +32,8 @@
32
32
  SaveObject_1.SaveObject.SerializeHeader(writer, component);
33
33
  writer.writeString(component.parentEntityName);
34
34
  }
35
- static ParseData(component, length, reader, buildVersion) {
36
- SaveObject_1.SaveObject.ParseData(component, length, reader, buildVersion);
35
+ static ParseData(component, length, reader, buildVersion, typePath) {
36
+ SaveObject_1.SaveObject.ParseData(component, length, reader, buildVersion, typePath);
37
37
  }
38
38
  }
39
39
  SaveComponent.TypeID = 0;
@@ -1,9 +1,14 @@
1
- import { ByteReader } from "../../byte/byte-reader.class";
1
+ import { BinaryReadable } from "../../byte/binary-readable.interface";
2
2
  import { ByteWriter } from "../../byte/byte-writer.class";
3
3
  import { Transform } from "../structs/util.types";
4
4
  import { ObjectReference } from "./ObjectReference";
5
- import { SaveObject } from "./SaveObject";
5
+ import { SaveObject, SaveObjectHeader } from "./SaveObject";
6
6
  export declare const isSaveEntity: (obj: any) => obj is SaveEntity;
7
+ export interface SaveEntityHeader extends SaveObjectHeader {
8
+ needTransform: boolean;
9
+ transform: Transform;
10
+ wasPlacedInLevel: boolean;
11
+ }
7
12
  export declare class SaveEntity extends SaveObject {
8
13
  typePath: string;
9
14
  rootObject: string;
@@ -18,8 +23,8 @@ export declare class SaveEntity extends SaveObject {
18
23
  parentObjectName: string;
19
24
  components: ObjectReference[];
20
25
  constructor(typePath: string, rootObject: string, instanceName: string, parentEntityName?: string, needsTransform?: boolean);
21
- static ParseHeader(reader: ByteReader, obj: SaveEntity): void;
22
- static ParseData(entity: SaveEntity, length: number, reader: ByteReader, buildVersion: number): void;
26
+ static ParseHeader(reader: BinaryReadable, obj: SaveEntity): void;
27
+ static ParseData(entity: SaveEntity, length: number, reader: BinaryReadable, buildVersion: number, typePath: string): void;
23
28
  static SerializeHeader(writer: ByteWriter, entity: SaveEntity): void;
24
29
  static SerializeData(writer: ByteWriter, entity: SaveEntity, buildVersion: number): void;
25
30
  }
@@ -42,7 +42,7 @@
42
42
  obj.transform = (0, util_types_1.ParseTransform)(reader);
43
43
  obj.wasPlacedInLevel = reader.readInt32() == 1;
44
44
  }
45
- static ParseData(entity, length, reader, buildVersion) {
45
+ static ParseData(entity, length, reader, buildVersion, typePath) {
46
46
  var newLen = length - 12;
47
47
  entity.parentObjectRoot = reader.readString();
48
48
  if (entity.parentObjectRoot.length > 0)
@@ -56,7 +56,7 @@
56
56
  entity.components.push(componentRef);
57
57
  newLen -= 10 + componentRef.levelName.length + componentRef.pathName.length;
58
58
  }
59
- SaveObject_1.SaveObject.ParseData(entity, newLen, reader, buildVersion);
59
+ return SaveObject_1.SaveObject.ParseData(entity, newLen, reader, buildVersion, typePath);
60
60
  }
61
61
  static SerializeHeader(writer, entity) {
62
62
  SaveObject_1.SaveObject.SerializeHeader(writer, entity);