Skip to content

Commit 27290ef

Browse files
committed
Add support log, improve bone name display, fix incognify issues
1 parent 22e7fe9 commit 27290ef

File tree

7 files changed

+180
-8
lines changed

7 files changed

+180
-8
lines changed

CustomizePlus.GameData/CustomizePlus.GameData.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,12 @@
4545
</Reference>
4646
</ItemGroup>
4747

48+
<!--<PropertyGroup Condition="'$(Configuration)'=='Debug'">
49+
<DefineConstants>INCOGNIFY_STRINGS</DefineConstants>
50+
</PropertyGroup>-->
51+
52+
<PropertyGroup Condition="'$(Configuration)'=='Release'">
53+
<DefineConstants>INCOGNIFY_STRINGS</DefineConstants>
54+
</PropertyGroup>
55+
4856
</Project>

CustomizePlus/Core/ServiceManagerBuilder.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ private static ServiceManager AddCore(this ServiceManager services)
137137
.AddSingleton<SaveService>()
138138
.AddSingleton<FilenameService>()
139139
.AddSingleton<BackupService>()
140-
.AddSingleton<FrameworkManager>();
140+
.AddSingleton<FrameworkManager>()
141+
.AddSingleton<SupportLogBuilderService>();
141142

142143
return services;
143144
}
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
using CustomizePlus.Armatures.Services;
2+
using CustomizePlus.Configuration.Data;
3+
using CustomizePlus.Core.Data;
4+
using CustomizePlus.Core.Extensions;
5+
using CustomizePlus.Profiles;
6+
using CustomizePlus.Templates;
7+
using Dalamud.Plugin;
8+
using OtterGui.Services;
9+
using System;
10+
using System.Collections.Generic;
11+
using System.Linq;
12+
using System.Reflection;
13+
using System.Text;
14+
using System.Threading.Tasks;
15+
16+
namespace CustomizePlus.Core.Services;
17+
18+
//Based on Penumbra's support log
19+
public class SupportLogBuilderService
20+
{
21+
private readonly PluginConfiguration _configuration;
22+
private readonly TemplateManager _templateManager;
23+
private readonly ProfileManager _profileManager;
24+
private readonly ArmatureManager _armatureManager;
25+
private readonly DalamudPluginInterface _dalamudPluginInterface;
26+
27+
public SupportLogBuilderService(
28+
PluginConfiguration configuration,
29+
TemplateManager templateManager,
30+
ProfileManager profileManager,
31+
ArmatureManager armatureManager,
32+
DalamudPluginInterface dalamudPluginInterface)
33+
{
34+
_configuration = configuration;
35+
_templateManager = templateManager;
36+
_profileManager = profileManager;
37+
_armatureManager = armatureManager;
38+
_dalamudPluginInterface = dalamudPluginInterface;
39+
}
40+
41+
public string BuildSupportLog()
42+
{
43+
var sb = new StringBuilder(10240);
44+
sb.AppendLine("**Settings**");
45+
sb.Append($"> **`Plugin Version: `** {Plugin.Version}\n");
46+
sb.Append($"> **`Commit Hash: `** {ThisAssembly.Git.Commit}+{ThisAssembly.Git.Sha}\n");
47+
sb.Append($"> **`Root editing: `** {_configuration.EditorConfiguration.RootPositionEditingEnabled}\n");
48+
sb.AppendLine("**Settings -> Editor Settings**");
49+
sb.Append($"> **`Limit to my creatures (editor): `** {_configuration.EditorConfiguration.LimitLookupToOwnedObjects}\n");
50+
sb.Append($"> **`Preview character (editor): `** {_configuration.EditorConfiguration.PreviewCharacterName?.Incognify() ?? "Not set"}\n");
51+
sb.AppendLine("**Settings -> Profile application**");
52+
sb.Append($"> **`Character window: `** {_configuration.ProfileApplicationSettings.ApplyInCharacterWindow}\n");
53+
sb.Append($"> **`Try On: `** {_configuration.ProfileApplicationSettings.ApplyInTryOn}\n");
54+
sb.Append($"> **`Cards: `** {_configuration.ProfileApplicationSettings.ApplyInCards}\n");
55+
sb.Append($"> **`Inspect: `** {_configuration.ProfileApplicationSettings.ApplyInInspect}\n");
56+
sb.Append($"> **`Lobby: `** {_configuration.ProfileApplicationSettings.ApplyInLobby}\n");
57+
sb.AppendLine("**Relevant plugins**");
58+
GatherRelevantPlugins(sb);
59+
sb.AppendLine("**Templates**");
60+
sb.Append($"> **`Count: `** {_templateManager.Templates.Count}\n");
61+
foreach (var template in _templateManager.Templates)
62+
{
63+
sb.Append($"> > **`{template.ToString(),-29}`**\n");
64+
}
65+
sb.AppendLine("**Profiles**");
66+
sb.Append($"> **`Count: `** {_profileManager.Profiles.Count}\n");
67+
foreach (var profile in _profileManager.Profiles)
68+
{
69+
sb.Append($"> > =====\n");
70+
sb.Append($"> > **`{profile.ToString(),-29}`*\n");
71+
sb.Append($"> > **`Name: {profile.Name.Text.Incognify()}`**\n");
72+
sb.Append($"> > **`Type: {profile.ProfileType}`**\n");
73+
sb.Append($"> > **`Character name: {profile.CharacterName.Text.Incognify()}`**\n");
74+
sb.Append($"> > **`Limit to my creatures: {profile.LimitLookupToOwnedObjects}`**\n");
75+
sb.Append($"> > **`Templates:`**\n");
76+
sb.Append($"> > > **`Count: {profile.Templates.Count}`**\n");
77+
foreach (var template in profile.Templates)
78+
{
79+
sb.Append($"> > > **`{template.ToString()}`**\n");
80+
}
81+
sb.Append($"> > **`Armatures:`**\n");
82+
sb.Append($"> > > **`Count: {profile.Armatures.Count}`**\n");
83+
foreach (var armature in profile.Armatures)
84+
{
85+
sb.Append($"> > > **`{armature.ToString()}`**\n");
86+
}
87+
sb.Append($"> > =====\n");
88+
}
89+
sb.AppendLine("**Armatures**");
90+
sb.Append($"> **`Count: `** {_armatureManager.Armatures.Count}\n");
91+
foreach (var kvPair in _armatureManager.Armatures)
92+
{
93+
var identifier = kvPair.Key;
94+
var armature = kvPair.Value;
95+
sb.Append($"> > =====\n");
96+
sb.Append($"> > **`{armature.ToString(),-29}`**\n");
97+
sb.Append($"> > **`Actor: {armature.ActorIdentifier.Incognito(null) ?? "None"}`**\n");
98+
sb.Append($"> > **`Built: {armature.IsBuilt}`**\n");
99+
sb.Append($"> > **`Visible: {armature.IsVisible}`**\n");
100+
sb.Append($"> > **`Pending rebind: {armature.IsPendingProfileRebind}`**\n");
101+
sb.Append($"> > **`Last seen: {armature.LastSeen}`**\n");
102+
sb.Append($"> > **`Profile: {armature.Profile?.ToString() ?? "None"}`**\n");
103+
sb.Append($"> > **`Main Root Bone/Total Bones/Partial Skeleton Count: {armature.MainRootBone}/{armature.TotalBoneCount}/{armature.PartialSkeletonCount}`**\n");
104+
sb.Append($"> > **`Bone template bindings:`**\n");
105+
foreach (var bindingKvPair in armature.BoneTemplateBinding)
106+
{
107+
sb.Append($"> > > **`{BoneData.GetBoneDisplayName(bindingKvPair.Key)} ({bindingKvPair.Key}) -> {bindingKvPair.Value.ToString()}`**\n");
108+
}
109+
sb.Append($"> > =====\n");
110+
}
111+
return sb.ToString();
112+
}
113+
114+
115+
private void GatherRelevantPlugins(StringBuilder sb)
116+
{
117+
ReadOnlySpan<string> relevantPlugins =
118+
[
119+
"MareSynchronos", "Ktisis", "Brio", "DynamicBridge"
120+
];
121+
var plugins = _dalamudPluginInterface.InstalledPlugins
122+
.GroupBy(p => p.InternalName)
123+
.ToDictionary(g => g.Key, g =>
124+
{
125+
var item = g.OrderByDescending(p => p.IsLoaded).ThenByDescending(p => p.Version).First();
126+
return (item.IsLoaded, item.Version, item.Name);
127+
});
128+
foreach (var plugin in relevantPlugins)
129+
{
130+
if (plugins.TryGetValue(plugin, out var data))
131+
sb.Append($"> **`{data.Name + ':',-29}`** {data.Version}{(data.IsLoaded ? string.Empty : " (Disabled)")}\n");
132+
}
133+
}
134+
}

CustomizePlus/CustomizePlus.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838

3939
<ItemGroup>
4040
<!--<PackageReference Include="DalamudPackager" Version="2.1.12" />-->
41+
<PackageReference Include="GitInfo" Version="3.3.5">
42+
<PrivateAssets>all</PrivateAssets>
43+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
44+
</PackageReference>
4145
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
4246
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
4347
<PrivateAssets>all</PrivateAssets>
@@ -82,7 +86,7 @@
8286
</None>
8387
</ItemGroup>
8488

85-
<!-- <PropertyGroup Condition="'$(Configuration)'=='Debug'">
89+
<!--<PropertyGroup Condition="'$(Configuration)'=='Debug'">
8690
<DefineConstants>INCOGNIFY_STRINGS</DefineConstants>
8791
</PropertyGroup>-->
8892

CustomizePlus/Plugin.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,25 @@
99
using OtterGui.Services;
1010
using CustomizePlus.Api;
1111
using ECommons;
12+
using ECommons.Commands;
13+
using ECommons.Configuration;
14+
using OtterGui;
15+
using System.IO;
16+
using System.Security.Cryptography;
17+
using System.Text;
18+
using System.Linq;
19+
using CustomizePlus.Configuration.Data;
20+
using CustomizePlus.Core.Extensions;
21+
using CustomizePlus.Templates;
22+
using CustomizePlus.Profiles;
23+
using CustomizePlus.Armatures.Services;
1224

1325
namespace CustomizePlus;
1426

1527
public sealed class Plugin : IDalamudPlugin
1628
{
1729
#if DEBUG
18-
public static readonly string Version = $"{Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? string.Empty} [DEBUG]";
30+
public static readonly string Version = $"{ThisAssembly.Git.Commit}+{ThisAssembly.Git.Sha} [DEBUG]";
1931
#else
2032
public static readonly string Version = Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? string.Empty;
2133
#endif
@@ -40,7 +52,7 @@ public Plugin(DalamudPluginInterface pluginInterface)
4052
_services.GetService<CPlusWindowSystem>();
4153
_services.GetService<CommandService>();
4254

43-
Logger.Information($"Customize+ v{Version} [FantasiaPlus] started");
55+
Logger.Information($"Customize+ v{Version} ({ThisAssembly.Git.Commit}+{ThisAssembly.Git.Sha}) [FantasiaPlus] started");
4456
}
4557
catch (Exception ex)
4658
{

CustomizePlus/UI/Windows/MainWindow/Tabs/Debug/StateMonitoringTab.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using CustomizePlus.Core.Extensions;
1313
using System.Numerics;
1414
using CustomizePlus.Game.Services;
15+
using CustomizePlus.Core.Data;
1516

1617
namespace CustomizePlus.UI.Windows.MainWindow.Tabs.Debug;
1718

@@ -187,7 +188,7 @@ private void DrawSingleTemplate(string prefix, Template template)
187188
#if !INCOGNIFY_STRINGS
188189
ImGui.Text($"{kvPair.Key}: p: {kvPair.Value.Translation} | r: {kvPair.Value.Rotation} | s: {kvPair.Value.Scaling}");
189190
#else
190-
ImGui.Text($"{kvPair.Key}: p: {(kvPair.Value.Translation.IsApproximately(Vector3.Zero) ? "Approx. not changed" : "Changed")} | r: {(kvPair.Value.Rotation.IsApproximately(Vector3.Zero) ? "Approx. not changed" : "Changed")} | s: {(kvPair.Value.Scaling.IsApproximately(Vector3.One) ? "Not changed" : "Changed")}");
191+
ImGui.Text($"{BoneData.GetBoneDisplayName(kvPair.Key)} ({kvPair.Key}): p: {(kvPair.Value.Translation.IsApproximately(Vector3.Zero) ? "Approx. not changed" : "Changed")} | r: {(kvPair.Value.Rotation.IsApproximately(Vector3.Zero) ? "Approx. not changed" : "Changed")} | s: {(kvPair.Value.Scaling.IsApproximately(Vector3.One) ? "Not changed" : "Changed")}");
191192
#endif
192193
}
193194
}
@@ -215,7 +216,7 @@ private void DrawSingleArmature(string prefix, Armature armature)
215216
ImGui.Text($"Bone template bindings:");
216217
foreach (var kvPair in armature.BoneTemplateBinding)
217218
{
218-
ImGui.Text($"{kvPair.Key} -> {kvPair.Value.Name.Text.Incognify()} ({kvPair.Value.UniqueId})");
219+
ImGui.Text($"{BoneData.GetBoneDisplayName(kvPair.Key)} ({kvPair.Key}) -> {kvPair.Value.Name.Text.Incognify()} ({kvPair.Value.UniqueId})");
219220
}
220221
}
221222
}

CustomizePlus/UI/Windows/MainWindow/Tabs/SettingsTab.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,24 @@ public class SettingsTab
2828
private readonly TemplateEditorManager _templateEditorManager;
2929
private readonly CPlusChangeLog _changeLog;
3030
private readonly MessageService _messageService;
31+
private readonly SupportLogBuilderService _supportLogBuilderService;
3132

3233
public SettingsTab(
3334
PluginConfiguration configuration,
3435
ArmatureManager armatureManager,
3536
HookingService hookingService,
3637
TemplateEditorManager templateEditorManager,
3738
CPlusChangeLog changeLog,
38-
MessageService messageService)
39+
MessageService messageService,
40+
SupportLogBuilderService supportLogBuilderService)
3941
{
4042
_configuration = configuration;
4143
_armatureManager = armatureManager;
4244
_hookingService = hookingService;
4345
_templateEditorManager = templateEditorManager;
4446
_changeLog = changeLog;
4547
_messageService = messageService;
48+
_supportLogBuilderService = supportLogBuilderService;
4649
}
4750

4851
public void Draw()
@@ -53,6 +56,7 @@ public void Draw()
5356

5457
DrawGeneralSettings();
5558

59+
ImGui.NewLine();
5660
ImGui.NewLine();
5761
ImGui.NewLine();
5862

@@ -299,7 +303,7 @@ private void DrawDebugModeCheckbox()
299303
#region Support Area
300304
private void DrawSupportButtons()
301305
{
302-
var width = ImGui.CalcTextSize("Join Discord for Support").X + ImGui.GetStyle().FramePadding.X * 2;
306+
var width = ImGui.CalcTextSize("Copy Support Info to Clipboard").X + ImGui.GetStyle().FramePadding.X * 2;
303307
var xPos = ImGui.GetWindowWidth() - width;
304308
// Respect the scroll bar width.
305309
if (ImGui.GetScrollMaxY() > 0)
@@ -311,6 +315,14 @@ private void DrawSupportButtons()
311315
ImGui.SetCursorPos(new Vector2(xPos, 1 * ImGui.GetFrameHeightWithSpacing()));
312316
if (ImGui.Button("Show update history", new Vector2(width, 0)))
313317
_changeLog.Changelog.ForceOpen = true;
318+
319+
ImGui.SetCursorPos(new Vector2(xPos, 2 * ImGui.GetFrameHeightWithSpacing()));
320+
if (!ImGui.Button("Copy Support Info to Clipboard"))
321+
return;
322+
323+
var text = _supportLogBuilderService.BuildSupportLog();
324+
ImGui.SetClipboardText(text);
325+
_messageService.NotificationMessage($"Copied Support Info to Clipboard.", NotificationType.Success, false);
314326
}
315327

316328
/// <summary> Draw a button to open the official discord server. </summary>

0 commit comments

Comments
 (0)