Avoid re-creating title version string every frame (#2117)

* Avoid re-creating title version string every frame

* Marked title version string that it has been changed by Dalamud by
  appending a newline payload with a string expression embedded within,
  which the game will ignore (effectively `<br(!Dalamud!)>`.)
* Added `PluginManager.LoadedPluginCount` which will count the number of
  loaded plugin without making a copy of the plugin list.
* Made TitleScreenMenuWindow.OnVersionStringDraw` update the title
  version text addon only if number of loaded plugin changes or the text
  is missing the custom suffix from the first point.

* Use OriginalTextPointer to determine if SetText(ROS) has been called
This commit is contained in:
srkizer 2024-11-26 10:09:43 +09:00 committed by GitHub
parent 4c9b2a1577
commit db4b6cea2c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 48 additions and 16 deletions

View file

@ -162,6 +162,27 @@ internal class PluginManager : IInternalDisposableService
/// </summary>
public static int DalamudApiLevel { get; private set; }
/// <summary>
/// Gets the number of loaded plugins.
/// </summary>
public int LoadedPluginCount
{
get
{
var res = 0;
lock (this.pluginListLock)
{
foreach (var p in this.installedPluginsList)
{
if (p.State == PluginState.Loaded)
res++;
}
}
return res;
}
}
/// <summary>
/// Gets a copy of the list of all loaded plugins.
/// </summary>