mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-15 05:04:15 +01:00
Revert "add Penumbra.ObjectIsRedrawn and Penumbra.ReverseResolvePath to API"
This reverts commit 45d8d58ce2.
This commit is contained in:
parent
2103ae3053
commit
54f2e5c58f
6 changed files with 127 additions and 194 deletions
|
|
@ -51,7 +51,6 @@ public interface IPenumbraApi : IPenumbraApiBase
|
|||
|
||||
// Triggered when the user clicks a listed changed object in a mod tab.
|
||||
public event ChangedItemClick? ChangedItemClicked;
|
||||
event EventHandler? ObjectIsRedrawn;
|
||||
|
||||
// Queue redrawing of all actors of the given name with the given RedrawType.
|
||||
public void RedrawObject( string name, RedrawType setting );
|
||||
|
|
@ -73,9 +72,6 @@ public interface IPenumbraApi : IPenumbraApiBase
|
|||
// Returns the given gamePath if penumbra would not manipulate it.
|
||||
public string ResolvePath( string gamePath, string characterName );
|
||||
|
||||
// Reverse resolves a given modded local path into its replacement in form of all applicable game path for given character
|
||||
public string[] ReverseResolvePath( string moddedPath, string characterName );
|
||||
|
||||
// Try to load a given gamePath with the resolved path from Penumbra.
|
||||
public T? GetFile< T >( string gamePath ) where T : FileResource;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
|||
public int ApiVersion { get; } = 4;
|
||||
private Penumbra? _penumbra;
|
||||
private Lumina.GameData? _lumina;
|
||||
public event EventHandler? ObjectIsRedrawn;
|
||||
|
||||
public bool Valid
|
||||
=> _penumbra != null;
|
||||
|
|
@ -31,17 +30,10 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
|||
_lumina = ( Lumina.GameData? )Dalamud.GameData.GetType()
|
||||
.GetField( "gameData", BindingFlags.Instance | BindingFlags.NonPublic )
|
||||
?.GetValue( Dalamud.GameData );
|
||||
_penumbra.ObjectReloader.ObjectIsRedrawn += ObjectReloader_ObjectIsRedrawn;
|
||||
}
|
||||
|
||||
private void ObjectReloader_ObjectIsRedrawn( object? sender, EventArgs e )
|
||||
{
|
||||
ObjectIsRedrawn?.Invoke( sender, e );
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_penumbra!.ObjectReloader.ObjectIsRedrawn -= ObjectReloader_ObjectIsRedrawn;
|
||||
_penumbra = null;
|
||||
_lumina = null;
|
||||
}
|
||||
|
|
@ -129,20 +121,6 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
|||
Penumbra.CollectionManager.Character( characterName ) );
|
||||
}
|
||||
|
||||
public string[] ReverseResolvePath( string path, string characterName )
|
||||
{
|
||||
CheckInitialized();
|
||||
if( !Penumbra.Config.EnableMods )
|
||||
{
|
||||
return new[] { path };
|
||||
}
|
||||
|
||||
var gamePath = Utf8GamePath.FromString( path, out var p, true ) ? p : Utf8GamePath.Empty;
|
||||
var ret = Penumbra.CollectionManager.Character( characterName ).ResolveReversePath( new FullPath( path ) ) ?? new List<Utf8GamePath>();
|
||||
if( ret.Count == 0 ) ret.Add( gamePath );
|
||||
return ret.Select( r => r.ToString() ).ToArray();
|
||||
}
|
||||
|
||||
private T? GetFileIntern< T >( string resolvedPath ) where T : FileResource
|
||||
{
|
||||
CheckInitialized();
|
||||
|
|
|
|||
|
|
@ -115,13 +115,11 @@ public partial class PenumbraIpc
|
|||
public const string LabelProviderRedrawIndex = "Penumbra.RedrawObjectByIndex";
|
||||
public const string LabelProviderRedrawObject = "Penumbra.RedrawObject";
|
||||
public const string LabelProviderRedrawAll = "Penumbra.RedrawAll";
|
||||
public const string LabelProviderObjectIsRedrawn = "Penumbra.ObjectIsRedrawn";
|
||||
|
||||
internal ICallGateProvider< string, int, object >? ProviderRedrawName;
|
||||
internal ICallGateProvider< int, int, object >? ProviderRedrawIndex;
|
||||
internal ICallGateProvider< GameObject, int, object >? ProviderRedrawObject;
|
||||
internal ICallGateProvider< int, object >? ProviderRedrawAll;
|
||||
internal ICallGateProvider<string, string> ProviderObjectIsRedrawn;
|
||||
|
||||
private static RedrawType CheckRedrawType( int value )
|
||||
{
|
||||
|
|
@ -175,21 +173,6 @@ public partial class PenumbraIpc
|
|||
{
|
||||
PluginLog.Error( $"Error registering IPC provider for {LabelProviderRedrawAll}:\n{e}" );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
ProviderObjectIsRedrawn = pi.GetIpcProvider<string, string>( LabelProviderObjectIsRedrawn );
|
||||
Api.ObjectIsRedrawn += Api_ObjectIsRedrawn;
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
PluginLog.Error( $"Error registering IPC provider for {LabelProviderObjectIsRedrawn}:\n{e}" );
|
||||
}
|
||||
}
|
||||
|
||||
private void Api_ObjectIsRedrawn( object? sender, EventArgs e )
|
||||
{
|
||||
ProviderObjectIsRedrawn.SendMessage( ( ( GameObject? )sender )?.Name.ToString() ?? "" );
|
||||
}
|
||||
|
||||
private void DisposeRedrawProviders()
|
||||
|
|
@ -198,7 +181,6 @@ public partial class PenumbraIpc
|
|||
ProviderRedrawIndex?.UnregisterAction();
|
||||
ProviderRedrawObject?.UnregisterAction();
|
||||
ProviderRedrawAll?.UnregisterAction();
|
||||
Api.ObjectIsRedrawn -= Api_ObjectIsRedrawn;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -207,12 +189,10 @@ public partial class PenumbraIpc
|
|||
public const string LabelProviderResolveDefault = "Penumbra.ResolveDefaultPath";
|
||||
public const string LabelProviderResolveCharacter = "Penumbra.ResolveCharacterPath";
|
||||
public const string LabelProviderGetDrawObjectInfo = "Penumbra.GetDrawObjectInfo";
|
||||
public const string LabelProviderReverseResolvePath = "Penumbra.ReverseResolvePath";
|
||||
|
||||
internal ICallGateProvider< string, string >? ProviderResolveDefault;
|
||||
internal ICallGateProvider< string, string, string >? ProviderResolveCharacter;
|
||||
internal ICallGateProvider< IntPtr, (IntPtr, string) >? ProviderGetDrawObjectInfo;
|
||||
internal ICallGateProvider<string, string, string[]>? ProviderReverseResolvePath;
|
||||
|
||||
private void InitializeResolveProviders( DalamudPluginInterface pi )
|
||||
{
|
||||
|
|
@ -245,16 +225,6 @@ public partial class PenumbraIpc
|
|||
{
|
||||
PluginLog.Error( $"Error registering IPC provider for {LabelProviderGetDrawObjectInfo}:\n{e}" );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
ProviderReverseResolvePath = pi.GetIpcProvider<string, string, string[]>( LabelProviderReverseResolvePath );
|
||||
ProviderReverseResolvePath.RegisterFunc( Api.ReverseResolvePath );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
PluginLog.Error( $"Error registering IPC provider for {LabelProviderGetDrawObjectInfo}:\n{e}" );
|
||||
}
|
||||
}
|
||||
|
||||
private void DisposeResolveProviders()
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ public partial class ModCollection
|
|||
PluginLog.Verbose( "Cleared cache of collection {Name:l}.", Name );
|
||||
}
|
||||
|
||||
public List<Utf8GamePath>? ResolveReversePath( FullPath path ) => _cache?.ReverseResolvePath( path );
|
||||
|
||||
public FullPath? ResolvePath( Utf8GamePath path )
|
||||
=> _cache?.ResolvePath( path );
|
||||
|
|
|
|||
|
|
@ -79,13 +79,6 @@ public partial class ModCollection
|
|||
return candidate.Path;
|
||||
}
|
||||
|
||||
public List<Utf8GamePath> ReverseResolvePath( FullPath localFilePath )
|
||||
{
|
||||
string strToSearchFor = localFilePath.FullName.Replace( '/', '\\' ).ToLower();
|
||||
return ResolvedFiles.Where( f => f.Value.Path.FullName.ToLower() == strToSearchFor )
|
||||
.Select( kvp => kvp.Key ).ToList();
|
||||
}
|
||||
|
||||
private void OnModSettingChange( ModSettingChange type, int modIdx, int oldValue, int groupIdx, bool _ )
|
||||
{
|
||||
switch( type )
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ public unsafe partial class ObjectReloader
|
|||
private static void EnableDraw( GameObject actor )
|
||||
=> ( ( delegate* unmanaged< IntPtr, void >** )actor.Address )[ 0 ][ 16 ]( actor.Address );
|
||||
|
||||
public event EventHandler? ObjectIsRedrawn;
|
||||
|
||||
// Check whether we currently are in GPose.
|
||||
// Also clear the name list.
|
||||
|
|
@ -282,8 +281,6 @@ public sealed unsafe partial class ObjectReloader : IDisposable
|
|||
break;
|
||||
default: throw new ArgumentOutOfRangeException( nameof( settings ), settings, null );
|
||||
}
|
||||
|
||||
ObjectIsRedrawn?.Invoke( actor, new EventArgs() );
|
||||
}
|
||||
|
||||
private static GameObject? GetLocalPlayer()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue