Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: clean the whole project.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed May 5, 2023
1 parent 5bdf85c commit 7563160
Show file tree
Hide file tree
Showing 16 changed files with 247 additions and 646 deletions.
24 changes: 0 additions & 24 deletions FakeName/Commands.cs

This file was deleted.

10 changes: 4 additions & 6 deletions FakeName/Configuration.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using Dalamud.Configuration;

namespace FakeName;
Expand All @@ -8,14 +8,12 @@ public class Configuration : IPluginConfiguration
{
public int Version { get; set; } = 0;

public bool Enabled { get; set; } = false;
public bool Enabled = false;

public bool PartyMemberReplace { get; set; } = false;
public bool PartyMemberReplace = false;

public string FakeNameText { get; set; } = "";
public string FakeNameText = "";

public string FakeFcNameText { get; set; } = "";

internal void SaveConfig()
{
Service.Interface.SavePluginConfig(this);
Expand Down
7 changes: 1 addition & 6 deletions FakeName/FakeName.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,15 @@
<AssemblyVersion>1.0.0.5</AssemblyVersion>
<TargetFramework>net7.0-windows</TargetFramework>
<Platforms>x64</Platforms>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>

<PropertyGroup>
<DalamudLibPath>$(AppData)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DalamudPackager" Version="2.1.10" MakeZip="true" />
<PackageReference Include="DalamudPackager" Version="2.1.11" MakeZip="true" />
<Reference Include="FFXIVClientStructs">
<HintPath>$(DalamudLibPath)FFXIVClientStructs.dll</HintPath>
<Private>false</Private>
Expand Down
88 changes: 0 additions & 88 deletions FakeName/GameFunctions/AtkTextNodeSetText.cs

This file was deleted.

133 changes: 0 additions & 133 deletions FakeName/GameFunctions/SetNamePlate.cs

This file was deleted.

70 changes: 70 additions & 0 deletions FakeName/Hooker.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using System;
using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Hooking;
using Dalamud.Logging;
using Dalamud.Utility.Signatures;

namespace FakeName;

public class Hooker
{
private delegate void AtkTextNodeSetTextDelegate(IntPtr node, IntPtr text);

/// <summary>
/// https://github.com/aers/FFXIVClientStructs/blob/main/FFXIVClientStructs/FFXIV/Component/GUI/AtkTextNode.cs#L79
/// </summary>
[Signature("E8 ?? ?? ?? ?? 8D 4E 32", DetourName = nameof(AtkTextNodeSetTextDetour))]
private Hook<AtkTextNodeSetTextDelegate> AtkTextNodeSetTextHook { get; init; } = null!;

private delegate void SetNamePlateDelegate(
IntPtr addon, bool isPrefixTitle, bool displayTitle,
IntPtr titlePtr, IntPtr namePtr, IntPtr fcNamePtr, int iconId
);

/// <summary>
/// https://github.com/Haplo064/JobIcons/blob/master/PluginAddressResolver.cs#L34
/// </summary>
[Signature("48 89 5C 24 ?? 48 89 6C 24 ?? 56 57 41 54 41 56 41 57 48 83 EC 40 44 0F B6 E2", DetourName = nameof(SetNamePlateDetour))]
private Hook<SetNamePlateDelegate> SetNamePlateHook { get; init; } = null!;

// Constructor
internal unsafe Hooker()
{
SignatureHelper.Initialise(this);

AtkTextNodeSetTextHook.Enable();
SetNamePlateHook.Enable();
Service.ChatGui.ChatMessage += OnChatMessage;

}

public unsafe void Dispose()
{
AtkTextNodeSetTextHook.Dispose();
SetNamePlateHook.Dispose();
Service.ChatGui.ChatMessage -= OnChatMessage;

}

private void AtkTextNodeSetTextDetour(IntPtr node, IntPtr text)
{
AtkTextNodeSetTextHook.Original(node, Replacer.ChangeName(text));
}

private unsafe void SetNamePlateDetour(
IntPtr namePlateObjectPtr, bool isPrefixTitle, bool displayTitle,
IntPtr titlePtr, IntPtr namePtr, IntPtr fcNamePtr, int iconId)
{
SetNamePlateHook.Original(
namePlateObjectPtr, isPrefixTitle, displayTitle,
titlePtr, Replacer.ChangeName(namePtr), fcNamePtr, iconId
);
}

private void OnChatMessage(
XivChatType type, uint senderId, ref SeString sender, ref SeString message, ref bool isHandled)
{
Replacer.ChangeSeString(ref sender);
}
}
Loading

0 comments on commit 7563160

Please sign in to comment.