Merge branch 'master' into feature/ifontatlas-lock-safety

This commit is contained in:
goat 2024-02-08 19:04:54 +01:00 committed by GitHub
commit 47b1dfd7f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 82 additions and 29 deletions

View file

@ -667,7 +667,7 @@ internal class DalamudInterface : IDisposable, IServiceType
}
var antiDebug = Service<AntiDebug>.Get();
if (ImGui.MenuItem("Enable AntiDebug", null, antiDebug.IsEnabled))
if (ImGui.MenuItem("Disable Debugging Protections", null, antiDebug.IsEnabled))
{
var newEnabled = !antiDebug.IsEnabled;
if (newEnabled)

View file

@ -1,4 +1,8 @@
using Dalamud.Game.Command;
using System.Linq;
using Dalamud.Game.Command;
using Dalamud.Interface.Utility.Raii;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
@ -28,9 +32,52 @@ internal class CommandWidget : IDataWindowWidget
{
var commandManager = Service<CommandManager>.Get();
foreach (var command in commandManager.Commands)
var tableFlags = ImGuiTableFlags.ScrollY | ImGuiTableFlags.Borders | ImGuiTableFlags.SizingStretchProp |
ImGuiTableFlags.Sortable | ImGuiTableFlags.SortTristate;
using var table = ImRaii.Table("CommandList", 4, tableFlags);
if (table)
{
ImGui.Text($"{command.Key}\n -> {command.Value.HelpMessage}\n -> In help: {command.Value.ShowInHelp}\n\n");
ImGui.TableSetupScrollFreeze(0, 1);
ImGui.TableSetupColumn("Command");
ImGui.TableSetupColumn("Plugin");
ImGui.TableSetupColumn("HelpMessage", ImGuiTableColumnFlags.NoSort);
ImGui.TableSetupColumn("In Help?", ImGuiTableColumnFlags.NoSort);
ImGui.TableHeadersRow();
var sortSpecs = ImGui.TableGetSortSpecs();
var commands = commandManager.Commands.ToArray();
if (sortSpecs.SpecsCount != 0)
{
commands = sortSpecs.Specs.ColumnIndex switch
{
0 => sortSpecs.Specs.SortDirection == ImGuiSortDirection.Ascending
? commands.OrderBy(kv => kv.Key).ToArray()
: commands.OrderByDescending(kv => kv.Key).ToArray(),
1 => sortSpecs.Specs.SortDirection == ImGuiSortDirection.Ascending
? commands.OrderBy(kv => kv.Value.LoaderAssemblyName).ToArray()
: commands.OrderByDescending(kv => kv.Value.LoaderAssemblyName).ToArray(),
_ => commands,
};
}
foreach (var command in commands)
{
ImGui.TableNextRow();
ImGui.TableSetColumnIndex(0);
ImGui.Text(command.Key);
ImGui.TableNextColumn();
ImGui.Text(command.Value.LoaderAssemblyName);
ImGui.TableNextColumn();
ImGui.TextWrapped(command.Value.HelpMessage);
ImGui.TableNextColumn();
ImGui.Text(command.Value.ShowInHelp ? "Yes" : "No");
}
}
}
}

View file

@ -2556,7 +2556,7 @@ internal class PluginInstallerWindow : Window, IDisposable
if (ImGui.MenuItem(Locs.PluginContext_DeletePluginConfigReload))
{
this.ShowDeletePluginConfigWarningModal(plugin.Name).ContinueWith(t =>
this.ShowDeletePluginConfigWarningModal(plugin.Manifest.Name).ContinueWith(t =>
{
var shouldDelete = t.Result;
@ -2571,7 +2571,7 @@ internal class PluginInstallerWindow : Window, IDisposable
{
this.installStatus = OperationStatus.Idle;
this.DisplayErrorContinuation(task, Locs.ErrorModal_DeleteConfigFail(plugin.Name));
this.DisplayErrorContinuation(task, Locs.ErrorModal_DeleteConfigFail(plugin.Manifest.InternalName));
});
}
});
@ -3773,7 +3773,7 @@ internal class PluginInstallerWindow : Window, IDisposable
public static string DeletePluginConfigWarningModal_Title => Loc.Localize("InstallerDeletePluginConfigWarning", "Warning###InstallerDeletePluginConfigWarning");
public static string DeletePluginConfigWarningModal_Body(string pluginName) => Loc.Localize("InstallerDeletePluginConfigWarningBody", "Are you sure you want to delete all data and configuration for v{0}?").Format(pluginName);
public static string DeletePluginConfigWarningModal_Body(string pluginName) => Loc.Localize("InstallerDeletePluginConfigWarningBody", "Are you sure you want to delete all data and configuration for {0}?").Format(pluginName);
public static string DeletePluginConfirmWarningModal_Yes => Loc.Localize("InstallerDeletePluginConfigWarningYes", "Yes");

