Restore Create<AtkTextNode> (#1449)

This commit is contained in:
MidoriKami 2023-10-03 13:35:35 -07:00 committed by GitHub
parent 2cfd96a1fe
commit eb835548d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -417,7 +417,7 @@ internal sealed unsafe class DtrBar : IDisposable, IServiceType, IDtrBar
private AtkTextNode* MakeNode(uint nodeId)
{
var newTextNode = AtkUldManager.CreateAtkTextNode();
var newTextNode = IMemorySpace.GetUISpace()->Create<AtkTextNode>(); // AtkUldManager.CreateAtkTextNode();
if (newTextNode == null)
{
Log.Debug("Failed to allocate memory for AtkTextNode");
@ -443,15 +443,16 @@ internal sealed unsafe class DtrBar : IDisposable, IServiceType, IDtrBar
newTextNode->TextColor = new ByteColor { R = 255, G = 255, B = 255, A = 255 };
newTextNode->EdgeColor = new ByteColor { R = 142, G = 106, B = 12, A = 255 };
// Memory is filled with random data after being created, zero out some things to avoid issues.
newTextNode->UnkPtr_1 = null;
newTextNode->SelectStart = 0;
newTextNode->SelectEnd = 0;
newTextNode->FontCacheHandle = 0;
newTextNode->CharSpacing = 0;
newTextNode->BackgroundColor = new ByteColor { R = 0, G = 0, B = 0, A = 0 };
newTextNode->TextId = 0;
newTextNode->SheetType = 0;
// ICreatable was restored, this may be necessary if AtkUldManager.CreateAtkTextNode(); is used instead of Create<T>
// // Memory is filled with random data after being created, zero out some things to avoid issues.
// newTextNode->UnkPtr_1 = null;
// newTextNode->SelectStart = 0;
// newTextNode->SelectEnd = 0;
// newTextNode->FontCacheHandle = 0;
// newTextNode->CharSpacing = 0;
// newTextNode->BackgroundColor = new ByteColor { R = 0, G = 0, B = 0, A = 0 };
// newTextNode->TextId = 0;
// newTextNode->SheetType = 0;
return newTextNode;
}