mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
Merge pull request #465 from daemitus/clientState
This commit is contained in:
commit
2550b097bb
11 changed files with 1074 additions and 22 deletions
|
|
@ -1,14 +1,16 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using Dalamud.Game.ClientState.Actors;
|
||||
using Dalamud.Game.ClientState.Actors.Types;
|
||||
using Dalamud.Game.ClientState.Conditions;
|
||||
using Dalamud.Game.ClientState.Fates;
|
||||
using Dalamud.Game.Internal;
|
||||
using Dalamud.Game.ClientState.GamePad;
|
||||
using Dalamud.Game.ClientState.Keys;
|
||||
using Dalamud.Hooking;
|
||||
using JetBrains.Annotations;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using Serilog;
|
||||
|
||||
namespace Dalamud.Game.ClientState
|
||||
|
|
@ -93,7 +95,7 @@ namespace Dalamud.Game.ClientState
|
|||
/// <summary>
|
||||
/// Event that gets fired when a duty is ready.
|
||||
/// </summary>
|
||||
public event EventHandler<ContentFinderCondition> CfPop;
|
||||
public event EventHandler<Lumina.Excel.GeneratedSheets.ContentFinderCondition> CfPop;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the table of all present actors.
|
||||
|
|
@ -194,7 +196,7 @@ namespace Dalamud.Game.ClientState
|
|||
return this.setupTerritoryTypeHook.Original(manager, terriType);
|
||||
}
|
||||
|
||||
private void NetworkHandlersOnCfPop(object sender, ContentFinderCondition e)
|
||||
private void NetworkHandlersOnCfPop(object sender, Lumina.Excel.GeneratedSheets.ContentFinderCondition e)
|
||||
{
|
||||
this.CfPop?.Invoke(this, e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace Dalamud.Game.ClientState
|
||||
namespace Dalamud.Game.ClientState.Conditions
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides access to conditions (generally player state). You can check whether a player is in combat, mounted, etc.
|
||||
|
|
@ -37,7 +37,7 @@ namespace Dalamud.Game.ClientState
|
|||
{
|
||||
var idx = (int)flag;
|
||||
|
||||
if (idx > MaxConditionEntries || idx < 0)
|
||||
if (idx < 0 || idx >= MaxConditionEntries)
|
||||
return false;
|
||||
|
||||
return *(bool*)(this.ConditionArrayBase + idx);
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace Dalamud.Game.ClientState
|
||||
namespace Dalamud.Game.ClientState.Conditions
|
||||
{
|
||||
/// <summary>
|
||||
/// Possible state flags (or conditions as they're called internally) that can be set on the local client.
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
using System;
|
||||
|
||||
namespace Dalamud.Game.ClientState
|
||||
namespace Dalamud.Game.ClientState.GamePad
|
||||
{
|
||||
/// <summary>
|
||||
/// Bitmask of the Button ushort used by the game.
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Dalamud.Game.ClientState.Structs
|
||||
namespace Dalamud.Game.ClientState.GamePad
|
||||
{
|
||||
/// <summary>
|
||||
/// Struct which gets populated by polling the gamepads.
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
using System;
|
||||
|
||||
using Dalamud.Game.ClientState.Structs;
|
||||
using Dalamud.Hooking;
|
||||
using ImGuiNET;
|
||||
using Serilog;
|
||||
|
||||
namespace Dalamud.Game.ClientState
|
||||
namespace Dalamud.Game.ClientState.GamePad
|
||||
{
|
||||
/// <summary>
|
||||
/// Exposes the game gamepad state to dalamud.
|
||||
|
|
@ -24,7 +23,7 @@ namespace Dalamud.Game.ClientState
|
|||
private int rightStickY;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GamepadState" /> class.
|
||||
/// Initializes a new instance of the <see cref="GamepadState" /> class.
|
||||
/// </summary>
|
||||
/// <param name="resolver">Resolver knowing the pointer to the GamepadPoll function.</param>
|
||||
public GamepadState(ClientStateAddressResolver resolver)
|
||||
|
|
@ -43,12 +42,10 @@ namespace Dalamud.Game.ClientState
|
|||
|
||||
private delegate int ControllerPoll(IntPtr controllerInput);
|
||||
|
||||
#if DEBUG
|
||||
/// <summary>
|
||||
/// Gets the pointer to the current instance of the GamepadInput struct.
|
||||
/// </summary>
|
||||
public IntPtr GamepadInput { get; private set; }
|
||||
#endif
|
||||
public IntPtr GamepadInputAddress { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the state of the left analogue stick in the left direction between 0 (not tilted) and 1 (max tilt).
|
||||
|
|
@ -189,9 +186,7 @@ namespace Dalamud.Game.ClientState
|
|||
var original = this.gamepadPoll.Original(gamepadInput);
|
||||
try
|
||||
{
|
||||
#if DEBUG
|
||||
this.GamepadInput = gamepadInput;
|
||||
#endif
|
||||
this.GamepadInputAddress = gamepadInput;
|
||||
var input = (GamepadInput*)gamepadInput;
|
||||
this.leftStickX = input->LeftStickX;
|
||||
this.leftStickY = input->LeftStickY;
|
||||
|
|
@ -3,7 +3,7 @@ using System.Runtime.InteropServices;
|
|||
|
||||
using Serilog;
|
||||
|
||||
namespace Dalamud.Game.ClientState
|
||||
namespace Dalamud.Game.ClientState.Keys
|
||||
{
|
||||
/// <summary>
|
||||
/// Wrapper around the game keystate buffer, which contains the pressed state for all keyboard keys, indexed by virtual vkCode.
|
||||
|
|
@ -52,6 +52,13 @@ namespace Dalamud.Game.ClientState
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get or set the keypressed state for a given VirtualKey enum.
|
||||
/// </summary>
|
||||
/// <param name="vk">The virtual key to change.</param>
|
||||
/// <returns>Whether the specified key is currently pressed.</returns>
|
||||
public bool this[VirtualKey vk] => this[(int)vk];
|
||||
|
||||
/// <summary>
|
||||
/// Clears the pressed state for all keys.
|
||||
/// </summary>
|
||||
1044
Dalamud/Game/ClientState/Keys/VirtualKey.cs
Normal file
1044
Dalamud/Game/ClientState/Keys/VirtualKey.cs
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -8,6 +8,7 @@ using System.Threading;
|
|||
|
||||
using Dalamud.Game;
|
||||
using Dalamud.Game.ClientState;
|
||||
using Dalamud.Game.ClientState.GamePad;
|
||||
using Dalamud.Game.Internal.DXGI;
|
||||
using Dalamud.Hooking;
|
||||
using Dalamud.Hooking.Internal;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ using Dalamud.Game;
|
|||
using Dalamud.Game.ClientState;
|
||||
using Dalamud.Game.ClientState.Actors.Types;
|
||||
using Dalamud.Game.ClientState.Actors.Types.NonPlayer;
|
||||
using Dalamud.Game.ClientState.Conditions;
|
||||
using Dalamud.Game.ClientState.GamePad;
|
||||
using Dalamud.Game.ClientState.Structs.JobGauge;
|
||||
using Dalamud.Game.Gui.Addons;
|
||||
using Dalamud.Game.Gui.Toast;
|
||||
|
|
@ -758,13 +760,13 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
$"R3 {resolve(GamepadButtons.R3)} ");
|
||||
}
|
||||
#if DEBUG
|
||||
ImGui.Text($"GamepadInput 0x{this.dalamud.ClientState.GamepadState.GamepadInput.ToInt64():X}");
|
||||
ImGui.Text($"GamepadInput 0x{this.dalamud.ClientState.GamepadState.GamepadInputAddress.ToInt64():X}");
|
||||
|
||||
if (ImGui.IsItemHovered())
|
||||
ImGui.SetMouseCursor(ImGuiMouseCursor.Hand);
|
||||
|
||||
if (ImGui.IsItemClicked())
|
||||
ImGui.SetClipboardText($"0x{this.dalamud.ClientState.GamepadState.GamepadInput.ToInt64():X}");
|
||||
ImGui.SetClipboardText($"0x{this.dalamud.ClientState.GamepadState.GamepadInputAddress.ToInt64():X}");
|
||||
#endif
|
||||
|
||||
DrawHelper(
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Diagnostics;
|
||||
|
||||
using Dalamud.Game.ClientState;
|
||||
using Dalamud.Game.ClientState.Conditions;
|
||||
using Dalamud.Interface.Internal;
|
||||
using ImGuiNET;
|
||||
using ImGuiScene;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue