mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-30 12:23:41 +01:00
tmp
This commit is contained in:
parent
3c564add0e
commit
73e2793da6
48 changed files with 4231 additions and 456 deletions
|
|
@ -3,7 +3,8 @@ using System.Collections.Generic;
|
|||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Character;
|
||||
|
||||
using Penumbra.Services;
|
||||
|
||||
namespace Penumbra.Interop.Resolver;
|
||||
|
||||
public class CutsceneCharacters : IDisposable
|
||||
|
|
@ -17,8 +18,8 @@ public class CutsceneCharacters : IDisposable
|
|||
|
||||
public IEnumerable< KeyValuePair< int, global::Dalamud.Game.ClientState.Objects.Types.GameObject > > Actors
|
||||
=> Enumerable.Range( CutsceneStartIdx, CutsceneSlots )
|
||||
.Where( i => Dalamud.Objects[ i ] != null )
|
||||
.Select( i => KeyValuePair.Create( i, this[ i ] ?? Dalamud.Objects[ i ]! ) );
|
||||
.Where( i => DalamudServices.Objects[ i ] != null )
|
||||
.Select( i => KeyValuePair.Create( i, this[ i ] ?? DalamudServices.Objects[ i ]! ) );
|
||||
|
||||
public CutsceneCharacters(GameEventManager events)
|
||||
{
|
||||
|
|
@ -35,7 +36,7 @@ public class CutsceneCharacters : IDisposable
|
|||
{
|
||||
Debug.Assert( idx is >= CutsceneStartIdx and < CutsceneEndIdx );
|
||||
idx = _copiedCharacters[ idx - CutsceneStartIdx ];
|
||||
return idx < 0 ? null : Dalamud.Objects[ idx ];
|
||||
return idx < 0 ? null : DalamudServices.Objects[ idx ];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ using FFXIVClientStructs.FFXIV.Client.Game.Character;
|
|||
using FFXIVClientStructs.FFXIV.Client.Game.Object;
|
||||
using Penumbra.Collections;
|
||||
using Penumbra.GameData.Actors;
|
||||
|
||||
using Penumbra.Services;
|
||||
|
||||
namespace Penumbra.Interop.Resolver;
|
||||
|
||||
public unsafe class IdentifiedCollectionCache : IDisposable, IEnumerable< (IntPtr Address, ActorIdentifier Identifier, ModCollection Collection) >
|
||||
|
|
@ -29,7 +30,7 @@ public unsafe class IdentifiedCollectionCache : IDisposable, IEnumerable< (IntPt
|
|||
|
||||
Penumbra.CollectionManager.CollectionChanged += CollectionChangeClear;
|
||||
Penumbra.TempMods.CollectionChanged += CollectionChangeClear;
|
||||
Dalamud.ClientState.TerritoryChanged += TerritoryClear;
|
||||
DalamudServices.ClientState.TerritoryChanged += TerritoryClear;
|
||||
_events.CharacterDestructor += OnCharacterDestruct;
|
||||
_enabled = true;
|
||||
}
|
||||
|
|
@ -43,7 +44,7 @@ public unsafe class IdentifiedCollectionCache : IDisposable, IEnumerable< (IntPt
|
|||
|
||||
Penumbra.CollectionManager.CollectionChanged -= CollectionChangeClear;
|
||||
Penumbra.TempMods.CollectionChanged -= CollectionChangeClear;
|
||||
Dalamud.ClientState.TerritoryChanged -= TerritoryClear;
|
||||
DalamudServices.ClientState.TerritoryChanged -= TerritoryClear;
|
||||
_events.CharacterDestructor -= OnCharacterDestruct;
|
||||
_enabled = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using Penumbra.Collections;
|
|||
using Penumbra.GameData;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.Interop.Structs;
|
||||
using Penumbra.Services;
|
||||
using Penumbra.String;
|
||||
using Penumbra.String.Classes;
|
||||
using Penumbra.Util;
|
||||
|
|
@ -137,9 +138,9 @@ public unsafe partial class PathResolver
|
|||
{
|
||||
var getGameObjectIdx = ( ( delegate* unmanaged< IntPtr, int >** )timeline )[ 0 ][ Offsets.GetGameObjectIdxVfunc ];
|
||||
var idx = getGameObjectIdx( timeline );
|
||||
if( idx >= 0 && idx < Dalamud.Objects.Length )
|
||||
if( idx >= 0 && idx < DalamudServices.Objects.Length )
|
||||
{
|
||||
var obj = Dalamud.Objects[ idx ];
|
||||
var obj = DalamudServices.Objects[ idx ];
|
||||
return obj != null ? IdentifyCollection( ( GameObject* )obj.Address, true ) : ResolveData.Invalid;
|
||||
}
|
||||
}
|
||||
|
|
@ -203,9 +204,9 @@ public unsafe partial class PathResolver
|
|||
if( timelinePtr != IntPtr.Zero )
|
||||
{
|
||||
var actorIdx = ( int )( *( *( ulong** )timelinePtr + 1 ) >> 3 );
|
||||
if( actorIdx >= 0 && actorIdx < Dalamud.Objects.Length )
|
||||
if( actorIdx >= 0 && actorIdx < DalamudServices.Objects.Length )
|
||||
{
|
||||
_animationLoadData = IdentifyCollection( ( GameObject* )( Dalamud.Objects[ actorIdx ]?.Address ?? IntPtr.Zero ), true );
|
||||
_animationLoadData = IdentifyCollection( ( GameObject* )( DalamudServices.Objects[ actorIdx ]?.Address ?? IntPtr.Zero ), true );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -233,14 +234,14 @@ public unsafe partial class PathResolver
|
|||
|
||||
private global::Dalamud.Game.ClientState.Objects.Types.GameObject? GetOwnedObject( uint id )
|
||||
{
|
||||
var owner = Dalamud.Objects.SearchById( id );
|
||||
var owner = DalamudServices.Objects.SearchById( id );
|
||||
if( owner == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var idx = ( ( GameObject* )owner.Address )->ObjectIndex;
|
||||
return Dalamud.Objects[ idx + 1 ];
|
||||
return DalamudServices.Objects[ idx + 1 ];
|
||||
}
|
||||
|
||||
private IntPtr LoadCharacterVfxDetour( byte* vfxPath, VfxParams* vfxParams, byte unk1, byte unk2, float unk3, int unk4 )
|
||||
|
|
@ -251,8 +252,8 @@ public unsafe partial class PathResolver
|
|||
{
|
||||
var obj = vfxParams->GameObjectType switch
|
||||
{
|
||||
0 => Dalamud.Objects.SearchById( vfxParams->GameObjectId ),
|
||||
2 => Dalamud.Objects[ ( int )vfxParams->GameObjectId ],
|
||||
0 => DalamudServices.Objects.SearchById( vfxParams->GameObjectId ),
|
||||
2 => DalamudServices.Objects[ ( int )vfxParams->GameObjectId ],
|
||||
4 => GetOwnedObject( vfxParams->GameObjectId ),
|
||||
_ => null,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ using Penumbra.GameData;
|
|||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.String.Classes;
|
||||
using Penumbra.Util;
|
||||
|
||||
using Penumbra.Services;
|
||||
|
||||
namespace Penumbra.Interop.Resolver;
|
||||
|
||||
public unsafe partial class PathResolver
|
||||
|
|
@ -113,7 +114,7 @@ public unsafe partial class PathResolver
|
|||
// 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 )
|
||||
{
|
||||
gameObject = ( GameObject* )Dalamud.Objects.GetObjectAddress( gameObjectIdx );
|
||||
gameObject = ( GameObject* )DalamudServices.Objects.GetObjectAddress( gameObjectIdx );
|
||||
var draw = ( DrawObject* )drawObject;
|
||||
if( gameObject != null
|
||||
&& ( gameObject->DrawObject == draw || draw != null && gameObject->DrawObject == draw->Object.ParentObject ) )
|
||||
|
|
@ -251,9 +252,9 @@ public unsafe partial class PathResolver
|
|||
// We do not iterate the Dalamud table because it does not work when not logged in.
|
||||
private void InitializeDrawObjects()
|
||||
{
|
||||
for( var i = 0; i < Dalamud.Objects.Length; ++i )
|
||||
for( var i = 0; i < DalamudServices.Objects.Length; ++i )
|
||||
{
|
||||
var ptr = ( GameObject* )Dalamud.Objects.GetObjectAddress( i );
|
||||
var ptr = ( GameObject* )DalamudServices.Objects.GetObjectAddress( i );
|
||||
if( ptr != null && ptr->IsCharacter() && ptr->DrawObject != null )
|
||||
{
|
||||
_drawObjectToObject[ ( IntPtr )ptr->DrawObject ] = ( IdentifyCollection( ptr, false ), ptr->ObjectIndex );
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using OtterGui;
|
|||
using Penumbra.Collections;
|
||||
using Penumbra.GameData.Actors;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.Services;
|
||||
using Penumbra.Util;
|
||||
using Character = FFXIVClientStructs.FFXIV.Client.Game.Character.Character;
|
||||
using GameObject = FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject;
|
||||
|
|
@ -37,7 +38,7 @@ public unsafe partial class PathResolver
|
|||
// 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 )
|
||||
if( !DalamudServices.ClientState.IsLoggedIn )
|
||||
{
|
||||
var collection2 = Penumbra.CollectionManager.ByType( CollectionType.Yourself )
|
||||
?? CollectionByAttributes( gameObject )
|
||||
|
|
@ -46,7 +47,7 @@ public unsafe partial class PathResolver
|
|||
}
|
||||
|
||||
// Aesthetician. The relevant actor is yourself, so use player collection when possible.
|
||||
if( Dalamud.GameGui.GetAddonByName( "ScreenLog" ) == IntPtr.Zero )
|
||||
if( DalamudServices.GameGui.GetAddonByName( "ScreenLog" ) == IntPtr.Zero )
|
||||
{
|
||||
var player = Penumbra.Actors.GetCurrentPlayer();
|
||||
var collection2 = ( player.IsValid ? CollectionByIdentifier( player ) : null )
|
||||
|
|
@ -86,7 +87,7 @@ public unsafe partial class PathResolver
|
|||
public static ModCollection PlayerCollection()
|
||||
{
|
||||
using var performance = Penumbra.Performance.Measure( PerformanceType.IdentifyCollection );
|
||||
var gameObject = ( GameObject* )Dalamud.Objects.GetObjectAddress( 0 );
|
||||
var gameObject = ( GameObject* )DalamudServices.Objects.GetObjectAddress( 0 );
|
||||
if( gameObject == null )
|
||||
{
|
||||
return Penumbra.CollectionManager.ByType( CollectionType.Yourself )
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using FFXIVClientStructs.FFXIV.Client.System.Resource;
|
|||
using Penumbra.Collections;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.Interop.Loader;
|
||||
using Penumbra.Services;
|
||||
using Penumbra.String;
|
||||
using Penumbra.String.Classes;
|
||||
using Penumbra.Util;
|
||||
|
|
@ -34,7 +35,7 @@ public partial class PathResolver : IDisposable
|
|||
private readonly SubfileHelper _subFiles;
|
||||
|
||||
static PathResolver()
|
||||
=> ValidHumanModels = GetValidHumanModels( Dalamud.GameData );
|
||||
=> ValidHumanModels = GetValidHumanModels( DalamudServices.GameData );
|
||||
|
||||
public unsafe PathResolver( ResourceLoader loader )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue