Skip to content

Commit 48d3c80

Browse files
committed
New IDEVersion struct in GeneralInfo
1 parent a0dcfaf commit 48d3c80

1 file changed

Lines changed: 72 additions & 21 deletions

File tree

UndertaleModLib/Models/UndertaleGeneralInfo.cs

Lines changed: 72 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,58 @@ public enum FunctionClassification : ulong
182182
Steam = 0x2000000000000000UL,
183183
UNUSED5 = 2310346608841064448UL,
184184
Shaders = 0x4000000000000000UL,
185-
VertexBuffers = 9223372036854775808UL
185+
VertexBuffers = 0x8000000000000000UL
186+
}
187+
188+
/// <summary>
189+
/// The GameMaker IDE Version this game was made in.
190+
/// </summary>
191+
/// <remarks>
192+
/// UTMT also uses this to track the data file format for games made in
193+
/// GMS2 since the version stored in GEN8 is no longer being updated.
194+
/// </remarks>
195+
public struct IDEVersion
196+
{
197+
/// <summary>
198+
/// The most significant version part.
199+
///
200+
/// This can be 1, 2 or a year after 2021.
201+
/// </summary>
202+
/// <remarks>
203+
/// If greater than 1, serialization produces "2.0.0.0" due to the flag no longer updating in data.win
204+
/// </remarks>
205+
public uint Major = 1;
206+
207+
/// <summary>
208+
/// The second-most significant version part.
209+
/// </summary>
210+
public uint Minor = 0;
211+
212+
/// <summary>
213+
/// The third-most significant version part.
214+
/// </summary>
215+
public uint Release = 0;
216+
217+
/// <summary>
218+
/// The fourth-most (least) significant version part.
219+
/// </summary>
220+
public uint Build = 1337;
221+
222+
/// <summary>
223+
/// The GameMaker release branch of the data file. May be set to <see cref="BranchType.Post2022_0"/> when features exempted from LTS are detected.
224+
/// </summary>
225+
public BranchType Branch = BranchType.Pre2022_0;
226+
}
227+
228+
/// <summary>
229+
/// Different GameMaker release branches. LTS has some but not all features of equivalent newer versions.
230+
/// </summary>
231+
// TODO: implement LTS 2026
232+
public enum BranchType
233+
{
234+
Pre2022_0,
235+
LTS2022_0,
236+
Post2022_0
186237
}
187238

188239
/// <summary>
@@ -191,13 +242,18 @@ public enum FunctionClassification : ulong
191242
public bool IsDebuggerDisabled { get; set; } = true;
192243

193244
/// <summary>
194-
/// The bytecode version of the data file.
245+
/// The bytecode version of the data file, (theoretically) indicating the data file format version.
195246
/// </summary>
247+
/// <remarks>
248+
/// It's theoretical because this is stuck on 17 since GMS2 and this library uses
249+
/// the IDE version (via version checks) for those modern versions instead.
250+
/// </remarks>
196251
public byte BytecodeVersion { get; set; } = 0x10;
197252

198253
/// <summary>
199254
/// Likely padding, IsDebuggerDisabled and BytecodeVersion are written together as a 32-bit integer
200255
/// </summary>
256+
// TODO: this can probably be removed
201257
public ushort Padding { get; set; } = 0;
202258

203259
/// <summary>
@@ -211,17 +267,17 @@ public enum FunctionClassification : ulong
211267
public UndertaleString Config { get; set; }
212268

213269
/// <summary>
214-
/// The last object id of the data file.
270+
/// The last object ID of the data file.
215271
/// </summary>
216272
public uint LastObj { get; set; } = 100000;
217273

218274
/// <summary>
219-
/// The last tile id of the data file.
275+
/// The last tile ID of the data file.
220276
/// </summary>
221277
public uint LastTile { get; set; } = 10000000;
222278

223279
/// <summary>
224-
/// The game id of the data file.
280+
/// The game ID of the data file.
225281
/// </summary>
226282
public uint GameID { get; set; } = 13371337;
227283

@@ -237,40 +293,35 @@ public enum FunctionClassification : ulong
237293
public UndertaleString Name { get; set; }
238294

239295
/// <summary>
240-
/// Different GameMaker release branches. LTS has some but not all features of equivalent newer versions.
241-
/// </summary>
242-
public enum BranchType
243-
{
244-
Pre2022_0,
245-
LTS2022_0,
246-
Post2022_0
247-
}
248-
249-
/// <summary>
250-
/// The GameMaker release branch of the data file. May be set to <see cref="BranchType.Post2022_0"/> when features exempted from LTS are detected.
296+
/// The GameMaker IDE Version this game was made in.
251297
/// </summary>
252-
public BranchType Branch = BranchType.Pre2022_0;
298+
public IDEVersion Version;
253299

254300
/// <summary>
255301
/// The major version of the data file.
256302
/// If greater than 1, serialization produces "2.0.0.0" due to the flag no longer updating in data.win
257303
/// </summary>
258-
public uint Major { get; set; } = 1;
304+
public uint Major { get => Version.Major; set { Version.Major = value; } }
259305

260306
/// <summary>
261307
/// The minor version of the data file.
262308
/// </summary>
263-
public uint Minor { get; set; } = 0;
309+
public uint Minor { get => Version.Minor; set { Version.Minor = value; } }
264310

265311
/// <summary>
266312
/// The Release version of the data file.
267313
/// </summary>
268-
public uint Release { get; set; } = 0;
314+
public uint Release { get => Version.Release; set { Version.Release = value; } }
269315

270316
/// <summary>
271317
/// The build version of the data file.
272318
/// </summary>
273-
public uint Build { get; set; } = 1337;
319+
public uint Build { get => Version.Build; set { Version.Build = value; } }
320+
321+
/// <summary>
322+
/// The GameMaker release branch of the data file. May be set to <see cref="BranchType.Post2022_0"/> when features exempted from LTS are detected.
323+
/// </summary>
324+
public BranchType Branch { get => Version.Branch; set { Version.Branch = value; } }
274325

275326
/// <summary>
276327
/// The default window width of the game.

0 commit comments

Comments
 (0)