-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated to latest Penumbra.GameData, updated ObjectManager
- Loading branch information
Showing
16 changed files
with
313 additions
and
246 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
48 changes: 48 additions & 0 deletions
48
CustomizePlus.GameData/Hooks/Objects/CharacterDestructor.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,48 @@ | ||
using Dalamud.Hooking; | ||
using FFXIVClientStructs.FFXIV.Client.Game.Character; | ||
using OtterGui.Classes; | ||
using OtterGui.Services; | ||
using Penumbra.GameData; | ||
|
||
namespace CustomizePlus.GameData.Hooks.Objects; | ||
public sealed unsafe class CharacterDestructor : EventWrapperPtr<Character, CharacterDestructor.Priority>, IHookService | ||
{ | ||
public enum Priority | ||
{ | ||
/// <seealso cref="PathResolving.CutsceneService"/> | ||
CutsceneService = 0, | ||
|
||
/// <seealso cref="PathResolving.IdentifiedCollectionCache"/> | ||
IdentifiedCollectionCache = 0, | ||
} | ||
|
||
public CharacterDestructor(HookManager hooks) | ||
: base("Character Destructor") | ||
=> _task = hooks.CreateHook<Delegate>(Name, Sigs.CharacterDestructor, Detour, true); | ||
|
||
private readonly Task<Hook<Delegate>> _task; | ||
|
||
public nint Address | ||
=> _task.Result.Address; | ||
|
||
public void Enable() | ||
=> _task.Result.Enable(); | ||
|
||
public void Disable() | ||
=> _task.Result.Disable(); | ||
|
||
public Task Awaiter | ||
=> _task; | ||
|
||
public bool Finished | ||
=> _task.IsCompletedSuccessfully; | ||
|
||
private delegate void Delegate(Character* character); | ||
|
||
private void Detour(Character* character) | ||
{ | ||
//Penumbra.Log.Verbose($"[{Name}] Triggered with 0x{(nint)character:X}."); | ||
Invoke(character); | ||
_task.Result.Original(character); | ||
} | ||
} |
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,46 @@ | ||
using Dalamud.Hooking; | ||
using FFXIVClientStructs.FFXIV.Client.Game.Character; | ||
using OtterGui.Classes; | ||
using OtterGui.Services; | ||
|
||
namespace CustomizePlus.GameData.Hooks.Objects; | ||
public sealed unsafe class CopyCharacter : EventWrapperPtr<Character, Character, CopyCharacter.Priority>, IHookService | ||
{ | ||
public enum Priority | ||
{ | ||
/// <seealso cref="PathResolving.CutsceneService"/> | ||
CutsceneService = 0, | ||
} | ||
|
||
public CopyCharacter(HookManager hooks) | ||
: base("Copy Character") | ||
=> _task = hooks.CreateHook<Delegate>(Name, Address, Detour, true); | ||
|
||
private readonly Task<Hook<Delegate>> _task; | ||
|
||
public nint Address | ||
=> (nint)CharacterSetup.MemberFunctionPointers.CopyFromCharacter; | ||
|
||
public void Enable() | ||
=> _task.Result.Enable(); | ||
|
||
public void Disable() | ||
=> _task.Result.Disable(); | ||
|
||
public Task Awaiter | ||
=> _task; | ||
|
||
public bool Finished | ||
=> _task.IsCompletedSuccessfully; | ||
|
||
private delegate ulong Delegate(CharacterSetup* target, Character* source, uint unk); | ||
|
||
private ulong Detour(CharacterSetup* target, Character* source, uint unk) | ||
{ | ||
// TODO: update when CS updated. | ||
var character = ((Character**)target)[1]; | ||
//Penumbra.Log.Verbose($"[{Name}] Triggered with target: 0x{(nint)target:X}, source : 0x{(nint)source:X} unk: {unk}."); | ||
Invoke(character, source); | ||
return _task.Result.Original(target, source, unk); | ||
} | ||
} |
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
Oops, something went wrong.