mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-09-28 20:17:25 +08:00
fix(); remove pack:/ texture prefix and double .dds suffix
This commit is contained in:
parent
999adedb5d
commit
dd0020ba61
@ -80,7 +80,26 @@ namespace CodeWalker.GameFiles
|
|||||||
writer.Write(this.Unknown_18h);
|
writer.Write(this.Unknown_18h);
|
||||||
writer.Write(this.Unknown_1Ch);
|
writer.Write(this.Unknown_1Ch);
|
||||||
writer.WriteBlock(this.TextureNameHashes);
|
writer.WriteBlock(this.TextureNameHashes);
|
||||||
writer.WriteBlock(this.Textures);
|
if (Textures?.data_items != null)
|
||||||
|
{
|
||||||
|
foreach (var tex in Textures.data_items)
|
||||||
|
{
|
||||||
|
string textureName = tex.Name;
|
||||||
|
if (textureName.StartsWith("pack:/", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
textureName = textureName.Substring(6);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (textureName.EndsWith(".dds", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
textureName = textureName.Substring(0, textureName.Length - 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
tex.Name = textureName;
|
||||||
|
|
||||||
|
tex.Write(writer);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public void WriteXml(StringBuilder sb, int indent, string ddsfolder)
|
public void WriteXml(StringBuilder sb, int indent, string ddsfolder)
|
||||||
{
|
{
|
||||||
@ -90,6 +109,20 @@ namespace CodeWalker.GameFiles
|
|||||||
foreach (var tex in Textures.data_items)
|
foreach (var tex in Textures.data_items)
|
||||||
{
|
{
|
||||||
YtdXml.OpenTag(sb, indent, "Item");
|
YtdXml.OpenTag(sb, indent, "Item");
|
||||||
|
string textureName = tex.Name;
|
||||||
|
|
||||||
|
if (textureName.StartsWith("pack:/", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
textureName = textureName.Substring(6);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (textureName.EndsWith(".dds", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
textureName = textureName.Substring(0, textureName.Length - 4); // Strip any existing ".dds" suffix
|
||||||
|
}
|
||||||
|
|
||||||
|
tex.Name = textureName;
|
||||||
|
|
||||||
tex.WriteXml(sb, indent + 1, ddsfolder);
|
tex.WriteXml(sb, indent + 1, ddsfolder);
|
||||||
YtdXml.CloseTag(sb, indent, "Item");
|
YtdXml.CloseTag(sb, indent, "Item");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user