mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 10:17:23 +01:00
make shit compile.
This commit is contained in:
parent
10631341cb
commit
4eb46a9fff
14 changed files with 56 additions and 63 deletions
|
|
@ -15,6 +15,7 @@ public partial class Design : DesignData, ISavable
|
|||
{
|
||||
public const int FileVersion = 1;
|
||||
|
||||
|
||||
public Guid Identifier { get; internal init; }
|
||||
public DateTimeOffset CreationDate { get; internal init; }
|
||||
public LowerString Name { get; internal set; } = LowerString.Empty;
|
||||
|
|
@ -85,7 +86,7 @@ public partial class Design : DesignData, ISavable
|
|||
[nameof(Description)] = Description,
|
||||
[nameof(Tags)] = JArray.FromObject(Tags),
|
||||
[nameof(WriteProtected)] = WriteProtected,
|
||||
[nameof(ModelData.Equipment)] = SerializeEquipment(),
|
||||
["Equipment"] = SerializeEquipment(),
|
||||
[nameof(ModelData.Customize)] = SerializeCustomize(),
|
||||
};
|
||||
return ret;
|
||||
|
|
@ -269,15 +270,15 @@ public partial class Design : DesignData, ISavable
|
|||
UpdateMainhand(items, data.MainHand);
|
||||
UpdateOffhand(items, data.OffHand);
|
||||
foreach (var slot in EquipSlotExtensions.EqdpSlots)
|
||||
UpdateArmor(items, slot, data.Equipment[slot], true);
|
||||
ModelData.CustomizeData = data.CustomizeData;
|
||||
ApplyEquip = applyEquip;
|
||||
ApplyCustomize = applyCustomize;
|
||||
WriteProtected = writeProtected;
|
||||
Wetness = wet;
|
||||
Hat = hat;
|
||||
Visor = visor;
|
||||
Weapon = weapon;
|
||||
UpdateArmor(items, slot, data.Armor(slot), true);
|
||||
ModelData.Customize = data.Customize;
|
||||
ApplyEquip = applyEquip;
|
||||
ApplyCustomize = applyCustomize;
|
||||
WriteProtected = writeProtected;
|
||||
Wetness = wet;
|
||||
Hat = hat;
|
||||
Visor = visor;
|
||||
Weapon = weapon;
|
||||
}
|
||||
|
||||
public static Design CreateTemporaryFromBase64(ItemManager items, string base64, bool customize, bool equip)
|
||||
|
|
|
|||
|
|
@ -1,14 +1,10 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Glamourer.Customization;
|
||||
using Glamourer.Interop;
|
||||
using Glamourer.Services;
|
||||
using OtterGui.Classes;
|
||||
using OtterGui;
|
||||
using Penumbra.GameData.Data;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
using CustomizeData = FFXIVClientStructs.FFXIV.Client.Game.Character.CustomizeData;
|
||||
|
||||
namespace Glamourer.Designs;
|
||||
|
||||
|
|
@ -218,7 +214,6 @@ public class DesignData
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
private bool SetArmor(EquipSlot slot, SetId set, byte variant, string name, uint id)
|
||||
{
|
||||
var changes = false;
|
||||
|
|
@ -373,13 +368,16 @@ public static class DesignBase64Migration
|
|||
{
|
||||
fixed (byte* ptr = bytes)
|
||||
{
|
||||
data.CustomizeData.Read(ptr + 4);
|
||||
data.Customize.Load(*(Customize*) (ptr + 4));
|
||||
var cur = (CharacterWeapon*)(ptr + 30);
|
||||
data.MainHand = cur[0];
|
||||
data.OffHand = cur[1];
|
||||
var eq = (CharacterArmor*)(cur + 2);
|
||||
foreach (var (slot, idx) in EquipSlotExtensions.EqdpSlots.WithIndex())
|
||||
data.Equipment[slot] = eq[idx];
|
||||
{
|
||||
var mdl = eq[idx];
|
||||
data.SetPiece(slot, mdl.Set, mdl.Variant, mdl.Stain, out _);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -409,7 +407,7 @@ public static class DesignBase64Migration
|
|||
| (equipFlags.HasFlag(EquipFlag.Wrist) ? 0x02 : 0)
|
||||
| (equipFlags.HasFlag(EquipFlag.RFinger) ? 0x04 : 0)
|
||||
| (equipFlags.HasFlag(EquipFlag.LFinger) ? 0x08 : 0));
|
||||
save.CustomizeData.Write(data + 4);
|
||||
save.Customize.Load(*(Customize*) (data + 4));
|
||||
((CharacterWeapon*)(data + 30))[0] = save.MainHand;
|
||||
((CharacterWeapon*)(data + 30))[1] = save.OffHand;
|
||||
((CharacterArmor*)(data + 44))[0] = save.Head;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,13 @@ using Penumbra.String.Functions;
|
|||
|
||||
namespace Glamourer.Designs;
|
||||
|
||||
public struct ItemPiece
|
||||
{
|
||||
public string Name;
|
||||
public uint ItemId;
|
||||
public SetId ModelId;
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum ModelFlags : ushort
|
||||
{
|
||||
|
|
|
|||
|
|
@ -58,9 +58,9 @@ public class DrawObjectManager : IDisposable
|
|||
// Compare game object customize data against draw object customize data for transformations.
|
||||
// Apply customization if they correspond and there is customization to apply.
|
||||
var gameObjectCustomize = gameObject.Customize;
|
||||
var customize = new Customize((CustomizeData*)customizePtr);
|
||||
var customize = new Customize(*(CustomizeData*)customizePtr);
|
||||
if (gameObjectCustomize.Equals(customize))
|
||||
customize.Load(design.Customize);
|
||||
customize.Load(design.ModelData.Customize);
|
||||
|
||||
// Compare game object equip data against draw object equip data for transformations.
|
||||
// Apply each piece of equip that should be applied if they correspond.
|
||||
|
|
@ -68,11 +68,10 @@ public class DrawObjectManager : IDisposable
|
|||
var equip = new CharacterEquip((CharacterArmor*)equipDataPtr);
|
||||
if (gameObjectEquip.Equals(equip))
|
||||
{
|
||||
var saveEquip = design.Equipment;
|
||||
foreach (var slot in EquipSlotExtensions.EquipmentSlots)
|
||||
{
|
||||
(_, equip[slot]) =
|
||||
_items.ResolveRestrictedGear(saveEquip[slot], slot, customize.Race, customize.Gender);
|
||||
_items.ResolveRestrictedGear(design.ModelData.Armor(slot), slot, customize.Race, customize.Gender);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,13 +20,10 @@ public partial class CustomizationDrawer : IDisposable
|
|||
private bool _withFlags = false;
|
||||
private Exception? _terminate = null;
|
||||
|
||||
private readonly unsafe CustomizeData* _data;
|
||||
|
||||
private Customize _customize;
|
||||
private CustomizationSet _set = null!;
|
||||
|
||||
public unsafe CustomizeData CustomizeData
|
||||
=> *_data;
|
||||
public Customize Customize;
|
||||
|
||||
public CustomizeFlag CurrentFlag { get; private set; }
|
||||
public CustomizeFlag Changed { get; private set; }
|
||||
|
|
@ -49,21 +46,12 @@ public partial class CustomizationDrawer : IDisposable
|
|||
_service = service;
|
||||
_items = items;
|
||||
_legacyTattoo = GetLegacyTattooIcon(pi);
|
||||
unsafe
|
||||
{
|
||||
_data = (CustomizeData*)Marshal.AllocHGlobal(sizeof(CustomizeData));
|
||||
*_data = Customize.Default;
|
||||
_customize = new Customize(_data);
|
||||
}
|
||||
Customize = Customize.Default;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_legacyTattoo?.Dispose();
|
||||
unsafe
|
||||
{
|
||||
Marshal.FreeHGlobal((nint)_data);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Draw(Customize current, bool locked)
|
||||
|
|
|
|||
|
|
@ -72,8 +72,8 @@ public partial class Interface
|
|||
_currentSave.Initialize(_items, _currentData.Objects[0]);
|
||||
|
||||
RevertButton();
|
||||
if (_main._customizationDrawer.Draw(_currentSave.Customize, _identifier.Type == IdentifierType.Special))
|
||||
_activeDesigns.ChangeCustomize(_currentSave, _main._customizationDrawer.Changed, _main._customizationDrawer.CustomizeData,
|
||||
if (_main._customizationDrawer.Draw(_currentSave.ModelData.Customize, _identifier.Type == IdentifierType.Special))
|
||||
_activeDesigns.ChangeCustomize(_currentSave, _main._customizationDrawer.Changed, _main._customizationDrawer.Customize.Data,
|
||||
false);
|
||||
|
||||
foreach (var slot in EquipSlotExtensions.EqdpSlots)
|
||||
|
|
@ -82,8 +82,8 @@ public partial class Interface
|
|||
if (_main._equipmentDrawer.DrawStain(current.Stain, slot, out var stain))
|
||||
_activeDesigns.ChangeStain(_currentSave, slot, stain.RowIndex, false);
|
||||
ImGui.SameLine();
|
||||
if (_main._equipmentDrawer.DrawArmor(current, slot, out var armor, _currentSave.Customize.Gender,
|
||||
_currentSave.Customize.Race))
|
||||
if (_main._equipmentDrawer.DrawArmor(current, slot, out var armor, _currentSave.ModelData.Customize.Gender,
|
||||
_currentSave.ModelData.Customize.Race))
|
||||
_activeDesigns.ChangeEquipment(_currentSave, slot, armor, false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ public partial class Interface
|
|||
if (!child)
|
||||
return;
|
||||
|
||||
_main._customizationDrawer.Draw(Selector.Selected.Customize, CustomizeFlagExtensions.All, true);
|
||||
_main._customizationDrawer.Draw(Selector.Selected.ModelData.Customize, CustomizeFlagExtensions.All, true);
|
||||
foreach (var slot in EquipSlotExtensions.EqdpSlots)
|
||||
{
|
||||
var current = Selector.Selected.Armor(slot);
|
||||
|
|
|
|||
|
|
@ -82,10 +82,10 @@ public unsafe partial struct Actor : IEquatable<Actor>, IDesignable
|
|||
=> ObjectKind == ObjectKind.Companion ? *(ushort*)((byte*)Pointer + 0x1AAC) : (ushort)0;
|
||||
|
||||
public Customize Customize
|
||||
=> new((CustomizeData*)Pointer->CustomizeData);
|
||||
=> new(*(CustomizeData*)&Pointer->DrawData.CustomizeData);
|
||||
|
||||
public CharacterEquip Equip
|
||||
=> new((CharacterArmor*)Pointer->EquipSlotData);
|
||||
=> new((CharacterArmor*)&Pointer->DrawData.Head);
|
||||
|
||||
public CharacterWeapon MainHand
|
||||
{
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public unsafe partial struct DrawObject : IEquatable<DrawObject>, IDesignable
|
|||
=> (*(delegate* unmanaged<Human*, uint>**)Pointer)[50](Pointer);
|
||||
|
||||
public Customize Customize
|
||||
=> new((CustomizeData*)Pointer->CustomizeData);
|
||||
=> *(Customize*)Pointer->CustomizeData;
|
||||
|
||||
public CharacterEquip Equip
|
||||
=> new((CharacterArmor*)Pointer->EquipSlotData);
|
||||
|
|
|
|||
|
|
@ -56,20 +56,19 @@ public unsafe partial class RedrawManager : IDisposable
|
|||
|
||||
// Compare game object customize data against draw object customize data for transformations.
|
||||
// Apply customization if they correspond and there is customization to apply.
|
||||
var gameObjectCustomize = new Customize((CustomizeData*)actor.Pointer->CustomizeData);
|
||||
var gameObjectCustomize = new Customize(*(CustomizeData*)&actor.Pointer->DrawData.CustomizeData);
|
||||
if (gameObjectCustomize.Equals(customize))
|
||||
customize.Load(save!.Customize);
|
||||
customize.Load(save.ModelData.Customize);
|
||||
|
||||
// Compare game object equip data against draw object equip data for transformations.
|
||||
// Apply each piece of equip that should be applied if they correspond.
|
||||
var gameObjectEquip = new CharacterEquip((CharacterArmor*)actor.Pointer->EquipSlotData);
|
||||
var gameObjectEquip = new CharacterEquip((CharacterArmor*)&actor.Pointer->DrawData.Head);
|
||||
if (gameObjectEquip.Equals(equip))
|
||||
{
|
||||
var saveEquip = save!.Equipment;
|
||||
foreach (var slot in EquipSlotExtensions.EqdpSlots)
|
||||
{
|
||||
(_, equip[slot]) =
|
||||
_items.ResolveRestrictedGear(saveEquip[slot], slot, customize.Race, customize.Gender);
|
||||
_items.ResolveRestrictedGear(save.ModelData.Armor(slot), slot, customize.Race, customize.Gender);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -78,7 +77,7 @@ public unsafe partial class RedrawManager : IDisposable
|
|||
{
|
||||
try
|
||||
{
|
||||
OnCharacterRedraw(gameObject, (uint*)modelId, new Customize((CustomizeData*)customize),
|
||||
OnCharacterRedraw(gameObject, (uint*)modelId, new Customize(*(CustomizeData*)customize),
|
||||
new CharacterEquip((CharacterArmor*)equipData));
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class SaveService
|
|||
public void QueueSave(ISavable value)
|
||||
{
|
||||
var file = value.ToFilename(FileNames);
|
||||
_framework.RegisterDelayed(value.GetType().Name + file, () =>
|
||||
_framework.RegisterOnTick(value.GetType().Name + file, () =>
|
||||
{
|
||||
ImmediateSave(value);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ public sealed partial class ActiveDesign
|
|||
ChangeStain(to, slot, armor.Stain, fromFixed);
|
||||
}
|
||||
|
||||
ChangeCustomize(to, from.ApplyCustomize, *from.Customize.Data, fromFixed);
|
||||
ChangeCustomize(to, from.ApplyCustomize, from.ModelData.Customize.Data, fromFixed);
|
||||
|
||||
if (from.Wetness.Enabled)
|
||||
SetWetness(to, from.Wetness.ForcedValue, fromFixed);
|
||||
|
|
@ -168,11 +168,11 @@ public sealed partial class ActiveDesign
|
|||
{ }
|
||||
|
||||
public void RevertCustomize(ActiveDesign design, CustomizeFlag flags)
|
||||
=> ChangeCustomize(design, flags, design._initialData.CustomizeData, false);
|
||||
=> ChangeCustomize(design, flags, design._initialData.Customize.Data, false);
|
||||
|
||||
public void ChangeCustomize(ActiveDesign design, CustomizeFlag flags, CustomizeData newValue, bool fromFixed)
|
||||
{
|
||||
var customize = new Customize(ref newValue);
|
||||
var customize = new Customize(newValue);
|
||||
var anyChanges = false;
|
||||
foreach (var option in Enum.GetValues<CustomizeIndex>())
|
||||
{
|
||||
|
|
@ -203,13 +203,13 @@ public sealed partial class ActiveDesign
|
|||
if (redraw)
|
||||
_penumbra.RedrawObject(obj, RedrawType.Redraw);
|
||||
else
|
||||
_customize.UpdateCustomize(obj, design.ModelData.CustomizeData);
|
||||
_customize.UpdateCustomize(obj, design.ModelData.Customize.Data);
|
||||
}
|
||||
}
|
||||
|
||||
public void RevertEquipment(ActiveDesign design, EquipSlot slot, bool equip, bool stain)
|
||||
{
|
||||
var item = design._initialData.Equipment[slot];
|
||||
var item = design._initialData.Armor(slot);
|
||||
if (equip)
|
||||
{
|
||||
var flag = slot.ToFlag();
|
||||
|
|
@ -239,7 +239,7 @@ public sealed partial class ActiveDesign
|
|||
var flag = slot.ToFlag();
|
||||
design.SetArmor(slot, item);
|
||||
var current = design.Armor(slot);
|
||||
var initial = design._initialData.Equipment[slot];
|
||||
var initial = design._initialData.Armor(slot);
|
||||
if (current.ModelBase.Value != initial.Set.Value || current.Variant != initial.Variant)
|
||||
design.ChangedEquip |= flag;
|
||||
else
|
||||
|
|
@ -265,7 +265,7 @@ public sealed partial class ActiveDesign
|
|||
{
|
||||
EquipSlot.MainHand => (design.WeaponMain.Stain, design._initialData.MainHand.Stain, true),
|
||||
EquipSlot.OffHand => (design.WeaponOff.Stain, design._initialData.OffHand.Stain, true),
|
||||
_ => (design.Armor(slot).Stain, design._initialData.Equipment[slot].Stain, false),
|
||||
_ => (design.Armor(slot).Stain, design._initialData.Armor(slot).Stain, false),
|
||||
};
|
||||
if (current.Value != initial.Value)
|
||||
design.ChangedEquip |= flag;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ using Penumbra.GameData.Enums;
|
|||
|
||||
namespace Glamourer.State;
|
||||
|
||||
|
||||
|
||||
public sealed partial class ActiveDesign : DesignData
|
||||
{
|
||||
public readonly ActorIdentifier Identifier;
|
||||
|
|
@ -74,17 +76,16 @@ public sealed partial class ActiveDesign : DesignData
|
|||
if (!_initialData.Customize.Equals(actor.Customize))
|
||||
{
|
||||
_initialData.Customize.Load(actor.Customize);
|
||||
Customize.Load(actor.Customize);
|
||||
ModelData.Customize.Load(actor.Customize);
|
||||
}
|
||||
|
||||
var initialEquip = _initialData.Equipment;
|
||||
var currentEquip = actor.Equip;
|
||||
foreach (var slot in EquipSlotExtensions.EqdpSlots)
|
||||
{
|
||||
var current = currentEquip[slot];
|
||||
if (initialEquip[slot] != current)
|
||||
if (_initialData.Armor(slot) != current)
|
||||
{
|
||||
initialEquip[slot] = current;
|
||||
_initialData.SetPiece(slot, current.Set, current.Variant, current.Stain, out _);
|
||||
UpdateArmor(items, slot, current, true);
|
||||
SetStain(slot, current.Stain);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public class FixedDesignManager
|
|||
{
|
||||
public class FixedDesign
|
||||
{
|
||||
public Design Design;
|
||||
public Design Design = null!;
|
||||
public byte? JobCondition;
|
||||
public ushort? TerritoryCondition;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue