From 70a5d0ef69d98573b2733e7c36b6cf61de167d6a Mon Sep 17 00:00:00 2001 From: bird_egop Date: Sun, 7 Jun 2026 15:55:56 +0300 Subject: [PATCH] fix material texture name --- MaterialLib/MaterialParser.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MaterialLib/MaterialParser.cs b/MaterialLib/MaterialParser.cs index cf337dd..0a56b92 100644 --- a/MaterialLib/MaterialParser.cs +++ b/MaterialLib/MaterialParser.cs @@ -83,7 +83,12 @@ public static class MaterialParser // Texture name: 16 байт. textureNameBuffer.Clear(); fs.ReadExactly(textureNameBuffer); - var textureName = Encoding.ASCII.GetString(textureNameBuffer).TrimEnd('\0'); + var terminator = textureNameBuffer.IndexOf((byte)0); + if (terminator == -1) + { + terminator = textureNameBuffer.Length - 1; + } + var textureName = Encoding.ASCII.GetString(textureNameBuffer[..terminator]); stages.Add(new MaterialStage( ambientR,