mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Merge remote-tracking branch 'origin/master' into net9-rollup
This commit is contained in:
commit
f9bdceb662
15 changed files with 747 additions and 764 deletions
|
|
@ -5,7 +5,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Label="Feature">
|
||||
<DalamudVersion>11.0.1.0</DalamudVersion>
|
||||
<DalamudVersion>11.0.2.0</DalamudVersion>
|
||||
<Description>XIV Launcher addon framework</Description>
|
||||
<AssemblyVersion>$(DalamudVersion)</AssemblyVersion>
|
||||
<Version>$(DalamudVersion)</Version>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -9,6 +9,7 @@ using Dalamud.Logging.Internal;
|
|||
using Dalamud.Plugin.Services;
|
||||
using Dalamud.Utility;
|
||||
|
||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Control;
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.String;
|
||||
|
|
@ -16,6 +17,7 @@ using FFXIVClientStructs.FFXIV.Client.UI;
|
|||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||
using FFXIVClientStructs.FFXIV.Common.Component.BGCollision;
|
||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
|
||||
using ImGuiNET;
|
||||
|
||||
using Vector2 = System.Numerics.Vector2;
|
||||
|
|
@ -34,7 +36,6 @@ internal sealed unsafe class GameGui : IInternalDisposableService, IGameGui
|
|||
|
||||
private readonly GameGuiAddressResolver address;
|
||||
|
||||
private readonly Hook<SetGlobalBgmDelegate> setGlobalBgmHook;
|
||||
private readonly Hook<AgentItemDetail.Delegates.Update> handleItemHoverHook;
|
||||
private readonly Hook<AgentItemDetail.Delegates.ReceiveEvent> handleItemOutHook;
|
||||
private readonly Hook<AgentActionDetail.Delegates.HandleActionHover> handleActionHoverHook;
|
||||
|
|
@ -50,12 +51,8 @@ internal sealed unsafe class GameGui : IInternalDisposableService, IGameGui
|
|||
this.address.Setup(sigScanner);
|
||||
|
||||
Log.Verbose("===== G A M E G U I =====");
|
||||
Log.Verbose($"GameGuiManager address {Util.DescribeAddress(this.address.BaseAddress)}");
|
||||
Log.Verbose($"SetGlobalBgm address {Util.DescribeAddress(this.address.SetGlobalBgm)}");
|
||||
Log.Verbose($"HandleImm address {Util.DescribeAddress(this.address.HandleImm)}");
|
||||
|
||||
this.setGlobalBgmHook = Hook<SetGlobalBgmDelegate>.FromAddress(this.address.SetGlobalBgm, this.HandleSetGlobalBgmDetour);
|
||||
|
||||
this.handleItemHoverHook = Hook<AgentItemDetail.Delegates.Update>.FromAddress((nint)AgentItemDetail.StaticVirtualTablePointer->Update, this.HandleItemHoverDetour);
|
||||
this.handleItemOutHook = Hook<AgentItemDetail.Delegates.ReceiveEvent>.FromAddress((nint)AgentItemDetail.StaticVirtualTablePointer->ReceiveEvent, this.HandleItemOutDetour);
|
||||
|
||||
|
|
@ -68,7 +65,6 @@ internal sealed unsafe class GameGui : IInternalDisposableService, IGameGui
|
|||
|
||||
this.utf8StringFromSequenceHook = Hook<Utf8String.Delegates.Ctor_FromSequence>.FromAddress(Utf8String.Addresses.Ctor_FromSequence.Value, this.Utf8StringFromSequenceDetour);
|
||||
|
||||
this.setGlobalBgmHook.Enable();
|
||||
this.handleItemHoverHook.Enable();
|
||||
this.handleItemOutHook.Enable();
|
||||
this.handleImmHook.Enable();
|
||||
|
|
@ -80,9 +76,6 @@ internal sealed unsafe class GameGui : IInternalDisposableService, IGameGui
|
|||
|
||||
// Hooked delegates
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
|
||||
private delegate IntPtr SetGlobalBgmDelegate(ushort bgmKey, byte a2, uint a3, uint a4, uint a5, byte a6);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
|
||||
private delegate char HandleImmDelegate(IntPtr framework, char a2, byte a3);
|
||||
|
||||
|
|
@ -254,7 +247,6 @@ internal sealed unsafe class GameGui : IInternalDisposableService, IGameGui
|
|||
/// </summary>
|
||||
void IInternalDisposableService.DisposeService()
|
||||
{
|
||||
this.setGlobalBgmHook.Dispose();
|
||||
this.handleItemHoverHook.Dispose();
|
||||
this.handleItemOutHook.Dispose();
|
||||
this.handleImmHook.Dispose();
|
||||
|
|
@ -265,25 +257,23 @@ internal sealed unsafe class GameGui : IInternalDisposableService, IGameGui
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the game is on the title screen.
|
||||
/// Indicates if the game is in the lobby scene (title screen, chara select, chara make, aesthetician etc.).
|
||||
/// </summary>
|
||||
/// <returns>A value indicating whether or not the game is on the title screen.</returns>
|
||||
internal bool IsOnTitleScreen()
|
||||
{
|
||||
var charaSelect = this.GetAddonByName("CharaSelect");
|
||||
var charaMake = this.GetAddonByName("CharaMake");
|
||||
var titleDcWorldMap = this.GetAddonByName("TitleDCWorldMap");
|
||||
if (charaMake != nint.Zero || charaSelect != nint.Zero || titleDcWorldMap != nint.Zero)
|
||||
return false;
|
||||
|
||||
return !Service<ClientState.ClientState>.Get().IsLoggedIn;
|
||||
}
|
||||
/// <returns>A value indicating whether or not the game is in the lobby scene.</returns>
|
||||
internal bool IsInLobby() => RaptureAtkModule.Instance()->CurrentUIScene.StartsWith("LobbyMain"u8);
|
||||
|
||||
/// <summary>
|
||||
/// Set the current background music.
|
||||
/// Sets the current background music.
|
||||
/// </summary>
|
||||
/// <param name="bgmKey">The background music key.</param>
|
||||
internal void SetBgm(ushort bgmKey) => this.setGlobalBgmHook.Original(bgmKey, 0, 0, 0, 0, 0);
|
||||
/// <param name="bgmId">The BGM row id.</param>
|
||||
/// <param name="sceneId">The BGM scene index. Defaults to MiniGame scene to avoid conflicts.</param>
|
||||
internal void SetBgm(ushort bgmId, uint sceneId = 2) => BGMSystem.SetBGM(bgmId, sceneId);
|
||||
|
||||
/// <summary>
|
||||
/// Resets the current background music.
|
||||
/// </summary>
|
||||
/// <param name="sceneId">The BGM scene index.</param>
|
||||
internal void ResetBgm(uint sceneId = 2) => BGMSystem.Instance()->ResetBGM(sceneId);
|
||||
|
||||
/// <summary>
|
||||
/// Reset the stored "UI hide" state.
|
||||
|
|
@ -293,15 +283,6 @@ internal sealed unsafe class GameGui : IInternalDisposableService, IGameGui
|
|||
this.GameUiHidden = false;
|
||||
}
|
||||
|
||||
private IntPtr HandleSetGlobalBgmDetour(ushort bgmKey, byte a2, uint a3, uint a4, uint a5, byte a6)
|
||||
{
|
||||
var retVal = this.setGlobalBgmHook.Original(bgmKey, a2, a3, a4, a5, a6);
|
||||
|
||||
Log.Verbose("SetGlobalBgm: {0} {1} {2} {3} {4} {5} -> {6}", bgmKey, a2, a3, a4, a5, a6, retVal);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
private void HandleItemHoverDetour(AgentItemDetail* thisPtr, uint frameCount)
|
||||
{
|
||||
this.handleItemHoverHook.Original(thisPtr, frameCount);
|
||||
|
|
|
|||
|
|
@ -5,16 +5,6 @@ namespace Dalamud.Game.Gui;
|
|||
/// </summary>
|
||||
internal sealed class GameGuiAddressResolver : BaseAddressResolver
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the base address of the native GuiManager class.
|
||||
/// </summary>
|
||||
public IntPtr BaseAddress { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the address of the native SetGlobalBgm method.
|
||||
/// </summary>
|
||||
public IntPtr SetGlobalBgm { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the address of the native HandleImm method.
|
||||
/// </summary>
|
||||
|
|
@ -23,7 +13,6 @@ internal sealed class GameGuiAddressResolver : BaseAddressResolver
|
|||
/// <inheritdoc/>
|
||||
protected override void Setup64Bit(ISigScanner sig)
|
||||
{
|
||||
this.SetGlobalBgm = sig.ScanText("E8 ?? ?? ?? ?? 8B 2F"); // unnamed in CS
|
||||
this.HandleImm = sig.ScanText("E8 ?? ?? ?? ?? 84 C0 75 10 48 83 FF 09"); // unnamed in CS
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -328,9 +328,22 @@ internal unsafe class NamePlateUpdateHandler : INamePlateUpdateHandler
|
|||
public ulong GameObjectId => this.gameObjectId ??= this.NamePlateInfo->ObjectId;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IGameObject? GameObject => this.gameObject ??= this.context.ObjectTable[
|
||||
this.context.Ui3DModule->NamePlateObjectInfoPointers[this.ArrayIndex]
|
||||
.Value->GameObject->ObjectIndex];
|
||||
public IGameObject? GameObject
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.GameObjectId == 0xE0000000)
|
||||
{
|
||||
// Skipping Ui3DModule lookup for invalid nameplate (NamePlateInfo->ObjectId is 0xE0000000). This
|
||||
// prevents crashes around certain Doman Reconstruction cutscenes.
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.gameObject ??= this.context.ObjectTable[
|
||||
this.context.Ui3DModule->NamePlateObjectInfoPointers[this.ArrayIndex]
|
||||
.Value->GameObject->ObjectIndex];
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IBattleChara? BattleChara => this.GameObject as IBattleChara;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public static class XivChatTypeExtensions
|
|||
/// </summary>
|
||||
/// <param name="chatType">The chat type.</param>
|
||||
/// <returns>The info attribute.</returns>
|
||||
public static XivChatTypeInfoAttribute GetDetails(this XivChatType chatType)
|
||||
public static XivChatTypeInfoAttribute? GetDetails(this XivChatType chatType)
|
||||
{
|
||||
return chatType.GetAttribute<XivChatTypeInfoAttribute>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ internal class DalamudCommands : IServiceType
|
|||
else
|
||||
{
|
||||
// Revert to the original BGM by specifying an invalid one
|
||||
gameGui.SetBgm(9999);
|
||||
gameGui.ResetBgm();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,9 +60,7 @@ internal unsafe partial class TextNodeTree : ResNodeTree
|
|||
EdgeStrength = 1f,
|
||||
};
|
||||
|
||||
#pragma warning disable SeStringRenderer
|
||||
ImGuiHelpers.SeStringWrapped(this.NodeText.AsSpan(), style);
|
||||
#pragma warning restore SeStringRenderer
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@ using Lumina.Text.ReadOnly;
|
|||
|
||||
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||
|
||||
#pragma warning disable SeStringRenderer
|
||||
|
||||
/// <summary>
|
||||
/// Widget for displaying AtkArrayData.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@ using Lumina.Excel.Sheets;
|
|||
|
||||
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||
|
||||
#pragma warning disable SeStringRenderer
|
||||
|
||||
/// <summary>
|
||||
/// Widget for displaying inventory data.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@ using Lumina.Text.ReadOnly;
|
|||
|
||||
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||
|
||||
#pragma warning disable SeStringRenderer
|
||||
|
||||
/// <summary>
|
||||
/// Widget for displaying Addon Data.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
|
@ -194,6 +194,7 @@ Contribute at: https://github.com/goatcorp/Dalamud
|
|||
private readonly IFontAtlas privateAtlas;
|
||||
|
||||
private string creditsText;
|
||||
private bool isBgmSet;
|
||||
|
||||
private bool resetNow = false;
|
||||
private IDalamudTextureWrap? logoTexture;
|
||||
|
|
@ -222,10 +223,13 @@ Contribute at: https://github.com/goatcorp/Dalamud
|
|||
|
||||
this.creditsText = string.Format(CreditsTextTempl, typeof(Dalamud).Assembly.GetName().Version, pluginCredits, Util.GetGitHashClientStructs());
|
||||
|
||||
var gg = Service<GameGui>.Get();
|
||||
if (!gg.IsOnTitleScreen() && UIState.Instance() != null)
|
||||
var gameGui = Service<GameGui>.Get();
|
||||
var playerState = PlayerState.Instance();
|
||||
|
||||
if (!gameGui.IsInLobby() && playerState != null)
|
||||
{
|
||||
gg.SetBgm((ushort)(UIState.Instance()->PlayerState.MaxExpansion > 3 ? 833 : 132));
|
||||
gameGui.SetBgm((ushort)(playerState->MaxExpansion > 3 ? 833 : 132));
|
||||
this.isBgmSet = true;
|
||||
}
|
||||
|
||||
this.creditsThrottler.Restart();
|
||||
|
|
@ -242,9 +246,15 @@ Contribute at: https://github.com/goatcorp/Dalamud
|
|||
{
|
||||
this.creditsThrottler.Reset();
|
||||
|
||||
var gg = Service<GameGui>.Get();
|
||||
if (!gg.IsOnTitleScreen())
|
||||
gg.SetBgm(9999);
|
||||
if (this.isBgmSet)
|
||||
{
|
||||
var gameGui = Service<GameGui>.Get();
|
||||
|
||||
if (!gameGui.IsInLobby())
|
||||
gameGui.ResetBgm();
|
||||
|
||||
this.isBgmSet = false;
|
||||
}
|
||||
|
||||
Service<DalamudInterface>.Get().SetCreditsDarkeningAnimation(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -212,7 +212,6 @@ public static class ImGuiHelpers
|
|||
/// <returns>Interaction result of the rendered text.</returns>
|
||||
/// <remarks>This function is experimental. Report any issues to GitHub issues or to Discord #dalamud-dev channel.
|
||||
/// The function definition is stable; only in the next API version a function may be removed.</remarks>
|
||||
[Experimental("SeStringRenderer")]
|
||||
public static SeStringDrawResult SeStringWrapped(
|
||||
ReadOnlySpan<byte> sss,
|
||||
scoped in SeStringDrawParams style = default,
|
||||
|
|
@ -229,7 +228,6 @@ public static class ImGuiHelpers
|
|||
/// <returns>Interaction result of the rendered text.</returns>
|
||||
/// <remarks>This function is experimental. Report any issues to GitHub issues or to Discord #dalamud-dev channel.
|
||||
/// The function definition is stable; only in the next API version a function may be removed.</remarks>
|
||||
[Experimental("SeStringRenderer")]
|
||||
public static SeStringDrawResult CompileSeStringWrapped(
|
||||
string text,
|
||||
scoped in SeStringDrawParams style = default,
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit d4778799d378fe66099fd337f55849acf1f16dcd
|
||||
Subproject commit df03181ccbbbfead3db116b59359dae4a31cb07d
|
||||
Loading…
Add table
Add a link
Reference in a new issue