mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-03 14:23:40 +01:00
Compare commits
5 commits
bd427d7b54
...
c136934aa8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c136934aa8 | ||
|
|
c6b173dd63 | ||
|
|
9e5195492e | ||
|
|
1e7e7c732d | ||
|
|
efd66fd3f8 |
5 changed files with 87 additions and 16 deletions
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<PropertyGroup Label="Feature">
|
||||
<Description>XIV Launcher addon framework</Description>
|
||||
<DalamudVersion>13.0.0.10</DalamudVersion>
|
||||
<DalamudVersion>13.0.0.11</DalamudVersion>
|
||||
<AssemblyVersion>$(DalamudVersion)</AssemblyVersion>
|
||||
<Version>$(DalamudVersion)</Version>
|
||||
<FileVersion>$(DalamudVersion)</FileVersion>
|
||||
|
|
|
|||
|
|
@ -1060,7 +1060,7 @@ internal class DalamudInterface : IInternalDisposableService
|
|||
{
|
||||
ImGui.PushFont(InterfaceManager.MonoFont);
|
||||
|
||||
ImGui.BeginMenu(Util.GetBranch() ?? "???", false);
|
||||
ImGui.BeginMenu($"{Util.GetActiveTrack() ?? "???"} on {Util.GetGitBranch() ?? "???"}", false);
|
||||
ImGui.BeginMenu($"{Util.GetScmVersion()}", false);
|
||||
ImGui.BeginMenu(this.FrameCount.ToString("000000"), false);
|
||||
ImGui.BeginMenu(ImGui.GetIO().Framerate.ToString("000"), false);
|
||||
|
|
|
|||
|
|
@ -46,10 +46,12 @@ public class BranchSwitcherWindow : Window
|
|||
this.branches = await client.GetFromJsonAsync<Dictionary<string, VersionEntry>>(BranchInfoUrl);
|
||||
Debug.Assert(this.branches != null, "this.branches != null");
|
||||
|
||||
var branch = Util.GetBranch();
|
||||
this.selectedBranchIndex = this.branches!.Any(x => x.Value.Track == branch) ?
|
||||
this.branches.TakeWhile(x => x.Value.Track != branch).Count()
|
||||
: 0;
|
||||
var trackName = Util.GetActiveTrack();
|
||||
this.selectedBranchIndex = this.branches.IndexOf(x => x.Value.Track != trackName);
|
||||
if (this.selectedBranchIndex == -1)
|
||||
{
|
||||
this.selectedBranchIndex = 0;
|
||||
}
|
||||
});
|
||||
|
||||
base.OnOpen();
|
||||
|
|
@ -103,7 +105,7 @@ public class BranchSwitcherWindow : Window
|
|||
};
|
||||
|
||||
ps.ArgumentList.Add($"--dalamud-beta-kind={config.DalamudBetaKind}");
|
||||
ps.ArgumentList.Add($"--dalamud-beta-key={config.DalamudBetaKey}");
|
||||
ps.ArgumentList.Add($"--dalamud-beta-key={(config.DalamudBetaKey.IsNullOrEmpty() ? "invalid" : config.DalamudBetaKey)}");
|
||||
|
||||
Process.Start(ps);
|
||||
Environment.Exit(0);
|
||||
|
|
|
|||
|
|
@ -55,6 +55,9 @@ public abstract class Window
|
|||
private Vector2 fadeOutSize = Vector2.Zero;
|
||||
private Vector2 fadeOutOrigin = Vector2.Zero;
|
||||
|
||||
private bool hasError = false;
|
||||
private Exception? lastError;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Window"/> class.
|
||||
/// </summary>
|
||||
|
|
@ -458,14 +461,24 @@ public abstract class Window
|
|||
this.presetDirty = true;
|
||||
}
|
||||
|
||||
// Draw the actual window contents
|
||||
try
|
||||
if (this.hasError)
|
||||
{
|
||||
this.Draw();
|
||||
this.DrawErrorMessage();
|
||||
}
|
||||
catch (Exception ex)
|
||||
else
|
||||
{
|
||||
Log.Error(ex, "Error during Draw(): {WindowName}", this.WindowName);
|
||||
// Draw the actual window contents
|
||||
try
|
||||
{
|
||||
this.Draw();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex, "Error during Draw(): {WindowName}", this.WindowName);
|
||||
|
||||
this.hasError = true;
|
||||
this.lastError = ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -793,7 +806,7 @@ public abstract class Window
|
|||
hovered = true;
|
||||
|
||||
// We can't use ImGui native functions here, because they don't work with clickthrough
|
||||
if ((global::Windows.Win32.PInvoke.GetKeyState((int)VirtualKey.LBUTTON) & 0x8000) != 0)
|
||||
if ((Windows.Win32.PInvoke.GetKeyState((int)VirtualKey.LBUTTON) & 0x8000) != 0)
|
||||
{
|
||||
held = true;
|
||||
pressed = true;
|
||||
|
|
@ -871,6 +884,52 @@ public abstract class Window
|
|||
ImGui.End();
|
||||
}
|
||||
|
||||
private void DrawErrorMessage()
|
||||
{
|
||||
// TODO: Once window systems are services, offer to reload the plugin
|
||||
ImGui.TextColoredWrapped(ImGuiColors.DalamudRed,Loc.Localize("WindowSystemErrorOccurred", "An error occurred while rendering this window. Please contact the developer for details."));
|
||||
|
||||
ImGuiHelpers.ScaledDummy(5);
|
||||
|
||||
if (ImGui.Button(Loc.Localize("WindowSystemErrorRecoverButton", "Attempt to retry")))
|
||||
{
|
||||
this.hasError = false;
|
||||
this.lastError = null;
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
|
||||
if (ImGui.Button(Loc.Localize("WindowSystemErrorClose", "Close Window")))
|
||||
{
|
||||
this.IsOpen = false;
|
||||
this.hasError = false;
|
||||
this.lastError = null;
|
||||
}
|
||||
|
||||
ImGuiHelpers.ScaledDummy(10);
|
||||
|
||||
if (this.lastError != null)
|
||||
{
|
||||
using var child = ImRaii.Child("##ErrorDetails", new Vector2(0, 200 * ImGuiHelpers.GlobalScale), true);
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudGrey))
|
||||
{
|
||||
ImGui.TextWrapped(Loc.Localize("WindowSystemErrorDetails", "Error Details:"));
|
||||
ImGui.Separator();
|
||||
ImGui.TextWrapped(this.lastError.ToString());
|
||||
}
|
||||
|
||||
var childWindowSize = ImGui.GetWindowSize();
|
||||
var copyText = Loc.Localize("WindowSystemErrorCopy", "Copy");
|
||||
var buttonWidth = ImGuiComponents.GetIconButtonWithTextWidth(FontAwesomeIcon.Copy, copyText);
|
||||
ImGui.SetCursorPos(new Vector2(childWindowSize.X - buttonWidth - ImGui.GetStyle().FramePadding.X,
|
||||
ImGui.GetStyle().FramePadding.Y));
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Copy, copyText))
|
||||
{
|
||||
ImGui.SetClipboardText(this.lastError.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Structure detailing the size constraints of a window.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -140,10 +140,10 @@ public static partial class Util
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Dalamud branch name this version of Dalamud was built from, or null, if this is a Debug build.
|
||||
/// Gets the Git branch name this version of Dalamud was built from, or null, if this is a Debug build.
|
||||
/// </summary>
|
||||
/// <returns>The branch name.</returns>
|
||||
public static string? GetBranch()
|
||||
public static string? GetGitBranch()
|
||||
{
|
||||
if (branchInternal != null)
|
||||
return branchInternal;
|
||||
|
|
@ -155,7 +155,17 @@ public static partial class Util
|
|||
if (gitBranch == null)
|
||||
return null;
|
||||
|
||||
return branchInternal = gitBranch == "master" ? "release" : gitBranch;
|
||||
return branchInternal = gitBranch;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the active Dalamud track, if this instance was launched through XIVLauncher and used a version
|
||||
/// downloaded from webservices.
|
||||
/// </summary>
|
||||
/// <returns>The name of the track, or null.</returns>
|
||||
internal static string? GetActiveTrack()
|
||||
{
|
||||
return Environment.GetEnvironmentVariable("DALAMUD_BRANCH");
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="DescribeAddress(nint)"/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue