Skip to content

Commit

Permalink
Fix WDB6 in test uril
Browse files Browse the repository at this point in the history
  • Loading branch information
Marlamin committed Nov 24, 2024
1 parent d5d32fa commit 0289594
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
20 changes: 16 additions & 4 deletions code/C#/DBDefsTest/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static void Main(string[] args)

foreach(var build in builds)
{
if (build.expansion != 8 || build.major != 1) continue;
if (build.expansion != 7 || build.major < 1) continue;

Console.WriteLine("Checking " + build + "..");
if (Directory.Exists(Path.Combine(dbcDir, build.ToString(), "DBFilesClient")))
Expand Down Expand Up @@ -87,6 +87,13 @@ static void LoadDBC(string filename)

if (!definitionCache.ContainsKey(name.ToLower()))
{
Console.WriteLine("No definition found for " + name + ", skipping.");
return;
}

if(Path.GetExtension(filename) != ".dbc" && Path.GetExtension(filename) != ".db2")
{
Console.WriteLine("Skipping " + filename + " as it is not a DBC file, skipping.");
return;
}

Expand Down Expand Up @@ -166,7 +173,7 @@ static void LoadDBC(string filename)
case "WDB6":
var db6header = bin.Read<WDB6Header>();
fileDef.recordSize = db6header.recordSize;
fileDef.fieldCount = db6header.fieldCount;
fileDef.fieldCount = db6header.totalFieldCount;
fileDef.layoutHash = db6header.layoutHash.ToString("X8");
break;
case "WDC1":
Expand Down Expand Up @@ -311,6 +318,11 @@ static void LoadDBC(string filename)
Console.ResetColor();
}

if(fileDef.fields == null)
{
return;
}

// Check record sizes
var dbdRecordSize = 0;
var i = 0;
Expand Down Expand Up @@ -389,15 +401,15 @@ static void LoadDBC(string filename)
if (!layoutHashFound && fileDef.layoutHash != "")
{
foundError = true;
Console.ForegroundColor = ConsoleColor.Red;
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("[" + buildDir + "][" + Path.GetFileNameWithoutExtension(filename) + "] Unable to find layouthash in definitions!");
Console.ResetColor();
}

if (!dbChecked)
{
foundError = true;
Console.ForegroundColor = ConsoleColor.Red;
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("[" + buildDir + "][" + Path.GetFileNameWithoutExtension(filename) + "] Unable to find applicable definitions!");
Console.ResetColor();
}
Expand Down
1 change: 0 additions & 1 deletion code/C#/DBDefsTest/Structs/DBC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public struct WDB6Header
public uint stringTableSize;
public uint tableHash;
public uint layoutHash;
public uint timestampLastWritten;
public uint minID;
public uint maxID;
public uint locale;
Expand Down

0 comments on commit 0289594

Please sign in to comment.