Skip to content

Commit 7e5f12d

Browse files
Merge pull request #129 from Kjir/master
Add support for save version 66.3 (July 2025 patch)
2 parents 6e16b1f + 60ef2d5 commit 7e5f12d

6 files changed

Lines changed: 28 additions & 9 deletions

File tree

mgz/fast/header.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ def parse_lobby(data, version, save):
175175
data.read(8)
176176
if save >= 64.3:
177177
data.read(16)
178+
if save >= 66.3:
179+
data.read(1)
178180
data.read(8)
179181
if version not in (Version.DE, Version.HD):
180182
data.read(1)
@@ -280,7 +282,9 @@ def parse_scenario(data, num_players, version, save):
280282
map_id, difficulty_id = unpack('<II', data)
281283
remainder = data.read()
282284
if version is Version.DE:
283-
if save >= 64.3:
285+
if save >= 66.3:
286+
settings_version = 4.5
287+
elif save >= 64.3:
284288
settings_version = 4.1
285289
elif save >= 63:
286290
settings_version = 3.9
@@ -406,7 +410,7 @@ def parse_de(data, version, save, skip=False):
406410
if save > 50:
407411
data.read(1)
408412
players = []
409-
for _ in range(num_players if save >= 37 else 8):
413+
for _ in range(num_players if 66.3 > save >= 37 else 8):
410414
data.read(4)
411415
color_id = unpack('<i', data)
412416
data.read(2)
@@ -424,6 +428,8 @@ def parse_de(data, version, save, skip=False):
424428
data.read(1)
425429
ai_name = de_string(data)
426430
name = de_string(data)
431+
if save >= 66.3:
432+
_name2 = de_string(data)
427433
type = unpack('<I', data)
428434
profile_id, number = unpack('<I4xi', data)
429435
if save < 25.22:
@@ -448,7 +454,7 @@ def parse_de(data, version, save, skip=False):
448454
prefer_random=prefer_random == 1
449455
))
450456
data.read(12)
451-
if save >= 37:
457+
if 66.3 > save >= 37:
452458
for _ in range(8 - num_players):
453459
if save >= 61.5:
454460
data.read(4)
@@ -509,6 +515,8 @@ def parse_de(data, version, save, skip=False):
509515
data.read(1)
510516
if save >= 63:
511517
data.read(5)
518+
if save >= 66.3:
519+
data.read(16)
512520
if not skip:
513521
de_string(data)
514522
data.read(8)

mgz/header/de.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@
3434
"ai_civ_name_index"/Byte,
3535
"ai_name"/de_string,
3636
"name"/de_string,
37+
"name2"/If(lambda ctx: find_save_version(ctx) >= 66.3,de_string),
3738
"type"/PlayerTypeEnum(Int32ul),
38-
"profile_id"/Int32ul,
39+
"profile_id"/Int32sl, # -1 if it's an empty slot
3940
"ai_unknown" / Int32sl, # Often 0, sometimes -1 for AI players
4041
"player_number"/Int32sl,
4142
"hd_rm_elo"/If(lambda ctx: find_save_version(ctx) < 25.22, Int32ul),
@@ -106,12 +107,12 @@
106107
"handicap"/If(lambda ctx: find_save_version(ctx) >= 25.06, Flag),
107108
"unk"/If(lambda ctx: find_save_version(ctx) >= 50, Flag),
108109
separator,
109-
"players"/Array(lambda ctx: ctx.num_players if find_save_version(ctx) >= 37 else 8, player),
110+
"players"/Array(lambda ctx: ctx.num_players if find_save_version(ctx) >= 37 and find_save_version(ctx) < 66.3 else 8, player),
110111
Bytes(9),
111112
"fog_of_war"/Flag,
112113
"cheat_notifications"/Flag,
113114
"colored_chat"/Flag,
114-
"empty_slots"/If(lambda ctx: find_save_version(ctx) >= 37, Array(lambda ctx: 8 - ctx.num_players, Struct(
115+
"empty_slots"/If(lambda ctx: find_save_version(ctx) >= 37 and find_save_version(ctx) < 66.3, Array(lambda ctx: 8 - ctx.num_players, Struct(
115116
"unk"/If(lambda ctx: find_save_version(ctx) >= 61.5, Int32ul),
116117
"i0x"/Int32ul,
117118
"i0a"/Int32ul,
@@ -162,6 +163,9 @@
162163
If(lambda ctx: find_save_version(ctx) >= 50, Bytes(8)),
163164
If(lambda ctx: find_save_version(ctx) >= 61.5, Flag),
164165
If(lambda ctx: find_save_version(ctx) >= 63, Bytes(5)),
166+
"unknown_count"/If(lambda ctx: find_save_version(ctx) >= 66.3, Int32ul),
167+
If(lambda ctx: find_save_version(ctx) >= 66.3, Bytes(12)),
168+
If(lambda ctx: find_save_version(ctx) >= 66.3, Array(lambda ctx: ctx.unknown_count, Bytes(4))),
165169
de_string,
166170
Bytes(5),
167171
If(lambda ctx: find_save_version(ctx) >= 13.13, Byte),

mgz/header/lobby.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
If(lambda ctx: find_save_version(ctx) >= 26.16, Bytes(5)),
1616
If(lambda ctx: find_save_version(ctx) >= 37, Bytes(8)),
1717
If(lambda ctx: find_save_version(ctx) >= 64.3, Bytes(16)),
18+
If(lambda ctx: find_save_version(ctx) >= 66.3, Bytes(1)),
1819
Array(8, "teams"/Byte), # team number selected by each player
1920
If(lambda ctx: ctx._.version not in (Version.DE, Version.HD),
2021
Padding(1),
@@ -60,6 +61,7 @@
6061
If(lambda ctx: find_save_version(ctx) >= 26.16, Bytes(4)),
6162
If(lambda ctx: find_save_version(ctx) >= 37, Bytes(4)),
6263
If(lambda ctx: find_save_version(ctx) >= 50, Bytes(1)),
64+
If(lambda ctx: find_save_version(ctx) >= 66.3, Bytes(4)),
6365
)
6466
)
6567
)

mgz/header/objects.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
"pathing_group_len"/Int32ul,
8282
"pathing_group"/Array(lambda ctx: ctx.pathing_group_len, "object_id"/Int32ul)
8383
)),
84+
If(lambda ctx: find_save_version(ctx) >= 66.3, Bytes(2)),
8485
"group_id"/Int32sl,
8586
"roo_already_called"/Byte,
8687
"de_static_unk1"/If(lambda ctx: find_version(ctx) == Version.DE, Bytes(17)),
@@ -127,7 +128,8 @@
127128
If(lambda ctx: ctx.type > 0, Bytes(16))
128129
))
129130
))
130-
))
131+
)),
132+
If(lambda ctx: find_save_version(ctx) >= 66.3, Bytes(4)),
131133
)
132134

133135

@@ -400,6 +402,7 @@
400402
Embedded(base_combat),
401403
"de_pre"/If(lambda ctx: find_version(ctx) == Version.DE and find_save_version(ctx) < 37, Bytes(4)),
402404
"de"/If(lambda ctx: find_version(ctx) == Version.DE, Bytes(14)),
405+
"de_unknown_66_3_1"/If(lambda ctx: find_save_version(ctx) >= 66.3, Bytes(4)),
403406
"de_2"/If(lambda ctx: find_save_version(ctx) >= 26.16, Bytes(16)),
404407
"de_3"/If(lambda ctx: 63 > find_save_version(ctx) >= 26.18, Bytes(1)),
405408
"de_4"/If(lambda ctx: find_save_version(ctx) >= 61.5, Bytes(4)),
@@ -497,6 +500,7 @@
497500
"de_unk_5"/If(lambda ctx: find_save_version(ctx) >= 50.4, Bytes(4)),
498501
"de_unk_6"/If(lambda ctx: find_save_version(ctx) >= 61.5, Bytes(12)),
499502
"de_unk_7"/If(lambda ctx: find_save_version(ctx) >= 64.3, Bytes(4)),
503+
"de_unknown_66_3_2"/If(lambda ctx: find_save_version(ctx) >= 66.3, Bytes(5)),
500504
)
501505

502506

mgz/header/scenario.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,11 @@
153153
If(lambda ctx: 61.5 > find_save_version(ctx) >= 37, Find(struct.pack('<d', 3.5), None)),
154154
If(lambda ctx: 63 > find_save_version(ctx) >= 61.5, Find(struct.pack('<d', 3.6), None)),
155155
If(lambda ctx: 64.3 > find_save_version(ctx) >= 63, Find(struct.pack('<d', 3.9), None)),
156-
If(lambda ctx: find_save_version(ctx) >= 64.3, Find(struct.pack('<d', 4.1), None)),
156+
If(lambda ctx: 66.3 > find_save_version(ctx) >= 64.3, Find(struct.pack('<d', 4.1), None)),
157+
If(lambda ctx: find_save_version(ctx) >= 66.3, Find(struct.pack('<d', 4.5), None)),
157158
),
158159
"end_of_game_settings"/Find(b'\x9a\x99\x99\x99\x99\x99\xf9\\x3f', None),
159-
)
160+
),
160161
)
161162

162163

tests/recs/de-66.3.aoe2record

5.55 MB
Binary file not shown.

0 commit comments

Comments
 (0)