Skip to content

Commit 7e04328

Browse files
authored
Merge pull request #631 from monkeyman192/update/17176007
Update for Worlds Part 2
2 parents 4920f0d + fe94366 commit 7e04328

File tree

2,511 files changed

+18360
-16514
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,511 files changed

+18360
-16514
lines changed

Tools/auto_extract/extractor.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,12 @@
156156
# methods.
157157
# TODO: If the GUID changes we need to raise an important message so that we may
158158
# fix it manually.
159-
DONT_OVERRIDE = [
160-
'TkAnimNodeFrameData',
159+
DONT_OVERRIDE = {
160+
'TkAnimNodeFrameData': 0xDD8A411B84D2D5DC,
161161
# 'TkAnimNodeFrameHalfData',
162-
'TkGeometryData',
163-
'TkMeshData',
164-
]
162+
'TkGeometryData': 0xED9C2FCDA6D4B22F,
163+
'TkMeshData': 0xA5E773D3424BA9FA,
164+
}
165165

166166
SUMMARY_FILE = op.join(op.dirname(__file__), 'summary.txt')
167167
TEMPLATES_DIR = op.join(op.dirname(__file__), TEMPLATE_DIR)
@@ -304,7 +304,7 @@ def __init__(self, data: bytes, nms_mem):
304304
self._is_list_field = False
305305

306306
# Get the name of the field.
307-
self._field_name = nms_mem.read_string(
307+
self._field_name: str = nms_mem.read_string(
308308
struct.unpack_from('<Q', data, offset=0x0)[0], byte=128
309309
)
310310
# Some field names are annoyingly duplicated in the exe. c# doesn't
@@ -327,15 +327,20 @@ def field_type(self):
327327
f'unknown ({self.raw_field_type:X})'
328328
)
329329

330+
@property
331+
def has_space_in_name(self):
332+
return " " in self._field_name
333+
330334
@property
331335
def field_name(self):
332-
if self._field_name[0].isdigit():
333-
return '_' + self._field_name
336+
field_name = self._field_name.replace(" ", "")
337+
if field_name[0].isdigit():
338+
return '_' + field_name
334339
if self._field_name_is_duplicate:
335-
return self._field_name + '_' + self.field_type
336-
if self._field_name[:2].lower() in {'gc', 'tk'}:
337-
return self._field_name[2:]
338-
return self._field_name
340+
return field_name + '_' + self.field_type
341+
if field_name[:2].lower() in {'gc', 'tk'}:
342+
return field_name[2:]
343+
return field_name
339344

