So much stuff...

This commit is contained in:
Ottermandias 2021-08-21 00:52:46 +02:00
parent f71b800b2e
commit 80ad0d774b
31 changed files with 2949 additions and 1226 deletions

View file

@ -1,5 +1,6 @@
using System;
using System.Runtime.InteropServices;
using Dalamud.Game.ClientState.Actors.Types;
using Penumbra.GameData.Enums;
namespace Glamourer.Customization
@ -13,6 +14,9 @@ namespace Glamourer.Customization
public ref ActorCustomization Value
=> ref *Address;
public LazyCustomization(ActorCustomization data)
=> Address = &data;
}
@ -22,7 +26,36 @@ namespace Glamourer.Customization
public const int CustomizationOffset = 0x1898;
public const int CustomizationBytes = 26;
private byte _race;
public static ActorCustomization Default = new()
{
Race = Race.Hyur,
Gender = Gender.Male,
BodyType = 1,
Height = 50,
Clan = SubRace.Midlander,
Face = 1,
Hairstyle = 1,
HighlightsOn = false,
SkinColor = 1,
EyeColorRight = 1,
HighlightsColor = 1,
FacialFeatures = 0,
TattooColor = 1,
Eyebrow = 1,
EyeColorLeft = 1,
EyeShape = 1,
Nose = 1,
Jaw = 1,
Mouth = 1,
LipColor = 1,
MuscleMass = 50,
TailShape = 1,
BustSize = 50,
FacePaint = 1,
FacePaintColor = 1,
};
public Race Race;
private byte _gender;
public byte BodyType;
public byte Height;
@ -49,12 +82,6 @@ namespace Glamourer.Customization
private byte _facePaint;
public byte FacePaintColor;
public Race Race
{
get => (Race) (_race > (byte) Race.Midlander ? _race + 1 : _race);
set => _race = (byte) (value > Race.Highlander ? value - 1 : value);
}
public Gender Gender
{
get => (Gender) (_gender + 1);
@ -117,12 +144,21 @@ namespace Glamourer.Customization
public unsafe void Read(IntPtr customizeAddress)
{
fixed (byte* ptr = &_race)
fixed (Race* ptr = &Race)
{
Buffer.MemoryCopy(customizeAddress.ToPointer(), ptr, CustomizationBytes, CustomizationBytes);
}
}
public void Read(Actor actor)
=> Read(actor.Address + CustomizationOffset);
public ActorCustomization(Actor actor)
: this()
{
Read(actor.Address + CustomizationOffset);
}
public byte this[CustomizationId id]
{
get => id switch
@ -244,7 +280,7 @@ namespace Glamourer.Customization
public unsafe void Write(IntPtr actorAddress)
{
fixed (byte* ptr = &_race)
fixed (Race* ptr = &Race)
{
Buffer.MemoryCopy(ptr, (byte*) actorAddress + CustomizationOffset, CustomizationBytes, CustomizationBytes);
}
@ -252,7 +288,7 @@ namespace Glamourer.Customization
public unsafe void WriteBytes(byte[] array, int offset = 0)
{
fixed (byte* ptr = &_race)
fixed (Race* ptr = &Race)
{
Marshal.Copy(new IntPtr(ptr), array, offset, CustomizationBytes);
}

View file

@ -68,7 +68,7 @@ namespace Glamourer.Customization
_ => throw new ArgumentOutOfRangeException(nameof(customizationId), customizationId, null),
};
public static CharaMakeParams.MenuType ToType(this CustomizationId customizationId, Race race = Race.Midlander)
public static CharaMakeParams.MenuType ToType(this CustomizationId customizationId, Race race = Race.Hyur)
=> customizationId switch
{
CustomizationId.Race => CharaMakeParams.MenuType.IconSelector,