Add function that handles prepending DX11 dashes.

This commit is contained in:
Ottermandias 2024-01-14 14:15:07 +01:00
parent 574a129772
commit 965f8efd80
4 changed files with 7 additions and 38 deletions

View file

@ -79,21 +79,9 @@ public static class CustomizationSwap
}
public static FileSwap CreateTex(MetaFileManager manager, Func<Utf8GamePath, FullPath> redirections, BodySlot slot, GenderRace race,
PrimaryId idFrom, ref MtrlFile.Texture texture,
ref bool dataWasChanged)
PrimaryId idFrom, ref MtrlFile.Texture texture, ref bool dataWasChanged)
{
var path = texture.Path;
var addedDashes = false;
if (texture.DX11)
{
var fileName = Path.GetFileName(path);
if (!fileName.StartsWith("--"))
{
path = path.Replace(fileName, $"--{fileName}");
addedDashes = true;
}
}
var addedDashes = GamePaths.Tex.HandleDx11Path(texture, out var path);
var newPath = ItemSwap.ReplaceAnyRace(path, race);
newPath = ItemSwap.ReplaceAnyBody(newPath, slot, idFrom);
newPath = ItemSwap.AddSuffix(newPath, ".tex", $"_{Path.GetFileName(texture.Path).GetStableHashCode():x8}", true);

View file

@ -402,22 +402,10 @@ public static class EquipmentSwap
=> CreateTex(manager, redirections, prefix, EquipSlot.Unknown, EquipSlot.Unknown, idFrom, idTo, ref texture, ref dataWasChanged);
public static FileSwap CreateTex(MetaFileManager manager, Func<Utf8GamePath, FullPath> redirections, char prefix, EquipSlot slotFrom,
EquipSlot slotTo, PrimaryId idFrom,
PrimaryId idTo, ref MtrlFile.Texture texture, ref bool dataWasChanged)
EquipSlot slotTo, PrimaryId idFrom, PrimaryId idTo, ref MtrlFile.Texture texture, ref bool dataWasChanged)
{
var path = texture.Path;
var addedDashes = false;
if (texture.DX11)
{
var fileName = Path.GetFileName(path);
if (!fileName.StartsWith("--"))
{
path = path.Replace(fileName, $"--{fileName}");
addedDashes = true;
}
}
var newPath = ItemSwap.ReplaceAnyId(path, prefix, idFrom);
var addedDashes = GamePaths.Tex.HandleDx11Path(texture, out var path);
var newPath = ItemSwap.ReplaceAnyId(path, prefix, idFrom);
newPath = ItemSwap.ReplaceSlot(newPath, slotTo, slotFrom, slotTo != slotFrom);
newPath = ItemSwap.AddSuffix(newPath, ".tex", $"_{Path.GetFileName(texture.Path).GetStableHashCode():x8}");
if (newPath != path)