diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 34d7aab1..b2e48dce 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -121,8 +121,8 @@ jobs:
mod_description: ${{ needs.build-module.outputs.mod_description }}
artifact_name: bannerlord
secrets:
- NEXUSMODS_APIKEY: ${{ secrets.NEXUSMODS_APIKEY }}
- NEXUSMODS_COOKIES: ${{ secrets.NEXUSMODS_COOKIES }}
+ NEXUSMODS_APIKEY: ${{ secrets.ARAGAS_NEXUSMODS_API_KEY }}
+ NEXUSMODS_COOKIES: ${{ secrets.ARAGAS_NEXUSMODS_COOKIE_SID_DEVELOP }}
###########################
# STEAM #
diff --git a/README.md b/README.md
index 57f7d9cf..88460a58 100644
--- a/README.md
+++ b/README.md
@@ -50,6 +50,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Extension library for Mount & Blade II: Bannerlord.
diff --git a/build/common.props b/build/common.props
index 1fcbb887..c50f8056 100644
--- a/build/common.props
+++ b/build/common.props
@@ -4,13 +4,14 @@
- 2.8.1
+ 2.8.2
2.2.2
3.2.0.77
- 1.0.1.44
+ 1.0.1.50
-
+
+
2.0.0
1.1.0.102
@@ -20,12 +21,12 @@
BUTR Team
-
ButterLib Library for Bannerlord
+
@@ -143,5 +144,5 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/changelog.txt b/changelog.txt
index b8b78aa7..bc01c2e1 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,4 +1,8 @@
---------------------------------------------------------------------------------------------------
+Version: 2.8.2
+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.2.0
+* v1.2.0 - Suppress the new TW debugger so ButterLib's Crash Reporter can work
+---------------------------------------------------------------------------------------------------
Version: 2.8.1
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.2.0
* Added support for v1.2.0
diff --git a/src/Bannerlord.ButterLib.Implementation/Bannerlord.ButterLib.Implementation.csproj b/src/Bannerlord.ButterLib.Implementation/Bannerlord.ButterLib.Implementation.csproj
index 6df46153..b6580ead 100644
--- a/src/Bannerlord.ButterLib.Implementation/Bannerlord.ButterLib.Implementation.csproj
+++ b/src/Bannerlord.ButterLib.Implementation/Bannerlord.ButterLib.Implementation.csproj
@@ -5,12 +5,12 @@
net472;netcoreapp3.1
10.0
enable
- x64
+ x64
false
false
Stable_Debug;Stable_Release;Beta_Debug;Beta_Release
- $(DefineConstants);$(GameVersionConstant)
+ $(DefineConstants);$(GameVersionConstant);X64
$(MSBuildProjectName).$(GameVersion)
@@ -35,12 +35,17 @@
-
+
+
+
+
+
+
diff --git a/src/Bannerlord.ButterLib.Implementation/MBSubModuleBaseExtended/MBSubModuleBaseExSubSystem.cs b/src/Bannerlord.ButterLib.Implementation/MBSubModuleBaseExtended/MBSubModuleBaseExSubSystem.cs
index ecc2bc24..7047c4b6 100644
--- a/src/Bannerlord.ButterLib.Implementation/MBSubModuleBaseExtended/MBSubModuleBaseExSubSystem.cs
+++ b/src/Bannerlord.ButterLib.Implementation/MBSubModuleBaseExtended/MBSubModuleBaseExSubSystem.cs
@@ -45,7 +45,7 @@ public void Disable()
// Think about DelayedSubModuleManager.Unregister
}
- internal static void LogNoHooksIssue(ILogger logger, int originalCallIndex, int finallyIndex, List codes, MethodBase currentMethod)
+ internal static void LogNoHooksIssue(ILogger logger, int originalCallIndex, int finallyIndex, List codes, MethodBase? currentMethod)
{
var issueInfo = new StringBuilder("Indexes: ");
issueInfo.Append($"\n\toriginalCallIndex = {originalCallIndex}.\n\tfinallyIndex={finallyIndex}.");
diff --git a/src/Bannerlord.ButterLib.Implementation/ObjectSystem/MBObjectExtensionDataStore.cs b/src/Bannerlord.ButterLib.Implementation/ObjectSystem/MBObjectExtensionDataStore.cs
index 30b0b11c..7aeafafb 100755
--- a/src/Bannerlord.ButterLib.Implementation/ObjectSystem/MBObjectExtensionDataStore.cs
+++ b/src/Bannerlord.ButterLib.Implementation/ObjectSystem/MBObjectExtensionDataStore.cs
@@ -107,13 +107,13 @@ private sealed class DataKey : IEquatable
internal readonly MBGUID ObjectId;
[SaveableField(1)]
- internal readonly string Key;
+ internal readonly string? Key;
private DataKey(MBGUID objectId, string key) => (ObjectId, Key) = (objectId, key);
internal static DataKey Make(MBObjectBase obj, string key) => new(obj.Id, key);
- public bool Equals(DataKey other) => ObjectId == other.ObjectId && !(Key is null || other.Key is null) && Key.Equals(other.Key);
+ public bool Equals(DataKey? other) => ObjectId == other?.ObjectId && !(Key is null || other.Key is null) && Key.Equals(other.Key);
public override bool Equals(object? obj) => obj is DataKey k && Equals(k);
diff --git a/src/Bannerlord.ButterLib.Implementation/ObjectSystem/Patches/CampaignBehaviorManagerPatch.cs b/src/Bannerlord.ButterLib.Implementation/ObjectSystem/Patches/CampaignBehaviorManagerPatch.cs
index 05077fb0..f38c9cc7 100755
--- a/src/Bannerlord.ButterLib.Implementation/ObjectSystem/Patches/CampaignBehaviorManagerPatch.cs
+++ b/src/Bannerlord.ButterLib.Implementation/ObjectSystem/Patches/CampaignBehaviorManagerPatch.cs
@@ -78,9 +78,9 @@ internal static void Disable(Harmony harmony) { }
private static readonly Type? CampaignBehaviorDataStoreT =
typeof(Campaign).Assembly.GetType("TaleWorlds.CampaignSystem.CampaignBehaviorDataStore");
- private static readonly MethodInfo? LoadBehaviorDataMI = AccessTools2.Method(CampaignBehaviorDataStoreT, "LoadBehaviorData");
+ private static readonly MethodInfo? LoadBehaviorDataMI = AccessTools2.Method(CampaignBehaviorDataStoreT!, "LoadBehaviorData");
- private static readonly MethodInfo? SaveBehaviorDataMI = AccessTools2.Method(CampaignBehaviorDataStoreT, "SaveBehaviorData");
+ private static readonly MethodInfo? SaveBehaviorDataMI = AccessTools2.Method(CampaignBehaviorDataStoreT!, "SaveBehaviorData");
// Patch implementation:
diff --git a/src/Bannerlord.ButterLib.Implementation/Properties/launchSettings.json b/src/Bannerlord.ButterLib.Implementation/Properties/launchSettings.json
index 9af5d7cf..65805984 100644
--- a/src/Bannerlord.ButterLib.Implementation/Properties/launchSettings.json
+++ b/src/Bannerlord.ButterLib.Implementation/Properties/launchSettings.json
@@ -18,21 +18,21 @@
"commandLineArgs": "/singleplayer _MODULES_*Bannerlord.Harmony*Bannerlord.ButterLib*Native*SandBoxCore*Sandbox*StoryMode*CustomBattle*Bannerlord.ButterLib.HotKeys.Test*_MODULES_",
"workingDirectory": "$(GameFolder)\\bin\\Win64_Shipping_Client"
},
- "MBSE Bannerlord": {
+ "BLSE Bannerlord": {
"commandName": "Executable",
- "executablePath": "$(GameFolder)\\bin\\Win64_Shipping_Client\\Bannerlord.MBSE.exe",
+ "executablePath": "$(GameFolder)\\bin\\Win64_Shipping_Client\\Bannerlord.BLSE.Standalone.exe",
"commandLineArgs": "/singleplayer _MODULES_*Bannerlord.Harmony*Bannerlord.ButterLib*Native*SandBoxCore*Sandbox*StoryMode*CustomBattle*_MODULES_",
"workingDirectory": "$(GameFolder)\\bin\\Win64_Shipping_Client"
},
- "MBSE BannerlordWithMCM": {
+ "BLSE BannerlordWithMCM": {
"commandName": "Executable",
- "executablePath": "$(GameFolder)\\bin\\Win64_Shipping_Client\\Bannerlord.MBSE.exe",
+ "executablePath": "$(GameFolder)\\bin\\Win64_Shipping_Client\\Bannerlord.BLSE.Standalone.exe",
"commandLineArgs": "/singleplayer _MODULES_*Bannerlord.Harmony*Bannerlord.ButterLib*Bannerlord.UIExtenderEx*Bannerlord.MBOptionScreen*Native*SandBoxCore*Sandbox*StoryMode*CustomBattle*_MODULES_",
"workingDirectory": "$(GameFolder)\\bin\\Win64_Shipping_Client"
},
- "MBSE BannerlordWithTests": {
+ "BLSE BannerlordWithTests": {
"commandName": "Executable",
- "executablePath": "$(GameFolder)\\bin\\Win64_Shipping_Client\\Bannerlord.MBSE.exe",
+ "executablePath": "$(GameFolder)\\bin\\Win64_Shipping_Client\\Bannerlord.BLSE.Standalone.exe",
"commandLineArgs": "/singleplayer _MODULES_*Bannerlord.Harmony*Bannerlord.ButterLib*Native*SandBoxCore*Sandbox*StoryMode*CustomBattle*Bannerlord.ButterLib.HotKeys.Test*_MODULES_",
"workingDirectory": "$(GameFolder)\\bin\\Win64_Shipping_Client"
}
diff --git a/src/Bannerlord.ButterLib.Implementation/SaveSystem/Patches/BehaviourNamePatch.cs b/src/Bannerlord.ButterLib.Implementation/SaveSystem/Patches/BehaviourNamePatch.cs
index 7fe75ae9..1e0e6b4c 100644
--- a/src/Bannerlord.ButterLib.Implementation/SaveSystem/Patches/BehaviourNamePatch.cs
+++ b/src/Bannerlord.ButterLib.Implementation/SaveSystem/Patches/BehaviourNamePatch.cs
@@ -29,7 +29,7 @@ internal static bool Disable(Harmony harmony)
return true;
}
- private static void CampaignBehaviorBaseCtorPostfix(CampaignBehaviorBase __instance, ref string ___StringId)
+ private static void CampaignBehaviorBaseCtorPostfix(CampaignBehaviorBase __instance, ref string? ___StringId)
{
var module = ModuleInfoHelper.GetModuleByType(__instance.GetType());
if (module is null) // A non-module dll
diff --git a/src/Bannerlord.ButterLib.Implementation/SaveSystem/Patches/DefinitionContextPatch.cs b/src/Bannerlord.ButterLib.Implementation/SaveSystem/Patches/DefinitionContextPatch.cs
index c386b9c5..1c5c849d 100644
--- a/src/Bannerlord.ButterLib.Implementation/SaveSystem/Patches/DefinitionContextPatch.cs
+++ b/src/Bannerlord.ButterLib.Implementation/SaveSystem/Patches/DefinitionContextPatch.cs
@@ -144,7 +144,7 @@ private static bool NotNull(T obj, string name, string? errPrefix = null) whe
if (obj is null)
{
var prefix = errPrefix ?? string.Empty;
- _log.LogError($"{prefix}{name} is null!");
+ _log.LogError("{Prefix}{Name} is null!", prefix, name);
return false;
}
@@ -168,7 +168,7 @@ protected Patch(string patchMethodName, MethodInfo? targetMethod)
internal virtual bool IsReady => ThisNotNull(PatchMethod, nameof(PatchMethod)) & ThisNotNull(TargetMethod, nameof(TargetMethod));
- private MethodInfo? ResolvePatchMethod() => AccessTools2.Method(GetType().DeclaringType, PatchMethodName);
+ private MethodInfo? ResolvePatchMethod() => AccessTools2.Method(GetType().DeclaringType!, PatchMethodName);
protected bool ThisNotNull(object? obj, string objName) => NotNull(obj, objName, $"Patch {PatchMethodName}: ");
}
diff --git a/src/Bannerlord.ButterLib.Implementation/SaveSystem/Patches/TypeExtensionsPatch.cs b/src/Bannerlord.ButterLib.Implementation/SaveSystem/Patches/TypeExtensionsPatch.cs
index 3db6fff7..b8705114 100644
--- a/src/Bannerlord.ButterLib.Implementation/SaveSystem/Patches/TypeExtensionsPatch.cs
+++ b/src/Bannerlord.ButterLib.Implementation/SaveSystem/Patches/TypeExtensionsPatch.cs
@@ -52,7 +52,7 @@ internal static bool Disable(Harmony harmony)
private static readonly Type? TargetType = typeof(MetaData).Assembly.GetType("TaleWorlds.SaveSystem.TypeExtensions");
private static readonly Type[] TargetMethodParams = { typeof(Type), typeof(ContainerType).MakeByRefType() };
- private static readonly MethodInfo? TargetMethod = AccessTools2.Method(TargetType, "IsContainer", TargetMethodParams);
+ private static readonly MethodInfo? TargetMethod = AccessTools2.Method(TargetType!, "IsContainer", TargetMethodParams);
private static readonly MethodInfo? PatchMethod = AccessTools2.Method("Bannerlord.ButterLib.Implementation.SaveSystem.Patches.TypeExtensionsPatch:IsContainerPrefix");
// ReSharper disable once RedundantAssignment
diff --git a/src/Bannerlord.ButterLib.Implementation/_Module/ModuleData/Languages/EN/sta_strings.xml b/src/Bannerlord.ButterLib.Implementation/_Module/ModuleData/Languages/EN/sta_strings.xml
index 9b2103f0..701703f1 100644
--- a/src/Bannerlord.ButterLib.Implementation/_Module/ModuleData/Languages/EN/sta_strings.xml
+++ b/src/Bannerlord.ButterLib.Implementation/_Module/ModuleData/Languages/EN/sta_strings.xml
@@ -17,5 +17,11 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Bannerlord.ButterLib.Implementation/_Module/SubModule.xml b/src/Bannerlord.ButterLib.Implementation/_Module/SubModule.xml
index 04b0d361..b2dc20bb 100644
--- a/src/Bannerlord.ButterLib.Implementation/_Module/SubModule.xml
+++ b/src/Bannerlord.ButterLib.Implementation/_Module/SubModule.xml
@@ -9,6 +9,9 @@
+
diff --git a/src/Bannerlord.ButterLib.sln b/src/Bannerlord.ButterLib.sln
index 05923a4c..f981fc79 100644
--- a/src/Bannerlord.ButterLib.sln
+++ b/src/Bannerlord.ButterLib.sln
@@ -112,72 +112,192 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Development", "Development"
..\docs\articles\Development\Overview.md = ..\docs\articles\Development\Overview.md
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ben.Demystifier", "Ben.Demystifier\src\Ben.Demystifier\Ben.Demystifier.csproj", "{0F069603-5A4C-4397-A741-0E4D9D5A9635}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ben.Demystifier", "Ben.Demystifier\src\Ben.Demystifier\Ben.Demystifier.csproj", "{0F069603-5A4C-4397-A741-0E4D9D5A9635}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Beta_Debug|Any CPU = Beta_Debug|Any CPU
Beta_Debug|x64 = Beta_Debug|x64
+ Beta_Release|Any CPU = Beta_Release|Any CPU
Beta_Release|x64 = Beta_Release|x64
+ Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
+ Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
+ Stable_Debug|Any CPU = Stable_Debug|Any CPU
Stable_Debug|x64 = Stable_Debug|x64
+ Stable_Release|Any CPU = Stable_Release|Any CPU
Stable_Release|x64 = Stable_Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Beta_Debug|x64.ActiveCfg = Beta_Debug|x64
- {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Beta_Debug|x64.Build.0 = Beta_Debug|x64
- {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Beta_Release|x64.ActiveCfg = Beta_Release|x64
- {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Beta_Release|x64.Build.0 = Beta_Release|x64
- {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Stable_Debug|x64.ActiveCfg = Stable_Debug|x64
- {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Stable_Debug|x64.Build.0 = Stable_Debug|x64
- {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Stable_Release|x64.ActiveCfg = Stable_Release|x64
- {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Stable_Release|x64.Build.0 = Stable_Release|x64
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Beta_Debug|Any CPU.ActiveCfg = Beta_Debug|Any CPU
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Beta_Debug|Any CPU.Build.0 = Beta_Debug|Any CPU
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Beta_Debug|x64.ActiveCfg = Beta_Debug|Any CPU
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Beta_Debug|x64.Build.0 = Beta_Debug|Any CPU
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Beta_Release|Any CPU.ActiveCfg = Beta_Release|Any CPU
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Beta_Release|Any CPU.Build.0 = Beta_Release|Any CPU
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Beta_Release|x64.ActiveCfg = Beta_Release|Any CPU
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Beta_Release|x64.Build.0 = Beta_Release|Any CPU
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Debug|Any CPU.ActiveCfg = Stable_Debug|Any CPU
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Debug|Any CPU.Build.0 = Stable_Debug|Any CPU
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Debug|x64.ActiveCfg = Stable_Debug|x64
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Debug|x64.Build.0 = Stable_Debug|x64
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Release|Any CPU.ActiveCfg = Stable_Release|Any CPU
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Release|Any CPU.Build.0 = Stable_Release|Any CPU
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Release|x64.ActiveCfg = Stable_Release|x64
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Release|x64.Build.0 = Stable_Release|x64
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Stable_Debug|Any CPU.ActiveCfg = Stable_Debug|Any CPU
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Stable_Debug|Any CPU.Build.0 = Stable_Debug|Any CPU
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Stable_Debug|x64.ActiveCfg = Stable_Debug|Any CPU
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Stable_Debug|x64.Build.0 = Stable_Debug|Any CPU
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Stable_Release|Any CPU.ActiveCfg = Stable_Release|Any CPU
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Stable_Release|Any CPU.Build.0 = Stable_Release|Any CPU
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Stable_Release|x64.ActiveCfg = Stable_Release|Any CPU
+ {1339A1C0-C2F0-4491-91BB-D49C00332F68}.Stable_Release|x64.Build.0 = Stable_Release|Any CPU
+ {17BE8506-B22B-4705-A777-C862888DA1F5}.Beta_Debug|Any CPU.ActiveCfg = Debug|x64
+ {17BE8506-B22B-4705-A777-C862888DA1F5}.Beta_Debug|Any CPU.Build.0 = Debug|x64
{17BE8506-B22B-4705-A777-C862888DA1F5}.Beta_Debug|x64.ActiveCfg = Debug|x64
{17BE8506-B22B-4705-A777-C862888DA1F5}.Beta_Debug|x64.Build.0 = Debug|x64
+ {17BE8506-B22B-4705-A777-C862888DA1F5}.Beta_Release|Any CPU.ActiveCfg = Release|x64
+ {17BE8506-B22B-4705-A777-C862888DA1F5}.Beta_Release|Any CPU.Build.0 = Release|x64
{17BE8506-B22B-4705-A777-C862888DA1F5}.Beta_Release|x64.ActiveCfg = Release|x64
{17BE8506-B22B-4705-A777-C862888DA1F5}.Beta_Release|x64.Build.0 = Release|x64
+ {17BE8506-B22B-4705-A777-C862888DA1F5}.Debug|Any CPU.ActiveCfg = Debug|x64
+ {17BE8506-B22B-4705-A777-C862888DA1F5}.Debug|Any CPU.Build.0 = Debug|x64
+ {17BE8506-B22B-4705-A777-C862888DA1F5}.Debug|x64.ActiveCfg = Debug|x64
+ {17BE8506-B22B-4705-A777-C862888DA1F5}.Debug|x64.Build.0 = Debug|x64
+ {17BE8506-B22B-4705-A777-C862888DA1F5}.Release|Any CPU.ActiveCfg = Release|x64
+ {17BE8506-B22B-4705-A777-C862888DA1F5}.Release|Any CPU.Build.0 = Release|x64
+ {17BE8506-B22B-4705-A777-C862888DA1F5}.Release|x64.ActiveCfg = Release|x64
+ {17BE8506-B22B-4705-A777-C862888DA1F5}.Release|x64.Build.0 = Release|x64
+ {17BE8506-B22B-4705-A777-C862888DA1F5}.Stable_Debug|Any CPU.ActiveCfg = Debug|x64
+ {17BE8506-B22B-4705-A777-C862888DA1F5}.Stable_Debug|Any CPU.Build.0 = Debug|x64
{17BE8506-B22B-4705-A777-C862888DA1F5}.Stable_Debug|x64.ActiveCfg = Debug|x64
{17BE8506-B22B-4705-A777-C862888DA1F5}.Stable_Debug|x64.Build.0 = Debug|x64
+ {17BE8506-B22B-4705-A777-C862888DA1F5}.Stable_Release|Any CPU.ActiveCfg = Release|x64
+ {17BE8506-B22B-4705-A777-C862888DA1F5}.Stable_Release|Any CPU.Build.0 = Release|x64
{17BE8506-B22B-4705-A777-C862888DA1F5}.Stable_Release|x64.ActiveCfg = Release|x64
{17BE8506-B22B-4705-A777-C862888DA1F5}.Stable_Release|x64.Build.0 = Release|x64
+ {C2FEF2CB-356C-4045-948D-F0755ABA6378}.Beta_Debug|Any CPU.ActiveCfg = Beta_Debug|x64
+ {C2FEF2CB-356C-4045-948D-F0755ABA6378}.Beta_Debug|Any CPU.Build.0 = Beta_Debug|x64
{C2FEF2CB-356C-4045-948D-F0755ABA6378}.Beta_Debug|x64.ActiveCfg = Beta_Debug|x64
{C2FEF2CB-356C-4045-948D-F0755ABA6378}.Beta_Debug|x64.Build.0 = Beta_Debug|x64
+ {C2FEF2CB-356C-4045-948D-F0755ABA6378}.Beta_Release|Any CPU.ActiveCfg = Beta_Release|x64
+ {C2FEF2CB-356C-4045-948D-F0755ABA6378}.Beta_Release|Any CPU.Build.0 = Beta_Release|x64
{C2FEF2CB-356C-4045-948D-F0755ABA6378}.Beta_Release|x64.ActiveCfg = Beta_Release|x64
{C2FEF2CB-356C-4045-948D-F0755ABA6378}.Beta_Release|x64.Build.0 = Beta_Release|x64
+ {C2FEF2CB-356C-4045-948D-F0755ABA6378}.Debug|Any CPU.ActiveCfg = Stable_Debug|x64
+ {C2FEF2CB-356C-4045-948D-F0755ABA6378}.Debug|Any CPU.Build.0 = Stable_Debug|x64
+ {C2FEF2CB-356C-4045-948D-F0755ABA6378}.Debug|x64.ActiveCfg = Stable_Debug|x64
+ {C2FEF2CB-356C-4045-948D-F0755ABA6378}.Debug|x64.Build.0 = Stable_Debug|x64
+ {C2FEF2CB-356C-4045-948D-F0755ABA6378}.Release|Any CPU.ActiveCfg = Stable_Release|x64
+ {C2FEF2CB-356C-4045-948D-F0755ABA6378}.Release|Any CPU.Build.0 = Stable_Release|x64
+ {C2FEF2CB-356C-4045-948D-F0755ABA6378}.Release|x64.ActiveCfg = Stable_Release|x64
+ {C2FEF2CB-356C-4045-948D-F0755ABA6378}.Release|x64.Build.0 = Stable_Release|x64
+ {C2FEF2CB-356C-4045-948D-F0755ABA6378}.Stable_Debug|Any CPU.ActiveCfg = Stable_Debug|x64
+ {C2FEF2CB-356C-4045-948D-F0755ABA6378}.Stable_Debug|Any CPU.Build.0 = Stable_Debug|x64
{C2FEF2CB-356C-4045-948D-F0755ABA6378}.Stable_Debug|x64.ActiveCfg = Stable_Debug|x64
{C2FEF2CB-356C-4045-948D-F0755ABA6378}.Stable_Debug|x64.Build.0 = Stable_Debug|x64
+ {C2FEF2CB-356C-4045-948D-F0755ABA6378}.Stable_Release|Any CPU.ActiveCfg = Stable_Release|x64
+ {C2FEF2CB-356C-4045-948D-F0755ABA6378}.Stable_Release|Any CPU.Build.0 = Stable_Release|x64
{C2FEF2CB-356C-4045-948D-F0755ABA6378}.Stable_Release|x64.ActiveCfg = Stable_Release|x64
{C2FEF2CB-356C-4045-948D-F0755ABA6378}.Stable_Release|x64.Build.0 = Stable_Release|x64
+ {CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Beta_Debug|Any CPU.ActiveCfg = Beta_Debug|x64
+ {CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Beta_Debug|Any CPU.Build.0 = Beta_Debug|x64
{CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Beta_Debug|x64.ActiveCfg = Beta_Debug|x64
{CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Beta_Debug|x64.Build.0 = Beta_Debug|x64
+ {CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Beta_Release|Any CPU.ActiveCfg = Beta_Release|x64
+ {CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Beta_Release|Any CPU.Build.0 = Beta_Release|x64
{CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Beta_Release|x64.ActiveCfg = Beta_Release|x64
{CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Beta_Release|x64.Build.0 = Beta_Release|x64
+ {CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Debug|Any CPU.ActiveCfg = Stable_Debug|x64
+ {CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Debug|Any CPU.Build.0 = Stable_Debug|x64
+ {CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Debug|x64.ActiveCfg = Stable_Debug|x64
+ {CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Debug|x64.Build.0 = Stable_Debug|x64
+ {CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Release|Any CPU.ActiveCfg = Stable_Release|x64
+ {CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Release|Any CPU.Build.0 = Stable_Release|x64
+ {CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Release|x64.ActiveCfg = Stable_Release|x64
+ {CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Release|x64.Build.0 = Stable_Release|x64
+ {CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Stable_Debug|Any CPU.ActiveCfg = Stable_Debug|x64
+ {CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Stable_Debug|Any CPU.Build.0 = Stable_Debug|x64
{CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Stable_Debug|x64.ActiveCfg = Stable_Debug|x64
{CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Stable_Debug|x64.Build.0 = Stable_Debug|x64
+ {CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Stable_Release|Any CPU.ActiveCfg = Stable_Release|x64
+ {CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Stable_Release|Any CPU.Build.0 = Stable_Release|x64
{CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Stable_Release|x64.ActiveCfg = Stable_Release|x64
{CC56F4AA-1C6F-4B20-9DA3-79A30E1F6734}.Stable_Release|x64.Build.0 = Stable_Release|x64
+ {451849FC-0522-493D-B0DF-9538ABDBE56D}.Beta_Debug|Any CPU.ActiveCfg = Beta_Debug|x64
+ {451849FC-0522-493D-B0DF-9538ABDBE56D}.Beta_Debug|Any CPU.Build.0 = Beta_Debug|x64
{451849FC-0522-493D-B0DF-9538ABDBE56D}.Beta_Debug|x64.ActiveCfg = Beta_Debug|x64
{451849FC-0522-493D-B0DF-9538ABDBE56D}.Beta_Debug|x64.Build.0 = Beta_Debug|x64
+ {451849FC-0522-493D-B0DF-9538ABDBE56D}.Beta_Release|Any CPU.ActiveCfg = Beta_Release|x64
+ {451849FC-0522-493D-B0DF-9538ABDBE56D}.Beta_Release|Any CPU.Build.0 = Beta_Release|x64
{451849FC-0522-493D-B0DF-9538ABDBE56D}.Beta_Release|x64.ActiveCfg = Beta_Release|x64
{451849FC-0522-493D-B0DF-9538ABDBE56D}.Beta_Release|x64.Build.0 = Beta_Release|x64
+ {451849FC-0522-493D-B0DF-9538ABDBE56D}.Debug|Any CPU.ActiveCfg = Stable_Debug|x64
+ {451849FC-0522-493D-B0DF-9538ABDBE56D}.Debug|Any CPU.Build.0 = Stable_Debug|x64
+ {451849FC-0522-493D-B0DF-9538ABDBE56D}.Debug|x64.ActiveCfg = Stable_Debug|x64
+ {451849FC-0522-493D-B0DF-9538ABDBE56D}.Debug|x64.Build.0 = Stable_Debug|x64
+ {451849FC-0522-493D-B0DF-9538ABDBE56D}.Release|Any CPU.ActiveCfg = Stable_Release|x64
+ {451849FC-0522-493D-B0DF-9538ABDBE56D}.Release|Any CPU.Build.0 = Stable_Release|x64
+ {451849FC-0522-493D-B0DF-9538ABDBE56D}.Release|x64.ActiveCfg = Stable_Release|x64
+ {451849FC-0522-493D-B0DF-9538ABDBE56D}.Release|x64.Build.0 = Stable_Release|x64
+ {451849FC-0522-493D-B0DF-9538ABDBE56D}.Stable_Debug|Any CPU.ActiveCfg = Stable_Debug|x64
+ {451849FC-0522-493D-B0DF-9538ABDBE56D}.Stable_Debug|Any CPU.Build.0 = Stable_Debug|x64
{451849FC-0522-493D-B0DF-9538ABDBE56D}.Stable_Debug|x64.ActiveCfg = Stable_Debug|x64
{451849FC-0522-493D-B0DF-9538ABDBE56D}.Stable_Debug|x64.Build.0 = Stable_Debug|x64
+ {451849FC-0522-493D-B0DF-9538ABDBE56D}.Stable_Release|Any CPU.ActiveCfg = Stable_Release|x64
+ {451849FC-0522-493D-B0DF-9538ABDBE56D}.Stable_Release|Any CPU.Build.0 = Stable_Release|x64
{451849FC-0522-493D-B0DF-9538ABDBE56D}.Stable_Release|x64.ActiveCfg = Stable_Release|x64
{451849FC-0522-493D-B0DF-9538ABDBE56D}.Stable_Release|x64.Build.0 = Stable_Release|x64
+ {5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Beta_Debug|Any CPU.ActiveCfg = Beta_Debug|x64
+ {5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Beta_Debug|Any CPU.Build.0 = Beta_Debug|x64
{5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Beta_Debug|x64.ActiveCfg = Beta_Debug|x64
{5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Beta_Debug|x64.Build.0 = Beta_Debug|x64
+ {5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Beta_Release|Any CPU.ActiveCfg = Beta_Release|x64
+ {5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Beta_Release|Any CPU.Build.0 = Beta_Release|x64
{5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Beta_Release|x64.ActiveCfg = Beta_Release|x64
{5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Beta_Release|x64.Build.0 = Beta_Release|x64
+ {5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Debug|Any CPU.ActiveCfg = Stable_Debug|x64
+ {5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Debug|Any CPU.Build.0 = Stable_Debug|x64
+ {5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Debug|x64.ActiveCfg = Stable_Debug|x64
+ {5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Debug|x64.Build.0 = Stable_Debug|x64
+ {5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Release|Any CPU.ActiveCfg = Stable_Release|x64
+ {5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Release|Any CPU.Build.0 = Stable_Release|x64
+ {5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Release|x64.ActiveCfg = Stable_Release|x64
+ {5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Release|x64.Build.0 = Stable_Release|x64
+ {5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Stable_Debug|Any CPU.ActiveCfg = Stable_Debug|x64
+ {5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Stable_Debug|Any CPU.Build.0 = Stable_Debug|x64
{5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Stable_Debug|x64.ActiveCfg = Stable_Debug|x64
{5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Stable_Debug|x64.Build.0 = Stable_Debug|x64
+ {5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Stable_Release|Any CPU.ActiveCfg = Stable_Release|x64
+ {5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Stable_Release|Any CPU.Build.0 = Stable_Release|x64
{5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Stable_Release|x64.ActiveCfg = Stable_Release|x64
{5C1705E2-CC31-4215-A4CE-7A8AFF6D9BC3}.Stable_Release|x64.Build.0 = Stable_Release|x64
+ {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Beta_Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Beta_Debug|Any CPU.Build.0 = Debug|Any CPU
{0F069603-5A4C-4397-A741-0E4D9D5A9635}.Beta_Debug|x64.ActiveCfg = Debug|Any CPU
{0F069603-5A4C-4397-A741-0E4D9D5A9635}.Beta_Debug|x64.Build.0 = Debug|Any CPU
- {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Beta_Release|x64.ActiveCfg = Debug|Any CPU
- {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Beta_Release|x64.Build.0 = Debug|Any CPU
+ {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Beta_Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Beta_Release|Any CPU.Build.0 = Release|Any CPU
+ {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Beta_Release|x64.ActiveCfg = Release|Any CPU
+ {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Beta_Release|x64.Build.0 = Release|Any CPU
+ {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Debug|x64.Build.0 = Debug|Any CPU
+ {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Release|x64.ActiveCfg = Release|Any CPU
+ {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Release|x64.Build.0 = Release|Any CPU
+ {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Stable_Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Stable_Debug|Any CPU.Build.0 = Debug|Any CPU
{0F069603-5A4C-4397-A741-0E4D9D5A9635}.Stable_Debug|x64.ActiveCfg = Debug|Any CPU
{0F069603-5A4C-4397-A741-0E4D9D5A9635}.Stable_Debug|x64.Build.0 = Debug|Any CPU
- {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Stable_Release|x64.ActiveCfg = Debug|Any CPU
- {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Stable_Release|x64.Build.0 = Debug|Any CPU
+ {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Stable_Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Stable_Release|Any CPU.Build.0 = Release|Any CPU
+ {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Stable_Release|x64.ActiveCfg = Release|Any CPU
+ {0F069603-5A4C-4397-A741-0E4D9D5A9635}.Stable_Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/src/Bannerlord.ButterLib/Bannerlord.ButterLib.csproj b/src/Bannerlord.ButterLib/Bannerlord.ButterLib.csproj
index bbec774f..0a7b84d3 100644
--- a/src/Bannerlord.ButterLib/Bannerlord.ButterLib.csproj
+++ b/src/Bannerlord.ButterLib/Bannerlord.ButterLib.csproj
@@ -5,12 +5,12 @@
net472;netcoreapp3.1;netstandard2.0
11.0
enable
- x64
+ x64
true
true
$(BANNERLORD_BUTR_UPLOAD_URL)
- $(DefineConstants);BANNERLORDBUTRSHARED_BUTTERLIB
+ $(DefineConstants);BANNERLORDBUTRSHARED_BUTTERLIB;X64
1.0.0
@@ -33,10 +33,14 @@
+
-
+
+
@@ -46,6 +50,11 @@
+
diff --git a/src/Bannerlord.ButterLib/ButterLibSubModule.cs b/src/Bannerlord.ButterLib/ButterLibSubModule.cs
index 3d03d283..c03341e4 100644
--- a/src/Bannerlord.ButterLib/ButterLibSubModule.cs
+++ b/src/Bannerlord.ButterLib/ButterLibSubModule.cs
@@ -78,6 +78,8 @@ public void OnServiceRegistration()
this.AddDefaultSerilogLogger();
this.AddSerilogLoggerProvider("butterlib.txt", new[] { "Bannerlord.ButterLib.*" });
this.AddSerilogLoggerProvider("trace.txt", new[] { "System.Diagnostics.Logger.*" });
+ //this.AddSteamWriterLogger("harmony.txt", out var harmonyStreamWriter);
+ //HarmonyLib.FileLog.LogWriter = harmonyStreamWriter;
Services.AddSubSystem();
Services.AddSubSystem();
diff --git a/src/Bannerlord.ButterLib/CrashUploader/BUTRCrashUploader.cs b/src/Bannerlord.ButterLib/CrashUploader/BUTRCrashUploader.cs
index 56ed8619..fa931f72 100644
--- a/src/Bannerlord.ButterLib/CrashUploader/BUTRCrashUploader.cs
+++ b/src/Bannerlord.ButterLib/CrashUploader/BUTRCrashUploader.cs
@@ -47,6 +47,8 @@ public async Task UploadAsync(CrashReport crashReport)
using var responseReader = new StreamReader(stream);
var result = await responseReader.ReadLineAsync().ConfigureAwait(false);
+ if (string.IsNullOrEmpty(result))
+ return CrashUploaderResult.ResponseUrlIsNullOrEmpty();
return CrashUploaderResult.Success(result);
}
catch (Exception e)
diff --git a/src/Bannerlord.ButterLib/CrashUploader/CrashUploaderResult.cs b/src/Bannerlord.ButterLib/CrashUploader/CrashUploaderResult.cs
index 26260614..1969be5a 100644
--- a/src/Bannerlord.ButterLib/CrashUploader/CrashUploaderResult.cs
+++ b/src/Bannerlord.ButterLib/CrashUploader/CrashUploaderResult.cs
@@ -7,6 +7,7 @@ internal record CrashUploaderResult
public static CrashUploaderResult ResponseIsNotHttpWebResponse() => new(CrashUploaderStatus.ResponseIsNotHttpWebResponse);
public static CrashUploaderResult WrongStatusCode(string statusCode) => new(CrashUploaderStatus.WrongStatusCode) { StatusCode = statusCode };
public static CrashUploaderResult ResponseStreamIsNull() => new(CrashUploaderStatus.ResponseStreamIsNull);
+ public static CrashUploaderResult ResponseUrlIsNullOrEmpty() => new(CrashUploaderStatus.UrlIsNullOrEmpty);
public static CrashUploaderResult FailedWithException(string exception) => new(CrashUploaderStatus.FailedWithException) { Exception = exception };
public CrashUploaderStatus Status { get; }
diff --git a/src/Bannerlord.ButterLib/CrashUploader/CrashUploaderStatus.cs b/src/Bannerlord.ButterLib/CrashUploader/CrashUploaderStatus.cs
index 044ed7cb..554687ee 100644
--- a/src/Bannerlord.ButterLib/CrashUploader/CrashUploaderStatus.cs
+++ b/src/Bannerlord.ButterLib/CrashUploader/CrashUploaderStatus.cs
@@ -8,5 +8,6 @@ internal enum CrashUploaderStatus
WrongStatusCode,
ResponseStreamIsNull,
FailedWithException,
+ UrlIsNullOrEmpty,
}
}
\ No newline at end of file
diff --git a/src/Bannerlord.ButterLib/DynamicAPI/DynamicApiProvider.cs b/src/Bannerlord.ButterLib/DynamicAPI/DynamicApiProvider.cs
index a1200375..03b2682b 100644
--- a/src/Bannerlord.ButterLib/DynamicAPI/DynamicApiProvider.cs
+++ b/src/Bannerlord.ButterLib/DynamicAPI/DynamicApiProvider.cs
@@ -42,7 +42,7 @@ private record MethodInfoWithAttribute(MethodInfo MethodInfo, CustomAttributeDat
private static TypeWithAttribute? GetDynamicAPIClass(Type? type)
{
bool Predicate(CustomAttributeData x) =>
- PossibleClassNames.Contains(x.AttributeType.FullName) && x.ConstructorArguments.Count == 1 && x.ConstructorArguments[0].ArgumentType == typeof(string);
+ PossibleClassNames.Contains(x.AttributeType.FullName!) && x.ConstructorArguments.Count == 1 && x.ConstructorArguments[0].ArgumentType == typeof(string);
if (type is null)
return null;
@@ -59,7 +59,7 @@ bool Predicate(CustomAttributeData x) =>
private static MethodInfoWithAttribute? GetDynamicAPIMethod(MethodInfo? methodInfo)
{
bool Predicate(CustomAttributeData x) =>
- PossibleMethodNames.Contains(x.AttributeType.FullName) && x.ConstructorArguments.Count == 1 && x.ConstructorArguments[0].ArgumentType == typeof(string);
+ PossibleMethodNames.Contains(x.AttributeType.FullName!) && x.ConstructorArguments.Count == 1 && x.ConstructorArguments[0].ArgumentType == typeof(string);
if (methodInfo is null)
return null;
@@ -71,17 +71,17 @@ bool Predicate(CustomAttributeData x) =>
}
private static string DynamicAPIClassAttributeName(TypeWithAttribute typeWithAttribute) =>
- (string) typeWithAttribute.CustomAttributeData.ConstructorArguments[0].Value;
+ (string) typeWithAttribute.CustomAttributeData.ConstructorArguments[0].Value!;
private static string DynamicAPIMethodAttributeName(MethodInfoWithAttribute methodInfoWithAttribute)
{
- var name = (string) methodInfoWithAttribute.CustomAttributeData.ConstructorArguments[0].Value;
+ var name = (string) methodInfoWithAttribute.CustomAttributeData.ConstructorArguments[0].Value!;
return $"{(methodInfoWithAttribute.MethodInfo.IsStatic ? "0static" : "0instance")}_{name}";
}
private static IEnumerable GetAssembliesToScan()
{
- var loadedModules = ModuleInfoHelper.GetLoadedModules().OfType().ToList();
+ var loadedModules = ModuleInfoHelper.GetLoadedModules().Where(x => x is not null).ToList();
foreach (var assembly in AccessTools2.AllAssemblies().Where(x => !x.IsDynamic && !string.IsNullOrEmpty(x.Location)))
{
if (loadedModules.Any(loadedModule => ModuleInfoHelper.IsModuleAssembly(loadedModule, assembly)))
diff --git a/src/Bannerlord.ButterLib/ExceptionHandler/BEWPatch.cs b/src/Bannerlord.ButterLib/ExceptionHandler/BEWPatch.cs
index 8fb59738..7f76cfba 100644
--- a/src/Bannerlord.ButterLib/ExceptionHandler/BEWPatch.cs
+++ b/src/Bannerlord.ButterLib/ExceptionHandler/BEWPatch.cs
@@ -1,4 +1,4 @@
-using Bannerlord.BUTRLoader;
+using Bannerlord.BLSE;
using Bannerlord.ButterLib.Common.Extensions;
using Bannerlord.ButterLib.ExceptionHandler.DebuggerDetection;
@@ -28,7 +28,7 @@ namespace Bannerlord.ButterLib.ExceptionHandler
// TaleWorlds.MountAndBlade.MissionBehaviour:OnMissionTick -> Called by TaleWorlds.MountAndBlade.Mission:Tick
// TaleWorlds.MountAndBlade.MBSubModuleBase:OnSubModuleLoad -> Replicated
- [BUTRLoaderInterceptor]
+ [BLSELoaderInterceptor]
internal sealed class BEWPatch
{
public static bool IsDebuggerAttached()
@@ -44,7 +44,7 @@ public static bool IsDebuggerAttached()
return false;
}
- internal record ExceptionIdentifier(Type Type, string StackTrace, string Message)
+ internal record ExceptionIdentifier(Type Type, string? StackTrace, string Message)
{
public static ExceptionIdentifier FromException(Exception e) => new(e.GetType(), e.StackTrace, e.Message);
}
diff --git a/src/Bannerlord.ButterLib/ExceptionHandler/CrashReport.cs b/src/Bannerlord.ButterLib/ExceptionHandler/CrashReport.cs
index 9e0d8f00..fcb76907 100644
--- a/src/Bannerlord.ButterLib/ExceptionHandler/CrashReport.cs
+++ b/src/Bannerlord.ButterLib/ExceptionHandler/CrashReport.cs
@@ -13,7 +13,7 @@
namespace Bannerlord.ButterLib.ExceptionHandler
{
- internal record StacktraceEntry(MethodBase Method, bool MethodFromStackframeIssue, ModuleInfoExtended? ModuleInfo, string StackFrameDescription);
+ internal record StacktraceEntry(MethodBase Method, bool MethodFromStackframeIssue, ModuleInfoExtended? ModuleInfo, string StackFrameDescription, string[] CilInstructions);
internal class CrashReport
{
@@ -35,11 +35,11 @@ public CrashReport(Exception exception)
foreach (var subModule in LoadedModules.SelectMany(module => module.SubModules))
{
moduleAssemblies.Add(Path.GetFileNameWithoutExtension(subModule.DLLName));
- moduleAssemblies.AddRange(subModule.Assemblies.Select(Path.GetFileNameWithoutExtension));
+ moduleAssemblies.AddRange(subModule.Assemblies.Select(Path.GetFileNameWithoutExtension).Where(x => x is not null));
}
- ModuleLoadedAssemblies.AddRange(AccessTools2.AllAssemblies().Where(a => moduleAssemblies.Contains(a.GetName().Name)));
- ExternalLoadedAssemblies.AddRange(AccessTools2.AllAssemblies().Where(a => !moduleAssemblies.Contains(a.GetName().Name)));
+ ModuleLoadedAssemblies.AddRange(AccessTools2.AllAssemblies().Where(a => moduleAssemblies.Contains(a.GetName().Name!)));
+ ExternalLoadedAssemblies.AddRange(AccessTools2.AllAssemblies().Where(a => !moduleAssemblies.Contains(a.GetName().Name!)));
foreach (var originalMethod in Harmony.GetAllPatchedMethods())
{
@@ -101,7 +101,7 @@ private static IEnumerable GetAllInvolvedModules(Exception ex)
{
if (!frame.HasMethod()) continue;
- MethodBase? method;
+ MethodBase method;
var methodFromStackframeIssue = false;
try
{
@@ -110,15 +110,15 @@ private static IEnumerable GetAllInvolvedModules(Exception ex)
// NullReferenceException means the method was not found. Harmony doesn't handle this case gracefully
catch (NullReferenceException)
{
- method = frame.GetMethod();
+ method = frame.GetMethod()!;
}
// The given generic instantiation was invalid.
// From what I understand, this will occur with generic methods
// Also when static constructors throw errors, Harmony resolution will fail
- catch (Exception e)
+ catch (Exception)
{
methodFromStackframeIssue = true;
- method = frame.GetMethod();
+ method = frame.GetMethod()!;
}
var frameDesc = $"{frame} (IL Offset: {frame.GetILOffset()})";
@@ -126,27 +126,46 @@ private static IEnumerable GetAllInvolvedModules(Exception ex)
var patches = FindPatches(method);
foreach (var (methodBase, extendedModuleInfo) in GetFinalizers(patches))
{
- yield return new(methodBase, methodFromStackframeIssue, extendedModuleInfo, frameDesc);
+ yield return new(methodBase, methodFromStackframeIssue, extendedModuleInfo, frameDesc, Array.Empty());
}
foreach (var (methodBase, extendedModuleInfo) in GetPostfixes(patches))
{
- yield return new(methodBase, methodFromStackframeIssue, extendedModuleInfo, frameDesc);
+ yield return new(methodBase, methodFromStackframeIssue, extendedModuleInfo, frameDesc, Array.Empty());
}
foreach (var (methodBase, extendedModuleInfo) in GetPrefixes(patches))
{
- yield return new(methodBase, methodFromStackframeIssue, extendedModuleInfo, frameDesc);
+ yield return new(methodBase, methodFromStackframeIssue, extendedModuleInfo, frameDesc, Array.Empty());
}
foreach (var (methodBase, extendedModuleInfo) in GetTranspilers(patches))
{
- yield return new(methodBase, methodFromStackframeIssue, extendedModuleInfo, frameDesc);
+ yield return new(methodBase, methodFromStackframeIssue, extendedModuleInfo, frameDesc, Array.Empty());
}
var moduleInfo = GetModuleInfoIfMod(method);
- yield return new(method, methodFromStackframeIssue, moduleInfo, frameDesc);
+ yield return new(method, methodFromStackframeIssue, moduleInfo, frameDesc, Array.Empty());
- if (method is MethodInfo methodInfo && Harmony.GetOriginalMethod(methodInfo) is { } original)
- yield return new(original, methodFromStackframeIssue, moduleInfo, frameDesc);
+ /*
+ // Further versions of Harmony will do `PlatformTriple.Current.GetIdentifiable(method) is MethodInfo identifiableMethod` themselves
+ if (method is MethodInfo && MonoMod.Core.Platforms.PlatformTriple.Current.GetIdentifiable(method) is MethodInfo identifiableMethod && Harmony.GetOriginalMethod(identifiableMethod) is { } original)
+ {
+ AsmResolver.DotNet.Code.Cil.CilInstructionCollection? instructions;
+ try
+ {
+ var module = AsmResolver.DotNet.ModuleDefinition.FromModule(identifiableMethod.Module);
+ var dynamicMethodDefinition = new AsmResolver.DotNet.Dynamic.DynamicMethodDefinition(module, identifiableMethod);
+ var cilMethodBody = dynamicMethodDefinition.MethodBody as AsmResolver.DotNet.Code.Cil.CilMethodBody;
+ instructions = cilMethodBody?.Instructions;
+ }
+ catch (Exception)
+ {
+ instructions = null;
+ }
+
+ var instructionsStr = instructions.Select(x => x.ToString()).ToArray();
+ yield return new(original, methodFromStackframeIssue, moduleInfo, frameDesc, instructionsStr);
+ }
+ */
}
}
}
diff --git a/src/Bannerlord.ButterLib/ExceptionHandler/DebuggerDetection/ProcessDebug.cs b/src/Bannerlord.ButterLib/ExceptionHandler/DebuggerDetection/ProcessDebug.cs
index 9dc3de96..4c262c8f 100644
--- a/src/Bannerlord.ButterLib/ExceptionHandler/DebuggerDetection/ProcessDebug.cs
+++ b/src/Bannerlord.ButterLib/ExceptionHandler/DebuggerDetection/ProcessDebug.cs
@@ -6,7 +6,7 @@ namespace Bannerlord.ButterLib.ExceptionHandler.DebuggerDetection
{
internal static class ProcessDebug
{
- private const int PROCESS_DEBUG_OBJECT_HANDLE = 0x1E;
+ private const int PROCESS_DEBUG_OBJECT_HANDLE = 30;
private const int PROCESS_DEBUG_PORT = 7;
[DllImport("ntdll.dll", SetLastError = true)]
diff --git a/src/Bannerlord.ButterLib/ExceptionHandler/ExceptionHandlerSubSystem.cs b/src/Bannerlord.ButterLib/ExceptionHandler/ExceptionHandlerSubSystem.cs
index 06f88198..0e3de08b 100644
--- a/src/Bannerlord.ButterLib/ExceptionHandler/ExceptionHandlerSubSystem.cs
+++ b/src/Bannerlord.ButterLib/ExceptionHandler/ExceptionHandlerSubSystem.cs
@@ -78,6 +78,34 @@ private set
}
}
+ private bool _useVanillaCrashHandler = false;
+ public bool UseVanillaCrashHandler
+ {
+ get => _catchAutoGenExceptions;
+ private set
+ {
+ if (_useVanillaCrashHandler != value)
+ {
+ _useVanillaCrashHandler = value;
+
+ if (_useVanillaCrashHandler)
+ {
+ if (IsEnabled)
+ {
+ WatchdogHandler.EnableTWWatchdog();
+ }
+ }
+ else
+ {
+ if (IsEnabled)
+ {
+ WatchdogHandler.DisableTWWatchdog();
+ }
+ }
+ }
+ }
+ }
+
///
public IReadOnlyCollection> Declarations { get; } = new SubSystemSettingsDeclaration[]
{
@@ -86,9 +114,13 @@ private set
"{=r3ktQzFMRz} Stops the Exception Handler when a debugger is attached.",
x => x.DisableWhenDebuggerIsAttached),
new SubSystemSettingsPropertyBool(
- "{=B7bfrDNzIk} Catch AutoGenerated Code Exceptions (Lower Performance)",
- "{=r3ktQzFMRz} Catch every Native->Managed call. Should catch every exception not catched the standard way. Might decrease the overall performance a bit.",
+ "{=jorWb502pD} Catch AutoGenerated Code Exceptions (Lower Performance) (DISABLED)",
+ "{=ji1brrsEZz} Catch every Native->Managed call. Should catch every exception not catched the standard way. Might decrease the overall performance a bit.",
x => x.CatchAutoGenExceptions),
+ new SubSystemSettingsPropertyBool(
+ "{=ZD69h3IpF5} Use Vanilla Crash Handler",
+ "{=o0DgSNv5V1} Disables ButterLib's and BEW's Crash Handlers with the new Watchdog Crash Handler. Do not enable if not sure.",
+ x => x.UseVanillaCrashHandler),
};
@@ -105,6 +137,8 @@ public void Enable()
SubscribeToUnhandledException();
BEWPatch.Enable(Harmony);
+
+ WatchdogHandler.DisableTWWatchdog();
}
public void Disable()
@@ -117,6 +151,8 @@ public void Disable()
{
BEWPatch.Disable(Harmony);
}
+
+ WatchdogHandler.EnableTWWatchdog();
}
private static bool _isSubscribedToUnhandledException;
diff --git a/src/Bannerlord.ButterLib/ExceptionHandler/HtmlBuilder.cs b/src/Bannerlord.ButterLib/ExceptionHandler/HtmlBuilder.cs
index 1a511e19..95432dc5 100644
--- a/src/Bannerlord.ButterLib/ExceptionHandler/HtmlBuilder.cs
+++ b/src/Bannerlord.ButterLib/ExceptionHandler/HtmlBuilder.cs
@@ -1,6 +1,7 @@
using Bannerlord.BUTR.Shared.Extensions;
using Bannerlord.BUTR.Shared.Helpers;
using Bannerlord.ButterLib.Common.Extensions;
+using Bannerlord.ButterLib.Helpers;
using Bannerlord.ButterLib.Logger;
using Bannerlord.ModuleManager;
@@ -26,7 +27,7 @@ namespace Bannerlord.ButterLib.ExceptionHandler
{
internal static class HtmlBuilder
{
- private static readonly int Version = 10;
+ private static readonly int Version = 11;
private static readonly string NL = Environment.NewLine;
public static readonly string MiniDumpTag = "";
@@ -315,10 +316,10 @@ function screenshot(element) {{