mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
RT: Fix VPR offhand material paths
This commit is contained in:
parent
c849e31034
commit
243593e30f
1 changed files with 14 additions and 20 deletions
|
|
@ -111,31 +111,25 @@ internal partial record ResolveContext
|
||||||
if (setIdHigh is 20 && mtrlFileName[14] == (byte)'c')
|
if (setIdHigh is 20 && mtrlFileName[14] == (byte)'c')
|
||||||
return Utf8GamePath.FromString(GamePaths.Weapon.Mtrl.Path(2001, 1, 1, "c"), out var path) ? path : Utf8GamePath.Empty;
|
return Utf8GamePath.FromString(GamePaths.Weapon.Mtrl.Path(2001, 1, 1, "c"), out var path) ? path : Utf8GamePath.Empty;
|
||||||
|
|
||||||
// MNK (03??, 16??), NIN (18??) and DNC (26??) offhands share materials with the corresponding mainhand
|
// Some offhands share materials with the corresponding mainhand
|
||||||
if (setIdHigh is 3 or 16 or 18 or 26)
|
if (ItemData.AdaptOffhandImc(Equipment.Set.Id, out var mirroredSetId))
|
||||||
{
|
{
|
||||||
var setIdLow = Equipment.Set.Id % 100;
|
var variant = ResolveMaterialVariant(imc, Equipment.Variant);
|
||||||
if (setIdLow > 50)
|
var fileName = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(mtrlFileName);
|
||||||
{
|
|
||||||
var variant = ResolveMaterialVariant(imc, Equipment.Variant);
|
|
||||||
var fileName = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(mtrlFileName);
|
|
||||||
|
|
||||||
var mirroredSetId = (ushort)(Equipment.Set.Id - 50);
|
Span<byte> mirroredFileName = stackalloc byte[32];
|
||||||
|
mirroredFileName = mirroredFileName[..fileName.Length];
|
||||||
|
fileName.CopyTo(mirroredFileName);
|
||||||
|
WriteZeroPaddedNumber(mirroredFileName[4..8], mirroredSetId.Id);
|
||||||
|
|
||||||
Span<byte> mirroredFileName = stackalloc byte[32];
|
Span<byte> pathBuffer = stackalloc byte[CharaBase.PathBufferSize];
|
||||||
mirroredFileName = mirroredFileName[..fileName.Length];
|
pathBuffer = AssembleMaterialPath(pathBuffer, modelPath.Path.Span, variant, mirroredFileName);
|
||||||
fileName.CopyTo(mirroredFileName);
|
|
||||||
WriteZeroPaddedNumber(mirroredFileName[4..8], mirroredSetId);
|
|
||||||
|
|
||||||
Span<byte> pathBuffer = stackalloc byte[CharaBase.PathBufferSize];
|
var weaponPosition = pathBuffer.IndexOf("/weapon/w"u8);
|
||||||
pathBuffer = AssembleMaterialPath(pathBuffer, modelPath.Path.Span, variant, mirroredFileName);
|
if (weaponPosition >= 0)
|
||||||
|
WriteZeroPaddedNumber(pathBuffer[(weaponPosition + 9)..(weaponPosition + 13)], mirroredSetId.Id);
|
||||||
|
|
||||||
var weaponPosition = pathBuffer.IndexOf("/weapon/w"u8);
|
return Utf8GamePath.FromSpan(pathBuffer, MetaDataComputation.None, out var path) ? path.Clone() : Utf8GamePath.Empty;
|
||||||
if (weaponPosition >= 0)
|
|
||||||
WriteZeroPaddedNumber(pathBuffer[(weaponPosition + 9)..(weaponPosition + 13)], mirroredSetId);
|
|
||||||
|
|
||||||
return Utf8GamePath.FromSpan(pathBuffer, MetaDataComputation.None, out var path) ? path.Clone() : Utf8GamePath.Empty;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResolveEquipmentMaterialPath(modelPath, imc, mtrlFileName);
|
return ResolveEquipmentMaterialPath(modelPath, imc, mtrlFileName);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue