Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Meddle/Meddle.Plugin/Meddle.Plugin.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Dalamud.NET.Sdk/14.0.1">
<Project Sdk="Dalamud.NET.Sdk/15.0.0">
<PropertyGroup>
<Version>0.0.1</Version>
<ImplicitUsings>enable</ImplicitUsings>
Expand All @@ -15,6 +15,7 @@
<Reference Include="OtterTex">
<HintPath>..\Meddle.Utils\Lib\OtterTex.dll</HintPath>
</Reference>
<PackageReference Update="DalamudPackager" Version="15.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
29 changes: 10 additions & 19 deletions Meddle/Meddle.Plugin/Models/Structs/CustomizeParameter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Meddle.Plugin.Models.Structs;

[StructLayout(LayoutKind.Explicit, Size = 0x90)]
[StructLayout(LayoutKind.Explicit, Size = 0x70)]
public struct CustomizeParameter
{
/// <summary>
Expand All @@ -15,60 +15,51 @@ public struct CustomizeParameter
[FieldOffset(0xC)]
public float MuscleTone;

[FieldOffset(0x10)]
public Vector4 SkinFresnelValue0;

/// <summary>
/// XYZ : Lip diffuse color, as squared RGB.
/// W : Lip opacity.
/// </summary>
[FieldOffset(0x20)]
[FieldOffset(0x10)]
public Vector4 LipColor;

/// <summary>
/// XYZ : Hair primary color, as squared RGB.
/// </summary>
[FieldOffset(0x30)]
[FieldOffset(0x20)]
public Vector3 MainColor;

[FieldOffset(0x3C)]
[FieldOffset(0x2C)]
public float FacePaintUVMultiplier;

[FieldOffset(0x40)]
public Vector3 HairFresnelValue0;

[FieldOffset(0x4C)]
public float Unk0;

/// <summary>
/// XYZ : Hair highlight color, as squared RGB.
/// </summary>
[FieldOffset(0x50)]
[FieldOffset(0x30)]
public Vector3 MeshColor;

[FieldOffset(0x5C)]
[FieldOffset(0x3C)]
public float FacePaintUVOffset;

/// <summary>
/// XYZ : Left eye color, as squared RGB.
/// W : Left Eye Limbal Ring Intensity
/// </summary>
[FieldOffset(0x60)]
[FieldOffset(0x40)]
public Vector4 LeftColor;

/// <summary>
/// XYZ : Right eye color, as squared RGB.
/// W : Right Eye Limbal Ring Intensity
/// </summary>
[FieldOffset(0x70)]
[FieldOffset(0x50)]
public Vector4 RightColor;

/// <summary>
/// XYZ : Race feature color, as squared RGB.
/// </summary>
[FieldOffset(0x80)]
[FieldOffset(0x60)]
public Vector3 OptionColor;

[FieldOffset(0x8C)]
[FieldOffset(0x6C)]
public float Unk1;
}
10 changes: 5 additions & 5 deletions Meddle/Meddle.Plugin/Services/LayoutService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
string? path = null;
if (primaryPath.HasValue)
{
path = primaryPath;
path = primaryPath.ToString();
}

return new ParsedUnsupportedInstance((nint)instanceLayout,
Expand Down Expand Up @@ -387,7 +387,7 @@
}

var primaryPath = sharedGroup->GetPrimaryPath();
string path = primaryPath.HasValue ? primaryPath : throw new Exception("SharedGroup has no primary path");
string path = primaryPath.HasValue ? primaryPath.ToString() : throw new Exception("SharedGroup has no primary path");

var furnitureMatch = context.Housing.Furniture.FirstOrDefault(item => item.LayoutInstance == sharedGroupPtr);
if (furnitureMatch is not null)
Expand Down Expand Up @@ -441,7 +441,7 @@
}

var primaryPath = bgPart->GetPrimaryPath();
string path = primaryPath.HasValue ? primaryPath : throw new Exception("BgPart has no primary path");
string path = primaryPath.HasValue ? primaryPath.ToString() : throw new Exception("BgPart has no primary path");

var bgChangeHandle = graphics->GetBgChangeMaterial();
(int BgChangeMaterialIndex, string Path)? bgChangeMaterial = null;
Expand Down Expand Up @@ -640,13 +640,13 @@
var furniture = type switch
{
HousingTerritoryType.Indoor => ((IndoorTerritory*)territory)->FurnitureManager.FurnitureMemory,
HousingTerritoryType.Outdoor => ((OutdoorTerritory*)territory)->FurnitureStruct.FurnitureMemory,
HousingTerritoryType.Outdoor => ((OutdoorTerritory*)territory)->FurnitureManager.FurnitureMemory,

Check failure on line 643 in Meddle/Meddle.Plugin/Services/LayoutService.cs

View workflow job for this annotation

GitHub Actions / Build (10.0.x, latest)

'OutdoorTerritory' does not contain a definition for 'FurnitureManager' and no accessible extension method 'FurnitureManager' accepting a first argument of type 'OutdoorTerritory' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 643 in Meddle/Meddle.Plugin/Services/LayoutService.cs

View workflow job for this annotation

GitHub Actions / Build (10.0.x, latest)

'OutdoorTerritory' does not contain a definition for 'FurnitureManager' and no accessible extension method 'FurnitureManager' accepting a first argument of type 'OutdoorTerritory' could be found (are you missing a using directive or an assembly reference?)
_ => []
};
var objectManager = type switch
{
HousingTerritoryType.Indoor => &((IndoorTerritory*)territory)->FurnitureManager.ObjectManager,
HousingTerritoryType.Outdoor => &((OutdoorTerritory*)territory)->FurnitureStruct.ObjectManager,
HousingTerritoryType.Outdoor => &((OutdoorTerritory*)territory)->FurnitureManager.ObjectManager,

Check failure on line 649 in Meddle/Meddle.Plugin/Services/LayoutService.cs

View workflow job for this annotation

GitHub Actions / Build (10.0.x, latest)

'OutdoorTerritory' does not contain a definition for 'FurnitureManager' and no accessible extension method 'FurnitureManager' accepting a first argument of type 'OutdoorTerritory' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 649 in Meddle/Meddle.Plugin/Services/LayoutService.cs

View workflow job for this annotation

GitHub Actions / Build (10.0.x, latest)

'OutdoorTerritory' does not contain a definition for 'FurnitureManager' and no accessible extension method 'FurnitureManager' accepting a first argument of type 'OutdoorTerritory' could be found (are you missing a using directive or an assembly reference?)
_ => null
};

Expand Down
2 changes: 1 addition & 1 deletion Meddle/Meddle.Plugin/UI/CommonUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
var modelType = ((CharacterBase*)drawObject)->GetModelType();

var name = obj.Name.TextValue;
if (obj.ObjectKind == ObjectKind.Player && !string.IsNullOrWhiteSpace(config.PlayerNameOverride))
if (obj.ObjectKind == ObjectKind.Pc && !string.IsNullOrWhiteSpace(config.PlayerNameOverride))

Check failure on line 196 in Meddle/Meddle.Plugin/UI/CommonUI.cs

View workflow job for this annotation

GitHub Actions / Build (10.0.x, latest)

'ObjectKind' does not contain a definition for 'Pc'

Check failure on line 196 in Meddle/Meddle.Plugin/UI/CommonUI.cs

View workflow job for this annotation

GitHub Actions / Build (10.0.x, latest)

'ObjectKind' does not contain a definition for 'Pc'
{
name = config.PlayerNameOverride;
}
Expand Down
2 changes: 1 addition & 1 deletion Meddle/Meddle.Plugin/UI/Layout/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private void DrawOptions()
}

var drawTypes = config.LayoutConfig.DrawTypes;
if (ImGui.BeginCombo("Draw Types", drawTypes.ToString()))
if (ImGui.BeginCombo("Draw Types", drawTypes.GetDescription()))
{
foreach (var type in Enum.GetValues<ParsedInstanceType>())
{
Expand Down
6 changes: 3 additions & 3 deletions Meddle/Meddle.Plugin/UI/LiveCharacterTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ private void DrawMaterial(Pointer<CSMaterial> mtPtr, int materialIdx, Lazy<Point

if (i < material->MaterialResourceHandle->TextureCount)
{
var textureName = material->MaterialResourceHandle->TexturePath(i);
var textureName = material->MaterialResourceHandle->TexturePath(i).ToString();
var gpuTex = DxHelper.ExportTextureResource(textureEntry.Texture->Texture);
var textureData = gpuTex.Resource.ToTexture();
textureBuffer[textureName] = textureData;
Expand Down Expand Up @@ -814,7 +814,7 @@ private void DrawMaterial(Pointer<CSMaterial> mtPtr, int materialIdx, Lazy<Point
ImGui.Text($"Material Index: {materialIdx}");
ImGui.Text($"Texture Count: {material->TextureCount}");
ImGui.Text($"Ref Count: {material->RefCount}");
var shpkName = material->MaterialResourceHandle->ShpkName;
var shpkName = material->MaterialResourceHandle->ShpkName.ToString();
UiUtil.Text($"Shader Package: {shpkName}", shpkName);
ImGui.Text($"Shader Flags: 0x{material->ShaderFlags:X8}");

Expand Down Expand Up @@ -851,7 +851,7 @@ private void DrawTexture(CSMaterial* material, CSMaterial.TextureEntry textureEn
using var textureId = ImRaii.PushId($"{(nint)textureEntry.Texture}");
string? textureName = null;
if (texIdx < material->MaterialResourceHandle->TextureCount)
textureName = material->MaterialResourceHandle->TexturePath(texIdx);
textureName = material->MaterialResourceHandle->TexturePath(texIdx).ToString();
var textureFileName = textureEntry.Texture->FileName.ParseString();
ImGui.TableNextRow();
ImGui.TableSetColumnIndex(0);
Expand Down
24 changes: 1 addition & 23 deletions Meddle/Meddle.Plugin/UI/MaterialParameterTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,7 @@ public unsafe void DrawCustomizeParams(CharacterBase* cbase)
{
parameter.MuscleTone = customizeParameters!.Value.MuscleTone;
}

ImGui.ColorEdit4("Skin Fresnel", ref parameter.SkinFresnelValue0);
ImGui.SameLine();
if (ImGui.Button("Restore##SkinFresnel"))
{
parameter.SkinFresnelValue0 = customizeParameters!.Value.SkinFresnelValue0;
}


ImGui.ColorEdit4("Lip Color", ref parameter.LipColor);
ImGui.SameLine();
if (ImGui.Button("Restore##LipColor"))
Expand All @@ -154,21 +147,6 @@ public unsafe void DrawCustomizeParams(CharacterBase* cbase)
{
parameter.FacePaintUVMultiplier = customizeParameters!.Value.FacePaintUVMultiplier;
}

ImGui.ColorEdit3("Hair Fresnel", ref parameter.HairFresnelValue0);
ImGui.SameLine();
if (ImGui.Button("Restore##HairFresnel"))
{
parameter.HairFresnelValue0 = customizeParameters!.Value.HairFresnelValue0;
}

ImGui.DragFloat("Unk0", ref parameter.Unk0, 0.01f, -10.0f, 10.0f, "%.2f");
ImGui.SameLine();
if (ImGui.Button("Restore##Unk0"))
{
parameter.Unk0 = customizeParameters!.Value.Unk0;
}

ImGui.ColorEdit3("Mesh Color", ref parameter.MeshColor);
ImGui.SameLine();
if (ImGui.Button("Restore##MeshColor"))
Expand Down
1 change: 1 addition & 0 deletions Meddle/Meddle.Plugin/UI/Windows/DebugWindow.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Numerics;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Windowing;
using Meddle.Plugin.Models;
using Microsoft.Extensions.Logging;

Expand Down
1 change: 1 addition & 0 deletions Meddle/Meddle.Plugin/UI/Windows/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Dalamud.Interface;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Windowing;
using Meddle.Plugin.Models;
using Meddle.Plugin.UI.Layout;
using Microsoft.Extensions.Logging;
Expand Down
4 changes: 2 additions & 2 deletions Meddle/Meddle.Plugin/Utils/OnRenderMaterialUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private static void ApplySkinMaterialTextures(ref OnRenderMaterialOutput renderM
*/

var slotShpk = materialAtIndex.Value->MaterialResourceHandle->ShpkName;
if (slotShpk != "characterstockings.shpk")
if (slotShpk.ToString() != "characterstockings.shpk")
{
return;
}
Expand Down Expand Up @@ -228,7 +228,7 @@ private static void CopySkinMaterialTextures(ref OnRenderMaterialOutput renderMa
}

string? path = null;
string? pathFromMaterial = skinMaterialHandle->TextureCount > i ? skinMaterialHandle->TexturePath(i) : null;
string? pathFromMaterial = skinMaterialHandle->TextureCount > i ? skinMaterialHandle->TexturePath(i).ToString() : null;
if (entry.Texture != null && entry.Texture->Texture != null)
{
path = entry.Texture->FileName.ToString();
Expand Down
6 changes: 2 additions & 4 deletions Meddle/Meddle.Plugin/Utils/ParseMaterialUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static class ParseMaterialUtil
string? materialPathFromModel;
if (model != null)
{
materialPathFromModel = modelPtr.Value->ModelResourceHandle->GetMaterialFileNameBySlot((uint)materialIndex);
materialPathFromModel = modelPtr.Value->ModelResourceHandle->GetMaterialFileNameBySlot((uint)materialIndex).ToString();
}
else
{
Expand All @@ -109,7 +109,7 @@ public static class ParseMaterialUtil
var texturePath = texturePtr.TextureResourceHandle->FileName.ParseString();
if (texIdx < material->TextureCount)
{
var texturePathFromMaterial = material->MaterialResourceHandle->TexturePath(texIdx);
var texturePathFromMaterial = material->MaterialResourceHandle->TexturePath(texIdx).ToString();
var (resource, _) = DxHelper.ExportTextureResource(texturePtr.TextureResourceHandle->Texture);
var textureInfo = new ParsedTextureInfo(texturePath, texturePathFromMaterial, resource);
textures.Add(textureInfo);
Expand Down Expand Up @@ -172,11 +172,9 @@ public static unsafe ParsedHumanInfo ParseHuman(Pointer<CharacterBase> character
{
SkinColor = customizeCBuf.SkinColor,
MuscleTone = customizeCBuf.MuscleTone,
SkinFresnelValue0 = customizeCBuf.SkinFresnelValue0,
LipColor = customizeCBuf.LipColor,
MainColor = customizeCBuf.MainColor,
FacePaintUvMultiplier = customizeCBuf.FacePaintUVMultiplier,
HairFresnelValue0 = customizeCBuf.HairFresnelValue0,
MeshColor = customizeCBuf.MeshColor,
FacePaintUvOffset = customizeCBuf.FacePaintUVOffset,
LeftColor = customizeCBuf.LeftColor,
Expand Down
6 changes: 3 additions & 3 deletions Meddle/Meddle.Plugin/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"net10.0-windows7.0": {
"DalamudPackager": {
"type": "Direct",
"requested": "[14.0.1, )",
"resolved": "14.0.1",
"contentHash": "y0WWyUE6dhpGdolK3iKgwys05/nZaVf4ZPtIjpLhJBZvHxkkiE23zYRo7K7uqAgoK/QvK5cqF6l3VG5AbgC6KA=="
"requested": "[15.0.0, )",
"resolved": "15.0.0",
"contentHash": "411vwC8/X8Z/sQ2TI6v3SvOn66xFPeOjFn3Zn+h0d3Ox2t1kFm66AhDvmx/qcMwVrR+Hidxj0dadpQ2dgyXMBQ=="
},
"DotNet.ReproducibleBuilds": {
"type": "Direct",
Expand Down
4 changes: 0 additions & 4 deletions Meddle/Meddle.Utils/Export/CustomizeParameter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ public class CustomizeParameter {

public float MuscleTone;

public Vector4 SkinFresnelValue0;

/// <summary>
/// XYZ : Lip diffuse color, as squared RGB.
/// W : Lip opacity.
Expand All @@ -30,8 +28,6 @@ public class CustomizeParameter {
/// </summary>
public Vector3 MainColor;
public float FacePaintUvMultiplier;

public Vector3 HairFresnelValue0;

/// <summary>
/// XYZ : Hair highlight color, as squared RGB.
Expand Down
43 changes: 25 additions & 18 deletions Meddle/Meddle.Utils/Files/ShpkFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class ShpkFile
private const uint Dx11Magic = 0x31315844u; // bytes of DX11

private const uint Shpk13_1 = 0x0D01;
private const uint Shpk14_1 = 0x0E01;

public const uint MaterialParamsConstantId = 0x64D12851u; // g_MaterialParameter is a cbuffer filled from the ad hoc section of the mtrl

Expand All @@ -21,9 +22,11 @@ public ShpkFile(byte[] data) : this(new Span<byte>(data))

public ShpkHeader FileHeader;

public uint? Unk131A;
public uint? Unk131B;
public uint? Unk131C;
public uint? HullShaderCount;
public uint? DomainShaderCount;
public uint? GeometryShaderCount;

public uint? Unk141A;
//public byte[] Blobs;
//public byte[] Strings;
public Shader[] VertexShaders;
Expand Down Expand Up @@ -67,9 +70,13 @@ public ShpkFile(ReadOnlySpan<byte> data)

if (FileHeader.Version >= Shpk13_1)
{
Unk131A = reader.ReadUInt32();
Unk131B = reader.ReadUInt32();
Unk131C = reader.ReadUInt32();
HullShaderCount = reader.ReadUInt32();
DomainShaderCount = reader.ReadUInt32();
GeometryShaderCount = reader.ReadUInt32();
}
if (FileHeader.Version >= Shpk14_1)
{
Unk141A = reader.ReadUInt32();
}

// var blobs = data[(int)FileHeader.BlobsOffset..(int)FileHeader.StringsOffset];
Expand Down Expand Up @@ -164,24 +171,24 @@ public Pass ReadPass(ref SpanBinaryReader r)
var id = r.ReadUInt32();
var vertexShader = r.ReadUInt32();
var pixelShader = r.ReadUInt32();
uint? unk131G = null;
uint? unk131H = null;
uint? unk131I = null;
uint? hullShader = null;
uint? domainShader = null;
uint? geometryShader = null;
if (FileHeader.Version >= Shpk13_1)
{
unk131G = r.ReadUInt32();
unk131H = r.ReadUInt32();
unk131I = r.ReadUInt32();
hullShader = r.ReadUInt32();
domainShader = r.ReadUInt32();
geometryShader = r.ReadUInt32();
}

return new Pass
{
Id = id,
VertexShader = vertexShader,
PixelShader = pixelShader,
Unk131G = unk131G,
Unk131H = unk131H,
Unk131I = unk131I
HullShader = hullShader,
DomainShader = domainShader,
GeometryShader = geometryShader
};
}

Expand Down Expand Up @@ -237,9 +244,9 @@ public struct Pass
public uint Id;
public uint VertexShader;
public uint PixelShader;
public uint? Unk131G;
public uint? Unk131H;
public uint? Unk131I;
public uint? HullShader;
public uint? DomainShader;
public uint? GeometryShader;
}

public struct Key
Expand Down
Loading