mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Merge branch 'master' of github.com:xivDev/Penumbra
This commit is contained in:
commit
79e6a3b228
4 changed files with 32 additions and 9 deletions
|
|
@ -89,12 +89,16 @@ public interface IPenumbraApi : IPenumbraApiBase
|
|||
// Returns the given gamePath if penumbra would not manipulate it.
|
||||
public string ResolvePath( string gamePath, string characterName );
|
||||
|
||||
// Resolve a given gamePath via Penumbra using any applicable character collections for the current character.
|
||||
// Returns the given gamePath if penumbra would not manipulate it.
|
||||
public string ResolvePlayerPath( string gamePath );
|
||||
|
||||
// Reverse resolves a given modded local path into its replacement in form of all applicable game paths for given character collection.
|
||||
public string[] ReverseResolvePath( string moddedPath, string characterName );
|
||||
|
||||
// Reverse resolves a given modded local path into its replacement in form of all applicable game paths
|
||||
// using the collection applying to the player character.
|
||||
public string[] ReverseResolvePathPlayer( string moddedPath );
|
||||
public string[] ReverseResolvePlayerPath( string moddedPath );
|
||||
|
||||
// Try to load a given gamePath with the resolved path from Penumbra.
|
||||
public T? GetFile< T >( string gamePath ) where T : FileResource;
|
||||
|
|
|
|||
|
|
@ -278,10 +278,10 @@ public class IpcTester : IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
DrawIntro( PenumbraIpc.LabelProviderReverseResolvePathPlayer, "Reversed Game Paths (Player)" );
|
||||
DrawIntro( PenumbraIpc.LabelProviderReverseResolvePlayerPath, "Reversed Game Paths (Player)" );
|
||||
if( _currentReversePath.Length > 0 )
|
||||
{
|
||||
var list = _pi.GetIpcSubscriber< string, string[] >( PenumbraIpc.LabelProviderReverseResolvePathPlayer )
|
||||
var list = _pi.GetIpcSubscriber< string, string[] >( PenumbraIpc.LabelProviderReverseResolvePlayerPath )
|
||||
.InvokeFunc( _currentReversePath );
|
||||
if( list.Length > 0 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using System.Linq;
|
|||
using System.Reflection;
|
||||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
using Dalamud.Logging;
|
||||
using FFXIVClientStructs.FFXIV.Common.Configuration;
|
||||
using Lumina.Data;
|
||||
using Newtonsoft.Json;
|
||||
using OtterGui;
|
||||
|
|
@ -22,7 +23,7 @@ namespace Penumbra.Api;
|
|||
public class PenumbraApi : IDisposable, IPenumbraApi
|
||||
{
|
||||
public (int, int) ApiVersion
|
||||
=> ( 4, 9 );
|
||||
=> ( 4, 10 );
|
||||
|
||||
private Penumbra? _penumbra;
|
||||
private Lumina.GameData? _lumina;
|
||||
|
|
@ -123,6 +124,12 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
|||
return ResolvePath( path, Penumbra.ModManager, Penumbra.CollectionManager.Default );
|
||||
}
|
||||
|
||||
public string ResolvePlayerPath( string path )
|
||||
{
|
||||
CheckInitialized();
|
||||
return ResolvePath( path, Penumbra.ModManager, PathResolver.PlayerCollection() );
|
||||
}
|
||||
|
||||
public string ResolvePath( string path, string characterName )
|
||||
{
|
||||
CheckInitialized();
|
||||
|
|
@ -142,7 +149,7 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
|||
return ret.Select( r => r.ToString() ).ToArray();
|
||||
}
|
||||
|
||||
public string[] ReverseResolvePathPlayer( string path )
|
||||
public string[] ReverseResolvePlayerPath( string path )
|
||||
{
|
||||
CheckInitialized();
|
||||
if( !Penumbra.Config.EnableMods )
|
||||
|
|
|
|||
|
|
@ -259,13 +259,15 @@ public partial class PenumbraIpc
|
|||
{
|
||||
public const string LabelProviderResolveDefault = "Penumbra.ResolveDefaultPath";
|
||||
public const string LabelProviderResolveCharacter = "Penumbra.ResolveCharacterPath";
|
||||
public const string LabelProviderResolvePlayer = "Penumbra.ResolvePlayerPath";
|
||||
public const string LabelProviderGetDrawObjectInfo = "Penumbra.GetDrawObjectInfo";
|
||||
public const string LabelProviderReverseResolvePath = "Penumbra.ReverseResolvePath";
|
||||
public const string LabelProviderReverseResolvePathPlayer = "Penumbra.ReverseResolvePathPlayer";
|
||||
public const string LabelProviderReverseResolvePlayerPath = "Penumbra.ReverseResolvePlayerPath";
|
||||
public const string LabelProviderCreatingCharacterBase = "Penumbra.CreatingCharacterBase";
|
||||
|
||||
internal ICallGateProvider< string, string >? ProviderResolveDefault;
|
||||
internal ICallGateProvider< string, string, string >? ProviderResolveCharacter;
|
||||
internal ICallGateProvider< string, string >? ProviderResolvePlayer;
|
||||
internal ICallGateProvider< IntPtr, (IntPtr, string) >? ProviderGetDrawObjectInfo;
|
||||
internal ICallGateProvider< string, string, string[] >? ProviderReverseResolvePath;
|
||||
internal ICallGateProvider< string, string[] >? ProviderReverseResolvePathPlayer;
|
||||
|
|
@ -293,6 +295,16 @@ public partial class PenumbraIpc
|
|||
PluginLog.Error( $"Error registering IPC provider for {LabelProviderResolveCharacter}:\n{e}" );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
ProviderResolvePlayer = pi.GetIpcProvider< string, string >( LabelProviderResolvePlayer );
|
||||
ProviderResolvePlayer.RegisterFunc( Api.ResolvePlayerPath );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
PluginLog.Error( $"Error registering IPC provider for {LabelProviderResolveCharacter}:\n{e}" );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
ProviderGetDrawObjectInfo = pi.GetIpcProvider< IntPtr, (IntPtr, string) >( LabelProviderGetDrawObjectInfo );
|
||||
|
|
@ -315,12 +327,12 @@ public partial class PenumbraIpc
|
|||
|
||||
try
|
||||
{
|
||||
ProviderReverseResolvePathPlayer = pi.GetIpcProvider< string, string[] >( LabelProviderReverseResolvePathPlayer );
|
||||
ProviderReverseResolvePathPlayer.RegisterFunc( Api.ReverseResolvePathPlayer );
|
||||
ProviderReverseResolvePathPlayer = pi.GetIpcProvider< string, string[] >( LabelProviderReverseResolvePlayerPath );
|
||||
ProviderReverseResolvePathPlayer.RegisterFunc( Api.ReverseResolvePlayerPath );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
PluginLog.Error( $"Error registering IPC provider for {LabelProviderReverseResolvePathPlayer}:\n{e}" );
|
||||
PluginLog.Error( $"Error registering IPC provider for {LabelProviderReverseResolvePlayerPath}:\n{e}" );
|
||||
}
|
||||
|
||||
try
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue