mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-15 13:14:17 +01:00
Derp
This commit is contained in:
parent
21181370e7
commit
c5ac9f6f08
5 changed files with 19 additions and 36 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
using Penumbra.GameData.Enums;
|
using Penumbra.GameData.Enums;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using Penumbra.GameData;
|
||||||
|
|
||||||
namespace Penumbra.Import;
|
namespace Penumbra.Import;
|
||||||
|
|
||||||
|
|
@ -52,10 +53,10 @@ public class MetaFileInfo
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public MetaFileInfo( string fileName )
|
public MetaFileInfo( IGamePathParser parser, string fileName )
|
||||||
{
|
{
|
||||||
// Set the primary type from the gamePath start.
|
// Set the primary type from the gamePath start.
|
||||||
PrimaryType = Penumbra.GamePathParser.PathToObjectType( fileName );
|
PrimaryType = parser.PathToObjectType( fileName );
|
||||||
PrimaryId = 0;
|
PrimaryId = 0;
|
||||||
SecondaryType = BodySlot.Unknown;
|
SecondaryType = BodySlot.Unknown;
|
||||||
SecondaryId = 0;
|
SecondaryId = 0;
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using Penumbra.GameData;
|
||||||
using Penumbra.Meta.Manipulations;
|
using Penumbra.Meta.Manipulations;
|
||||||
|
|
||||||
namespace Penumbra.Import;
|
namespace Penumbra.Import;
|
||||||
|
|
@ -28,7 +29,7 @@ public partial class TexToolsMeta
|
||||||
public readonly List< MetaManipulation > MetaManipulations = new();
|
public readonly List< MetaManipulation > MetaManipulations = new();
|
||||||
private readonly bool _keepDefault = false;
|
private readonly bool _keepDefault = false;
|
||||||
|
|
||||||
public TexToolsMeta( byte[] data, bool keepDefault )
|
public TexToolsMeta( IGamePathParser parser, byte[] data, bool keepDefault )
|
||||||
{
|
{
|
||||||
_keepDefault = keepDefault;
|
_keepDefault = keepDefault;
|
||||||
try
|
try
|
||||||
|
|
@ -36,7 +37,7 @@ public partial class TexToolsMeta
|
||||||
using var reader = new BinaryReader( new MemoryStream( data ) );
|
using var reader = new BinaryReader( new MemoryStream( data ) );
|
||||||
Version = reader.ReadUInt32();
|
Version = reader.ReadUInt32();
|
||||||
FilePath = ReadNullTerminated( reader );
|
FilePath = ReadNullTerminated( reader );
|
||||||
var metaInfo = new MetaFileInfo( FilePath );
|
var metaInfo = new MetaFileInfo( parser, FilePath );
|
||||||
var numHeaders = reader.ReadUInt32();
|
var numHeaders = reader.ReadUInt32();
|
||||||
var headerSize = reader.ReadUInt32();
|
var headerSize = reader.ReadUInt32();
|
||||||
var headerStart = reader.ReadUInt32();
|
var headerStart = reader.ReadUInt32();
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ public partial class Mod
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var meta = new TexToolsMeta( File.ReadAllBytes( file.FullName ), Penumbra.Config.KeepDefaultMetaChanges );
|
var meta = new TexToolsMeta( Penumbra.GamePathParser, File.ReadAllBytes( file.FullName ), Penumbra.Config.KeepDefaultMetaChanges );
|
||||||
Penumbra.Log.Verbose( $"Incorporating {file} as Metadata file of {meta.MetaManipulations.Count} manipulations {deleteString}" );
|
Penumbra.Log.Verbose( $"Incorporating {file} as Metadata file of {meta.MetaManipulations.Count} manipulations {deleteString}" );
|
||||||
deleteList.Add( file.FullName );
|
deleteList.Add( file.FullName );
|
||||||
ManipulationData.UnionWith( meta.MetaManipulations );
|
ManipulationData.UnionWith( meta.MetaManipulations );
|
||||||
|
|
@ -288,7 +288,7 @@ public partial class Mod
|
||||||
{
|
{
|
||||||
var x = file.EndsWith( "rgsp" )
|
var x = file.EndsWith( "rgsp" )
|
||||||
? TexToolsMeta.FromRgspFile( file, data, Penumbra.Config.KeepDefaultMetaChanges )
|
? TexToolsMeta.FromRgspFile( file, data, Penumbra.Config.KeepDefaultMetaChanges )
|
||||||
: new TexToolsMeta( data, Penumbra.Config.KeepDefaultMetaChanges );
|
: new TexToolsMeta( Penumbra.GamePathParser, data, Penumbra.Config.KeepDefaultMetaChanges );
|
||||||
meta.UnionWith( x.MetaManipulations );
|
meta.UnionWith( x.MetaManipulations );
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
|
|
||||||
|
|
@ -33,16 +33,11 @@ using Penumbra.Interop.Services;
|
||||||
|
|
||||||
namespace Penumbra;
|
namespace Penumbra;
|
||||||
|
|
||||||
public partial class Penumbra : IDalamudPlugin
|
public class Penumbra : IDalamudPlugin
|
||||||
{
|
{
|
||||||
public string Name
|
public string Name
|
||||||
=> "Penumbra";
|
=> "Penumbra";
|
||||||
|
|
||||||
public static readonly string Version = Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? string.Empty;
|
|
||||||
|
|
||||||
public static readonly string CommitHash =
|
|
||||||
Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "Unknown";
|
|
||||||
|
|
||||||
public static Logger Log { get; private set; } = null!;
|
public static Logger Log { get; private set; } = null!;
|
||||||
public static ChatService ChatService { get; private set; } = null!;
|
public static ChatService ChatService { get; private set; } = null!;
|
||||||
public static SaveService SaveService { get; private set; } = null!;
|
public static SaveService SaveService { get; private set; } = null!;
|
||||||
|
|
@ -64,8 +59,6 @@ public partial class Penumbra : IDalamudPlugin
|
||||||
public static StainService StainService { get; private set; } = null!;
|
public static StainService StainService { get; private set; } = null!;
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
public static DalamudServices Dalamud { get; private set; } = null!;
|
|
||||||
|
|
||||||
public static ValidityChecker ValidityChecker { get; private set; } = null!;
|
public static ValidityChecker ValidityChecker { get; private set; } = null!;
|
||||||
|
|
||||||
public static PerformanceTracker Performance { get; private set; } = null!;
|
public static PerformanceTracker Performance { get; private set; } = null!;
|
||||||
|
|
@ -73,21 +66,14 @@ public partial class Penumbra : IDalamudPlugin
|
||||||
public readonly PathResolver PathResolver;
|
public readonly PathResolver PathResolver;
|
||||||
public readonly RedrawService RedrawService;
|
public readonly RedrawService RedrawService;
|
||||||
public readonly ModFileSystem ModFileSystem;
|
public readonly ModFileSystem ModFileSystem;
|
||||||
public PenumbraApi Api = null!;
|
|
||||||
public HttpApi HttpApi = null!;
|
public HttpApi HttpApi = null!;
|
||||||
public PenumbraIpcProviders IpcProviders = null!;
|
|
||||||
internal ConfigWindow? ConfigWindow { get; private set; }
|
internal ConfigWindow? ConfigWindow { get; private set; }
|
||||||
private PenumbraWindowSystem? _windowSystem;
|
private PenumbraWindowSystem? _windowSystem;
|
||||||
private CommandHandler? _commandHandler;
|
|
||||||
private readonly ResourceWatcher _resourceWatcher;
|
|
||||||
private bool _disposed;
|
private bool _disposed;
|
||||||
|
|
||||||
private readonly PenumbraNew _tmp;
|
private readonly PenumbraNew _tmp;
|
||||||
public static ItemData ItemData { get; private set; } = null!;
|
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
public static ResourceManagerService ResourceManagerService { get; private set; } = null!;
|
public static ResourceManagerService ResourceManagerService { get; private set; } = null!;
|
||||||
public static CharacterResolver CharacterResolver { get; private set; } = null!;
|
|
||||||
public static ResourceService ResourceService { get; private set; } = null!;
|
public static ResourceService ResourceService { get; private set; } = null!;
|
||||||
|
|
||||||
public Penumbra(DalamudPluginInterface pluginInterface)
|
public Penumbra(DalamudPluginInterface pluginInterface)
|
||||||
|
|
@ -110,8 +96,6 @@ public partial class Penumbra : IDalamudPlugin
|
||||||
Identifier = _tmp.Services.GetRequiredService<IdentifierService>().AwaitedService;
|
Identifier = _tmp.Services.GetRequiredService<IdentifierService>().AwaitedService;
|
||||||
GamePathParser = _tmp.Services.GetRequiredService<IGamePathParser>();
|
GamePathParser = _tmp.Services.GetRequiredService<IGamePathParser>();
|
||||||
StainService = _tmp.Services.GetRequiredService<StainService>();
|
StainService = _tmp.Services.GetRequiredService<StainService>();
|
||||||
ItemData = _tmp.Services.GetRequiredService<ItemService>().AwaitedService;
|
|
||||||
Dalamud = _tmp.Services.GetRequiredService<DalamudServices>();
|
|
||||||
TempMods = _tmp.Services.GetRequiredService<TempModManager>();
|
TempMods = _tmp.Services.GetRequiredService<TempModManager>();
|
||||||
ResidentResources = _tmp.Services.GetRequiredService<ResidentResourceManager>();
|
ResidentResources = _tmp.Services.GetRequiredService<ResidentResourceManager>();
|
||||||
ResourceManagerService = _tmp.Services.GetRequiredService<ResourceManagerService>();
|
ResourceManagerService = _tmp.Services.GetRequiredService<ResourceManagerService>();
|
||||||
|
|
@ -123,14 +107,12 @@ public partial class Penumbra : IDalamudPlugin
|
||||||
ResourceService = _tmp.Services.GetRequiredService<ResourceService>();
|
ResourceService = _tmp.Services.GetRequiredService<ResourceService>();
|
||||||
ResourceLoader = _tmp.Services.GetRequiredService<ResourceLoader>();
|
ResourceLoader = _tmp.Services.GetRequiredService<ResourceLoader>();
|
||||||
PathResolver = _tmp.Services.GetRequiredService<PathResolver>();
|
PathResolver = _tmp.Services.GetRequiredService<PathResolver>();
|
||||||
CharacterResolver = _tmp.Services.GetRequiredService<CharacterResolver>();
|
|
||||||
_resourceWatcher = _tmp.Services.GetRequiredService<ResourceWatcher>();
|
|
||||||
SetupInterface();
|
SetupInterface();
|
||||||
SetupApi();
|
SetupApi();
|
||||||
|
|
||||||
ValidityChecker.LogExceptions();
|
ValidityChecker.LogExceptions();
|
||||||
Log.Information($"Penumbra Version {Version}, Commit #{CommitHash} successfully Loaded from {pluginInterface.SourceRepository}.");
|
Log.Information($"Penumbra Version {ValidityChecker.Version}, Commit #{ValidityChecker.CommitHash} successfully Loaded from {pluginInterface.SourceRepository}.");
|
||||||
OtterTex.NativeDll.Initialize(DalamudServices.PluginInterface.AssemblyLocation.DirectoryName);
|
OtterTex.NativeDll.Initialize(pluginInterface.AssemblyLocation.DirectoryName);
|
||||||
Log.Information($"Loading native OtterTex assembly from {OtterTex.NativeDll.Directory}.");
|
Log.Information($"Loading native OtterTex assembly from {OtterTex.NativeDll.Directory}.");
|
||||||
|
|
||||||
if (CharacterUtility.Ready)
|
if (CharacterUtility.Ready)
|
||||||
|
|
@ -146,18 +128,17 @@ public partial class Penumbra : IDalamudPlugin
|
||||||
private void SetupApi()
|
private void SetupApi()
|
||||||
{
|
{
|
||||||
using var timer = _tmp.Services.GetRequiredService<StartTracker>().Measure(StartTimeType.Api);
|
using var timer = _tmp.Services.GetRequiredService<StartTracker>().Measure(StartTimeType.Api);
|
||||||
Api = (PenumbraApi)_tmp.Services.GetRequiredService<IPenumbraApi>();
|
var api = _tmp.Services.GetRequiredService<IPenumbraApi>();
|
||||||
IpcProviders = _tmp.Services.GetRequiredService<PenumbraIpcProviders>();
|
|
||||||
HttpApi = _tmp.Services.GetRequiredService<HttpApi>();
|
HttpApi = _tmp.Services.GetRequiredService<HttpApi>();
|
||||||
|
_tmp.Services.GetRequiredService<PenumbraIpcProviders>();
|
||||||
if (Config.EnableHttpApi)
|
if (Config.EnableHttpApi)
|
||||||
HttpApi.CreateWebServer();
|
HttpApi.CreateWebServer();
|
||||||
Api.ChangedItemTooltip += it =>
|
api.ChangedItemTooltip += it =>
|
||||||
{
|
{
|
||||||
if (it is Item)
|
if (it is Item)
|
||||||
ImGui.TextUnformatted("Left Click to create an item link in chat.");
|
ImGui.TextUnformatted("Left Click to create an item link in chat.");
|
||||||
};
|
};
|
||||||
Api.ChangedItemClicked += (button, it) =>
|
api.ChangedItemClicked += (button, it) =>
|
||||||
{
|
{
|
||||||
if (button == MouseButton.Left && it is Item item)
|
if (button == MouseButton.Left && it is Item item)
|
||||||
ChatService.LinkItem(item);
|
ChatService.LinkItem(item);
|
||||||
|
|
@ -170,7 +151,7 @@ public partial class Penumbra : IDalamudPlugin
|
||||||
{
|
{
|
||||||
using var tInterface = _tmp.Services.GetRequiredService<StartTracker>().Measure(StartTimeType.Interface);
|
using var tInterface = _tmp.Services.GetRequiredService<StartTracker>().Measure(StartTimeType.Interface);
|
||||||
var system = _tmp.Services.GetRequiredService<PenumbraWindowSystem>();
|
var system = _tmp.Services.GetRequiredService<PenumbraWindowSystem>();
|
||||||
_commandHandler = _tmp.Services.GetRequiredService<CommandHandler>();
|
_tmp.Services.GetRequiredService<CommandHandler>();
|
||||||
if (!_disposed)
|
if (!_disposed)
|
||||||
{
|
{
|
||||||
_windowSystem = system;
|
_windowSystem = system;
|
||||||
|
|
@ -237,8 +218,8 @@ public partial class Penumbra : IDalamudPlugin
|
||||||
var exists = Config.ModDirectory.Length > 0 && Directory.Exists(Config.ModDirectory);
|
var exists = Config.ModDirectory.Length > 0 && Directory.Exists(Config.ModDirectory);
|
||||||
var drive = exists ? new DriveInfo(new DirectoryInfo(Config.ModDirectory).Root.FullName) : null;
|
var drive = exists ? new DriveInfo(new DirectoryInfo(Config.ModDirectory).Root.FullName) : null;
|
||||||
sb.AppendLine("**Settings**");
|
sb.AppendLine("**Settings**");
|
||||||
sb.Append($"> **`Plugin Version: `** {Version}\n");
|
sb.Append($"> **`Plugin Version: `** {ValidityChecker.Version}\n");
|
||||||
sb.Append($"> **`Commit Hash: `** {CommitHash}\n");
|
sb.Append($"> **`Commit Hash: `** {ValidityChecker.CommitHash}\n");
|
||||||
sb.Append($"> **`Enable Mods: `** {Config.EnableMods}\n");
|
sb.Append($"> **`Enable Mods: `** {Config.EnableMods}\n");
|
||||||
sb.Append($"> **`Enable HTTP API: `** {Config.EnableHttpApi}\n");
|
sb.Append($"> **`Enable HTTP API: `** {Config.EnableHttpApi}\n");
|
||||||
sb.Append($"> **`Operating System: `** {(DalamudUtil.IsLinux() ? "Mac/Linux (Wine)" : "Windows")}\n");
|
sb.Append($"> **`Operating System: `** {(DalamudUtil.IsLinux() ? "Mac/Linux (Wine)" : "Windows")}\n");
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ public sealed class ConfigWindow : Window
|
||||||
private static string GetLabel(ValidityChecker checker)
|
private static string GetLabel(ValidityChecker checker)
|
||||||
=> checker.Version.Length == 0
|
=> checker.Version.Length == 0
|
||||||
? "Penumbra###PenumbraConfigWindow"
|
? "Penumbra###PenumbraConfigWindow"
|
||||||
: $"Penumbra v{Penumbra.Version}###PenumbraConfigWindow";
|
: $"Penumbra v{checker.Version}###PenumbraConfigWindow";
|
||||||
|
|
||||||
private void DrawProblemWindow(string text)
|
private void DrawProblemWindow(string text)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue