mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Merge branch 'master' into master
This commit is contained in:
commit
e5ef53b1c6
19 changed files with 118 additions and 60 deletions
3
.github/workflows/main.yml
vendored
3
.github/workflows/main.yml
vendored
|
|
@ -10,9 +10,10 @@ jobs:
|
|||
runs-on: windows-2022
|
||||
steps:
|
||||
- name: Checkout Dalamud
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
- name: Setup MSBuild
|
||||
uses: microsoft/setup-msbuild@v1.0.2
|
||||
- name: Define VERSION
|
||||
|
|
|
|||
|
|
@ -260,7 +260,6 @@ namespace Dalamud.Injector
|
|||
|
||||
for (var i = 2; i < args.Count; i++)
|
||||
{
|
||||
Log.Information(args[i]);
|
||||
if (args[i].StartsWith(key = "--dalamud-working-directory="))
|
||||
workingDirectory = args[i][key.Length..];
|
||||
else if (args[i].StartsWith(key = "--dalamud-configuration-path="))
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Label="Feature">
|
||||
<DalamudVersion>7.4.1.0</DalamudVersion>
|
||||
<DalamudVersion>7.4.3.0</DalamudVersion>
|
||||
<Description>XIV Launcher addon framework</Description>
|
||||
<AssemblyVersion>$(DalamudVersion)</AssemblyVersion>
|
||||
<Version>$(DalamudVersion)</Version>
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public sealed class DataManager : IDisposable, IServiceType
|
|||
{
|
||||
LoadMultithreaded = true,
|
||||
CacheFileResources = true,
|
||||
#if DEBUG
|
||||
#if NEVER // Lumina bug
|
||||
PanicOnSheetChecksumMismatch = true,
|
||||
#else
|
||||
PanicOnSheetChecksumMismatch = false,
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ public sealed class EntryPoint
|
|||
InitSymbolHandler(info);
|
||||
|
||||
var dalamud = new Dalamud(info, configuration, mainThreadContinueEvent);
|
||||
Log.Information("This is Dalamud - Core: {GitHash}, CS: {CsGitHash}", Util.GetGitHash(), Util.GetGitHashClientStructs());
|
||||
Log.Information("This is Dalamud - Core: {GitHash}, CS: {CsGitHash} [{CsVersion}]", Util.GetGitHash(), Util.GetGitHashClientStructs(), FFXIVClientStructs.Interop.Resolver.Version);
|
||||
|
||||
dalamud.WaitForUnload();
|
||||
|
||||
|
|
|
|||
|
|
@ -79,4 +79,9 @@ public enum ObjectKind : byte
|
|||
/// Objects representing card stand objects.
|
||||
/// </summary>
|
||||
CardStand = 0x0E,
|
||||
|
||||
/// <summary>
|
||||
/// Objects representing ornament (Fashion Accessories) objects.
|
||||
/// </summary>
|
||||
Ornament = 0x0F,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,8 +111,12 @@ public sealed partial class ObjectTable : IServiceType
|
|||
{
|
||||
ObjectKind.Player => new PlayerCharacter(address),
|
||||
ObjectKind.BattleNpc => new BattleNpc(address),
|
||||
ObjectKind.EventNpc => new Npc(address),
|
||||
ObjectKind.Retainer => new Npc(address),
|
||||
ObjectKind.EventObj => new EventObj(address),
|
||||
ObjectKind.Companion => new Npc(address),
|
||||
ObjectKind.MountType => new Npc(address),
|
||||
ObjectKind.Ornament => new Npc(address),
|
||||
_ => new GameObject(address),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,6 +113,11 @@ public unsafe partial class GameObject
|
|||
/// </summary>
|
||||
public uint OwnerId => this.Struct->OwnerID;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the index of this object in the object table.
|
||||
/// </summary>
|
||||
public ushort ObjectIndex => this.Struct->ObjectIndex;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the entity kind of this <see cref="GameObject" />.
|
||||
/// See <see cref="ObjectKind">the ObjectKind enum</see> for possible values.
|
||||
|
|
|
|||
|
|
@ -184,8 +184,18 @@ public sealed unsafe class GameGui : IDisposable, IServiceType
|
|||
/// </summary>
|
||||
/// <param name="worldPos">Coordinates in the world.</param>
|
||||
/// <param name="screenPos">Converted coordinates.</param>
|
||||
/// <returns>True if worldPos corresponds to a position in front of the camera.</returns>
|
||||
/// <returns>True if worldPos corresponds to a position in front of the camera and screenPos is in the viewport.</returns>
|
||||
public bool WorldToScreen(Vector3 worldPos, out Vector2 screenPos)
|
||||
=> this.WorldToScreen(worldPos, out screenPos, out var inView) && inView;
|
||||
|
||||
/// <summary>
|
||||
/// Converts in-world coordinates to screen coordinates (upper left corner origin).
|
||||
/// </summary>
|
||||
/// <param name="worldPos">Coordinates in the world.</param>
|
||||
/// <param name="screenPos">Converted coordinates.</param>
|
||||
/// <param name="inView">True if screenPos corresponds to a position inside the camera viewport.</param>
|
||||
/// <returns>True if worldPos corresponds to a position in front of the camera.</returns>
|
||||
public bool WorldToScreen(Vector3 worldPos, out Vector2 screenPos, out bool inView)
|
||||
{
|
||||
// Get base object with matrices
|
||||
var matrixSingleton = this.getMatrixSingleton();
|
||||
|
|
@ -203,9 +213,12 @@ public sealed unsafe class GameGui : IDisposable, IServiceType
|
|||
screenPos.X = (0.5f * width * (screenPos.X + 1f)) + windowPos.X;
|
||||
screenPos.Y = (0.5f * height * (1f - screenPos.Y)) + windowPos.Y;
|
||||
|
||||
return pCoords.Z > 0 &&
|
||||
screenPos.X > windowPos.X && screenPos.X < windowPos.X + width &&
|
||||
screenPos.Y > windowPos.Y && screenPos.Y < windowPos.Y + height;
|
||||
var inFront = pCoords.Z > 0;
|
||||
inView = inFront &&
|
||||
screenPos.X > windowPos.X && screenPos.X < windowPos.X + width &&
|
||||
screenPos.Y > windowPos.Y && screenPos.Y < windowPos.Y + height;
|
||||
|
||||
return inFront;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -395,26 +395,6 @@ public class SigScanner : IDisposable, IServiceType
|
|||
}
|
||||
}
|
||||
|
||||
private unsafe class UnsafeCodeReader : CodeReader
|
||||
{
|
||||
private readonly int length;
|
||||
private readonly byte* address;
|
||||
private int pos;
|
||||
public UnsafeCodeReader(byte* address, int length)
|
||||
{
|
||||
this.length = length;
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public bool CanReadByte => this.pos < this.length;
|
||||
|
||||
public override int ReadByte()
|
||||
{
|
||||
if (this.pos >= this.length) return -1;
|
||||
return *(this.address + this.pos++);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper for ScanText to get the correct address for IDA sigs that mark the first JMP or CALL location.
|
||||
/// </summary>
|
||||
|
|
@ -578,4 +558,25 @@ public class SigScanner : IDisposable, IServiceType
|
|||
Log.Error(ex, "Couldn't load cached sigs");
|
||||
}
|
||||
}
|
||||
|
||||
private unsafe class UnsafeCodeReader : CodeReader
|
||||
{
|
||||
private readonly int length;
|
||||
private readonly byte* address;
|
||||
private int pos;
|
||||
|
||||
public UnsafeCodeReader(byte* address, int length)
|
||||
{
|
||||
this.length = length;
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public bool CanReadByte => this.pos < this.length;
|
||||
|
||||
public override int ReadByte()
|
||||
{
|
||||
if (this.pos >= this.length) return -1;
|
||||
return *(this.address + this.pos++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ public class SeString
|
|||
foreach (var place in matches)
|
||||
{
|
||||
var map = mapSheet.FirstOrDefault(row => row.PlaceName.Row == place.RowId);
|
||||
if (map != null)
|
||||
if (map != null && map.TerritoryType.Row != 0)
|
||||
{
|
||||
return CreateMapLink(map.TerritoryType.Row, map.RowId, xCoord, yCoord, fudgeFactor);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ public class Hook<T> : IDisposable, IDalamudHook where T : Delegate
|
|||
if (EnvironmentConfiguration.DalamudForceMinHook)
|
||||
useMinHook = true;
|
||||
|
||||
address = HookManager.FollowJmp(address);
|
||||
this.address = address = HookManager.FollowJmp(address);
|
||||
if (useMinHook)
|
||||
this.compatHookImpl = new MinHookHook<T>(address, detour, callingAssembly);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -697,7 +697,7 @@ internal class DalamudInterface : IDisposable, IServiceType
|
|||
|
||||
ImGui.MenuItem(Util.AssemblyVersion, false);
|
||||
ImGui.MenuItem(startInfo.GameVersion?.ToString() ?? "Unknown version", false);
|
||||
ImGui.MenuItem($"D: {Util.GetGitHash()} CS: {Util.GetGitHashClientStructs()}", false);
|
||||
ImGui.MenuItem($"D: {Util.GetGitHash()} CS: {Util.GetGitHashClientStructs()} [{FFXIVClientStructs.Interop.Resolver.Version}]", false);
|
||||
ImGui.MenuItem($"CLR: {Environment.Version}", false);
|
||||
|
||||
ImGui.EndMenu();
|
||||
|
|
|
|||
|
|
@ -417,8 +417,8 @@ internal class InterfaceManager : IDisposable, IServiceType
|
|||
if (this.Device == null)
|
||||
return null;
|
||||
|
||||
var dxgiDev = this.Device.QueryInterface<SharpDX.DXGI.Device>();
|
||||
var dxgiAdapter = dxgiDev.Adapter.QueryInterfaceOrNull<SharpDX.DXGI.Adapter4>();
|
||||
var dxgiDev = this.Device.QueryInterfaceOrNull<SharpDX.DXGI.Device>();
|
||||
var dxgiAdapter = dxgiDev?.Adapter.QueryInterfaceOrNull<SharpDX.DXGI.Adapter4>();
|
||||
if (dxgiAdapter == null)
|
||||
return null;
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
|
||||
private readonly DateTime timeLoaded;
|
||||
|
||||
private readonly object listLock = new();
|
||||
|
||||
#region Image Tester State
|
||||
|
||||
private string[] testerImagePaths = new string[5];
|
||||
|
|
@ -214,14 +216,17 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
/// <inheritdoc/>
|
||||
public override void Draw()
|
||||
{
|
||||
this.DrawHeader();
|
||||
this.DrawPluginCategories();
|
||||
this.DrawFooter();
|
||||
this.DrawErrorModal();
|
||||
this.DrawUpdateModal();
|
||||
this.DrawTestingWarningModal();
|
||||
this.DrawFeedbackModal();
|
||||
this.DrawProgressOverlay();
|
||||
lock (this.listLock)
|
||||
{
|
||||
this.DrawHeader();
|
||||
this.DrawPluginCategories();
|
||||
this.DrawFooter();
|
||||
this.DrawErrorModal();
|
||||
this.DrawUpdateModal();
|
||||
this.DrawTestingWarningModal();
|
||||
this.DrawFeedbackModal();
|
||||
this.DrawProgressOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -431,7 +436,8 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
this.sortKind = selectable.SortKind;
|
||||
this.filterText = selectable.Localization;
|
||||
|
||||
this.ResortPlugins();
|
||||
lock (this.listLock)
|
||||
this.ResortPlugins();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1091,7 +1097,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
|
||||
private void DrawPluginCategoryContent()
|
||||
{
|
||||
var ready = this.DrawPluginListLoading() && !this.AnyOperationInProgress;
|
||||
var ready = this.DrawPluginListLoading();
|
||||
if (!this.categoryManager.IsSelectionValid || !ready)
|
||||
{
|
||||
return;
|
||||
|
|
@ -2684,11 +2690,14 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
{
|
||||
var pluginManager = Service<PluginManager>.Get();
|
||||
|
||||
// By removing installed plugins only when the available plugin list changes (basically when the window is
|
||||
// opened), plugins that have been newly installed remain in the available plugin list as installed.
|
||||
this.pluginListAvailable = pluginManager.AvailablePlugins.ToList();
|
||||
this.pluginListUpdatable = pluginManager.UpdatablePlugins.ToList();
|
||||
this.ResortPlugins();
|
||||
lock (this.listLock)
|
||||
{
|
||||
// By removing installed plugins only when the available plugin list changes (basically when the window is
|
||||
// opened), plugins that have been newly installed remain in the available plugin list as installed.
|
||||
this.pluginListAvailable = pluginManager.AvailablePlugins.ToList();
|
||||
this.pluginListUpdatable = pluginManager.UpdatablePlugins.ToList();
|
||||
this.ResortPlugins();
|
||||
}
|
||||
|
||||
this.UpdateCategoriesOnPluginsChange();
|
||||
}
|
||||
|
|
@ -2697,10 +2706,13 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
{
|
||||
var pluginManager = Service<PluginManager>.Get();
|
||||
|
||||
this.pluginListInstalled = pluginManager.InstalledPlugins.ToList();
|
||||
this.pluginListUpdatable = pluginManager.UpdatablePlugins.ToList();
|
||||
this.hasDevPlugins = this.pluginListInstalled.Any(plugin => plugin.IsDev);
|
||||
this.ResortPlugins();
|
||||
lock (this.listLock)
|
||||
{
|
||||
this.pluginListInstalled = pluginManager.InstalledPlugins.ToList();
|
||||
this.pluginListUpdatable = pluginManager.UpdatablePlugins.ToList();
|
||||
this.hasDevPlugins = this.pluginListInstalled.Any(plugin => plugin.IsDev);
|
||||
this.ResortPlugins();
|
||||
}
|
||||
|
||||
this.UpdateCategoriesOnPluginsChange();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using System.Reflection;
|
|||
|
||||
using Dalamud.Game;
|
||||
using Dalamud.Hooking.Internal;
|
||||
using Dalamud.Interface.Components;
|
||||
using Dalamud.Interface.Internal.Notifications;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Plugin.Internal;
|
||||
|
|
@ -68,6 +69,16 @@ internal class PluginStatWindow : Window
|
|||
}
|
||||
}
|
||||
|
||||
var loadedPlugins = pluginManager.InstalledPlugins.Where(plugin => plugin.State == PluginState.Loaded);
|
||||
var totalLast = loadedPlugins.Sum(plugin => plugin.DalamudInterface?.UiBuilder.LastDrawTime ?? 0);
|
||||
var totalAverage = loadedPlugins.Sum(plugin => plugin.DalamudInterface?.UiBuilder.DrawTimeHistory.DefaultIfEmpty().Average() ?? 0);
|
||||
|
||||
ImGuiComponents.TextWithLabel("Total Last", $"{totalLast / 10000f:F4}ms", "All last draw times added together");
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.TextWithLabel("Total Average", $"{totalAverage / 10000f:F4}ms", "All average draw times added together");
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.TextWithLabel("Collective Average", $"{(loadedPlugins.Any() ? totalAverage / loadedPlugins.Count() / 10000f : 0):F4}ms", "Average of all average draw times");
|
||||
|
||||
if (ImGui.BeginTable(
|
||||
"##PluginStatsDrawTimes",
|
||||
4,
|
||||
|
|
@ -86,8 +97,6 @@ internal class PluginStatWindow : Window
|
|||
ImGui.TableSetupColumn("Average");
|
||||
ImGui.TableHeadersRow();
|
||||
|
||||
var loadedPlugins = pluginManager.InstalledPlugins.Where(plugin => plugin.State == PluginState.Loaded);
|
||||
|
||||
var sortSpecs = ImGui.TableGetSortSpecs();
|
||||
loadedPlugins = sortSpecs.Specs.ColumnIndex switch
|
||||
{
|
||||
|
|
@ -149,6 +158,16 @@ internal class PluginStatWindow : Window
|
|||
Framework.StatsHistory.Clear();
|
||||
}
|
||||
|
||||
var statsHistory = Framework.StatsHistory.ToArray();
|
||||
var totalLast = statsHistory.Sum(stats => stats.Value.LastOrDefault());
|
||||
var totalAverage = statsHistory.Sum(stats => stats.Value.Average());
|
||||
|
||||
ImGuiComponents.TextWithLabel("Total Last", $"{totalLast:F4}ms", "All last update times added together");
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.TextWithLabel("Total Average", $"{totalAverage:F4}ms", "All average update times added together");
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.TextWithLabel("Collective Average", $"{(statsHistory.Any() ? totalAverage / statsHistory.Length : 0):F4}ms", "Average of all average update times");
|
||||
|
||||
if (ImGui.BeginTable(
|
||||
"##PluginStatsFrameworkTimes",
|
||||
4,
|
||||
|
|
@ -167,8 +186,6 @@ internal class PluginStatWindow : Window
|
|||
ImGui.TableSetupColumn("Average", ImGuiTableColumnFlags.None, 50);
|
||||
ImGui.TableHeadersRow();
|
||||
|
||||
var statsHistory = Framework.StatsHistory.ToArray();
|
||||
|
||||
var sortSpecs = ImGui.TableGetSortSpecs();
|
||||
statsHistory = sortSpecs.Specs.ColumnIndex switch
|
||||
{
|
||||
|
|
|
|||
|
|
@ -55,5 +55,6 @@ public class SettingsTabExperimental : SettingsTab
|
|||
base.Draw();
|
||||
|
||||
ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudGrey, "Total memory used by Dalamud & Plugins: " + Util.FormatBytes(GC.GetTotalMemory(false)));
|
||||
ImGuiHelpers.ScaledDummy(15);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ internal class LocalPlugin : IDisposable
|
|||
}
|
||||
|
||||
var pluginManager = Service<PluginManager>.Get();
|
||||
this.IsBanned = pluginManager.IsManifestBanned(this.Manifest);
|
||||
this.IsBanned = pluginManager.IsManifestBanned(this.Manifest) && !this.IsDev;
|
||||
this.BanReason = pluginManager.GetBanReason(this.Manifest);
|
||||
|
||||
this.SaveManifest();
|
||||
|
|
@ -320,7 +320,7 @@ internal class LocalPlugin : IDisposable
|
|||
throw new ArgumentOutOfRangeException(this.State.ToString());
|
||||
}
|
||||
|
||||
if (pluginManager.IsManifestBanned(this.Manifest))
|
||||
if (pluginManager.IsManifestBanned(this.Manifest) && !this.IsDev)
|
||||
throw new BannedPluginException($"Unable to load {this.Name}, banned");
|
||||
|
||||
if (this.Manifest.ApplicableVersion < startInfo.GameVersion)
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 08e6c7ed7747ad68a38e5762863b5874fe04b8b8
|
||||
Subproject commit 47ffffaa05ee72d286772cef9ab2f62ab1422e45
|
||||
Loading…
Add table
Add a link
Reference in a new issue