Skip to content

Commit

Permalink
Version Bump to 0.2.10, Sig Cleanup
Browse files Browse the repository at this point in the history
- Clean up some unnecessary signatures that were all pointing to PlayerState anyways
- Bump versions to 0.2.10
  • Loading branch information
KazWolfe committed Aug 17, 2022
1 parent db01e0e commit 830f466
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 36 deletions.
8 changes: 0 additions & 8 deletions .idea/.idea.XIVDeck/.idea/misc.xml

This file was deleted.

35 changes: 12 additions & 23 deletions FFXIVPlugin/Game/GameStateCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,13 @@ namespace XIVDeck.FFXIVPlugin.Game;
// ... and then promptly adapted and destroyed. I am sorry, goat.
internal unsafe class GameStateCache {
private static class Signatures {
internal const string PlayerStatus = "48 8D 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? 84 C0 75 0F FF C3";

internal const string IsEmoteUnlocked = "E8 ?? ?? ?? ?? 84 C0 74 A4";

internal const string MinionBitmask = "48 8D 0D ?? ?? ?? ?? 0F B6 04 08 84 D0 75 10 B8 ?? ?? ?? ?? 48 8B 5C 24";

internal const string PlayerState = "48 8D 0D ?? ?? ?? ?? E9 ?? ?? ?? ?? CC 40 53";

internal const string IsMountUnlocked = "E8 ?? ?? ?? ?? 84 C0 74 5C 8B CB";
internal const string MountBitmask = "48 8D 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? 84 C0 74 5C 8B CB E8";

internal const string IsOrnamentUnlocked = "E8 ?? ?? ?? ?? BA ?? ?? ?? ?? 41 0F B6 CE";
internal const string OrnamentBitmask = "48 8D 0D ?? ?? ?? ?? 48 8B D8 E8 ?? ?? ?? ?? BA ?? ?? ?? ?? 41 0F B6 CE";
internal const string IsEmoteUnlocked = "E8 ?? ?? ?? ?? 84 C0 74 A4";

// This sig is (interestingly) hand-found in order to allow Square to change McGuffin counts without
// breaking my code. Simple explanation is that ?? is current count of McGuffins.
internal const string IsMcGuffinUnlocked = "8D 42 FF 3C ?? 77 44 4C 8B 89";
Expand All @@ -52,17 +47,11 @@ internal struct Gearset {
private readonly delegate* unmanaged<IntPtr, uint, byte> _isMcGuffinUnlocked = null;

// Fields //
[Signature(Signatures.PlayerStatus, ScanType = ScanType.StaticAddress)]
private readonly IntPtr? _playerStatus = null;
[Signature(Signatures.PlayerState, ScanType = ScanType.StaticAddress)]
private readonly IntPtr? _playerState = null;

[Signature(Signatures.MinionBitmask, ScanType = ScanType.StaticAddress)]
private readonly IntPtr? _minionBitmask = null;

[Signature(Signatures.MountBitmask, ScanType = ScanType.StaticAddress)]
private readonly IntPtr? _mountBitmask = null;

[Signature(Signatures.OrnamentBitmask, ScanType = ScanType.StaticAddress)]
private readonly IntPtr? _ornamentBitmask = null;

internal IReadOnlyList<Emote>? UnlockedEmotes { get; private set; }
internal IReadOnlyList<Mount>? UnlockedMounts { get; private set; }
Expand All @@ -83,11 +72,11 @@ internal bool IsEmoteUnlocked(uint emoteId) {
}

internal bool IsMountUnlocked(uint mountId) {
if (this._mountBitmask == null || this._mountBitmask.Value == IntPtr.Zero) {
if (this._playerState == null || this._playerState.Value == IntPtr.Zero) {
return false;
}

return this._isMountUnlocked(this._mountBitmask.Value, mountId) > 0;
return this._isMountUnlocked(this._playerState.Value, mountId) > 0;
}

internal bool IsMinionUnlocked(uint minionId) {
Expand All @@ -99,19 +88,19 @@ internal bool IsMinionUnlocked(uint minionId) {
}

internal bool IsOrnamentUnlocked(uint ornamentId) {
if (this._ornamentBitmask == null || this._ornamentBitmask.Value == IntPtr.Zero) {
if (this._playerState == null || this._playerState.Value == IntPtr.Zero) {
return false;
}

return this._isOrnamentUnlocked(this._ornamentBitmask.Value, ornamentId) > 0;
return this._isOrnamentUnlocked(this._playerState.Value, ornamentId) > 0;
}

internal bool IsMcGuffinUnlocked(uint mcguffinId) {
if (this._playerStatus == null || this._playerStatus.Value == IntPtr.Zero) {
if (this._playerState == null || this._playerState.Value == IntPtr.Zero) {
return false;
}

return this._isMcGuffinUnlocked(this._playerStatus.Value, (byte) mcguffinId) > 0;
return this._isMcGuffinUnlocked(this._playerState.Value, (byte) mcguffinId) > 0;
}

internal GameStateCache() {
Expand Down
7 changes: 4 additions & 3 deletions FFXIVPlugin/Game/SigHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@ internal bool IsQuestCompleted(uint questId) {
internal void CalcBForSlot(HotBarSlot* slot, out HotbarSlotType actionType, out uint actionId) {
var hotbarModule = Framework.Instance()->GetUiModule()->GetRaptureHotbarModule();

var acType = HotbarSlotType.Empty;
uint acId = 0;
ushort acCA = 0;
// Take in default values, just in case GetSlotAppearance fails for some reason
var acType = slot->IconTypeB;
var acId = slot->IconB;
ushort acCA = slot->UNK_0xCA;

RaptureHotbarModule.GetSlotAppearance(&acType, &acId, &acCA, hotbarModule, slot);

Expand Down
2 changes: 1 addition & 1 deletion FFXIVPlugin/XIVDeck.FFXIVPlugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Product>XIVDeck Game Plugin</Product>
<Authors>Kaz Wolfe</Authors>
<Company>Blacksite Technologies</Company>
<Version>0.2.9</Version>
<Version>0.2.10</Version>

<AssemblyName>XIVDeck.FFXIVPlugin</AssemblyName>

Expand Down
2 changes: 1 addition & 1 deletion SDPlugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kazwolfe/xivdeck-sdplugin",
"version": "0.2.9",
"version": "0.2.10",
"private": true,
"license": "MPL",
"scripts": {
Expand Down

0 comments on commit 830f466

Please sign in to comment.