Update StaticAddressTemplates.cs
Store pointer to pointers in case the resolver is fired before the client is loaded.
namespace {{ struct.namespace }} {
public unsafe partial struct {{ struct.name }} {
{{~ for sa in struct.addresses ~}}
- public static {{ sa.type }} p{{ sa.name }} { internal set; get; }
+ public static {{ sa.type }}{{ if sa.is_pointer }}* p{{ end }}p{{ sa.name }} { internal set; get; }
public static partial {{ sa.type }} {{ sa.name }}()
{
- if (p{{ sa.name }} is null)
+ if ({{ if sa.is_pointer }}p{{ end }}p{{ sa.name }} is null)
{
throw new InvalidOperationException(""Static pointer for {{ struct.name }}::{{ sa.name }} is null. Did you forget to call Resolver.Initialize?"");
}
- return p{{ sa.name }};
+ return {{ if sa.is_pointer }}*p{{ end }}p{{ sa.name }};
}
{{~ end ~}}
}
@@ -33,7 +33,7 @@ namespace FFXIVClientStructs {
{{~ for sa in struct.addresses ~}}
try {
var address{{ struct.name }}{{ sa.name }} = s.GetStaticAddressFromSig(""{{ sa.signature }}"", {{ sa.offset }});
- {{ struct.namespace }}.{{ struct.name }}.p{{ sa.name }} = {{ if sa.is_pointer }}*{{ end }}({{ sa.type }}{{ if sa.is_pointer }}*{{ end }})address{{ struct.name }}{{ sa.name }};
+ {{ struct.namespace }}.{{ struct.name }}.{{ if sa.is_pointer }}p{{ end }}p{{ sa.name }} = ({{ sa.type }}{{ if sa.is_pointer }}*{{ end }})address{{ struct.name }}{{ sa.name }};
} catch (KeyNotFoundException) {
Log.Warning($""[FFXIVClientStructs] static address {{ struct.name }}::{{ sa.name }} failed to match signature {{ sa.signature }} and is unavailable"");
}
