-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Does not have contextual evaluation. Only styling payloads are handled for (relative) simplicity.
- Loading branch information
1 parent
1c0ad61
commit 844b04f
Showing
24 changed files
with
14,665 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
namespace Dalamud.Game.Config; | ||
|
||
// ReSharper disable InconsistentNaming | ||
// ReSharper disable IdentifierTypo | ||
// ReSharper disable CommentTypo | ||
|
||
/// <summary>Valid values for PadButton options under <see cref="SystemConfigOption"/>.</summary> | ||
/// <remarks>Names are the valid part. Enum values are exclusively for use with current Dalamud version.</remarks> | ||
public enum PadButtonValue | ||
{ | ||
/// <summary>Auto-run.</summary> | ||
Autorun_Support, | ||
|
||
/// <summary>Change Hotbar Set.</summary> | ||
Hotbar_Set_Change, | ||
|
||
/// <summary>Highlight Left Hotbar.</summary> | ||
XHB_Left_Start, | ||
|
||
/// <summary>Highlight Right Hotbar.</summary> | ||
XHB_Right_Start, | ||
|
||
/// <summary>Not directly referenced by Gamepad button customization window.</summary> | ||
Cursor_Operation, | ||
|
||
/// <summary>Draw Weapon/Lock On.</summary> | ||
Lockon_and_Sword, | ||
|
||
/// <summary>Sit/Lock On.</summary> | ||
Lockon_and_Sit, | ||
|
||
/// <summary>Change Camera.</summary> | ||
Camera_Modechange, | ||
|
||
/// <summary>Reset Camera Position.</summary> | ||
Camera_Reset, | ||
|
||
/// <summary>Draw/Sheathe Weapon.</summary> | ||
Drawn_Sword, | ||
|
||
/// <summary>Lock On.</summary> | ||
Camera_Lockononly, | ||
|
||
/// <summary>Face Target.</summary> | ||
FaceTarget, | ||
|
||
/// <summary>Assist Target.</summary> | ||
AssistTarget, | ||
|
||
/// <summary>Face Camera.</summary> | ||
LookCamera, | ||
|
||
/// <summary>Execute Macro #98 (Exclusive).</summary> | ||
Macro98, | ||
|
||
/// <summary>Execute Macro #99 (Exclusive).</summary> | ||
Macro99, | ||
|
||
/// <summary>Not Assigned.</summary> | ||
Notset, | ||
|
||
/// <summary>Jump/Cancel Casting.</summary> | ||
Jump, | ||
|
||
/// <summary>Select Target/Confirm.</summary> | ||
Accept, | ||
|
||
/// <summary>Cancel.</summary> | ||
Cancel, | ||
|
||
/// <summary>Open Map/Subcommands.</summary> | ||
Map_Sub, | ||
|
||
/// <summary>Open Main Menu.</summary> | ||
MainCommand, | ||
|
||
/// <summary>Select HUD.</summary> | ||
HUD_Select, | ||
|
||
/// <summary>Move Character.</summary> | ||
Move_Operation, | ||
|
||
/// <summary>Move Camera.</summary> | ||
Camera_Operation, | ||
} |
149 changes: 149 additions & 0 deletions
149
Dalamud/Interface/Internal/ImGuiSeStringRenderer/GfdFile.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
using System.IO; | ||
using System.Numerics; | ||
using System.Runtime.InteropServices; | ||
|
||
using Lumina.Data; | ||
|
||
namespace Dalamud.Interface.Internal.ImGuiSeStringRenderer; | ||
|
||
/// <summary>Reference member view of a .gfd file data.</summary> | ||
internal sealed unsafe class GfdFile : FileResource | ||
{ | ||
/// <summary>Gets or sets the file header.</summary> | ||
public GfdHeader Header { get; set; } | ||
|
||
/// <summary>Gets or sets the entries.</summary> | ||
public GfdEntry[] Entries { get; set; } = []; | ||
|
||
/// <inheritdoc/> | ||
public override void LoadFile() | ||
{ | ||
if (this.DataSpan.Length < sizeof(GfdHeader)) | ||
throw new InvalidDataException($"Not enough space for a {nameof(GfdHeader)}"); | ||
if (this.DataSpan.Length < sizeof(GfdHeader) + (this.Header.Count * sizeof(GfdEntry))) | ||
throw new InvalidDataException($"Not enough space for all the {nameof(GfdEntry)}"); | ||
|
||
this.Header = MemoryMarshal.AsRef<GfdHeader>(this.DataSpan); | ||
this.Entries = MemoryMarshal.Cast<byte, GfdEntry>(this.DataSpan[sizeof(GfdHeader)..]).ToArray(); | ||
} | ||
|
||
/// <summary>Attempts to get an entry.</summary> | ||
/// <param name="iconId">The icon ID.</param> | ||
/// <param name="entry">The entry.</param> | ||
/// <param name="followRedirect">Whether to follow redirects.</param> | ||
/// <returns><c>true</c> if found.</returns> | ||
public bool TryGetEntry(uint iconId, out GfdEntry entry, bool followRedirect = true) | ||
{ | ||
if (iconId == 0) | ||
{ | ||
entry = default; | ||
return false; | ||
} | ||
|
||
var entries = this.Entries; | ||
if (iconId <= this.Entries.Length && entries[(int)(iconId - 1)].Id == iconId) | ||
{ | ||
if (iconId <= entries.Length) | ||
{ | ||
entry = entries[(int)(iconId - 1)]; | ||
return !entry.IsEmpty; | ||
} | ||
|
||
entry = default; | ||
return false; | ||
} | ||
|
||
var lo = 0; | ||
var hi = entries.Length; | ||
while (lo <= hi) | ||
{ | ||
var i = lo + ((hi - lo) >> 1); | ||
if (entries[i].Id == iconId) | ||
{ | ||
if (followRedirect && entries[i].Redirect != 0) | ||
{ | ||
iconId = entries[i].Redirect; | ||
lo = 0; | ||
hi = entries.Length; | ||
continue; | ||
} | ||
|
||
entry = entries[i]; | ||
return !entry.IsEmpty; | ||
} | ||
|
||
if (entries[i].Id < iconId) | ||
lo = i + 1; | ||
else | ||
hi = i - 1; | ||
} | ||
|
||
entry = default; | ||
return false; | ||
} | ||
|
||
/// <summary>Header of a .gfd file.</summary> | ||
[StructLayout(LayoutKind.Sequential)] | ||
public struct GfdHeader | ||
{ | ||
/// <summary>Signature: "gftd0100".</summary> | ||
public fixed byte Signature[8]; | ||
|
||
/// <summary>Number of entries.</summary> | ||
public int Count; | ||
|
||
/// <summary>Unused/unknown.</summary> | ||
public fixed byte Padding[4]; | ||
} | ||
|
||
/// <summary>An entry of a .gfd file.</summary> | ||
[StructLayout(LayoutKind.Sequential, Size = 0x10)] | ||
public struct GfdEntry | ||
{ | ||
/// <summary>ID of the entry.</summary> | ||
public ushort Id; | ||
|
||
/// <summary>The left offset of the entry.</summary> | ||
public ushort Left; | ||
|
||
/// <summary>The top offset of the entry.</summary> | ||
public ushort Top; | ||
|
||
/// <summary>The width of the entry.</summary> | ||
public ushort Width; | ||
|
||
/// <summary>The height of the entry.</summary> | ||
public ushort Height; | ||
|
||
/// <summary>Unknown/unused.</summary> | ||
public ushort Unk0A; | ||
|
||
/// <summary>The redirected entry, maybe.</summary> | ||
public ushort Redirect; | ||
|
||
/// <summary>Unknown/unused.</summary> | ||
public ushort Unk0E; | ||
|
||
/// <summary>Gets a value indicating whether this entry is effectively empty.</summary> | ||
public bool IsEmpty => this.Width == 0 || this.Height == 0; | ||
|
||
/// <summary>Gets or sets the size of this entry.</summary> | ||
public Vector2 Size | ||
{ | ||
get => new(this.Width, this.Height); | ||
set => (this.Width, this.Height) = (checked((ushort)value.X), checked((ushort)value.Y)); | ||
} | ||
|
||
/// <summary>Gets the UV0 of this entry.</summary> | ||
public Vector2 Uv0 => new(this.Left / 512f, this.Top / 1024f); | ||
|
||
/// <summary>Gets the UV1 of this entry.</summary> | ||
public Vector2 Uv1 => new((this.Left + this.Width) / 512f, (this.Top + this.Height) / 1024f); | ||
|
||
/// <summary>Gets the UV0 of the HQ version of this entry.</summary> | ||
public Vector2 HqUv0 => new(this.Left / 256f, (this.Top + 170.5f) / 512f); | ||
|
||
/// <summary>Gets the UV1 of the HQ version of this entry.</summary> | ||
public Vector2 HqUv1 => new((this.Left + this.Width) / 256f, (this.Top + this.Height + 170.5f) / 512f); | ||
} | ||
} |
Oops, something went wrong.