mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-14 20:54:16 +01:00
Use correct collections on login screen.
This commit is contained in:
parent
be2260dc51
commit
a47a14fe95
2 changed files with 58 additions and 42 deletions
|
|
@ -11,6 +11,7 @@ using FFXIVClientStructs.FFXIV.Client.Game.Object;
|
||||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
|
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
|
||||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||||
|
using Lumina.Data.Parsing.Uld;
|
||||||
using Penumbra.Api;
|
using Penumbra.Api;
|
||||||
using Penumbra.Collections;
|
using Penumbra.Collections;
|
||||||
using Penumbra.GameData.ByteString;
|
using Penumbra.GameData.ByteString;
|
||||||
|
|
@ -151,15 +152,12 @@ public unsafe partial class PathResolver
|
||||||
// Check that a linked DrawObject still corresponds to the correct actor and that it still exists, otherwise remove it.
|
// Check that a linked DrawObject still corresponds to the correct actor and that it still exists, otherwise remove it.
|
||||||
private bool VerifyEntry( IntPtr drawObject, int gameObjectIdx, out GameObject* gameObject )
|
private bool VerifyEntry( IntPtr drawObject, int gameObjectIdx, out GameObject* gameObject )
|
||||||
{
|
{
|
||||||
var tmp = Dalamud.Objects[ gameObjectIdx ];
|
gameObject = ( GameObject* )Dalamud.Objects.GetObjectAddress( gameObjectIdx );
|
||||||
if( tmp != null )
|
var draw = ( DrawObject* )drawObject;
|
||||||
{
|
if( gameObject != null && gameObject->DrawObject == draw || gameObject->DrawObject == draw->Object.ParentObject )
|
||||||
gameObject = ( GameObject* )tmp.Address;
|
|
||||||
if( gameObject->DrawObject == ( DrawObject* )drawObject )
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
gameObject = null;
|
gameObject = null;
|
||||||
DrawObjectToObject.Remove( drawObject );
|
DrawObjectToObject.Remove( drawObject );
|
||||||
|
|
@ -293,6 +291,16 @@ public unsafe partial class PathResolver
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
// Login screen. Names are populated after actors are drawn,
|
||||||
|
// so it is not possible to fetch names from the ui list.
|
||||||
|
// Actors are also not named. So use Yourself > Players > Racial > Default.
|
||||||
|
if( !Dalamud.ClientState.IsLoggedIn )
|
||||||
|
{
|
||||||
|
return Penumbra.CollectionManager.ByType( CollectionType.Yourself )
|
||||||
|
?? ( CollectionByActor( string.Empty, gameObject, out var c ) ? c : Penumbra.CollectionManager.Default );
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// Housing Retainers
|
// Housing Retainers
|
||||||
if( Penumbra.Config.UseDefaultCollectionForRetainers
|
if( Penumbra.Config.UseDefaultCollectionForRetainers
|
||||||
|
|
@ -334,6 +342,7 @@ public unsafe partial class PathResolver
|
||||||
? c
|
? c
|
||||||
: Penumbra.CollectionManager.Default;
|
: Penumbra.CollectionManager.Default;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch( Exception e )
|
catch( Exception e )
|
||||||
{
|
{
|
||||||
PluginLog.Error( $"Error identifying collection:\n{e}" );
|
PluginLog.Error( $"Error identifying collection:\n{e}" );
|
||||||
|
|
@ -459,7 +468,7 @@ public unsafe partial class PathResolver
|
||||||
// Update collections linked to Game/DrawObjects due to a change in collection configuration.
|
// Update collections linked to Game/DrawObjects due to a change in collection configuration.
|
||||||
private void CheckCollections( CollectionType type, ModCollection? _1, ModCollection? _2, string? name )
|
private void CheckCollections( CollectionType type, ModCollection? _1, ModCollection? _2, string? name )
|
||||||
{
|
{
|
||||||
if( type is not (CollectionType.Character or CollectionType.Default) )
|
if( type is CollectionType.Inactive or CollectionType.Current )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -515,12 +524,13 @@ public unsafe partial class PathResolver
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find all current DrawObjects used in the GameObject table.
|
// Find all current DrawObjects used in the GameObject table.
|
||||||
|
// We do not iterate the Dalamud table because it does not work when not logged in.
|
||||||
private void InitializeDrawObjects()
|
private void InitializeDrawObjects()
|
||||||
{
|
{
|
||||||
foreach( var gameObject in Dalamud.Objects )
|
for( var i = 0; i < Dalamud.Objects.Length; ++i )
|
||||||
{
|
{
|
||||||
var ptr = ( GameObject* )gameObject.Address;
|
var ptr = ( GameObject* )Dalamud.Objects.GetObjectAddress( i );
|
||||||
if( ptr->IsCharacter() && ptr->DrawObject != null )
|
if( ptr != null && ptr->IsCharacter() && ptr->DrawObject != null )
|
||||||
{
|
{
|
||||||
DrawObjectToObject[ ( IntPtr )ptr->DrawObject ] = ( IdentifyCollection( ptr ), ptr->ObjectIndex );
|
DrawObjectToObject[ ( IntPtr )ptr->DrawObject ] = ( IdentifyCollection( ptr ), ptr->ObjectIndex );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,13 @@ using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using FFXIVClientStructs.FFXIV.Client.Game.Character;
|
using FFXIVClientStructs.FFXIV.Client.Game.Character;
|
||||||
|
using FFXIVClientStructs.FFXIV.Client.Game.Object;
|
||||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
|
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
|
||||||
using FFXIVClientStructs.FFXIV.Client.System.Resource;
|
using FFXIVClientStructs.FFXIV.Client.System.Resource;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using OtterGui;
|
using OtterGui;
|
||||||
using OtterGui.Raii;
|
using OtterGui.Raii;
|
||||||
|
using Penumbra.GameData.ByteString;
|
||||||
using Penumbra.Interop.Loader;
|
using Penumbra.Interop.Loader;
|
||||||
using Penumbra.Interop.Structs;
|
using Penumbra.Interop.Structs;
|
||||||
using CharacterUtility = Penumbra.Interop.CharacterUtility;
|
using CharacterUtility = Penumbra.Interop.CharacterUtility;
|
||||||
|
|
@ -166,9 +168,12 @@ public partial class ConfigWindow
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.TextUnformatted( idx.ToString() );
|
ImGui.TextUnformatted( idx.ToString() );
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.TextUnformatted( Dalamud.Objects[ idx ]?.Address.ToString() ?? "NULL" );
|
var obj = ( GameObject* )Dalamud.Objects.GetObjectAddress( idx );
|
||||||
|
var (address, name) =
|
||||||
|
obj != null ? ( $"0x{( ulong )obj:X}", new Utf8String( obj->Name ).ToString() ) : ( "NULL", "NULL" );
|
||||||
|
ImGui.TextUnformatted( address );
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.TextUnformatted( Dalamud.Objects[ idx ]?.Name.ToString() ?? "NULL" );
|
ImGui.TextUnformatted( name );
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.TextUnformatted( c.Name );
|
ImGui.TextUnformatted( c.Name );
|
||||||
}
|
}
|
||||||
|
|
@ -399,6 +404,7 @@ public partial class ConfigWindow
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_window._penumbra.Ipc.Tester.Draw();
|
_window._penumbra.Ipc.Tester.Draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue