Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wod legion missing patterns #194

Merged
merged 7 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/C#/DBDefsDumper/DBDefsDumper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
55 changes: 41 additions & 14 deletions code/C#/DBDefsDumper/Pattern.cs
Original file line number Diff line number Diff line change
@@ -1,35 +1,61 @@
using System.Collections.Generic;
using System;

namespace DBDefsDumper
{
class VersionRange
{
public List<string> mmps;
public int minBuild;
public int maxBuild;

public VersionRange(List<string> mmps, int minBuild = 0, int maxBuild = 0x7fffffff)
{
this.mmps = mmps;
this.minBuild = minBuild;
this.maxBuild = maxBuild;
}

public bool allows(string mmpb)
{
string[] parts = mmpb.Split('.');
if (parts.Length != 4)
{
throw new Exception("Bad major.minor.patch.build: " + mmpb);
}
var build = Int32.Parse(parts[3]);
return this.mmps.Contains(parts[0] + "." + parts[1] + "." + parts[2]) &&
this.minBuild <= build &&
build <= this.maxBuild;
}
};

class Pattern
{
public string name;
public List<string> compatiblePatches;
public List<VersionRange> compatible;
public int cur_pos;
public string cur_pattern;
public int minBuild;
public int maxBuild;
public Dictionary<string, int> offsets = new Dictionary<string, int>();

public Pattern(string name, List<string> compatiblePatches, int minBuild, int maxBuild)
public Pattern(string name, List<VersionRange> compatible)
{
this.name = name;
this.compatiblePatches = compatiblePatches;
this.compatible = compatible;
this.cur_pos = 0;
this.cur_pattern = "";
this.minBuild = minBuild;
this.maxBuild = maxBuild;
}

public Pattern(string name, List<string> compatiblePatches)
public bool allows(string mmpb)
{
this.name = name;
this.compatiblePatches = compatiblePatches;
this.cur_pos = 0;
this.cur_pattern = "";
this.minBuild = 0;
this.maxBuild = 0;
foreach (var range in this.compatible)
{
if (range.allows(mmpb))
{
return true;
}
}
return false;
}

// Utilities
Expand Down Expand Up @@ -171,5 +197,6 @@ class Name
public const string UNK_BOOL_601dbc_x3b = "unkown bool x3b 6.0.1";
public const string UNK_BOOL_11DB2_x1C = "unknown bool x1C 11.0.0";
public const string UNK_BOOL_11DB2_x1D = "unknown bool x1D 11.0.0";
public const string UNK_EXTRA_POINTER_IN_720 = "UNK_EXTRA_POINTER_IN_720";
}
}
49 changes: 26 additions & 23 deletions code/C#/DBDefsDumper/PatternBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public PatternBuilder()
//);

patterns.Add(
new Pattern("11.0.0", new() { "11.0.0", "11.0.2", "1.15.4", "4.4.1", "11.0.5", "11.0.7", "1.15.5" }, 54210, 0)
new Pattern("11.0.0", new() { new VersionRange (new() { "11.0.0", "11.0.2", "1.15.4", "4.4.1", "11.0.5", "11.0.7", "1.15.5" }, 54210 ) })
.Pointer(Name.DB_NAME)
.FileDataID(Name.FDID)
.FieldReference(Name.NUM_FIELD_IN_FILE)
Expand Down Expand Up @@ -77,7 +77,7 @@ public PatternBuilder()
);

patterns.Add(
new Pattern("10.1.0", new List<string> { "10.1.0", "10.1.5", "1.14.4", "1.15.0", "3.4.2", "10.1.7", "10.2.0", "3.4.3", "10.2.5", "4.4.0", "1.15.1", "10.2.7", "10.2.6", "1.15.2", "1.15.3" }, 48480, 0)
new Pattern("10.1.0", new() { new VersionRange (new() { "10.1.0", "10.1.5", "1.14.4", "1.15.0", "3.4.2", "10.1.7", "10.2.0", "3.4.3", "10.2.5", "4.4.0", "1.15.1", "10.2.7", "10.2.6", "1.15.2", "1.15.3" }, 48480 ) })
.Pointer(Name.DB_NAME)
.FileDataID(Name.FDID)
.FieldReference(Name.NUM_FIELD_IN_FILE)
Expand Down Expand Up @@ -107,7 +107,7 @@ public PatternBuilder()
);

patterns.Add(
new Pattern("8.0.1", new List<string> { "8.3.0", "8.2.5", "8.2.0", "8.1.5", "8.1.0", "8.0.1", "1.13.2", "1.13.3", "1.13.4", "9.0.1", "1.13.5", "8.3.7", "9.0.2", "1.13.6", "1.13.7", "9.0.5", "2.5.1", "9.1.0", "2.5.2", "1.14.0", "9.1.5", "1.14.1", "9.2.0", "1.14.2", "2.5.3", "2.5.4", "9.2.5", "1.14.3", "3.4.0", "10.0.0", "10.0.2", "9.2.7", "3.4.1", "10.0.5", "10.0.7"}, 26232, 0)
new Pattern("8.0.1", new() { new VersionRange (new() { "8.3.0", "8.2.5", "8.2.0", "8.1.5", "8.1.0", "8.0.1", "1.13.2", "1.13.3", "1.13.4", "9.0.1", "1.13.5", "8.3.7", "9.0.2", "1.13.6", "1.13.7", "9.0.5", "2.5.1", "9.1.0", "2.5.2", "1.14.0", "9.1.5", "1.14.1", "9.2.0", "1.14.2", "2.5.3", "2.5.4", "9.2.5", "1.14.3", "3.4.0", "10.0.0", "10.0.2", "9.2.7", "3.4.1", "10.0.5", "10.0.7" }, 26232 ) })
.Pointer(Name.DB_NAME)
.FileDataID(Name.FDID)
.FieldReference(Name.NUM_FIELD_IN_FILE)
Expand Down Expand Up @@ -139,7 +139,10 @@ public PatternBuilder()
);

patterns.Add(
new Pattern("8.0.1-prefdid", new List<string> { "8.0.1" }, 25901, 26231)
new Pattern("8.0.1-prefdid,1.13.0-retail,7.3.5-release",
new() { new VersionRange (new() { "8.0.1" }, 25901, 26231 ),
new VersionRange (new() { "1.13.0" }),
new VersionRange (new() { "7.3.5" }, 25875, 26972 ) })
.Pointer(Name.DB_NAME)
.FieldReference(Name.NUM_FIELD_IN_FILE)
.RecordSize(Name.RECORD_SIZE)
Expand Down Expand Up @@ -170,7 +173,7 @@ public PatternBuilder()
);

patterns.Add(
new Pattern("1.13.0-retail", new List<string> { "1.13.0" }, 28211, 28211)
new Pattern("7.3.5-ptr", new() { new VersionRange (new() { "7.3.5" }, 25600, 25864 ) })
.Pointer(Name.DB_NAME)
.FieldReference(Name.NUM_FIELD_IN_FILE)
.RecordSize(Name.RECORD_SIZE)
Expand All @@ -180,7 +183,6 @@ public PatternBuilder()
.Pointer(Name.FIELD_OFFSETS)
.Pointer(Name.FIELD_SIZES)
.Pointer(Name.FIELD_TYPES)
.Pointer(Name.FIELD_FLAGS)
.Pointer(Name.FIELD_SIZES_IN_FILE)
.Pointer(Name.FIELD_TYPES_IN_FILE)
.Pointer(Name.FIELD_FLAGS_IN_FILE)
Expand All @@ -201,7 +203,7 @@ public PatternBuilder()
);

patterns.Add(
new Pattern("7.3.5-release", new List<string> { "7.3.5" }, 25875, 26972)
new Pattern("7.3.{0/2}", new() { new VersionRange (new() { "7.3.0", "7.3.2" } ) }) // note: also matches release-7.3.5 even though different struct
.Pointer(Name.DB_NAME)
.FieldReference(Name.NUM_FIELD_IN_FILE)
.RecordSize(Name.RECORD_SIZE)
Expand All @@ -224,24 +226,25 @@ public PatternBuilder()
.FieldReference(Name.FIELD_NUM_IDX_STRING)
.OptionalPointer(Name.FIELD_IDX_INT)
.OptionalPointer(Name.FIELD_IDX_STRING)
.Boolean(Name.HAS_RELATION)
.OptionalFieldReference(Name.FIELD_RELATION)
.OptionalFieldReference(Name.FIELD_RELATION_IN_FILE)
.OptionalPointer(Name.SORT_FUNC)
.Boolean(Name.UNKC0)
);

patterns.Add(
new Pattern("7.3.5-ptr", new List<string> { "7.3.5" }, 25600, 25864)
new Pattern("7.2.0-ptr-a", new() { new VersionRange (new() { "7.2.0" } ) })
.Pointer(Name.DB_NAME)
.Pointer(Name.DB_CACHE_FILENAME)
.FieldReference(Name.NUM_FIELD_IN_FILE)
.RecordSize(Name.RECORD_SIZE)
.FieldReference(Name.NUM_FIELD)
.OptionalFieldReference(Name.ID_COLUMN)
.Boolean(Name.SPARSE_TABLE)
.Pointer(Name.FIELD_OFFSETS)
.Pointer(Name.FIELD_OFFSETS) // might be dynamic in 7.2.0 builds!?
.Pointer(Name.FIELD_SIZES)
.Pointer(Name.FIELD_TYPES)
.Pointer(Name.FIELD_FLAGS)
.Pointer(Name.FIELD_SIZES_IN_FILE)
.Pointer(Name.FIELD_TYPES_IN_FILE)
.Pointer(Name.FIELD_FLAGS_IN_FILE)
Expand All @@ -254,25 +257,25 @@ public PatternBuilder()
.FieldReference(Name.FIELD_NUM_IDX_STRING)
.OptionalPointer(Name.FIELD_IDX_INT)
.OptionalPointer(Name.FIELD_IDX_STRING)
.Boolean(Name.HAS_RELATION)
.OptionalFieldReference(Name.FIELD_RELATION)
.OptionalFieldReference(Name.FIELD_RELATION_IN_FILE)
.OptionalPointer(Name.SORT_FUNC)
.Boolean(Name.UNKC0)
);

patterns.Add(
new Pattern("7.3.{0/2}", new List<string> { "7.3.0", "7.3.2" }, 24473, 25549) // note: also matches release-7.3.5 even though different struct
new Pattern("7.2.0-ptr-b", new() { new VersionRange (new() { "7.2.0" } ) })
.Pointer(Name.DB_NAME)
.FieldReference(Name.NUM_FIELD_IN_FILE)
.RecordSize(Name.RECORD_SIZE)
.FieldReference(Name.NUM_FIELD)
.OptionalFieldReference(Name.ID_COLUMN)
.Boolean(Name.SPARSE_TABLE)
.Pointer(Name.FIELD_FLAGS)
.Pointer(Name.FIELD_OFFSETS)
.OptionalPointer(Name.UNK_EXTRA_POINTER_IN_720)
.Pointer(Name.FIELD_OFFSETS) // might be dynamic in 7.2.0 builds!?
.Pointer(Name.FIELD_SIZES)
.Pointer(Name.FIELD_TYPES)
.Pointer(Name.FIELD_FLAGS)
.Pointer(Name.FIELD_SIZES_IN_FILE)
.Pointer(Name.FIELD_TYPES_IN_FILE)
.Pointer(Name.FIELD_FLAGS_IN_FILE)
Expand All @@ -292,14 +295,14 @@ public PatternBuilder()
);

patterns.Add(
new Pattern("7.{0,2.5}-release", new List<string> { "7.2.0", "7.2.5"}, 23514, 24973) // note: also matches release-7.3.5 even though different struct
new Pattern("7.{0,2.5}-release", new() { new VersionRange (new() { "7.2.0", "7.2.5"} ) }) // note: also matches release-7.3.5 even though different struct
.Pointer(Name.DB_NAME)
.FieldReference(Name.NUM_FIELD_IN_FILE)
.RecordSize(Name.RECORD_SIZE)
.FieldReference(Name.NUM_FIELD)
.OptionalFieldReference(Name.ID_COLUMN)
.Boolean(Name.SPARSE_TABLE)
.Pointer(Name.FIELD_OFFSETS)
.Pointer(Name.FIELD_OFFSETS) // might be dynamic in 7.2.0 builds!?
.Pointer(Name.FIELD_SIZES)
.Pointer(Name.FIELD_TYPES)
.Pointer(Name.FIELD_FLAGS)
Expand All @@ -322,7 +325,7 @@ public PatternBuilder()
);

patterns.Add(
new Pattern("7.{0,1}.{0,5}-release", new List<string> { "7.0.3", "7.1.0", "7.1.5", "7.2.0" }, 20740, 23476) //todo: find minbuild
new Pattern("7.{0,1}.{0,5}-release", new() { new VersionRange (new() { "7.0.1", "7.0.3", "7.1.0", "7.1.5", "7.2.0" }, 20740, 23476 ) }) //todo: find minbuild
.Pointer(Name.DB_NAME)
.Pointer(Name.DB_CACHE_FILENAME)
.FieldReference(Name.NUM_FIELD_IN_FILE)
Expand All @@ -341,7 +344,7 @@ public PatternBuilder()
);

