mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-23 08:59:18 +01:00
Even almoster...
This commit is contained in:
parent
65bd1d1b52
commit
8dd681bdda
19 changed files with 2625 additions and 1865 deletions
|
|
@ -1,5 +1,4 @@
|
|||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Components;
|
||||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
using OtterGui.Raii;
|
||||
|
|
@ -10,160 +9,164 @@ namespace Penumbra.UI;
|
|||
|
||||
public partial class ConfigWindow
|
||||
{
|
||||
// Sets the resource logger state when toggled,
|
||||
// and the filter when entered.
|
||||
private void DrawRequestedResourceLogging()
|
||||
private partial class SettingsTab
|
||||
{
|
||||
var tmp = Penumbra.Config.EnableResourceLogging;
|
||||
if( ImGui.Checkbox( "##resourceLogging", ref tmp ) )
|
||||
private void DrawAdvancedSettings()
|
||||
{
|
||||
_penumbra.ResourceLogger.SetState( tmp );
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGuiUtil.LabeledHelpMarker( "Enable Requested Resource Logging", "Log all game paths FFXIV requests to the plugin log.\n"
|
||||
+ "You can filter the logged paths for those containing the entered string or matching the regex, if the entered string compiles to a valid regex.\n"
|
||||
+ "Red boundary indicates invalid regex." );
|
||||
|
||||
ImGui.SameLine();
|
||||
|
||||
// Red borders if the string is not a valid regex.
|
||||
var tmpString = Penumbra.Config.ResourceLoggingFilter;
|
||||
using var color = ImRaii.PushColor( ImGuiCol.Border, Colors.RegexWarningBorder, !_penumbra.ResourceLogger.ValidRegex );
|
||||
using var style = ImRaii.PushStyle( ImGuiStyleVar.FrameBorderSize, ImGuiHelpers.GlobalScale, !_penumbra.ResourceLogger.ValidRegex );
|
||||
ImGui.SetNextItemWidth( -1 );
|
||||
if( ImGui.InputTextWithHint( "##ResourceLogFilter", "Filter...", ref tmpString, Utf8GamePath.MaxGamePathLength ) )
|
||||
{
|
||||
_penumbra.ResourceLogger.SetFilter( tmpString );
|
||||
}
|
||||
}
|
||||
|
||||
// Toggling audio streaming will need to apply to the music manager
|
||||
// and rediscover mods due to determining whether .scds will be loaded or not.
|
||||
private void DrawDisableSoundStreamingBox()
|
||||
{
|
||||
var tmp = Penumbra.Config.DisableSoundStreaming;
|
||||
if( ImGui.Checkbox( "##streaming", ref tmp ) && tmp != Penumbra.Config.DisableSoundStreaming )
|
||||
{
|
||||
Penumbra.Config.DisableSoundStreaming = tmp;
|
||||
Penumbra.Config.Save();
|
||||
if( tmp )
|
||||
if( !Penumbra.Config.ShowAdvanced || !ImGui.CollapsingHeader( "Advanced" ) )
|
||||
{
|
||||
_penumbra.MusicManager.DisableStreaming();
|
||||
}
|
||||
else
|
||||
{
|
||||
_penumbra.MusicManager.EnableStreaming();
|
||||
return;
|
||||
}
|
||||
|
||||
Penumbra.ModManager.DiscoverMods();
|
||||
DrawRequestedResourceLogging();
|
||||
DrawDisableSoundStreamingBox();
|
||||
DrawEnableHttpApiBox();
|
||||
DrawEnableDebugModeBox();
|
||||
DrawEnableFullResourceLoggingBox();
|
||||
DrawReloadResourceButton();
|
||||
ImGui.NewLine();
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGuiUtil.LabeledHelpMarker( "Disable Audio Streaming",
|
||||
"Disable streaming in the games audio engine.\n"
|
||||
+ "If you do not disable streaming, you can not replace sound files in the game (*.scd files), they will be ignored by Penumbra.\n\n"
|
||||
+ "Only touch this if you experience sound problems.\n"
|
||||
+ "If you toggle this, make sure no modified or to-be-modified sound file is currently playing or was recently playing, else you might crash.\n"
|
||||
+ "You might need to restart your game for this to fully take effect." );
|
||||
}
|
||||
|
||||
// Creates and destroys the web server when toggled.
|
||||
private void DrawEnableHttpApiBox()
|
||||
{
|
||||
var http = Penumbra.Config.EnableHttpApi;
|
||||
if( ImGui.Checkbox( "##http", ref http ) )
|
||||
// Sets the resource logger state when toggled,
|
||||
// and the filter when entered.
|
||||
private void DrawRequestedResourceLogging()
|
||||
{
|
||||
if( http )
|
||||
var tmp = Penumbra.Config.EnableResourceLogging;
|
||||
if( ImGui.Checkbox( "##resourceLogging", ref tmp ) )
|
||||
{
|
||||
_penumbra.CreateWebServer();
|
||||
}
|
||||
else
|
||||
{
|
||||
_penumbra.ShutdownWebServer();
|
||||
_window._penumbra.ResourceLogger.SetState( tmp );
|
||||
}
|
||||
|
||||
Penumbra.Config.EnableHttpApi = http;
|
||||
Penumbra.Config.Save();
|
||||
ImGui.SameLine();
|
||||
ImGuiUtil.LabeledHelpMarker( "Enable Requested Resource Logging", "Log all game paths FFXIV requests to the plugin log.\n"
|
||||
+ "You can filter the logged paths for those containing the entered string or matching the regex, if the entered string compiles to a valid regex.\n"
|
||||
+ "Red boundary indicates invalid regex." );
|
||||
|
||||
ImGui.SameLine();
|
||||
|
||||
// Red borders if the string is not a valid regex.
|
||||
var tmpString = Penumbra.Config.ResourceLoggingFilter;
|
||||
using var color = ImRaii.PushColor( ImGuiCol.Border, Colors.RegexWarningBorder, !_window._penumbra.ResourceLogger.ValidRegex );
|
||||
using var style = ImRaii.PushStyle( ImGuiStyleVar.FrameBorderSize, ImGuiHelpers.GlobalScale,
|
||||
!_window._penumbra.ResourceLogger.ValidRegex );
|
||||
ImGui.SetNextItemWidth( -1 );
|
||||
if( ImGui.InputTextWithHint( "##ResourceLogFilter", "Filter...", ref tmpString, Utf8GamePath.MaxGamePathLength ) )
|
||||
{
|
||||
_window._penumbra.ResourceLogger.SetFilter( tmpString );
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGuiUtil.LabeledHelpMarker( "Enable HTTP API",
|
||||
"Enables other applications, e.g. Anamnesis, to use some Penumbra functions, like requesting redraws." );
|
||||
}
|
||||
|
||||
// Should only be used for debugging.
|
||||
private static void DrawEnableFullResourceLoggingBox()
|
||||
{
|
||||
var tmp = Penumbra.Config.EnableFullResourceLogging;
|
||||
if( ImGui.Checkbox( "##fullLogging", ref tmp ) && tmp != Penumbra.Config.EnableFullResourceLogging )
|
||||
// Toggling audio streaming will need to apply to the music manager
|
||||
// and rediscover mods due to determining whether .scds will be loaded or not.
|
||||
private void DrawDisableSoundStreamingBox()
|
||||
{
|
||||
if( tmp )
|
||||
var tmp = Penumbra.Config.DisableSoundStreaming;
|
||||
if( ImGui.Checkbox( "##streaming", ref tmp ) && tmp != Penumbra.Config.DisableSoundStreaming )
|
||||
{
|
||||
Penumbra.ResourceLoader.EnableFullLogging();
|
||||
}
|
||||
else
|
||||
{
|
||||
Penumbra.ResourceLoader.DisableFullLogging();
|
||||
Penumbra.Config.DisableSoundStreaming = tmp;
|
||||
Penumbra.Config.Save();
|
||||
if( tmp )
|
||||
{
|
||||
_window._penumbra.MusicManager.DisableStreaming();
|
||||
}
|
||||
else
|
||||
{
|
||||
_window._penumbra.MusicManager.EnableStreaming();
|
||||
}
|
||||
|
||||
Penumbra.ModManager.DiscoverMods();
|
||||
}
|
||||
|
||||
Penumbra.Config.EnableFullResourceLogging = tmp;
|
||||
Penumbra.Config.Save();
|
||||
ImGui.SameLine();
|
||||
ImGuiUtil.LabeledHelpMarker( "Disable Audio Streaming",
|
||||
"Disable streaming in the games audio engine.\n"
|
||||
+ "If you do not disable streaming, you can not replace sound files in the game (*.scd files), they will be ignored by Penumbra.\n\n"
|
||||
+ "Only touch this if you experience sound problems.\n"
|
||||
+ "If you toggle this, make sure no modified or to-be-modified sound file is currently playing or was recently playing, else you might crash.\n"
|
||||
+ "You might need to restart your game for this to fully take effect." );
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGuiUtil.LabeledHelpMarker( "Enable Full Resource Logging",
|
||||
"[DEBUG] Enable the logging of all ResourceLoader events indiscriminately." );
|
||||
}
|
||||
|
||||
// Should only be used for debugging.
|
||||
private static void DrawEnableDebugModeBox()
|
||||
{
|
||||
var tmp = Penumbra.Config.DebugMode;
|
||||
if( ImGui.Checkbox( "##debugMode", ref tmp ) && tmp != Penumbra.Config.DebugMode )
|
||||
// Creates and destroys the web server when toggled.
|
||||
private void DrawEnableHttpApiBox()
|
||||
{
|
||||
if( tmp )
|
||||
var http = Penumbra.Config.EnableHttpApi;
|
||||
if( ImGui.Checkbox( "##http", ref http ) )
|
||||
{
|
||||
Penumbra.ResourceLoader.EnableDebug();
|
||||
}
|
||||
else
|
||||
{
|
||||
Penumbra.ResourceLoader.DisableDebug();
|
||||
if( http )
|
||||
{
|
||||
_window._penumbra.CreateWebServer();
|
||||
}
|
||||
else
|
||||
{
|
||||
_window._penumbra.ShutdownWebServer();
|
||||
}
|
||||
|
||||
Penumbra.Config.EnableHttpApi = http;
|
||||
Penumbra.Config.Save();
|
||||
}
|
||||
|
||||
Penumbra.Config.DebugMode = tmp;
|
||||
Penumbra.Config.Save();
|
||||
ImGui.SameLine();
|
||||
ImGuiUtil.LabeledHelpMarker( "Enable HTTP API",
|
||||
"Enables other applications, e.g. Anamnesis, to use some Penumbra functions, like requesting redraws." );
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGuiUtil.LabeledHelpMarker( "Enable Debug Mode",
|
||||
"[DEBUG] Enable the Debug Tab and Resource Manager Tab as well as some additional data collection. Also open the config window on plugin load." );
|
||||
}
|
||||
|
||||
private static void DrawReloadResourceButton()
|
||||
{
|
||||
if( ImGui.Button( "Reload Resident Resources" ) )
|
||||
// Should only be used for debugging.
|
||||
private static void DrawEnableFullResourceLoggingBox()
|
||||
{
|
||||
Penumbra.ResidentResources.Reload();
|
||||
var tmp = Penumbra.Config.EnableFullResourceLogging;
|
||||
if( ImGui.Checkbox( "##fullLogging", ref tmp ) && tmp != Penumbra.Config.EnableFullResourceLogging )
|
||||
{
|
||||
if( tmp )
|
||||
{
|
||||
Penumbra.ResourceLoader.EnableFullLogging();
|
||||
}
|
||||
else
|
||||
{
|
||||
Penumbra.ResourceLoader.DisableFullLogging();
|
||||
}
|
||||
|
||||
Penumbra.Config.EnableFullResourceLogging = tmp;
|
||||
Penumbra.Config.Save();
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGuiUtil.LabeledHelpMarker( "Enable Full Resource Logging",
|
||||
"[DEBUG] Enable the logging of all ResourceLoader events indiscriminately." );
|
||||
}
|
||||
|
||||
ImGuiUtil.HoverTooltip( "Reload some specific files that the game keeps in memory at all times.\n"
|
||||
+ "You usually should not need to do this." );
|
||||
}
|
||||
|
||||
private void DrawAdvancedSettings()
|
||||
{
|
||||
if( !Penumbra.Config.ShowAdvanced || !ImGui.CollapsingHeader( "Advanced" ) )
|
||||
// Should only be used for debugging.
|
||||
private static void DrawEnableDebugModeBox()
|
||||
{
|
||||
return;
|
||||
var tmp = Penumbra.Config.DebugMode;
|
||||
if( ImGui.Checkbox( "##debugMode", ref tmp ) && tmp != Penumbra.Config.DebugMode )
|
||||
{
|
||||
if( tmp )
|
||||
{
|
||||
Penumbra.ResourceLoader.EnableDebug();
|
||||
}
|
||||
else
|
||||
{
|
||||
Penumbra.ResourceLoader.DisableDebug();
|
||||
}
|
||||
|
||||
Penumbra.Config.DebugMode = tmp;
|
||||
Penumbra.Config.Save();
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGuiUtil.LabeledHelpMarker( "Enable Debug Mode",
|
||||
"[DEBUG] Enable the Debug Tab and Resource Manager Tab as well as some additional data collection. Also open the config window on plugin load." );
|
||||
}
|
||||
|
||||
DrawRequestedResourceLogging();
|
||||
DrawDisableSoundStreamingBox();
|
||||
DrawEnableHttpApiBox();
|
||||
DrawEnableDebugModeBox();
|
||||
DrawEnableFullResourceLoggingBox();
|
||||
DrawReloadResourceButton();
|
||||
ImGui.NewLine();
|
||||
private static void DrawReloadResourceButton()
|
||||
{
|
||||
if( ImGui.Button( "Reload Resident Resources" ) )
|
||||
{
|
||||
Penumbra.ResidentResources.Reload();
|
||||
}
|
||||
|
||||
ImGuiUtil.HoverTooltip( "Reload some specific files that the game keeps in memory at all times.\n"
|
||||
+ "You usually should not need to do this." );
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue