diff --git a/ShaderGenerator b/ShaderGenerator index 503dc20f..8ad62cc4 160000 --- a/ShaderGenerator +++ b/ShaderGenerator @@ -1 +1 @@ -Subproject commit 503dc20f017cca7215b886ea654e46b2c10aaf18 +Subproject commit 8ad62cc4ce956fa6904cfd9642d0955f7546335b diff --git a/TagTool/Shaders/ShaderMatching/ShaderMatcherNew.cs b/TagTool/Shaders/ShaderMatching/ShaderMatcherNew.cs index a528c87b..0ee78946 100644 --- a/TagTool/Shaders/ShaderMatching/ShaderMatcherNew.cs +++ b/TagTool/Shaders/ShaderMatching/ShaderMatcherNew.cs @@ -405,9 +405,17 @@ private Rmt2Descriptor RebuildRmt2Options(Rmt2Descriptor srcRmt2Descriptor, Stre string methodName = BaseCache.StringTable.GetString(baseRmdfDefinition.Categories[i].Name); - if (methodName == "reach_compatibility") + if (PortingCache.Version >= CacheVersion.HaloReach && methodName == "reach_compatibility") { - newOptions.Add(PortingCache.Version >= CacheVersion.HaloReach ? (byte)1 : (byte)0); + if (portingRmdfDefinition.GetCategoryOption(PortingCache, "detail", srcRmt2Descriptor.Options) == "repeat") + { + int potentialIndex = baseRmdfDefinition.GetCategoryOptionIndex(BaseCache, "reach_compatibility", "enabled_detail_repeat"); + newOptions.Add(potentialIndex != -1 ? (byte)potentialIndex : (byte)1); + } + else + { + newOptions.Add(1); + } continue; } diff --git a/TagTool/Tags/Definitions/RenderMethodDefinition.cs b/TagTool/Tags/Definitions/RenderMethodDefinition.cs index 6e007e5c..5ad51b29 100644 --- a/TagTool/Tags/Definitions/RenderMethodDefinition.cs +++ b/TagTool/Tags/Definitions/RenderMethodDefinition.cs @@ -3,6 +3,7 @@ using TagTool.Shaders; using System.Collections.Generic; using System; +using System.IO; namespace TagTool.Tags.Definitions { @@ -153,5 +154,32 @@ public bool ContainsCategory(GameCache cache, string categoryName) } return false; } + + public string GetCategoryOption(GameCache cache, string categoryName, byte[] options) + { + for (int i = 0; i < Categories.Count; i++) + { + if (cache.StringTable.GetString(Categories[i].Name) == categoryName) + return cache.StringTable.GetString(Categories[i].ShaderOptions[options[i]].Name); + } + return "INVALID_CATEGORY"; + } + + public int GetCategoryOptionIndex(GameCache cache, string categoryName, string optionName) + { + for (int i = 0; i < Categories.Count; i++) + { + if (cache.StringTable.GetString(Categories[i].Name) == categoryName) + { + for (int j = 0; j < Categories[i].ShaderOptions.Count; j++) + { + if (cache.StringTable.GetString(Categories[i].ShaderOptions[j].Name) == optionName) + return j; + } + break; + } + } + return -1; + } } } \ No newline at end of file