Skip to content

Commit 4796af5

Browse files
Add debug logging for trophy_crimsonbalrog NIF parsing
1 parent ebbd6b4 commit 4796af5

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Maple2.File.IO/Nif/NifDocument.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,15 @@ private void ParseImplementation() {
154154

155155
bool isLittleEndian = fileData[index] != 0;
156156

157+
if (RelPath.Contains("trophy_crimsonbalrog")) {
158+
using var md5 = System.Security.Cryptography.MD5.Create();
159+
byte[] hash = md5.ComputeHash(fileData);
160+
Console.Error.WriteLine($"[NIF DEBUG] {RelPath}: dataLen={fileData.Length} md5={Convert.ToHexString(hash)} " +
161+
$"headerLen={index - 4} endianByte=0x{fileData[index]:X2} isLittleEndian={isLittleEndian} " +
162+
$"swap={isLittleEndian != BitConverter.IsLittleEndian} BitConverter.IsLittleEndian={BitConverter.IsLittleEndian}");
163+
Console.Error.WriteLine($"[NIF DEBUG] bytes around endian flag [{index-2}..{index+3}]: {Convert.ToHexString(fileData, index - 2, 5)}");
164+
}
165+
157166
MemoryStream stream = new MemoryStream(fileData);
158167
Reader = new EndianReader(stream, isLittleEndian != BitConverter.IsLittleEndian);
159168

0 commit comments

Comments
 (0)