340345
@property
341346
def field_offset(self):
@@ -736,6 +741,8 @@ def read_class(
736741
dir_ = 'Globals'
737742
else:
738743
dir_ = PREFIX_MAPPING.get(name[:3].lower(), "GameComponents")
744+
if name in DONT_OVERRIDE and DONT_OVERRIDE[name] != guid:
745+
print(f'The template {name} has been updated. Please check')
739746
if (config['general'].getboolean('replace_existing_files', fallback=False)
740747
and name[1:] not in DONT_OVERRIDE
741748
):

Tools/auto_extract/templates/default/class_template.j2

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
{%- endif %}
1414
public enum {{ field.field_name }}Enum : {{ field.enum_dtype }} {
1515
{%- for enum_val in field.enum_data %}
16-
{{ enum_val[1] }}{% if field.requires_values %} = {{enum_val[0] }}{% endif %},
16+
{{ enum_val[1] }}{% if field.requires_values %} = {{ enum_val[0] }}{% endif %},
1717
{%- endfor %}
1818
}
19-
[NMS(Index = {{ field.field_index }})]
19+
[NMS(Index = {{ field.field_index }}{% if field.has_space_in_name %}, MxmlName = "{{ field._field_name }}"{% endif %})]
2020
/* {{ field.field_offset }} */ public {{ field.field_name }}Enum {{ field.field_name }};
2121
{%- elif field._is_array_field %}{# End of enum chunk, start of array chunk #}
2222
{%- if field.local_enum %}
@@ -27,16 +27,16 @@
2727
{%- endfor %}
2828
}
2929
{%- endif %}
30-
[NMS(Index = {{ field.field_index }}, Size = {{ field.array_size }}{% if field.array_enum_type is not none %}, EnumType = typeof({{ field.array_enum_type }}){% endif %})]
30+
[NMS(Index = {{ field.field_index }}, Size = {{ field.array_size }}{% if field.array_enum_type is not none %}, EnumType = typeof({{ field.array_enum_type }}){% endif %}{% if field.has_space_in_name %}, MxmlName = "{{ field._field_name }}"{% endif %})]
3131
/* {{ field.field_offset }} */ public {{ field.field_type }}[] {{ field.field_name }};
3232
{%- elif field._is_list_field %}{# End of array chunk, start of list chunk #}
33-
[NMS(Index = {{ field.field_index }})]
33+
[NMS(Index = {{ field.field_index }}{% if field.has_space_in_name %}, MxmlName = "{{ field._field_name }}"{% endif %})]
3434
/* {{ field.field_offset }} */ public List<{{ field.field_type }}> {{ field.field_name }};
3535
{%- elif field._is_hash_map_field %}{# End of array chunk, start of HashMap chunk #}
36-
[NMS(Index = {{ field.field_index }})]
36+
[NMS(Index = {{ field.field_index }}{% if field.has_space_in_name %}, MxmlName = "{{ field._field_name }}"{% endif %})]
3737
/* {{ field.field_offset }} */ public HashMap<{{ field.field_type }}> {{ field.field_name }};
3838
{%- else %}{# End of array chunk, start of normal field chunk #}
39-
[NMS(Index = {{ field.field_index }})]
39+
[NMS(Index = {{ field.field_index }}{% if field.has_space_in_name %}, MxmlName = "{{ field._field_name }}"{% endif %})]
4040
/* {{ field.field_offset }} */ public {{ field.field_type }} {{ field.field_name }};
4141
{%- endif %}
4242
{%- endfor %}

Tools/auto_extract/templates/default/static_templates/TkAnimNodeFrameData.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77

88
namespace libMBIN.NMS.Toolkit
99
{
10-
[NMS(GUID = 0xB2E78D75B9088DB6, NameHash = 0xADF5F9C3)]
10+
[NMS(GUID = 0xDD8A411B84D2D5DC, NameHash = 0xADF5F9C3)]
1111
public class TkAnimNodeFrameData : NMSTemplate
1212
{
1313
[NMS(Index = 0)]
1414
/* 0x00 */ public List<Quaternion> Rotations;
1515
[NMS(Index = 2)]
16-
/* 0x10 */ public List<Vector4f> Scales;
16+
/* 0x10 */ public List<Vector3f> Scales;
1717
[NMS(Index = 1)]
18-
/* 0x20 */ public List<Vector4f> Translations;
18+
/* 0x20 */ public List<Vector3f> Translations;
1919

2020
public override object CustomDeserialize(BinaryReader reader, Type field, NMSAttribute settings, FieldInfo fieldInfo) {
2121
var fieldName = fieldInfo.Name;

Tools/auto_extract/templates/default/static_templates/TkGeometryData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace libMBIN.NMS.Toolkit
88
{
9-
[NMS(GUID = 0x7148DB44E7586C99, NameHash = 0x819C3220)]
9+
[NMS(GUID = 0xED9C2FCDA6D4B22F, NameHash = 0x819C3220)]
1010
public class TkGeometryData : NMSTemplate
1111
{
1212
[NMS(Index = 20)]

Tools/auto_extract/templates/default/static_templates/TkMeshData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace libMBIN.NMS.Toolkit
88
{
9-
[NMS(GUID = 0x70272DC777DDD6BD, NameHash = 0x18D05F06)]
9+
[NMS(GUID = 0xA5E773D3424BA9FA, NameHash = 0x18D05F06)]
1010
public class TkMeshData : NMSTemplate
1111
{
1212
[NMS(Index = 0)]

libMBIN/Source/NMS/GameComponents/AxisSpecification.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace libMBIN.NMS.GameComponents
22
{
3-
[NMS(GUID = 0xBE02DA7E4A80CDBA, NameHash = 0x297A9843)]
3+
[NMS(GUID = 0x7D03FF5D22FE8495, NameHash = 0x297A9843)]
44
public class AxisSpecification : NMSTemplate
55
{
66
[NMS(Index = 1)]

libMBIN/Source/NMS/GameComponents/DirectMesh.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace libMBIN.NMS.GameComponents
22
{
3-
[NMS(GUID = 0x89F8ED6A89A7E06A, NameHash = 0x1A55832)]
3+
[NMS(GUID = 0x7CC2FBC562E1087, NameHash = 0x1A55832)]
44
public class DirectMesh : NMSTemplate
55
{
66
[NMS(Index = 1)]

libMBIN/Source/NMS/GameComponents/GcAIShipDebugSpawnData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace libMBIN.NMS.GameComponents
22
{
3-
[NMS(GUID = 0x3479C5490B000372, NameHash = 0xE69F2F79)]
3+
[NMS(GUID = 0x4E6D8E397C8D606, NameHash = 0xE69F2F79)]
44
public class GcAIShipDebugSpawnData : NMSTemplate
55
{
66
[NMS(Index = 1)]

libMBIN/Source/NMS/GameComponents/GcAIShipSpawnData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace libMBIN.NMS.GameComponents
66
{
7-
[NMS(GUID = 0xAC1E79EB9FFB3722, NameHash = 0x466A95A0)]
7+
[NMS(GUID = 0x1C2A29CB6EF85C1F, NameHash = 0x466A95A0)]
88
public class GcAIShipSpawnData : NMSTemplate
99
{
1010
[NMS(Index = 14)]

libMBIN/Source/NMS/GameComponents/GcAIShipSpawnMarkerData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace libMBIN.NMS.GameComponents
44
{
5-
[NMS(GUID = 0x21D5A3379472120A, NameHash = 0x5934F9B0)]
5+
[NMS(GUID = 0xD0DE56998CFEEF, NameHash = 0x5934F9B0)]
66
public class GcAIShipSpawnMarkerData : NMSTemplate
77
{
88
[NMS(Index = 1)]

0 commit comments

Comments
 (0)