Skip to content

Commit

Permalink
Merge pull request #61 from BUTR/dev
Browse files Browse the repository at this point in the history
v1.3.9
  • Loading branch information
Aragas committed Jun 23, 2023
2 parents e07e668 + 33309ac commit 19d2c87
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 19 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,21 @@ BLSE adds support for a new tag DependedModuleMetadatas that allows you to bette
<summary>Xbox Game Pass PC</summary>
<p>You need to copy content of '/bin/Gaming.Desktop.x64_Shipping_Client' from BLSE to 'Mount & Blade II- Bannerlord/Content/bin/Gaming.Desktop.x64_Shipping_Client'</p>
<img src="https://media.discordapp.net/attachments/422092475163869201/1088721252702765126/image.png" alt="BLSE Installation Path" width="500">
<p>You need to copy content of 'Modules/Bannerlord.Harmony' from BLSE to 'Mount & Blade II- Bannerlord/Content/Modules/Bannerlord.Harmony'</p>
<p>You need to copy content of 'Modules/Bannerlord.Harmony' from Harmony to 'Mount & Blade II- Bannerlord/Content/Modules/Bannerlord.Harmony'</p>
<img src="https://media.discordapp.net/attachments/422092475163869201/1088721253692616775/image.png" alt="Bannerlord.Harmony Installation Path" width="500">
</details>
* <details>
<summary>Steam</summary>
<p>You need to copy content of '/bin/Win64_Shipping_Client' from BLSE to 'Mount & Blade II Bannerlord/bin/Win64_Shipping_Client'</p>
<img src="https://media.discordapp.net/attachments/422092475163869201/1088721252962807818/image.png" alt="BLSE Installation Path" width="500">
<p>You need to copy content of 'Modules/Bannerlord.Harmony' from BLSE to 'Mount & Blade II Bannerlord/Modules/Bannerlord.Harmony'</p>
<p>You need to copy content of 'Modules/Bannerlord.Harmony' from Harmony to 'Mount & Blade II Bannerlord/Modules/Bannerlord.Harmony'</p>
<img src="https://media.discordapp.net/attachments/422092475163869201/1088721253478711407/image.png" alt="Bannerlord.Harmony Installation Path" width="500">
</details>
* <details>
<summary>GOG</summary>
<p>You need to copy content of '/bin/Win64_Shipping_Client' from BLSE to 'Mount & Blade II Bannerlord/bin/Win64_Shipping_Client'</p>
<img src="https://media.discordapp.net/attachments/422092475163869201/1088721253185097758/image.png" alt="BLSE Installation Path" width="500">
<p>You need to copy content of 'Modules/Bannerlord.Harmony' from BLSE to 'Mount & Blade II Bannerlord/Modules/Bannerlord.Harmony'</p>
<p>You need to copy content of 'Modules/Bannerlord.Harmony' from Harmony to 'Mount & Blade II Bannerlord/Modules/Bannerlord.Harmony'</p>
<img src="https://media.discordapp.net/attachments/422092475163869201/1088725020458614794/image.png" alt="Bannerlord.Harmony Installation Path" width="500">
</details>
* Do I need to include both `Win64_Shipping_Client` and `Gaming.Desktop.x64_Shipping_Client` directories?
Expand Down
7 changes: 4 additions & 3 deletions build/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<Project>

<PropertyGroup>
<GameFolder>$(BANNERLORD_GAME_DIR)</GameFolder>
<GameVersion>1.0.0</GameVersion>
<GameVersionFlat>$([System.String]::Copy('$(GameVersion)').Replace('.',''))</GameVersionFlat>
<GameVersionConstant>v$(GameVersionFlat)</GameVersionConstant>
Expand All @@ -10,13 +11,13 @@

<!--Development Variables-->
<PropertyGroup>
<Version>1.3.8</Version>
<Version>1.3.9</Version>
<HarmonyVersion>2.2.2</HarmonyVersion>
<BUTRSharedVersion>3.0.0.136</BUTRSharedVersion>
<BUTRModuleManagerVersion>5.0.198</BUTRModuleManagerVersion>
<BUTRModuleManagerVersion>5.0.209</BUTRModuleManagerVersion>
<HarmonyExtensionsVersion>3.2.0.77</HarmonyExtensionsVersion>
<HarmonyAnalyzerVersion>1.0.1.44</HarmonyAnalyzerVersion>
<LauncherManagerVersion>1.0.74</LauncherManagerVersion>
<LauncherManagerVersion>1.0.76</LauncherManagerVersion>
<DebugType>full</DebugType>
</PropertyGroup>

Expand Down
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
---------------------------------------------------------------------------------------------------
Version: 1.3.9
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
* Fixed LauncherEx version detection
* Added v1.2.0 support
---------------------------------------------------------------------------------------------------
Version: 1.3.8
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
* Another fix for continuing save files with spaces in names
Expand Down
3 changes: 2 additions & 1 deletion src/Bannerlord.BLSE.Shared/Bannerlord.BLSE.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
<!-- Embedding multiple versions of LauncherEx -->
<ItemGroup Condition="$(Configuration) == 'Release'">
<!-- From highest to lowest. Don't ask why. -->
<GameAPIVersion Include="v1.1.0-v1.1.1" GameVersion="1.1.0" Version="v1.1.0" Flat="110" Visible="false" />
<GameAPIVersion Include="v1.2.0-v1.2.0" GameVersion="1.2.0" Version="v1.2.0" Flat="120" Visible="false" />
<GameAPIVersion Include="v1.1.0-v1.1.4" GameVersion="1.1.0" Version="v1.1.0" Flat="110" Visible="false" />
<GameAPIVersion Include="v1.0.0-v1.0.3" GameVersion="1.0.0" Version="v1.0.0" Flat="100" Visible="false" />
<EmbeddedResource Include="@(GameAPIVersion->'..\Bannerlord.LauncherEx\bin\$(Configuration)_%(Flat)\netstandard2.0\Bannerlord.LauncherEx.dll')" Visible="false">
<Link>Bannerlord.LauncherEx_%(Version).dll</Link>
Expand Down
4 changes: 1 addition & 3 deletions src/Bannerlord.BLSE.Shared/ModuleInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
using System.Runtime.CompilerServices;
using System.Threading;

using TaleWorlds.Core;

internal static class ModuleInitializer
{
private static int _isAttached;
Expand Down Expand Up @@ -130,7 +128,7 @@ At least v2.2.2.x is required!
toLoad = exactVersion.Item1;

var comparer = new ApplicationVersionComparer();
var closestVersion = versions.Where(x => comparer.Compare(x.Item2, gameVersion) <= 0).MaxBy(x => x.Item2, comparer, out var maxKey);
var closestVersion = versions.Where(x => comparer.Compare(x.Item2, gameVersion) <= 0).MaxByOrDefault(x => x.Item2, comparer, out _);
if (closestVersion.Item2 != ApplicationVersion.Empty)
toLoad = closestVersion.Item1;

Expand Down
36 changes: 36 additions & 0 deletions src/Bannerlord.BLSE.Shared/Utils/IEnumerableExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;

namespace Bannerlord.BLSE.Shared.Utils;

public static class Extensions
{
public static TSource? MaxByOrDefault<TSource, TKey>(this IEnumerable<TSource> enumerable, Func<TSource, TKey> selector, IComparer<TKey> comparer, out TKey? maxKey)
{
if (enumerable == null)
throw new ArgumentNullException(nameof(enumerable));
if (selector == null)
throw new ArgumentNullException(nameof(selector));
if (comparer == null)
throw new ArgumentNullException(nameof(comparer));

using var enumerator = enumerable.GetEnumerator();
if (!enumerator.MoveNext())
{
maxKey = default;
return default;
}

var source = enumerator.Current;
maxKey = selector(source);
while (enumerator.MoveNext())
{
var current = enumerator.Current;
var x = selector(current);
if (comparer.Compare(x, maxKey) <= 0) continue;
source = current;
maxKey = x;
}
return source;
}
}
15 changes: 7 additions & 8 deletions src/Bannerlord.BLSE.Shared/Utils/ReflectionParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

using System;

namespace Bannerlord.BLSE.Shared.Utils
namespace Bannerlord.BLSE.Shared.Utils;

public static class ReflectionParser
{
public static class ReflectionParser
public static Version GetAssemblyVersion(string? path)
{
public static Version GetAssemblyVersion(string? path)
{
if (path is null) return new Version();
var assemblyDefinition = AssemblyDefinition.ReadAssembly(path);
return assemblyDefinition.Name.Version;
}
if (path is null) return new Version();
var assemblyDefinition = AssemblyDefinition.ReadAssembly(path);
return assemblyDefinition.Name.Version;
}
}
2 changes: 1 addition & 1 deletion src/Bannerlord.LauncherEx/Bannerlord.LauncherEx.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
</Target>

<Target Name="BuildExtended">
<CallTarget Targets="Build"/>
<CallTarget Targets="Build" />
</Target>

</Project>
28 changes: 28 additions & 0 deletions src/Bannerlord.LauncherEx/Helpers/Input/BUTRInputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ public bool IsKeyDownImmediate(InputKey key) =>
public void UpdateKeyData(byte[] keyData) => InputManager.UpdateKeyData(keyData);

public bool IsControllerConnected() => InputManager.IsControllerConnected();
#if v100 || v101 || v102 || v103 || v110 || v111 || v112 || v113 || v114 || v115
public InputKey GetControllerClickKey() => InputManager.GetControllerClickKey();
#endif

#if v110 || v111
public void SetRumbleEffect(float[] lowFrequencyLevels, float[] lowFrequencyDurations, int numLowFrequencyElements, float[] highFrequencyLevels,
Expand Down Expand Up @@ -136,6 +138,32 @@ private static TReturn IsAction<TReturn>(InputKey key, Func<Keys, TReturn> actio
return action(rawKey);
}

#if v120
public TaleWorlds.InputSystem.Input.ControllerTypes GetControllerType() => InputManager.GetControllerType();

public float GetGyroX() => InputManager.GetGyroX();
public float GetGyroY() => InputManager.GetGyroY();
public float GetGyroZ() => InputManager.GetGyroZ();

public InputKey[] GetClickKeys() => InputManager.GetClickKeys();

public void SetRumbleEffect(float[] lowFrequencyLevels, float[] lowFrequencyDurations, int numLowFrequencyElements, float[] highFrequencyLevels, float[] highFrequencyDurations, int numHighFrequencyElements) =>
InputManager.SetRumbleEffect(lowFrequencyLevels, lowFrequencyDurations, numLowFrequencyElements, highFrequencyLevels, highFrequencyDurations, numHighFrequencyElements);

public void SetTriggerFeedback(byte leftTriggerPosition, byte leftTriggerStrength, byte rightTriggerPosition, byte rightTriggerStrength) =>
InputManager.SetTriggerFeedback(leftTriggerPosition, leftTriggerStrength, rightTriggerPosition, rightTriggerStrength);

public void SetTriggerWeaponEffect(byte leftStartPosition, byte leftEnd_position, byte leftStrength, byte rightStartPosition, byte rightEndPosition, byte rightStrength) =>
InputManager.SetTriggerWeaponEffect(leftStartPosition, leftEnd_position, leftStrength, rightStartPosition, rightEndPosition, rightStrength);

public void SetTriggerVibration(float[] leftTriggerAmplitudes, float[] leftTriggerFrequencies, float[] leftTriggerDurations, int numLeftTriggerElements, float[] rightTriggerAmplitudes, float[] rightTriggerFrequencies, float[] rightTriggerDurations, int numRightTriggerElements) =>
InputManager.SetTriggerVibration(leftTriggerAmplitudes, leftTriggerFrequencies, leftTriggerDurations, numLeftTriggerElements, rightTriggerAmplitudes, rightTriggerFrequencies, rightTriggerDurations, numRightTriggerElements);

public void SetLightbarColor(float red, float green, float blue) => InputManager.SetLightbarColor(red, green, blue);

public bool IsAnyTouchActive() => InputManager.IsAnyTouchActive();
#endif

public void Dispose()
{
_currentState.Dispose();
Expand Down

0 comments on commit 19d2c87

Please sign in to comment.