From db0edf918632869d4617d16760863004d3187740 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Feb 2024 06:56:34 +0000 Subject: [PATCH 1/4] Bump codecov/codecov-action from 3.1.4 to 4.0.1 Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3.1.4 to 4.0.1. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v3.1.4...v4.0.1) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 29d80af3..d34b7a4a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -76,7 +76,7 @@ jobs: path: coveragereport - name: Upload ReportGenerator to CodeCov - uses: codecov/codecov-action@v3.1.4 + uses: codecov/codecov-action@v4.0.1 with: token: ${{secrets.CODECOV_TOKEN}} file: coveragereport/Cobertura.xml From 14a7fc04622c22857ab43a25817ee8085ff3d5f6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 06:41:19 +0000 Subject: [PATCH 2/4] Bump danielpalme/ReportGenerator-GitHub-Action from 5.2.0 to 5.2.1 Bumps [danielpalme/ReportGenerator-GitHub-Action](https://github.com/danielpalme/reportgenerator-github-action) from 5.2.0 to 5.2.1. - [Release notes](https://github.com/danielpalme/reportgenerator-github-action/releases) - [Commits](https://github.com/danielpalme/reportgenerator-github-action/compare/5.2.0...5.2.1) --- updated-dependencies: - dependency-name: danielpalme/ReportGenerator-GitHub-Action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 29d80af3..4a2dd762 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -61,7 +61,7 @@ jobs: shell: pwsh - name: ReportGenerator - uses: danielpalme/ReportGenerator-GitHub-Action@5.2.0 + uses: danielpalme/ReportGenerator-GitHub-Action@5.2.1 with: reports: 'coverage_uiextenderex_debug.xml;coverage_uiextenderex_release.xml' targetdir: 'coveragereport' From bad6c5e372a12e5546a351dfc72721b46e979474 Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Tue, 6 Feb 2024 11:12:36 +0200 Subject: [PATCH 3/4] * Disabled the BETA changes due to regression * Added back the old UIExtender constructor for backwards compatibility --- build/common.props | 2 +- changelog.txt | 5 +++++ src/Bannerlord.UIExtenderEx.sln | 8 ++++++++ .../Patches/UIConfigPatch.cs | 17 +++++++++++++++++ src/Bannerlord.UIExtenderEx/SubModule.cs | 19 +++++++++++++++++++ src/Bannerlord.UIExtenderEx/UIExtender.cs | 6 +++++- 6 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 src/Bannerlord.UIExtenderEx/Patches/UIConfigPatch.cs diff --git a/build/common.props b/build/common.props index 92165722..bdbd9c1e 100644 --- a/build/common.props +++ b/build/common.props @@ -4,7 +4,7 @@ - 2.10.0 + 2.11.0 2.2.2 3.2.0.77 diff --git a/changelog.txt b/changelog.txt index 73a074c8..dfab9144 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,9 @@ --------------------------------------------------------------------------------------------------- +Version: 2.11.0 +Game Versions: v1.0.0,v1.0.1,v1.0.2,v1.0.3,v1.1.0,v1.1.1,v1.1.2,v1.1.3,v1.1.4,v1.1.5,v1.1.6,v1.2.x +* Disabled the BETA changes due to regression +* Added back the old UIExtender constructor for backwards compatibility +--------------------------------------------------------------------------------------------------- Version: 2.10.0 Game Versions: v1.0.0,v1.0.1,v1.0.2,v1.0.3,v1.1.0,v1.1.1,v1.1.2,v1.1.3,v1.1.4,v1.1.5,v1.1.6,v1.2.8 * BETA! Might cause issues with the UI in specific cases! diff --git a/src/Bannerlord.UIExtenderEx.sln b/src/Bannerlord.UIExtenderEx.sln index 7eec80dc..bab44106 100644 --- a/src/Bannerlord.UIExtenderEx.sln +++ b/src/Bannerlord.UIExtenderEx.sln @@ -87,6 +87,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "articles", "articles", "{80 ..\docs\articles\toc.yml = ..\docs\articles\toc.yml EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "general", "general", "{3FA98C73-903D-406D-A1C4-D22DF4C5C00B}" + ProjectSection(SolutionItems) = preProject + ..\docs\articles\general\InteractingWithOtherMods.md = ..\docs\articles\general\InteractingWithOtherMods.md + ..\docs\articles\general\Overview.md = ..\docs\articles\general\Overview.md + ..\docs\articles\general\toc.yml = ..\docs\articles\general\toc.yml + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Beta_Release|x64 = Beta_Release|x64 @@ -128,6 +135,7 @@ Global {8969A5E2-BC12-46F8-BF4A-E8F73771E4E5} = {8034BC17-4282-4A4B-942B-80EEC315C1C2} {395402D4-28B5-4974-943D-04B7D5F6673D} = {8034BC17-4282-4A4B-942B-80EEC315C1C2} {B4D6A888-2D8F-49A4-87C5-6CD18D8F818B} = {8034BC17-4282-4A4B-942B-80EEC315C1C2} + {3FA98C73-903D-406D-A1C4-D22DF4C5C00B} = {8034BC17-4282-4A4B-942B-80EEC315C1C2} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {31629F18-48B4-4C3E-87C3-BDCB9BBF1BBD} diff --git a/src/Bannerlord.UIExtenderEx/Patches/UIConfigPatch.cs b/src/Bannerlord.UIExtenderEx/Patches/UIConfigPatch.cs new file mode 100644 index 00000000..40ec37ae --- /dev/null +++ b/src/Bannerlord.UIExtenderEx/Patches/UIConfigPatch.cs @@ -0,0 +1,17 @@ +using HarmonyLib; +using HarmonyLib.BUTR.Extensions; + +namespace Bannerlord.UIExtenderEx.Patches; + +internal static class UIConfigPatch +{ + public static void Patch(Harmony harmony) + { + harmony.TryPatch( + AccessTools2.DeclaredPropertySetter("TaleWorlds.Engine.GauntletUI.UIConfig:DoNotUseGeneratedPrefabs"), + prefix: AccessTools2.DeclaredMethod("Bannerlord.UIExtenderEx.Patches.UIConfigPatch:Prefix")); + } + + // Disable setting a value to DoNotUseGeneratedPrefabs + private static bool Prefix() => false; +} \ No newline at end of file diff --git a/src/Bannerlord.UIExtenderEx/SubModule.cs b/src/Bannerlord.UIExtenderEx/SubModule.cs index 8d3f843c..d1506210 100644 --- a/src/Bannerlord.UIExtenderEx/SubModule.cs +++ b/src/Bannerlord.UIExtenderEx/SubModule.cs @@ -1,4 +1,5 @@ using Bannerlord.BUTR.Shared.Helpers; + using BUTR.MessageBoxPInvoke.Helpers; using System; @@ -12,6 +13,24 @@ namespace Bannerlord.UIExtenderEx; public class SubModule : MBSubModuleBase { +#if !ENABLE_PARTIAL_AUTOGEN + static SubModule() + { + // Disable AutoGens as early as possible + try + { + // Force load TaleWorlds.Engine.GauntletUI as it might not be loaded yet! + System.Reflection.Assembly.Load("TaleWorlds.Engine.GauntletUI"); + } + catch (Exception e) + { + Utils.MessageUtils.Fail($"Failed to load 'TaleWorlds.Engine.GauntletUI'! Exception: {e}"); + } + + TaleWorlds.Engine.GauntletUI.UIConfig.DoNotUseGeneratedPrefabs = true; + } +#endif + // We can't rely on EN since the game assumes that the default locale is always English private const string SWarningTitle = @"{=eySpdc25EE}Warning from Bannerlord.UIExtenderEx!"; diff --git a/src/Bannerlord.UIExtenderEx/UIExtender.cs b/src/Bannerlord.UIExtenderEx/UIExtender.cs index 01724e73..7191f0c4 100644 --- a/src/Bannerlord.UIExtenderEx/UIExtender.cs +++ b/src/Bannerlord.UIExtenderEx/UIExtender.cs @@ -29,7 +29,11 @@ public class UIExtender static UIExtender() { +#if ENABLE_PARTIAL_AUTOGEN GauntletMoviePatch.Patch(Harmony); +#else + UIConfigPatch.Patch(Harmony); +#endif ViewModelPatch.Patch(Harmony); WidgetPrefabPatch.Patch(Harmony); BrushFactoryManager.Patch(Harmony); @@ -61,7 +65,7 @@ private UIExtender(string moduleName, bool _) /// Default constructor. `moduleName` should match module folder because it will be used to look-up resources /// /// Module name, should match module folder - [Obsolete("Use UIExtender.Create(moduleName)", true)] + [Obsolete("Use UIExtender.Create(moduleName) if backwards compatibility is not a concern.", false)] public UIExtender(string moduleName) { _moduleName = moduleName; From cec16dd766c7a99ddf19fb2de60bdde09e74aaf7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 09:14:22 +0000 Subject: [PATCH 4/4] Automated dotnet-format update --- .../Patches/GauntletMoviePatch.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Bannerlord.UIExtenderEx/Patches/GauntletMoviePatch.cs b/src/Bannerlord.UIExtenderEx/Patches/GauntletMoviePatch.cs index 7aa00fbc..5c88e954 100644 --- a/src/Bannerlord.UIExtenderEx/Patches/GauntletMoviePatch.cs +++ b/src/Bannerlord.UIExtenderEx/Patches/GauntletMoviePatch.cs @@ -17,8 +17,8 @@ internal static class GauntletMoviePatch private static readonly ConcurrentDictionary> _widgetNames = new(); private static readonly ConcurrentDictionary _widgetChildCache = new(); private static readonly AccessTools.FieldRef>>? _generatedPrefabs = - AccessTools2.FieldRefAccess>>("_generatedPrefabs"); - + AccessTools2.FieldRefAccess>>("_generatedPrefabs"); + public static void Register(UIExtenderRuntime runtime, string? autoGenWidgetName) { if (string.IsNullOrEmpty(autoGenWidgetName)) @@ -73,7 +73,7 @@ static IEnumerable GetChildWidgets(Type widgetType) var autoGenNames = widgetNames.Where(x => x.Contains("__")); return autoGenNames.Select(x => x.Split(["__"], StringSplitOptions.None)[0]); } - } + } /* This implementation actually created the Widget, but it seems that game didn't intend for that var variantName = datasource == null ? "Default" : datasource.GetType().FullName; var data = datasource == null ? new Dictionary() : new() { {"DataSource", datasource} }; @@ -88,16 +88,16 @@ static IEnumerable GetChildWidgets(Type widgetType) var autoGenNames = widgetNames.Where(x => x.Contains("__")).ToArray(); return autoGenNames.Select(x => x.Split(["__"], StringSplitOptions.None)[0]); } - */ - + */ + return Enumerable.Empty(); } var moviesPatched = new HashSet(UIExtender.GetAllRuntimes().SelectMany(x => x.PrefabComponent.GetMoviesToPatch())); var moviesInvolved = new HashSet(GetAllInvolvedAutoGenNames(widgetFactory, movieName, datasource)); if (moviesInvolved.Overlaps(moviesPatched)) - doNotUseGeneratedPrefabs = true; - + doNotUseGeneratedPrefabs = true; + var moviesBlacklisted = _widgetNames.SelectMany(kv => kv.Value); if (moviesBlacklisted.Contains(movieName)) doNotUseGeneratedPrefabs = true;