View file

@ -31,17 +31,20 @@ public sealed class LanguageChooserSettingsEntry : SettingsEntry
try
{
var locLanguagesList = new List<string>();
string locLanguage;
foreach (var language in this.languages)
{
if (language != "ko")
switch (language)
{
locLanguage = CultureInfo.GetCultureInfo(language).NativeName;
locLanguagesList.Add(char.ToUpper(locLanguage[0]) + locLanguage[1..]);
}
else
{
locLanguagesList.Add("Korean");
case "ko":
locLanguagesList.Add("Korean");
break;
case "tw":
locLanguagesList.Add("中華民國國語");
break;
default:
string locLanguage = CultureInfo.GetCultureInfo(language).NativeName;
locLanguagesList.Add(char.ToUpper(locLanguage[0]) + locLanguage[1..]);
break;
}
}

View file

@ -746,10 +746,12 @@ public sealed class UiBuilder : IDisposable
public event IFontHandle.ImFontChangedDelegate? ImFontChanged;
public Exception? LoadException =>
this.wrapped!.LoadException ?? new ObjectDisposedException(nameof(FontHandleWrapper));
public Exception? LoadException => this.WrappedNotDisposed.LoadException;
public bool Available => this.wrapped?.Available ?? false;
public bool Available => this.WrappedNotDisposed.Available;
private IFontHandle WrappedNotDisposed =>
this.wrapped ?? throw new ObjectDisposedException(nameof(FontHandleWrapper));
public void Dispose()
{
@ -764,16 +766,15 @@ public sealed class UiBuilder : IDisposable
public ILockedImFont Lock() =>
this.wrapped?.Lock() ?? throw new ObjectDisposedException(nameof(FontHandleWrapper));
public IDisposable Push() =>
this.wrapped?.Push() ?? throw new ObjectDisposedException(nameof(FontHandleWrapper));
public IDisposable Push() => this.WrappedNotDisposed.Push();
public void Pop() => this.wrapped?.Pop();
public void Pop() => this.WrappedNotDisposed.Pop();
public Task<IFontHandle> WaitAsync() =>
this.wrapped?.WaitAsync().ContinueWith(_ => (IFontHandle)this) ??
throw new ObjectDisposedException(nameof(FontHandleWrapper));
this.WrappedNotDisposed.WaitAsync().ContinueWith(_ => (IFontHandle)this);
public override string ToString() => $"{nameof(FontHandleWrapper)}({this.wrapped})";
public override string ToString() =>
$"{nameof(FontHandleWrapper)}({this.wrapped?.ToString() ?? "disposed"})";
private void WrappedOnImFontChanged(IFontHandle obj, ILockedImFont lockedFont) =>
this.ImFontChanged?.Invoke(obj, lockedFont);

View file

@ -1094,7 +1094,7 @@ internal partial class PluginManager : IDisposable, IServiceType
{
try
{
this.PluginConfigs.Delete(plugin.Name);
this.PluginConfigs.Delete(plugin.Manifest.InternalName);
break;
}
catch (IOException)

View file

@ -1,4 +1,5 @@
using System.Diagnostics.Contracts;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using System.IO;
using System.Threading.Tasks;
@ -64,8 +65,9 @@ internal interface IDalamudAssetManager
/// </summary>
/// <param name="asset">The texture asset.</param>
/// <param name="defaultWrap">The default return value, if the asset is not ready for whatever reason.</param>
/// <returns>The texture wrap.</returns>
/// <returns>The texture wrap. Can be <c>null</c> only if <paramref name="defaultWrap"/> is <c>null</c>.</returns>
[Pure]
[return: NotNullIfNotNull(nameof(defaultWrap))]
IDalamudTextureWrap? GetDalamudTextureWrap(DalamudAsset asset, IDalamudTextureWrap? defaultWrap);
/// <summary>

2
build.sh Normal file → Executable file
View file

@ -59,4 +59,4 @@ fi
echo "Microsoft (R) .NET Core SDK version $("$DOTNET_EXE" --version)"
"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false /p:EnableWindowsTargeting=true -nologo -clp:NoSummary --verbosity quiet
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- /p:EnableWindowsTargeting=true "$@"
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@"

@ -1 +1 @@
Subproject commit e9341bb3038bf4200300f21be4a8629525d15596
Subproject commit b5f5f68e147e1a21a0f0c88345f8d8c359678317