mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 10:17:22 +01:00
Again some Actor Refresher changes.
This commit is contained in:
parent
92e95400b0
commit
bb6c6aed8a
2 changed files with 32 additions and 47 deletions
|
|
@ -40,11 +40,12 @@ namespace Penumbra.Interop
|
||||||
private readonly ModManager _mods;
|
private readonly ModManager _mods;
|
||||||
private readonly Queue< (int actorId, string name, Redraw s) > _actorIds = new();
|
private readonly Queue< (int actorId, string name, Redraw s) > _actorIds = new();
|
||||||
|
|
||||||
private int _currentFrame = 0;
|
private int _currentFrame = 0;
|
||||||
private bool _changedSettings = false;
|
private bool _changedSettings = false;
|
||||||
private int _currentActorId = -1;
|
private int _currentActorId = -1;
|
||||||
private string? _currentActorName = null;
|
private string? _currentActorName = null;
|
||||||
private Redraw _currentActorRedraw = Redraw.Unload;
|
private LoadingFlags _currentActorStartState = 0;
|
||||||
|
private Redraw _currentActorRedraw = Redraw.Unload;
|
||||||
|
|
||||||
public static IntPtr RenderPtr( Actor actor )
|
public static IntPtr RenderPtr( Actor actor )
|
||||||
=> actor.Address + RenderModeOffset;
|
=> actor.Address + RenderModeOffset;
|
||||||
|
|
@ -70,15 +71,16 @@ namespace Penumbra.Interop
|
||||||
_changedSettings = false;
|
_changedSettings = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static unsafe void WriteInvisible( IntPtr renderPtr )
|
private unsafe void WriteInvisible( IntPtr renderPtr )
|
||||||
{
|
{
|
||||||
if( renderPtr != IntPtr.Zero )
|
if( renderPtr != IntPtr.Zero )
|
||||||
{
|
{
|
||||||
|
_currentActorStartState = *( LoadingFlags* )renderPtr;
|
||||||
*( LoadingFlags* )renderPtr |= LoadingFlags.Invisibility;
|
*( LoadingFlags* )renderPtr |= LoadingFlags.Invisibility;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static unsafe bool StillLoading( IntPtr renderPtr )
|
private unsafe bool StillLoading( IntPtr renderPtr )
|
||||||
{
|
{
|
||||||
const LoadingFlags stillLoadingFlags = LoadingFlags.SomeNpcFlag
|
const LoadingFlags stillLoadingFlags = LoadingFlags.SomeNpcFlag
|
||||||
| LoadingFlags.MaybeCulled
|
| LoadingFlags.MaybeCulled
|
||||||
|
|
@ -88,6 +90,10 @@ namespace Penumbra.Interop
|
||||||
if( renderPtr != IntPtr.Zero )
|
if( renderPtr != IntPtr.Zero )
|
||||||
{
|
{
|
||||||
var loadingFlags = *( LoadingFlags* )renderPtr;
|
var loadingFlags = *( LoadingFlags* )renderPtr;
|
||||||
|
if( loadingFlags == _currentActorStartState )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return !( loadingFlags == 0 || ( loadingFlags & stillLoadingFlags ) != 0 );
|
return !( loadingFlags == 0 || ( loadingFlags & stillLoadingFlags ) != 0 );
|
||||||
}
|
}
|
||||||
|
|
@ -152,11 +158,6 @@ namespace Penumbra.Interop
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( StillLoading( RenderPtr( actor ) ) )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch( _currentActorRedraw )
|
switch( _currentActorRedraw )
|
||||||
{
|
{
|
||||||
case Redraw.Unload:
|
case Redraw.Unload:
|
||||||
|
|
|
||||||
|
|
@ -173,6 +173,10 @@ namespace Penumbra.UI
|
||||||
.GetField( "_currentActorName", BindingFlags.Instance | BindingFlags.NonPublic )
|
.GetField( "_currentActorName", BindingFlags.Instance | BindingFlags.NonPublic )
|
||||||
?.GetValue( _plugin.ActorRefresher );
|
?.GetValue( _plugin.ActorRefresher );
|
||||||
|
|
||||||
|
var currentActorStartState = ( ActorRefresher.LoadingFlags? )_plugin.ActorRefresher.GetType()
|
||||||
|
.GetField( "_currentActorStartState", BindingFlags.Instance | BindingFlags.NonPublic )
|
||||||
|
?.GetValue( _plugin.ActorRefresher );
|
||||||
|
|
||||||
var currentActorRedraw = ( Redraw? )_plugin.ActorRefresher.GetType()
|
var currentActorRedraw = ( Redraw? )_plugin.ActorRefresher.GetType()
|
||||||
.GetField( "_currentActorRedraw", BindingFlags.Instance | BindingFlags.NonPublic )
|
.GetField( "_currentActorRedraw", BindingFlags.Instance | BindingFlags.NonPublic )
|
||||||
?.GetValue( _plugin.ActorRefresher );
|
?.GetValue( _plugin.ActorRefresher );
|
||||||
|
|
@ -188,41 +192,14 @@ namespace Penumbra.UI
|
||||||
if( ImGui.BeginTable( "##RedrawData", 2, ImGuiTableFlags.SizingFixedFit,
|
if( ImGui.BeginTable( "##RedrawData", 2, ImGuiTableFlags.SizingFixedFit,
|
||||||
new Vector2( -1, ImGui.GetTextLineHeightWithSpacing() * 7 ) ) )
|
new Vector2( -1, ImGui.GetTextLineHeightWithSpacing() * 7 ) ) )
|
||||||
{
|
{
|
||||||
ImGui.TableNextRow();
|
PrintValue( "Current Frame", currentFrame?.ToString() ?? "null" );
|
||||||
ImGui.TableNextColumn();
|
PrintValue( "Current Changed Settings", changedSettings?.ToString() ?? "null" );
|
||||||
ImGui.Text( "Current Frame" );
|
PrintValue( "Current Actor Id", currentActorId?.ToString( "X8" ) ?? "null" );
|
||||||
ImGui.TableNextColumn();
|
PrintValue( "Current Actor Name", currentActorName ?? "null" );
|
||||||
ImGui.Text( currentFrame?.ToString() ?? "null" );
|
PrintValue( "Current Actor Start State", ( ( int? )currentActorStartState )?.ToString( "X8" ) ?? "null" );
|
||||||
ImGui.TableNextRow();
|
PrintValue( "Current Actor Redraw", currentActorRedraw?.ToString() ?? "null" );
|
||||||
ImGui.TableNextColumn();
|
PrintValue( "Current Actor Address", currentActor?.Address.ToString( "X16" ) ?? "null" );
|
||||||
ImGui.Text( "Current Changed Settings" );
|
PrintValue( "Current Actor Render Flags", ( ( int? )currentRender )?.ToString( "X8" ) ?? "null" );
|
||||||
ImGui.TableNextColumn();
|
|
||||||
ImGui.Text( changedSettings?.ToString() ?? "null" );
|
|
||||||
ImGui.TableNextRow();
|
|
||||||
ImGui.TableNextColumn();
|
|
||||||
ImGui.Text( "Current Actor Id" );
|
|
||||||
ImGui.TableNextColumn();
|
|
||||||
ImGui.Text( currentActorId?.ToString( "X8" ) ?? "null" );
|
|
||||||
ImGui.TableNextRow();
|
|
||||||
ImGui.TableNextColumn();
|
|
||||||
ImGui.Text( "Current Actor Name" );
|
|
||||||
ImGui.TableNextColumn();
|
|
||||||
ImGui.Text( currentActorName ?? "null" );
|
|
||||||
ImGui.TableNextRow();
|
|
||||||
ImGui.TableNextColumn();
|
|
||||||
ImGui.Text( "Current Actor Redraw" );
|
|
||||||
ImGui.TableNextColumn();
|
|
||||||
ImGui.Text( currentActorRedraw?.ToString() ?? "null" );
|
|
||||||
ImGui.TableNextRow();
|
|
||||||
ImGui.TableNextColumn();
|
|
||||||
ImGui.Text( "Current Actor Address" );
|
|
||||||
ImGui.TableNextColumn();
|
|
||||||
ImGui.Text( currentActor?.Address.ToString( "X16" ) ?? "null" );
|
|
||||||
ImGui.TableNextRow();
|
|
||||||
ImGui.TableNextColumn();
|
|
||||||
ImGui.Text( "Current Actor Render Flags" );
|
|
||||||
ImGui.TableNextColumn();
|
|
||||||
ImGui.Text( ( ( int? )currentRender )?.ToString( "X8" ) ?? "null" );
|
|
||||||
ImGui.EndTable();
|
ImGui.EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -243,6 +220,13 @@ namespace Penumbra.UI
|
||||||
|
|
||||||
ImGui.EndTable();
|
ImGui.EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( queue.Any() && ImGui.Button( "Clear" ) )
|
||||||
|
{
|
||||||
|
queue.Clear();
|
||||||
|
_plugin.ActorRefresher.GetType()
|
||||||
|
.GetField( "_currentFrame", BindingFlags.Instance | BindingFlags.NonPublic )?.SetValue( _plugin.ActorRefresher, 0 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawDebugTabTempFiles()
|
private void DrawDebugTabTempFiles()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue