Expose GameState.GetCutsceneParentIndex and GameState.SetCutsceneParentIndex via IPC

This commit is contained in:
RisaDev
2024-09-30 22:44:19 +03:00
parent 0a6b5e51ca
commit 80d0ed4f07
5 changed files with 93 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
using CustomizePlus.Api.Enums;
using ECommons.EzIpcManager;
namespace CustomizePlus.Api;
public partial class CustomizePlusIpc
{
/// <summary>
/// Retrieve parent for actor. If actor has no parent will return -1.
/// This IPC method is identical to same method in Penumbra.
/// /!\ Generally speaking use cases for this are quite limited and you should not use this unless you know what you are doing.
/// Improper use of this method can lead to incorrect Customize+ behavior.
/// </summary>
[EzIPC("GameState.GetCutsceneParentIndex")]
private int GetCutsceneParentIndex(int actorIndex)
{
return _cutsceneService.GetParentIndex(actorIndex);
}
/// <summary>
/// Set parent for actor.
/// This IPC method is identical to same method in Penumbra.
/// /!\ Generally speaking use cases for this are quite limited and you should not use this unless you know what you are doing.
/// Improper use of this method can lead to incorrect Customize+ behavior.
/// </summary>
[EzIPC("GameState.SetCutsceneParentIndex")]
private int SetCutsceneParentIndex(int copyIndex, int newParentIndex)
{
return _cutsceneService.SetParentIndex(copyIndex, newParentIndex) ? (int)ErrorCode.Success : (int)ErrorCode.InvalidArgument;
}
}

View File

@@ -1,6 +1,7 @@
using CustomizePlus.Armatures.Events;
using CustomizePlus.Core.Services;
using CustomizePlus.Game.Services;
using CustomizePlus.GameData.Services;
using CustomizePlus.Profiles;
using CustomizePlus.Profiles.Events;
using Dalamud.Plugin;
@@ -25,6 +26,7 @@ public partial class CustomizePlusIpc : IDisposable
private readonly ProfileManager _profileManager;
private readonly GameObjectService _gameObjectService;
private readonly ProfileFileSystem _profileFileSystem;
private readonly CutsceneService _cutsceneService;
private readonly ArmatureChanged _armatureChangedEvent;
@@ -40,6 +42,7 @@ public partial class CustomizePlusIpc : IDisposable
ProfileManager profileManager,
GameObjectService gameObjectService,
ProfileFileSystem profileFileSystem,
CutsceneService cutsceneService,
ArmatureChanged armatureChangedEvent)
{
_pluginInterface = pluginInterface;
@@ -48,6 +51,7 @@ public partial class CustomizePlusIpc : IDisposable
_profileManager = profileManager;
_gameObjectService = gameObjectService;
_profileFileSystem = profileFileSystem;
_cutsceneService = cutsceneService;
_armatureChangedEvent = armatureChangedEvent;

View File

@@ -12,18 +12,26 @@ namespace CustomizePlus.Api.Enums;
public enum ErrorCode
{
Success = 0,
/// <summary>
/// Returned when invalid character address was provided
/// </summary>
InvalidCharacter = 1,
/// <summary>
/// Returned if IPCCharacterProfile could not be deserialized or deserialized into an empty object
/// </summary>
CorruptedProfile = 2,
/// <summary>
/// Provided character does not have active profiles, provided profile id is invalid or provided profile id is not valid for use in current function
/// </summary>
ProfileNotFound = 3,
/// <summary>
/// General error telling that one of the provided arguments were invalid.
/// </summary>
InvalidArgument = 4,
UnknownError = 255
}