Can boot into the UI

This commit is contained in:
RisaDev
2024-07-04 13:10:12 +03:00
parent b63a335e68
commit 11b5106aab
37 changed files with 85 additions and 70 deletions

View File

@@ -19,7 +19,7 @@ public sealed unsafe class CopyCharacter : EventWrapperPtr<Character, Character,
private readonly Task<Hook<Delegate>> _task;
public nint Address
=> (nint)CharacterSetup.MemberFunctionPointers.CopyFromCharacter;
=> (nint)CharacterSetupContainer.MemberFunctionPointers.CopyFromCharacter;
public void Enable()
=> _task.Result.Enable();
@@ -33,9 +33,9 @@ public sealed unsafe class CopyCharacter : EventWrapperPtr<Character, Character,
public bool Finished
=> _task.IsCompletedSuccessfully;
private delegate ulong Delegate(CharacterSetup* target, Character* source, uint unk);
private delegate ulong Delegate(CharacterSetupContainer* target, Character* source, uint unk);
private ulong Detour(CharacterSetup* target, Character* source, uint unk)
private ulong Detour(CharacterSetupContainer* target, Character* source, uint unk)
{
// TODO: update when CS updated.
var character = ((Character**)target)[1];

View File

@@ -20,7 +20,7 @@ public class CutsceneService : IService, IDisposable
private readonly CharacterDestructor _characterDestructor;
private readonly short[] _copiedCharacters = Enumerable.Repeat((short)-1, CutsceneSlots).ToArray();
public IEnumerable<KeyValuePair<int, Dalamud.Game.ClientState.Objects.Types.GameObject>> Actors
public IEnumerable<KeyValuePair<int, Dalamud.Game.ClientState.Objects.Types.IGameObject>> Actors
=> Enumerable.Range(CutsceneStartIdx, CutsceneSlots)
.Where(i => _objects[i] != null)
.Select(i => KeyValuePair.Create(i, this[i] ?? _objects[i]!));
@@ -43,7 +43,7 @@ public class CutsceneService : IService, IDisposable
/// Does not check for valid input index.
/// Returns null if no connected actor is set or the actor does not exist anymore.
/// </summary>
public Dalamud.Game.ClientState.Objects.Types.GameObject? this[int idx]
public Dalamud.Game.ClientState.Objects.Types.IGameObject? this[int idx]
{
get
{
@@ -101,7 +101,7 @@ public class CutsceneService : IService, IDisposable
// A hack to deal with GPose actors leaving and thus losing the link, we just set the home world instead.
// I do not think this breaks anything?
var address = (GameObject*)_objects.GetObjectAddress(i + CutsceneStartIdx);
if (address != null && address->GetObjectKind() is (byte)ObjectKind.Pc)
if (address != null && address->GetObjectKind() is ObjectKind.Pc)
((Character*)address)->HomeWorld = character->HomeWorld;
_copiedCharacters[i] = -1;

View File

@@ -29,7 +29,7 @@ public unsafe class GameEventManager : IDisposable
interop.InitializeFromAttributes(this);
_copyCharacterHook =
interop.HookFromAddress<CopyCharacterDelegate>((nint)CharacterSetup.MemberFunctionPointers.CopyFromCharacter, CopyCharacterDetour);
interop.HookFromAddress<CopyCharacterDelegate>((nint)CharacterSetupContainer.MemberFunctionPointers.CopyFromCharacter, CopyCharacterDetour);
_characterBaseCreateHook =
interop.HookFromAddress<CharacterBaseCreateDelegate>((nint)CharacterBase.MemberFunctionPointers.Create, CharacterBaseCreateDetour);
_characterBaseDestructorHook =
@@ -83,11 +83,11 @@ public unsafe class GameEventManager : IDisposable
#region Copy Character
private delegate ulong CopyCharacterDelegate(CharacterSetup* target, GameObject* source, uint unk);
private delegate ulong CopyCharacterDelegate(CharacterSetupContainer* target, GameObject* source, uint unk);
private readonly Hook<CopyCharacterDelegate> _copyCharacterHook;
private ulong CopyCharacterDetour(CharacterSetup* target, GameObject* source, uint unk)
private ulong CopyCharacterDetour(CharacterSetupContainer* target, GameObject* source, uint unk)
{
// TODO: update when CS updated.
var character = ((Character**)target)[1];

View File

@@ -16,7 +16,7 @@ public class ObjectManager(
IFramework framework,
IClientState clientState,
IObjectTable objects,
DalamudPluginInterface pi,
IDalamudPluginInterface pi,
Logger log,
ActorManager actors,
ITargetManager targets)
@@ -218,13 +218,16 @@ public class ObjectManager(
}
//c+ custom
[Obsolete("To be updated for DT")]
private unsafe bool AddLobbyCharacter()
{
return false;
/*
var agent = AgentLobby.Instance();
if (agent == null || agent->LobbyData.CharaSelectEntries.Size() == 0)
if (agent == null || agent->LobbyData.CharaSelectEntries.LongCount() == 0)
return false;
var chara = agent->LobbyData.CharaSelectEntries.Get((ulong)agent->SelectedCharacterIndex).Value;
var chara = agent->LobbyData.CharaSelectEntries.Get((ulong)agent->SelectedCharacterContentId).Value;
if (chara == null)
return false;
@@ -235,6 +238,6 @@ public class ObjectManager(
HandleIdentifier(actors.CreatePlayer(new ByteString(chara->Name), chara->HomeWorldId), actor);
return true;
return true;*/
}
}

View File

@@ -30,7 +30,7 @@ public partial class CustomizePlusIpc
/// /!\ If no profile is set on specified character profile id will be equal to Guid.Empty
/// </summary>
[EzIPCEvent("Profile.OnUpdate")]
private Action<Character, Guid> OnProfileUpdate;
private Action<ICharacter, Guid> OnProfileUpdate;
/// <summary>
/// Retrieve list of all user profiles
@@ -125,7 +125,7 @@ public partial class CustomizePlusIpc
/// Get unique id of currently active profile for character.
/// </summary>
[EzIPC("Profile.GetActiveProfileIdOnCharacter")]
private (int, Guid?) GetActiveProfileIdOnCharacter(Character character)
private (int, Guid?) GetActiveProfileIdOnCharacter(ICharacter character)
{
if (character == null)
return ((int)ErrorCode.InvalidCharacter, null);
@@ -143,7 +143,7 @@ public partial class CustomizePlusIpc
/// Returns profile's unique id which can be used to manipulate it at a later date.
/// </summary>
[EzIPC("Profile.SetTemporaryProfileOnCharacter")]
private (int, Guid?) SetTemporaryProfileOnCharacter(Character character, string profileJson)
private (int, Guid?) SetTemporaryProfileOnCharacter(ICharacter character, string profileJson)
{
//todo: do not allow to set temporary profile on reserved actors (examine, etc)
if (character == null)
@@ -190,7 +190,7 @@ public partial class CustomizePlusIpc
/// Delete temporary profile currently active on character
/// </summary>
[EzIPC("Profile.DeleteTemporaryProfileOnCharacter")]
private int DeleteTemporaryProfileOnCharacter(Character character)
private int DeleteTemporaryProfileOnCharacter(ICharacter character)
{
if (character == null)
return (int)ErrorCode.InvalidCharacter;
@@ -266,7 +266,7 @@ public partial class CustomizePlusIpc
if (armature.ActorIdentifier.ToNameWithoutOwnerName() != currentPlayerName)
return;
Character? localPlayerCharacter = (Character?)_gameObjectService.GetDalamudGameObjectFromActor(_gameObjectService.GetLocalPlayerActor());
ICharacter? localPlayerCharacter = (ICharacter?)_gameObjectService.GetDalamudGameObjectFromActor(_gameObjectService.GetLocalPlayerActor());
if (localPlayerCharacter == null)
return;
@@ -317,7 +317,7 @@ public partial class CustomizePlusIpc
}
}
private void OnProfileUpdateInternal(Character character, Profile? profile)
private void OnProfileUpdateInternal(ICharacter character, Profile? profile)
{
if (character == null)
return;

View File

@@ -19,7 +19,7 @@ namespace CustomizePlus.Api;
/// </summary>
public partial class CustomizePlusIpc : IDisposable
{
private readonly DalamudPluginInterface _pluginInterface;
private readonly IDalamudPluginInterface _pluginInterface;
private readonly Logger _logger;
private readonly HookingService _hookingService;
private readonly ProfileManager _profileManager;
@@ -34,7 +34,7 @@ public partial class CustomizePlusIpc : IDisposable
public bool IPCFailed { get; private set; }
public CustomizePlusIpc(
DalamudPluginInterface pluginInterface,
IDalamudPluginInterface pluginInterface,
Logger logger,
HookingService hookingService,
ProfileManager profileManager,

View File

@@ -5,6 +5,7 @@ using CustomizePlus.Core.Data;
using CustomizePlus.Templates.Data;
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
using FFXIVClientStructs.Havok;
using FFXIVClientStructs.Havok.Common.Base.Math.QsTransform;
namespace CustomizePlus.Armatures.Data;

View File

@@ -2,18 +2,15 @@
using System.Collections.Generic;
using System.IO;
using Dalamud.Configuration;
using Dalamud.Interface.Internal.Notifications;
using Newtonsoft.Json;
using OtterGui.Classes;
using OtterGui.Log;
using OtterGui.Widgets;
using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs;
using CustomizePlus.Core.Services;
using CustomizePlus.Core.Data;
using CustomizePlus.Configuration.Services;
using CustomizePlus.Game.Services;
using CustomizePlus.UI.Windows;
using Dalamud.Plugin.Services;
using Dalamud.Interface.ImGuiNotification;
namespace CustomizePlus.Configuration.Data;

View File

@@ -1,5 +1,4 @@
using Dalamud.Interface.Internal.Notifications;
using Newtonsoft.Json;
using Newtonsoft.Json;
using OtterGui.Classes;
using OtterGui.Log;
using System;
@@ -11,7 +10,7 @@ using CustomizePlus.Configuration.Helpers;
using CustomizePlus.Configuration.Data;
using CustomizePlus.Core.Events;
using CustomizePlus.Configuration.Data.Version3;
using CustomizePlus.UI.Windows;
using Dalamud.Interface.ImGuiNotification;
namespace CustomizePlus.Configuration.Services;

View File

@@ -4,6 +4,7 @@ using System.Runtime.Serialization;
using CustomizePlus.Core.Extensions;
using CustomizePlus.Game.Services.GPose.ExternalTools;
using FFXIVClientStructs.Havok;
using FFXIVClientStructs.Havok.Common.Base.Math.QsTransform;
namespace CustomizePlus.Core.Data;

View File

@@ -1,4 +1,7 @@
using FFXIVClientStructs.Havok;
using FFXIVClientStructs.Havok.Common.Base.Math.QsTransform;
using FFXIVClientStructs.Havok.Common.Base.Math.Quaternion;
using FFXIVClientStructs.Havok.Common.Base.Math.Vector;
using System.Numerics;
namespace CustomizePlus.Core.Data;

View File

@@ -2,6 +2,8 @@
using System.Numerics;
using CustomizePlus.Core.Data;
using FFXIVClientStructs.Havok;
using FFXIVClientStructs.Havok.Common.Base.Math.QsTransform;
using FFXIVClientStructs.Havok.Common.Base.Math.Vector;
//using FFXIVClientStructs.FFXIV.Client.Graphics;

View File

@@ -2,6 +2,8 @@
using System.Numerics;
using CustomizePlus.Anamnesis.Data;
using FFXIVClientStructs.Havok;
using FFXIVClientStructs.Havok.Common.Base.Math.Quaternion;
using FFXIVClientStructs.Havok.Common.Base.Math.Vector;
namespace CustomizePlus.Core.Extensions;

View File

@@ -37,7 +37,7 @@ namespace CustomizePlus.Core;
public static class ServiceManagerBuilder
{
public static ServiceManager CreateProvider(DalamudPluginInterface pi, Logger logger)
public static ServiceManager CreateProvider(IDalamudPluginInterface pi, Logger logger)
{
EventWrapperBase.ChangeLogger(logger);

View File

@@ -1,5 +1,4 @@
using Dalamud.Game.Command;
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Plugin.Services;
using OtterGui.Classes;
using System;
@@ -13,6 +12,7 @@ using CustomizePlus.UI.Windows.MainWindow;
using static System.Windows.Forms.AxHost;
using CustomizePlus.Profiles.Data;
using CustomizePlus.Configuration.Data;
using Dalamud.Interface.ImGuiNotification;
namespace CustomizePlus.Core.Services;

View File

@@ -10,7 +10,7 @@ namespace CustomizePlus.Core.Services;
public class DalamudServices
{
public static void AddServices(ServiceManager services, DalamudPluginInterface pi)
public static void AddServices(ServiceManager services, IDalamudPluginInterface pi)
{
services.AddExistingService(pi)
.AddExistingService(pi.UiBuilder)

View File

@@ -15,7 +15,7 @@ public class FilenameService
public readonly string TemplateDirectory;
public readonly string TemplateFileSystem;
public FilenameService(DalamudPluginInterface pi)
public FilenameService(IDalamudPluginInterface pi)
{
ConfigDirectory = pi.ConfigDirectory.FullName;
ConfigFile = pi.ConfigFile.FullName;

View File

@@ -55,6 +55,7 @@ public class HookingService : IDisposable
ReloadHooks();
}
[Obsolete("To be updated for Dawntrail")]
public void ReloadHooks()
{
RenderHookFailed = false;
@@ -64,7 +65,7 @@ public class HookingService : IDisposable
{
if (_configuration.PluginEnabled)
{
if (_renderManagerHook == null)
/*if (_renderManagerHook == null)
{
var renderAddress = _sigScanner.ScanText(Constants.RenderHookAddress);
_renderManagerHook = _hooker.HookFromAddress<RenderDelegate>(renderAddress, OnRender);
@@ -83,7 +84,7 @@ public class HookingService : IDisposable
_renderManagerHook.Enable();
_logger.Debug("Hooking movement functions");
_gameObjectMovementHook.Enable();
_gameObjectMovementHook.Enable();*/
}
else
{

View File

@@ -22,14 +22,14 @@ public class SupportLogBuilderService
private readonly TemplateManager _templateManager;
private readonly ProfileManager _profileManager;
private readonly ArmatureManager _armatureManager;
private readonly DalamudPluginInterface _dalamudPluginInterface;
private readonly IDalamudPluginInterface _dalamudPluginInterface;
public SupportLogBuilderService(
PluginConfiguration configuration,
TemplateManager templateManager,
ProfileManager profileManager,
ArmatureManager armatureManager,
DalamudPluginInterface dalamudPluginInterface)
IDalamudPluginInterface dalamudPluginInterface)
{
_configuration = configuration;
_templateManager = templateManager;

View File

@@ -93,4 +93,8 @@
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<DefineConstants>INCOGNIFY_STRINGS</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<GitVersion>false</GitVersion>
</PropertyGroup>
</Project>

View File

@@ -56,9 +56,9 @@ public class GPoseService : IDisposable
GPoseState = clientState.IsGPosing ? GPoseState.Inside : GPoseState.Outside;
var uiModule = Framework.Instance()->GetUiModule();
var enterGPoseAddress = (nint)uiModule->VTable->EnterGPose;
var exitGPoseAddress = (nint)uiModule->VTable->ExitGPose;
var uiModule = Framework.Instance()->GetUIModule();
var enterGPoseAddress = (nint)uiModule->VirtualTable->EnterGPose;
var exitGPoseAddress = (nint)uiModule->VirtualTable->ExitGPose;
_enterGPoseHook = hooker.HookFromAddress<EnterGPoseDelegate>(enterGPoseAddress, EnteringGPoseDetour);
_enterGPoseHook.Enable();

View File

@@ -6,7 +6,7 @@ using Penumbra.GameData.Actors;
using Penumbra.GameData.Enums;
using Penumbra.GameData.Interop;
using ObjectManager = CustomizePlus.GameData.Services.ObjectManager;
using DalamudGameObject = Dalamud.Game.ClientState.Objects.Types.GameObject;
using DalamudGameObject = Dalamud.Game.ClientState.Objects.Types.IGameObject;
using ECommons.Configuration;
using System;
using CustomizePlus.Configuration.Data;

View File

@@ -36,7 +36,7 @@ public sealed class Plugin : IDalamudPlugin
public static readonly Logger Logger = new(); //for loggin in static classes/methods
public Plugin(DalamudPluginInterface pluginInterface)
public Plugin(IDalamudPluginInterface pluginInterface)
{
try
{
@@ -52,7 +52,7 @@ public sealed class Plugin : IDalamudPlugin
_services.GetService<CPlusWindowSystem>();
_services.GetService<CommandService>();
Logger.Information($"Customize+ v{Version} ({ThisAssembly.Git.Commit}+{ThisAssembly.Git.Sha}) [FantasiaPlus] started");
Logger.Information($"Customize+ {Version} ({ThisAssembly.Git.Commit}+{ThisAssembly.Git.Sha}) [FantasiaPlus] started");
}
catch (Exception ex)
{

View File

@@ -6,10 +6,10 @@ using System.Text.RegularExpressions;
using System;
using System.Linq;
using OtterGui.Classes;
using Dalamud.Interface.Internal.Notifications;
using CustomizePlus.Core.Services;
using CustomizePlus.Profiles.Data;
using CustomizePlus.Profiles.Events;
using Dalamud.Interface.ImGuiNotification;
namespace CustomizePlus.Profiles;

View File

@@ -1,5 +1,4 @@
using Dalamud.Interface.Internal.Notifications;
using OtterGui.Classes;
using OtterGui.Classes;
using OtterGui.Filesystem;
using OtterGui.Log;
using System;
@@ -10,6 +9,7 @@ using System.Text.RegularExpressions;
using CustomizePlus.Core.Services;
using CustomizePlus.Templates.Events;
using CustomizePlus.Templates.Data;
using Dalamud.Interface.ImGuiNotification;
namespace CustomizePlus.Templates;

View File

@@ -10,12 +10,12 @@ namespace CustomizePlus.UI;
public class CPlusWindowSystem : IDisposable
{
private readonly WindowSystem _windowSystem = new("Customize+");
private readonly UiBuilder _uiBuilder;
private readonly IUiBuilder _uiBuilder;
private readonly MainWindow _mainWindow;
private readonly PopupSystem _popupSystem;
public CPlusWindowSystem(
UiBuilder uiBuilder,
IUiBuilder uiBuilder,
MainWindow mainWindow,
CPlusChangeLog changelog,
PopupSystem popupSystem,

View File

@@ -21,6 +21,7 @@ public class CPlusChangeLog
Add2_0_4_0(Changelog);
Add2_0_4_1(Changelog);
Add2_0_4_4(Changelog);
//Add2_0_5_0(Changelog);
}
private (int, ChangeLogDisplayType) ConfigData()
@@ -33,6 +34,13 @@ public class CPlusChangeLog
_config.Save();
}
private static void Add2_0_5_0(Changelog log)
=> log.NextVersion("Version 2.0.5.0")
.RegisterHighlight("Customize+ has been updated to support Dawntrail.")
.RegisterEntry("Added \"Copy Support Info to Clipboard\" button to Settings tab.")
.RegisterEntry("Renamed \"Default profile\" to \"Apply to all players and retainers\" to try and improve understanding of the function by the users. (2.0.4.5)")
.RegisterEntry("Improved UI behavior when \"Apply to all players and retainers\" is enabled. (2.0.4.5)");
private static void Add2_0_4_4(Changelog log)
=> log.NextVersion("Version 2.0.4.4")
.RegisterHighlight("Added edit button to the template selector in the profile editor which allows to quickly begin editing associated template.")

View File

@@ -47,7 +47,7 @@ public class MainWindow : Window, IDisposable
private Action? _actionAfterTabSwitch = null;
public MainWindow(
DalamudPluginInterface pluginInterface,
IDalamudPluginInterface pluginInterface,
SettingsTab settingsTab,
TemplatesTab templatesTab,
ProfilesTab profilesTab,
@@ -59,7 +59,7 @@ public class MainWindow : Window, IDisposable
PluginConfiguration configuration,
HookingService hookingService,
TemplateEditorEvent templateEditorEvent
) : base($"Customize+ v{Plugin.Version}###CPlusMainWindow")
) : base($"Customize+ {Plugin.Version}###CPlusMainWindow")
{
_settingsTab = settingsTab;
_templatesTab = templatesTab;

View File

@@ -50,13 +50,13 @@ public class IPCTestTab //: IDisposable
private readonly Func<Guid, int> _disableProfileByUniqueIdIpcFunc;
[EzIPC("Profile.GetActiveProfileIdOnCharacter")]
private readonly Func<Character, (int, Guid?)> _getActiveProfileIdOnCharacterIpcFunc;
private readonly Func<ICharacter, (int, Guid?)> _getActiveProfileIdOnCharacterIpcFunc;
[EzIPC("Profile.SetTemporaryProfileOnCharacter")]
private readonly Func<Character, string, (int, Guid?)> _setTemporaryProfileOnCharacterIpcFunc;
private readonly Func<ICharacter, string, (int, Guid?)> _setTemporaryProfileOnCharacterIpcFunc;
[EzIPC("Profile.DeleteTemporaryProfileOnCharacter")]
private readonly Func<Character, int> _deleteTemporaryProfileOnCharacterIpcFunc;
private readonly Func<ICharacter, int> _deleteTemporaryProfileOnCharacterIpcFunc;
[EzIPC("Profile.DeleteTemporaryProfileByUniqueId")]
private readonly Func<Guid, int> _deleteTemporaryProfileByUniqueIdIpcFunc;
@@ -80,7 +80,7 @@ public class IPCTestTab //: IDisposable
private string _targetProfileId = "";
public IPCTestTab(
DalamudPluginInterface pluginInterface,
IDalamudPluginInterface pluginInterface,
IObjectTable objectTable,
ProfileManager profileManager,
PopupSystem popupSystem,
@@ -311,16 +311,16 @@ public class IPCTestTab //: IDisposable
}
[EzIPCEvent("Profile.OnUpdate")]
private void OnProfileUpdate(Character Character, Guid ProfileUniqueId)
private void OnProfileUpdate(ICharacter Character, Guid ProfileUniqueId)
{
_logger.Debug($"IPC Test Tab - OnProfileUpdate: Character: {Character.Name.ToString().Incognify()}, Profile ID: {(ProfileUniqueId != Guid.Empty ? ProfileUniqueId.ToString() : "no id")}");
}
private Character? FindCharacterByAddress(nint address)
private ICharacter? FindCharacterByAddress(nint address)
{
foreach (var obj in _objectTable)
if (obj.Address == address)
return (Character)obj;
return (ICharacter)obj;
return null;
}

View File

@@ -1,6 +1,4 @@
//using CustomizePlus.UI.Windows.Debug;
using Dalamud.Interface;
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface;
using Dalamud.Interface.Utility;
using ImGuiNET;
using OtterGui.Classes;
@@ -15,6 +13,7 @@ using CustomizePlus.Profiles;
using CustomizePlus.Templates;
using CustomizePlus.Core.Helpers;
using CustomizePlus.Armatures.Services;
using Dalamud.Interface.ImGuiNotification;
namespace CustomizePlus.UI.Windows.MainWindow.Tabs;

View File

@@ -11,12 +11,9 @@ using System;
using System.Numerics;
using static CustomizePlus.UI.Windows.MainWindow.Tabs.Templates.TemplateFileSystemSelector;
using Newtonsoft.Json;
using System.Windows.Forms;
using System.Linq;
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiFileDialog;
using System.IO;
using System.Reflection;
using CustomizePlus.Templates;
using CustomizePlus.Configuration.Data;
using CustomizePlus.Profiles;
@@ -28,9 +25,8 @@ using CustomizePlus.Profiles.Events;
using CustomizePlus.Templates.Data;
using CustomizePlus.Configuration.Helpers;
using CustomizePlus.Configuration.Data.Version3;
using CustomizePlus.GameData.Data;
using static OtterGui.Classes.MessageService;
using CustomizePlus.Configuration.Data.Version2;
using Dalamud.Interface.ImGuiNotification;
namespace CustomizePlus.UI.Windows.MainWindow.Tabs.Templates;

View File

@@ -1,5 +1,4 @@
using Dalamud.Interface;
using Dalamud.Interface.Internal.Notifications;
using ImGuiNET;
using OtterGui;
using OtterGui.Classes;