patterns.Add(
new Pattern("6.x-db2-experimental", new List<string> { "6.0.1", "6.0.2", "6.0.3", "6.1.0", "6.1.2", "6.2.0", "6.2.1", "6.2.2", "6.2.3", "6.2.4" }, 18125, 21742) // note: subset of internal-6.0.1-dbc, so conflicts with that
new Pattern("6.x-db2-experimental", new() { new VersionRange (new() { "6.0.1", "6.0.2", "6.0.3", "6.1.0", "6.1.2", "6.2.0", "6.2.0a", "6.2.1", "6.2.2", "6.2.3", "6.2.4" }, 18125, 21742 ) }) // note: subset of internal-6.0.1-dbc, so conflicts with that
.Pointer(Name.DB_FILENAME)
.Pointer(Name.DB_CACHE_FILENAME)
.FieldReference(Name.NUM_FIELD_IN_FILE)
Expand All @@ -355,7 +358,7 @@ public PatternBuilder()
);

patterns.Add(
new Pattern("6.x-dbc-experimental", new List<string> { "6.0.1", "6.0.2", "6.0.3", "6.1.0", "6.1.2", "6.2.0", "6.2.1", "6.2.2", "6.2.3", "6.2.4" }, 18125, 21742) // note: subset of internal-6.0.1-dbc, so conflicts with that
new Pattern("6.x-dbc-experimental", new() { new VersionRange (new() { "6.0.1", "6.0.2", "6.0.3", "6.1.0", "6.1.2", "6.2.0", "6.2.0a", "6.2.1", "6.2.2", "6.2.3", "6.2.4" }, 18125, 21742 ) }) // note: subset of internal-6.0.1-dbc, so conflicts with that
.Pointer(Name.DB_FILENAME)
.FieldReference(Name.NUM_FIELD_IN_FILE)
.RecordSize(Name.RECORD_SIZE)
Expand All @@ -370,7 +373,7 @@ public PatternBuilder()
);

patterns.Add(
new Pattern("6.0.1-db2-internal", new List<string> { "6.0.1" }, 18179, 18179) // note: conflicts with internal-6.0.1-dbc
new Pattern("6.0.1-db2-internal", new() { new VersionRange (new() { "6.0.1" }, 18179, 18179 ) }) // note: conflicts with internal-6.0.1-dbc
.Pointer(Name.DB_FILENAME)
.Pointer(Name.DB_CACHE_FILENAME)
.FieldReference(Name.NUM_FIELD_IN_FILE)
Expand All @@ -395,7 +398,7 @@ public PatternBuilder()
);

patterns.Add(
new Pattern("6.0.1-dbc-internal", new List<string> { "6.0.1" }, 18179, 18179) // note: conflicts with internal-6.0.1-db2
new Pattern("6.0.1-dbc-internal", new() { new VersionRange (new() { "6.0.1" }, 18179, 18179 ) }) // note: conflicts with internal-6.0.1-db2
.Pointer(Name.DB_FILENAME)
.FieldReference(Name.NUM_FIELD_IN_FILE)
.RecordSize(Name.RECORD_SIZE)
Expand All @@ -414,7 +417,7 @@ public PatternBuilder()
);

patterns.Add(
new Pattern("5.0.1-dbc-internal", new List<string> { "5.0.1" }) // note: subset of internal-6.0.1-dbc, so conflicts with that
new Pattern("5.0.1-dbc-internal", new() { new VersionRange (new() { "5.0.1" } ) }) // note: subset of internal-6.0.1-dbc, so conflicts with that
.Pointer(Name.DB_FILENAME)
.FieldReference(Name.NUM_FIELD_IN_FILE)
.RecordSize(Name.RECORD_SIZE)
Expand All @@ -427,7 +430,7 @@ public PatternBuilder()
);

patterns.Add(
new Pattern("5.0.1-db2-internal", new List<string> { "5.0.1" }) // note: subset of internal-6.0.1-db2, so conflicts with that and internal-5.0.1-dbc
new Pattern("5.0.1-db2-internal", new() { new VersionRange (new() { "5.0.1" } ) }) // note: subset of internal-6.0.1-db2, so conflicts with that and internal-5.0.1-dbc
.Pointer(Name.DB_FILENAME)
.Pointer(Name.DB_CACHE_FILENAME)
.FieldReference(Name.NUM_FIELD_IN_FILE)
Expand Down
Loading
Loading