mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 10:17:22 +01:00
Added a bunch of logging, small fix.
This commit is contained in:
parent
9af4406c8c
commit
e8ee729ec5
16 changed files with 86 additions and 38 deletions
2
OtterGui
2
OtterGui
|
|
@ -1 +1 @@
|
|||
Subproject commit 1a3f6237c857562cac85de8f922dbef7bb63c870
|
||||
Subproject commit 627e313232a2e602432dcc4d090dccd5e27993a1
|
||||
|
|
@ -206,6 +206,7 @@ public partial class ModCollection
|
|||
|
||||
j.WriteEndObject();
|
||||
j.WriteEndObject();
|
||||
PluginLog.Verbose( "Active Collections saved." );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ public partial class ModCollection
|
|||
newCollection.Index = _collections.Count;
|
||||
_collections.Add( newCollection );
|
||||
newCollection.Save();
|
||||
PluginLog.Debug( "Added collection {Name:l}.", newCollection.Name );
|
||||
CollectionChanged.Invoke( Type.Inactive, null, newCollection );
|
||||
SetCollection( newCollection.Index, Type.Current );
|
||||
return true;
|
||||
|
|
@ -176,6 +177,7 @@ public partial class ModCollection
|
|||
}
|
||||
}
|
||||
|
||||
PluginLog.Debug( "Removed collection {Name:l}.", collection.Name );
|
||||
CollectionChanged.Invoke( Type.Inactive, collection, null );
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,24 +17,26 @@ public partial class ModCollection
|
|||
=> _cache != null;
|
||||
|
||||
// Only create, do not update.
|
||||
public void CreateCache( bool isDefault )
|
||||
private void CreateCache( bool isDefault )
|
||||
{
|
||||
if( _cache == null )
|
||||
{
|
||||
CalculateEffectiveFileList( true, isDefault );
|
||||
PluginLog.Verbose( "Created new cache for collection {Name:l}.", Name );
|
||||
}
|
||||
}
|
||||
|
||||
// Force an update with metadata for this cache.
|
||||
public void ForceCacheUpdate( bool isDefault )
|
||||
private void ForceCacheUpdate( bool isDefault )
|
||||
=> CalculateEffectiveFileList( true, isDefault );
|
||||
|
||||
|
||||
// Clear the current cache.
|
||||
public void ClearCache()
|
||||
private void ClearCache()
|
||||
{
|
||||
_cache?.Dispose();
|
||||
_cache = null;
|
||||
PluginLog.Verbose( "Cleared cache of collection {Name:l}.", Name );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -78,7 +80,7 @@ public partial class ModCollection
|
|||
return;
|
||||
}
|
||||
|
||||
PluginLog.Debug( "Recalculating effective file list for {CollectionName} [{WithMetaManipulations}] [{ReloadDefault}]", Name,
|
||||
PluginLog.Debug( "Recalculating effective file list for {CollectionName:l} [{WithMetaManipulations}] [{ReloadDefault}]", Name,
|
||||
withMetaManipulations, reloadDefault );
|
||||
_cache ??= new Cache( this );
|
||||
_cache.CalculateEffectiveFileList( withMetaManipulations );
|
||||
|
|
@ -164,6 +166,7 @@ public partial class ModCollection
|
|||
else
|
||||
{
|
||||
_cache.MetaManipulations.SetFiles();
|
||||
PluginLog.Debug( "Set CharacterUtility resources for collection {Name:l}.", Name );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -87,6 +87,7 @@ public partial class ModCollection
|
|||
try
|
||||
{
|
||||
file.Delete();
|
||||
PluginLog.Information( "Deleted collection file {File:l} for {Name:l}.", file.FullName, Name );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Dalamud.Logging;
|
||||
using OtterGui.Filesystem;
|
||||
using Penumbra.Mods;
|
||||
using Penumbra.Util;
|
||||
|
||||
namespace Penumbra.Collections;
|
||||
|
||||
|
|
@ -66,9 +66,6 @@ public partial class ModCollection
|
|||
return ValidInheritance.Valid;
|
||||
}
|
||||
|
||||
private bool CheckForCircle( ModCollection collection )
|
||||
=> ReferenceEquals( collection, this ) || _inheritance.Any( c => c.CheckForCircle( collection ) );
|
||||
|
||||
// Add a new collection to the inheritance list.
|
||||
// We do not check if this collection would be visited before,
|
||||
// only that it is unique in the list itself.
|
||||
|
|
@ -84,6 +81,7 @@ public partial class ModCollection
|
|||
collection.ModSettingChanged += OnInheritedModSettingChange;
|
||||
collection.InheritanceChanged += OnInheritedInheritanceChange;
|
||||
InheritanceChanged.Invoke( false );
|
||||
PluginLog.Debug( "Added {InheritedName:l} to {Name:l} inheritances.", collection.Name, Name );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -94,6 +92,7 @@ public partial class ModCollection
|
|||
inheritance.InheritanceChanged -= OnInheritedInheritanceChange;
|
||||
_inheritance.RemoveAt( idx );
|
||||
InheritanceChanged.Invoke( false );
|
||||
PluginLog.Debug( "Removed {InheritedName:l} from {Name:l} inheritances.", inheritance.Name, Name );
|
||||
}
|
||||
|
||||
// Order in the inheritance list is relevant.
|
||||
|
|
@ -102,6 +101,7 @@ public partial class ModCollection
|
|||
if( _inheritance.Move( from, to ) )
|
||||
{
|
||||
InheritanceChanged.Invoke( false );
|
||||
PluginLog.Debug( "Moved {Name:l}s inheritance {From} to {To}.", Name, from, to );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ public unsafe class CharacterUtility : IDisposable
|
|||
{
|
||||
ResetResource( idx );
|
||||
}
|
||||
PluginLog.Debug( "Reset all CharacterUtility resources to default." );
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using Dalamud.Logging;
|
||||
using Dalamud.Utility.Signatures;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.Resource;
|
||||
using Penumbra.Collections;
|
||||
|
|
@ -70,9 +71,10 @@ public partial class PathResolver : IDisposable
|
|||
EnableMetaHooks();
|
||||
|
||||
_loader.ResolvePathCustomization += CharacterResolver;
|
||||
PluginLog.Debug( "Character Path Resolver enabled." );
|
||||
}
|
||||
|
||||
public void Disable()
|
||||
private void Disable()
|
||||
{
|
||||
if( !Enabled )
|
||||
{
|
||||
|
|
@ -90,6 +92,7 @@ public partial class PathResolver : IDisposable
|
|||
PathCollections.Clear();
|
||||
|
||||
_loader.ResolvePathCustomization -= CharacterResolver;
|
||||
PluginLog.Debug( "Character Path Resolver disabled." );
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ public partial class Mod
|
|||
try
|
||||
{
|
||||
Directory.Delete( mod.BasePath.FullName, true );
|
||||
PluginLog.Debug( "Deleted directory {Directory:l} for {Name:l}.", mod.BasePath.FullName, mod.Name );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
|
|
@ -47,6 +48,7 @@ public partial class Mod
|
|||
}
|
||||
|
||||
ModPathChanged.Invoke( ModPathChangeType.Deleted, mod, mod.BasePath, null );
|
||||
PluginLog.Debug( "Deleted mod {Name:l}.", mod.Name );
|
||||
}
|
||||
|
||||
// Load a new mod and add it to the manager if successful.
|
||||
|
|
@ -66,6 +68,7 @@ public partial class Mod
|
|||
mod.Index = _mods.Count;
|
||||
_mods.Add( mod );
|
||||
ModPathChanged.Invoke( ModPathChangeType.Added, mod, null, mod.BasePath );
|
||||
PluginLog.Debug( "Added new mod {Name:l} from {Directory:l}.", mod.Name, modFolder.FullName );
|
||||
}
|
||||
|
||||
// Add new mods to NewMods and remove deleted mods from NewMods.
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ public sealed partial class Mod
|
|||
Valid = Directory.Exists( newDir.FullName );
|
||||
if( Penumbra.Config.ModDirectory != BasePath.FullName )
|
||||
{
|
||||
PluginLog.Information( "Set new mod base directory from {OldDirectory:l} to {NewDirectory:l}.", Penumbra.Config.ModDirectory, BasePath.FullName );
|
||||
Penumbra.Config.ModDirectory = BasePath.FullName;
|
||||
Penumbra.Config.Save();
|
||||
}
|
||||
|
|
@ -86,6 +87,7 @@ public sealed partial class Mod
|
|||
}
|
||||
|
||||
ModDiscoveryFinished?.Invoke();
|
||||
PluginLog.Information( "Rediscovered mods." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ public partial class Mod
|
|||
{
|
||||
var group = new MultiModGroup()
|
||||
{
|
||||
Name = groupData.GroupName!,
|
||||
Name = groupData.GroupName,
|
||||
Description = desc,
|
||||
Priority = priority,
|
||||
};
|
||||
|
|
@ -79,7 +79,7 @@ public partial class Mod
|
|||
{
|
||||
var group = new SingleModGroup()
|
||||
{
|
||||
Name = groupData.GroupName!,
|
||||
Name = groupData.GroupName,
|
||||
Description = desc,
|
||||
Priority = priority,
|
||||
};
|
||||
|
|
@ -97,9 +97,9 @@ public partial class Mod
|
|||
.Select( f => ( Utf8GamePath.FromFile( f, optionFolder, out var gamePath, true ), gamePath, new FullPath( f ) ) )
|
||||
.Where( t => t.Item1 );
|
||||
|
||||
var mod = new SubMod()
|
||||
var mod = new SubMod
|
||||
{
|
||||
Name = option.Name!,
|
||||
Name = option.Name,
|
||||
};
|
||||
foreach( var (_, gamePath, file) in list )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Dalamud.Logging;
|
||||
using OtterGui.Filesystem;
|
||||
|
||||
namespace Penumbra.Mods;
|
||||
|
|
@ -14,8 +15,11 @@ public sealed class ModFileSystem : FileSystem< Mod >, IDisposable
|
|||
// Save the current sort order.
|
||||
// Does not save or copy the backup in the current mod directory,
|
||||
// as this is done on mod directory changes only.
|
||||
public void Save()
|
||||
=> SaveToFile( new FileInfo( ModFileSystemFile ), SaveMod, true );
|
||||
private void Save()
|
||||
{
|
||||
SaveToFile( new FileInfo( ModFileSystemFile ), SaveMod, true );
|
||||
PluginLog.Verbose( "Saved mod filesystem." );
|
||||
}
|
||||
|
||||
// Create a new ModFileSystem from the currently loaded mods and the current sort order file.
|
||||
public static ModFileSystem Load()
|
||||
|
|
@ -46,6 +50,7 @@ public sealed class ModFileSystem : FileSystem< Mod >, IDisposable
|
|||
{
|
||||
Save();
|
||||
}
|
||||
PluginLog.Debug( "Reloaded mod filesystem." );
|
||||
}
|
||||
|
||||
// Save the filesystem on every filesystem change except full reloading.
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ public interface IModGroup : IEnumerable< ISubMod >
|
|||
try
|
||||
{
|
||||
File.Delete( file );
|
||||
PluginLog.Debug( "Deleted group file {File:l} for {GroupName:l}.", file, Name );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
|
|
@ -81,6 +82,7 @@ public interface IModGroup : IEnumerable< ISubMod >
|
|||
|
||||
j.WriteEndArray();
|
||||
j.WriteEndObject();
|
||||
PluginLog.Debug( "Saved group file {File:l} for {GroupName:l}.", file, group.Name );
|
||||
}
|
||||
|
||||
public IModGroup Convert( SelectType type );
|
||||
|
|
|
|||
|
|
@ -338,6 +338,7 @@ public sealed partial class ModFileSystemSelector : FileSystemSelector< Mod, Mod
|
|||
{
|
||||
base.SelectedLeaf = ( ModFileSystem.Leaf? )FileSystem.Root.GetAllDescendants( SortMode.Lexicographical )
|
||||
.FirstOrDefault( l => l is ModFileSystem.Leaf m && m.Value.BasePath.FullName == _lastSelectedDirectory );
|
||||
OnSelectionChange( null, base.SelectedLeaf?.Value, default );
|
||||
_lastSelectedDirectory = string.Empty;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using Penumbra.Mods;
|
|||
using Penumbra.UI.Classes;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using Dalamud.Logging;
|
||||
|
||||
namespace Penumbra.UI;
|
||||
|
||||
|
|
@ -18,21 +19,36 @@ public partial class ConfigWindow
|
|||
return;
|
||||
}
|
||||
|
||||
using var tab = ImRaii.TabItem( "Mods" );
|
||||
if( !tab )
|
||||
try
|
||||
{
|
||||
return;
|
||||
using var tab = ImRaii.TabItem( "Mods" );
|
||||
if( !tab )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_selector.Draw( GetModSelectorSize() );
|
||||
ImGui.SameLine();
|
||||
using var group = ImRaii.Group();
|
||||
DrawHeaderLine();
|
||||
|
||||
using var child = ImRaii.Child( "##ModsTabMod", -Vector2.One, true, ImGuiWindowFlags.HorizontalScrollbar );
|
||||
if( child )
|
||||
{
|
||||
_modPanel.Draw( _selector );
|
||||
}
|
||||
}
|
||||
|
||||
_selector.Draw( GetModSelectorSize() );
|
||||
ImGui.SameLine();
|
||||
using var group = ImRaii.Group();
|
||||
DrawHeaderLine();
|
||||
|
||||
using var child = ImRaii.Child( "##ModsTabMod", -Vector2.One, true, ImGuiWindowFlags.HorizontalScrollbar );
|
||||
if( child )
|
||||
catch( Exception e )
|
||||
{
|
||||
_modPanel.Draw( _selector );
|
||||
PluginLog.Error($"Exception thrown during ModPanel Render:\n{e}" );
|
||||
PluginLog.Error($"{Penumbra.ModManager.Count} Mods\n"
|
||||
+ $"{Penumbra.CollectionManager.Current.Name} Current Collection\n"
|
||||
+ $"{Penumbra.CollectionManager.Current.Settings.Count} Settings\n"
|
||||
+ $"{_selector.SortMode} Sort Mode\n"
|
||||
+ $"{_selector.SelectedLeaf?.Name ?? "NULL"} Selected Leaf\n"
|
||||
+ $"{_selector.Selected?.Name ?? "NULL"} Selected Mod\n"
|
||||
+ $"{string.Join(", ", Penumbra.CollectionManager.Current.Inheritance)} Inheritances\n"
|
||||
+ $"{_selector.SelectedSettingCollection.Name} Collection\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Numerics;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Logging;
|
||||
using ImGuiNET;
|
||||
using OtterGui.Raii;
|
||||
using Penumbra.Mods;
|
||||
|
|
@ -27,7 +28,7 @@ public sealed partial class ConfigWindow : Window, IDisposable
|
|||
{
|
||||
_penumbra = penumbra;
|
||||
_settingsTab = new SettingsTab( this );
|
||||
_selector = new ModFileSystemSelector( _penumbra.ModFileSystem );
|
||||
_selector = new ModFileSystemSelector( _penumbra.ModFileSystem );
|
||||
_modPanel = new ModPanel( this );
|
||||
_collectionsTab = new CollectionsTab( this );
|
||||
_effectiveTab = new EffectiveTab();
|
||||
|
|
@ -47,15 +48,22 @@ public sealed partial class ConfigWindow : Window, IDisposable
|
|||
|
||||
public override void Draw()
|
||||
{
|
||||
using var bar = ImRaii.TabBar( string.Empty, ImGuiTabBarFlags.NoTooltip );
|
||||
SetupSizes();
|
||||
_settingsTab.Draw();
|
||||
DrawModsTab();
|
||||
_collectionsTab.Draw();
|
||||
DrawChangedItemTab();
|
||||
_effectiveTab.Draw();
|
||||
_debugTab.Draw();
|
||||
_resourceTab.Draw();
|
||||
try
|
||||
{
|
||||
using var bar = ImRaii.TabBar( string.Empty, ImGuiTabBarFlags.NoTooltip );
|
||||
SetupSizes();
|
||||
_settingsTab.Draw();
|
||||
DrawModsTab();
|
||||
_collectionsTab.Draw();
|
||||
DrawChangedItemTab();
|
||||
_effectiveTab.Draw();
|
||||
_debugTab.Draw();
|
||||
_resourceTab.Draw();
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
PluginLog.Error( $"Exception thrown during UI Render:\n{e}" );
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue