mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Use UI3DModule for GameObject lookups, avoiding object table scan
This commit is contained in:
parent
9a1a32c03e
commit
bceca96998
3 changed files with 11 additions and 3 deletions
|
|
@ -102,7 +102,7 @@ internal sealed class NamePlateGui : IInternalDisposableService, INamePlateGui
|
|||
/// <returns>A span containing the free company tag without its surrounding quote characters.</returns>
|
||||
internal static ReadOnlySpan<byte> StripFreeCompanyTagQuotes(ReadOnlySpan<byte> text)
|
||||
{
|
||||
if (text.Length > 4 && text[..3].SequenceEqual(" «"u8) && text[^2..].SequenceEqual("»"u8))
|
||||
if (text.Length > 4 && text.StartsWith(" «"u8) && text.EndsWith("»"u8))
|
||||
{
|
||||
return text[3..^2];
|
||||
}
|
||||
|
|
@ -118,7 +118,7 @@ internal sealed class NamePlateGui : IInternalDisposableService, INamePlateGui
|
|||
/// <returns>A span containing the title without its surrounding quote characters.</returns>
|
||||
internal static ReadOnlySpan<byte> StripTitleQuotes(ReadOnlySpan<byte> text)
|
||||
{
|
||||
if (text.Length > 5 && text[..3].SequenceEqual("《"u8) && text[^3..].SequenceEqual("》"u8))
|
||||
if (text.Length > 5 && text.StartsWith("《"u8) && text.EndsWith("》"u8))
|
||||
{
|
||||
return text[3..^3];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ internal unsafe class NamePlateUpdateContext : INamePlateUpdateContext
|
|||
{
|
||||
this.ObjectTable = objectTable;
|
||||
this.RaptureAtkModule = FFXIVClientStructs.FFXIV.Client.UI.RaptureAtkModule.Instance();
|
||||
this.Ui3DModule = UIModule.Instance()->GetUI3DModule();
|
||||
this.ResetState(args);
|
||||
}
|
||||
|
||||
|
|
@ -98,6 +99,11 @@ internal unsafe class NamePlateUpdateContext : INamePlateUpdateContext
|
|||
/// </summary>
|
||||
internal RaptureAtkModule* RaptureAtkModule { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Ui3DModule.
|
||||
/// </summary>
|
||||
internal UI3DModule* Ui3DModule { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ObjectTable.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -327,7 +327,9 @@ internal unsafe class NamePlateUpdateHandler : INamePlateUpdateHandler
|
|||
public ulong GameObjectId => this.gameObjectId ??= this.NamePlateInfo->ObjectId;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IGameObject? GameObject => this.gameObject ??= this.context.ObjectTable.SearchById(this.GameObjectId);
|
||||
public IGameObject? GameObject => this.gameObject ??= this.context.ObjectTable.CreateObjectReference(
|
||||
(nint)this.context.Ui3DModule->NamePlateObjectInfoPointers[
|
||||
this.ArrayIndex].Value->GameObject);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IBattleChara? BattleChara => this.GameObject as IBattleChara;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue