Merge branch 'master' into master

This commit is contained in:
wolfcomp 2023-01-25 00:12:06 +01:00 committed by GitHub
commit e5ef53b1c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 118 additions and 60 deletions

View file

@ -697,7 +697,7 @@ internal class DalamudInterface : IDisposable, IServiceType
ImGui.MenuItem(Util.AssemblyVersion, false);
ImGui.MenuItem(startInfo.GameVersion?.ToString() ?? "Unknown version", false);
ImGui.MenuItem($"D: {Util.GetGitHash()} CS: {Util.GetGitHashClientStructs()}", false);
ImGui.MenuItem($"D: {Util.GetGitHash()} CS: {Util.GetGitHashClientStructs()} [{FFXIVClientStructs.Interop.Resolver.Version}]", false);
ImGui.MenuItem($"CLR: {Environment.Version}", false);
ImGui.EndMenu();

View file

@ -417,8 +417,8 @@ internal class InterfaceManager : IDisposable, IServiceType
if (this.Device == null)
return null;
var dxgiDev = this.Device.QueryInterface<SharpDX.DXGI.Device>();
var dxgiAdapter = dxgiDev.Adapter.QueryInterfaceOrNull<SharpDX.DXGI.Adapter4>();
var dxgiDev = this.Device.QueryInterfaceOrNull<SharpDX.DXGI.Device>();
var dxgiAdapter = dxgiDev?.Adapter.QueryInterfaceOrNull<SharpDX.DXGI.Adapter4>();
if (dxgiAdapter == null)
return null;

View file

@ -46,6 +46,8 @@ internal class PluginInstallerWindow : Window, IDisposable
private readonly DateTime timeLoaded;
private readonly object listLock = new();
#region Image Tester State
private string[] testerImagePaths = new string[5];
@ -214,14 +216,17 @@ internal class PluginInstallerWindow : Window, IDisposable
/// <inheritdoc/>
public override void Draw()
{
this.DrawHeader();
this.DrawPluginCategories();
this.DrawFooter();
this.DrawErrorModal();
this.DrawUpdateModal();
this.DrawTestingWarningModal();
this.DrawFeedbackModal();
this.DrawProgressOverlay();
lock (this.listLock)
{
this.DrawHeader();
this.DrawPluginCategories();
this.DrawFooter();
this.DrawErrorModal();
this.DrawUpdateModal();
this.DrawTestingWarningModal();
this.DrawFeedbackModal();
this.DrawProgressOverlay();
}
}
/// <summary>
@ -431,7 +436,8 @@ internal class PluginInstallerWindow : Window, IDisposable
this.sortKind = selectable.SortKind;
this.filterText = selectable.Localization;
this.ResortPlugins();
lock (this.listLock)
this.ResortPlugins();
}
}
@ -1091,7 +1097,7 @@ internal class PluginInstallerWindow : Window, IDisposable
private void DrawPluginCategoryContent()
{
var ready = this.DrawPluginListLoading() && !this.AnyOperationInProgress;
var ready = this.DrawPluginListLoading();
if (!this.categoryManager.IsSelectionValid || !ready)
{
return;
@ -2684,11 +2690,14 @@ internal class PluginInstallerWindow : Window, IDisposable
{
var pluginManager = Service<PluginManager>.Get();
// By removing installed plugins only when the available plugin list changes (basically when the window is
// opened), plugins that have been newly installed remain in the available plugin list as installed.
this.pluginListAvailable = pluginManager.AvailablePlugins.ToList();
this.pluginListUpdatable = pluginManager.UpdatablePlugins.ToList();
this.ResortPlugins();
lock (this.listLock)
{
// By removing installed plugins only when the available plugin list changes (basically when the window is
// opened), plugins that have been newly installed remain in the available plugin list as installed.
this.pluginListAvailable = pluginManager.AvailablePlugins.ToList();
this.pluginListUpdatable = pluginManager.UpdatablePlugins.ToList();
this.ResortPlugins();
}
this.UpdateCategoriesOnPluginsChange();
}
@ -2697,10 +2706,13 @@ internal class PluginInstallerWindow : Window, IDisposable
{
var pluginManager = Service<PluginManager>.Get();
this.pluginListInstalled = pluginManager.InstalledPlugins.ToList();
this.pluginListUpdatable = pluginManager.UpdatablePlugins.ToList();
this.hasDevPlugins = this.pluginListInstalled.Any(plugin => plugin.IsDev);
this.ResortPlugins();
lock (this.listLock)
{
this.pluginListInstalled = pluginManager.InstalledPlugins.ToList();
this.pluginListUpdatable = pluginManager.UpdatablePlugins.ToList();
this.hasDevPlugins = this.pluginListInstalled.Any(plugin => plugin.IsDev);
this.ResortPlugins();
}
this.UpdateCategoriesOnPluginsChange();
}

View file

@ -6,6 +6,7 @@ using System.Reflection;
using Dalamud.Game;
using Dalamud.Hooking.Internal;
using Dalamud.Interface.Components;
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.Windowing;
using Dalamud.Plugin.Internal;
@ -68,6 +69,16 @@ internal class PluginStatWindow : Window
}
}
var loadedPlugins = pluginManager.InstalledPlugins.Where(plugin => plugin.State == PluginState.Loaded);
var totalLast = loadedPlugins.Sum(plugin => plugin.DalamudInterface?.UiBuilder.LastDrawTime ?? 0);
var totalAverage = loadedPlugins.Sum(plugin => plugin.DalamudInterface?.UiBuilder.DrawTimeHistory.DefaultIfEmpty().Average() ?? 0);
ImGuiComponents.TextWithLabel("Total Last", $"{totalLast / 10000f:F4}ms", "All last draw times added together");
ImGui.SameLine();
ImGuiComponents.TextWithLabel("Total Average", $"{totalAverage / 10000f:F4}ms", "All average draw times added together");
ImGui.SameLine();
ImGuiComponents.TextWithLabel("Collective Average", $"{(loadedPlugins.Any() ? totalAverage / loadedPlugins.Count() / 10000f : 0):F4}ms", "Average of all average draw times");
if (ImGui.BeginTable(
"##PluginStatsDrawTimes",
4,
@ -86,8 +97,6 @@ internal class PluginStatWindow : Window
ImGui.TableSetupColumn("Average");
ImGui.TableHeadersRow();
var loadedPlugins = pluginManager.InstalledPlugins.Where(plugin => plugin.State == PluginState.Loaded);
var sortSpecs = ImGui.TableGetSortSpecs();
loadedPlugins = sortSpecs.Specs.ColumnIndex switch
{
@ -149,6 +158,16 @@ internal class PluginStatWindow : Window
Framework.StatsHistory.Clear();
}
var statsHistory = Framework.StatsHistory.ToArray();
var totalLast = statsHistory.Sum(stats => stats.Value.LastOrDefault());
var totalAverage = statsHistory.Sum(stats => stats.Value.Average());
ImGuiComponents.TextWithLabel("Total Last", $"{totalLast:F4}ms", "All last update times added together");
ImGui.SameLine();
ImGuiComponents.TextWithLabel("Total Average", $"{totalAverage:F4}ms", "All average update times added together");
ImGui.SameLine();
ImGuiComponents.TextWithLabel("Collective Average", $"{(statsHistory.Any() ? totalAverage / statsHistory.Length : 0):F4}ms", "Average of all average update times");
if (ImGui.BeginTable(
"##PluginStatsFrameworkTimes",
4,
@ -167,8 +186,6 @@ internal class PluginStatWindow : Window
ImGui.TableSetupColumn("Average", ImGuiTableColumnFlags.None, 50);
ImGui.TableHeadersRow();
var statsHistory = Framework.StatsHistory.ToArray();
var sortSpecs = ImGui.TableGetSortSpecs();
statsHistory = sortSpecs.Specs.ColumnIndex switch
{

View file

@ -55,5 +55,6 @@ public class SettingsTabExperimental : SettingsTab
base.Draw();
ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudGrey, "Total memory used by Dalamud & Plugins: " + Util.FormatBytes(GC.GetTotalMemory(false)));
ImGuiHelpers.ScaledDummy(15);
}
}