Update Utf8String.cs
change implicit string conversion to ToString() override
@@ -14,14 +14,14 @@ namespace FFXIVClientStructs.FFXIV.Client.System.String
[FieldOffset(0x8)] public long BufSize; // default buffer = 0x40
[FieldOffset(0x10)] public long BufUsed;
[FieldOffset(0x18)] public long StringLength; // string length not including null terminator
- [FieldOffset(0x20)] public ushort Unk; // default: 0x101
+ [FieldOffset(0x20)] public byte IsEmpty;
+ [FieldOffset(0x21)] public byte IsUsingInlineBuffer;
[FieldOffset(0x22)] public fixed byte InlineBuffer[0x40]; // inline buffer used until strlen > 0x40
- public static implicit operator string(Utf8String str) {
- var ptr = str.StringLength > str.BufSize ? str.StringPtr : str.InlineBuffer;
- if (str.StringLength == 0 || ptr == null)
+ public override string ToString() {
+ if (StringPtr == null || BufUsed <= 1)
return string.Empty;
- return Encoding.UTF8.GetString(ptr, (int)str.StringLength);
+ return Encoding.UTF8.GetString(StringPtr, (int)BufUsed - 1);
}
}
}
