Skip to content

Commit

Permalink
Merge pull request #336 from BUTR/dev
Browse files Browse the repository at this point in the history
v2.8.2
  • Loading branch information
Aragas authored Jul 2, 2023
2 parents 3b3825c + 48be2a5 commit a330639
Show file tree
Hide file tree
Showing 38 changed files with 443 additions and 120 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 #
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@
<img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fnexusmods-downloads-ayuqql60xfxb.runkit.sh%2F%3Ftype%3Dviews%26gameId%3D3174%26modId%3D2018" />
</a>
</br>
<a href="https://steamcommunity.com/sharedfiles/filedetails/?id=2859232415">
<img alt="Steam Mod Configuration Menu" src="https://img.shields.io/badge/Steam-ButterLib-blue.svg" />
</a>
<a href="https://steamcommunity.com/sharedfiles/filedetails/?id=2859232415">
<img alt="Steam Downloads" src="https://img.shields.io/steam/downloads/2859232415?label=Downloads&color=blue">
</a>
<a href="https://steamcommunity.com/sharedfiles/filedetails/?id=2859232415">
<img alt="Steam Views" src="https://img.shields.io/steam/views/2859232415?label=Views&color=blue">
</a>
<a href="https://steamcommunity.com/sharedfiles/filedetails/?id=2859232415">
<img alt="Steam Subscriptions" src="https://img.shields.io/steam/subscriptions/2859232415?label=Subscriptions&color=blue">
</a>
<a href="https://steamcommunity.com/sharedfiles/filedetails/?id=2859232415">
<img alt="Steam Favorites" src="https://img.shields.io/steam/favorites/2859232415?label=Favorites&color=blue">
</a>
</br>
</p>

Extension library for Mount & Blade II: Bannerlord.
Expand Down
11 changes: 6 additions & 5 deletions build/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
<!--Development Variables-->
<PropertyGroup>
<!--Module Version-->
<Version>2.8.1</Version>
<Version>2.8.2</Version>
<!--Harmony Version-->
<HarmonyVersion>2.2.2</HarmonyVersion>
<HarmonyExtensionsVersion>3.2.0.77</HarmonyExtensionsVersion>
<HarmonyAnalyzerVersion>1.0.1.44</HarmonyAnalyzerVersion>
<HarmonyAnalyzerVersion>1.0.1.50</HarmonyAnalyzerVersion>
<!--Microsoft Extension Libraries Version-->
<!--Serilog depends on abstraction 2.0.0, and since we can't do app redirects, we're stuck with that-->
<!--Switching to v7 or any version higher will require BLSE.AssemblyResolver-->
<!--Also, remove Ben.Demystifier and use the NuGet then-->
<ExtensionVersion>2.0.0</ExtensionVersion>
<!--BuildResources Version-->
<BuildResourcesVersion>1.1.0.102</BuildResourcesVersion>
Expand All @@ -20,12 +21,12 @@

<PropertyGroup>
<Authors>BUTR Team</Authors>
<Company></Company>
<Product>ButterLib Library for Bannerlord</Product>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
<PackageReference Include="Serilog" Version="3.0.1" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(ExtensionVersion)" />
Expand Down Expand Up @@ -143,5 +144,5 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<Platforms>x64</Platforms>
<Platform>x64</Platform>
<BuildForWindows>false</BuildForWindows>
<BuildForWindowsStore>false</BuildForWindowsStore>

<Configurations>Stable_Debug;Stable_Release;Beta_Debug;Beta_Release</Configurations>
<DefineConstants>$(DefineConstants);$(GameVersionConstant)</DefineConstants>
<DefineConstants>$(DefineConstants);$(GameVersionConstant);X64</DefineConstants>

<AssemblyName>$(MSBuildProjectName).$(GameVersion)</AssemblyName>
</PropertyGroup>
Expand All @@ -35,12 +35,17 @@
<ItemGroup>
<PackageReference Include="Bannerlord.BuildResources" Version="$(BuildResourcesVersion)" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />

<PackageReference Include="Bannerlord.Lib.Harmony" Version="$(HarmonyVersion)" PrivateAssets="all" IncludeAssets="compile" />
<PackageReference Include="Lib.Harmony" Version="$(HarmonyVersion)-prerelease.2" PrivateAssets="all" IncludeAssets="compile" />
<!-- Disable MonoMod.Backports since we don't need it for compilation -->
<PackageReference Include="MonoMod.Backports" Version="*" PrivateAssets="all" IncludeAssets="none" />

<PackageReference Include="Bannerlord.ReferenceAssemblies.Core" Version="$(GameVersion).*-*" PrivateAssets="all" />
<PackageReference Include="Bannerlord.ReferenceAssemblies.Native" Version="$(GameVersion).*-*" PrivateAssets="all" />

<PackageReference Include="IsExternalInit" Version="1.0.3" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />

<!-- AsmResolver.DotNet.Dynamic force pulls System.Runtime.CompilerSerices.Unsafe v6, downgrade it -->
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.5.3" />
</ItemGroup>
<!--NuGet References-->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void Disable()
// Think about DelayedSubModuleManager.Unregister
}

internal static void LogNoHooksIssue(ILogger logger, int originalCallIndex, int finallyIndex, List<CodeInstruction> codes, MethodBase currentMethod)
internal static void LogNoHooksIssue(ILogger logger, int originalCallIndex, int finallyIndex, List<CodeInstruction> codes, MethodBase? currentMethod)
{
var issueInfo = new StringBuilder("Indexes: ");
issueInfo.Append($"\n\toriginalCallIndex = {originalCallIndex}.\n\tfinallyIndex={finallyIndex}.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ private sealed class DataKey : IEquatable<DataKey>
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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ private static bool NotNull<T>(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;
}

Expand All @@ -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}: ");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,11 @@

<string id="B7bfrDNzIk" text="Disable when Debugger is Attached" />
<string id="r3ktQzFMRz" text="Stops the Exception Handler when a debugger is attached." />

<string id="jorWb502pD" text="Catch AutoGenerated Code Exceptions (Lower Performance) (DISABLED)" />
<string id="ji1brrsEZz" text="Catch every Native->Managed call. Should catch every exception not catched the standard way. Might decrease the overall performance a bit." />

<string id="ZD69h3IpF5" text="Use Vanilla Crash Handler" />
<string id="o0DgSNv5V1" text="Disables ButterLib's and BEW's Crash Handlers with the new Watchdog Crash Handler. Do not enable if not sure." />
</strings>
</base>
3 changes: 3 additions & 0 deletions src/Bannerlord.ButterLib.Implementation/_Module/SubModule.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
<ModuleCategory value="Singleplayer" />
<Url value="https://www.nexusmods.com/mountandblade2bannerlord/mods/2018" />
<DependedModules>
<!-- Uncomment when doing ExtensionVersion > 2.0.0
<DependedModule Id="BLSE.AssemblyResolver" />
-->
<DependedModule Id="Bannerlord.Harmony" DependentVersion="v$harmonyversion$" />
</DependedModules>
<ModulesToLoadAfterThis>
Expand Down
Loading

0 comments on commit a330639

Please sign in to comment.