Skip to content

Commit

Permalink
Merge pull request #21 from BUTR/dev
Browse files Browse the repository at this point in the history
v1.2.0
  • Loading branch information
Aragas authored Mar 23, 2023
2 parents 82b7571 + 3b8b465 commit cff143c
Show file tree
Hide file tree
Showing 25 changed files with 326 additions and 233 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ on:
- 'src/Bannerlord.LauncherEx/**.*'
- 'src/Bannerlord.BLSE/**.*'
- 'src/Bannerlord.BLSE.Shared/**.*'
- 'src/Bannerlord.BLSE.NativeAOT.Standalone/**.*'
- 'src/Bannerlord.BLSE.NativeAOT.Launcher/**.*'
- 'src/Bannerlord.BLSE.NativeAOT.LauncherEx/**.*'
- 'src/Bannerlord.BLSE.Loaders.Standalone/**.*'
- 'src/Bannerlord.BLSE.Loaders.Launcher/**.*'
- 'src/Bannerlord.BLSE.Loaders.LauncherEx/**.*'
workflow_dispatch:

env:
Expand Down Expand Up @@ -46,7 +46,7 @@ jobs:

build-loaders-standalone:
name: Build Loaders Standalone
runs-on: windows-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

Expand All @@ -55,10 +55,10 @@ jobs:
with:
github-token: ${{secrets.GITHUB_TOKEN}}

- name: Build Bannerlord.BLSE.NativeAOT.Standalone
- name: Build Bannerlord.BLSE.Loaders.Standalone
run: |
mkdir bannerlord;
dotnet build src/Bannerlord.BLSE.NativeAOT.Standalone/Bannerlord.BLSE.NativeAOT.Standalone.csproj --configuration Release -p:GameFolder="$PWD/bannerlord" /nowarn:MSB4011;
dotnet build src/Bannerlord.BLSE.Loaders.Standalone/Bannerlord.BLSE.Loaders.Standalone.csproj --configuration Release -p:GameFolder="$PWD/bannerlord" /nowarn:MSB4011;
shell: pwsh

- name: Upload Bannerlord folder
Expand All @@ -70,7 +70,7 @@ jobs:

build-loaders-launcher:
name: Build Loaders Launcher
runs-on: windows-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

Expand All @@ -79,10 +79,10 @@ jobs:
with:
github-token: ${{secrets.GITHUB_TOKEN}}

- name: Build Bannerlord.BLSE.NativeAOT.Launcher
- name: Build Bannerlord.BLSE.Loaders.Launcher
run: |
mkdir bannerlord;
dotnet build src/Bannerlord.BLSE.NativeAOT.Launcher/Bannerlord.BLSE.NativeAOT.Launcher.csproj --configuration Release -p:GameFolder="$PWD/bannerlord" /nowarn:MSB4011;
dotnet build src/Bannerlord.BLSE.Loaders.Launcher/Bannerlord.BLSE.Loaders.Launcher.csproj --configuration Release -p:GameFolder="$PWD/bannerlord" /nowarn:MSB4011;
shell: pwsh

- name: Upload Bannerlord folder
Expand All @@ -94,7 +94,7 @@ jobs:

build-loaders-launcherex:
name: Build Loaders LauncehrEx
runs-on: windows-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

Expand All @@ -103,10 +103,10 @@ jobs:
with:
github-token: ${{secrets.GITHUB_TOKEN}}

- name: Build Bannerlord.BLSE.NativeAOT.LauncherEx
- name: Build Bannerlord.BLSE.Loaders.LauncherEx
run: |
mkdir bannerlord;
dotnet build src/Bannerlord.BLSE.NativeAOT.LauncherEx/Bannerlord.BLSE.NativeAOT.LauncherEx.csproj --configuration Release -p:GameFolder="$PWD/bannerlord" /nowarn:MSB4011;
dotnet build src/Bannerlord.BLSE.Loaders.LauncherEx/Bannerlord.BLSE.Loaders.LauncherEx.csproj --configuration Release -p:GameFolder="$PWD/bannerlord" /nowarn:MSB4011;
shell: pwsh

- name: Upload Bannerlord folder
Expand Down
2 changes: 1 addition & 1 deletion build/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<!--Development Variables-->
<PropertyGroup>
<Version>1.1.0</Version>
<Version>1.2.0</Version>
<HarmonyVersion>2.10.1</HarmonyVersion>
<BUTRSharedVersion>3.0.0.135</BUTRSharedVersion>
<BUTRModuleManagerVersion>5.0.198</BUTRModuleManagerVersion>
Expand Down
8 changes: 8 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
---------------------------------------------------------------------------------------------------
Version: 1.2.0
Game Versions: v1.0.0,v1.0.1,v1.0.2,v1.0.3,v1.1.0,v1.1.1
* Reverted native code
* Added AccessViolationException handling support
* Fixed Singleplayer not being shown by default
* Better error messages
* Added /forcenetcore for Steam/GOG/Epic
---------------------------------------------------------------------------------------------------
Version: 1.1.0
Game Versions: v1.0.0,v1.0.1,v1.0.2,v1.0.3,v1.1.0,v1.1.1
* The launchers are now native code instead of C#, but for the cost of increased size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,26 @@

<PropertyGroup>
<OutputType>winexe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<PlatformTarget>x64</PlatformTarget>
<TargetFramework>net472</TargetFramework>
<LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable>
<ApplicationIcon>../../resources/BLSE_SMALL.ico</ApplicationIcon>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);LAUNCHER;</DefineConstants>
<DefineConstants>$(DefineConstants);LAUNCHER;NETCOREHOSTING;_NETFRAMEWORKHOSTING</DefineConstants>
<AssemblyName>Bannerlord.BLSE.Launcher</AssemblyName>
</PropertyGroup>

<!--
<PropertyGroup>
<PublishAot>true</PublishAot>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<TrimMode>full</TrimMode>
<DebugType>none</DebugType>
<GenerateRuntimeConfigurationFiles>false</GenerateRuntimeConfigurationFiles>
</PropertyGroup>

<PropertyGroup>
<DebuggerSupport>false</DebuggerSupport>
<AutoreleasePoolSupport>false</AutoreleasePoolSupport>
Expand All @@ -38,30 +43,27 @@
<IlcInvariantGlobalization>true</IlcInvariantGlobalization>
<IlcTrimMetadata>true</IlcTrimMetadata>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\Bannerlord.BLSE.NativeAOT.Standalone\NETCoreLoader.cs">
<Link>NETCoreLoader.cs</Link>
</Compile>
<Compile Include="..\Bannerlord.BLSE.NativeAOT.Standalone\NETFrameworkLoader.cs">
<Link>NETFrameworkLoader.cs</Link>
</Compile>
<Compile Include="..\Bannerlord.BLSE.NativeAOT.Standalone\Program.cs">
<Link>Program.cs</Link>
</Compile>
<PackageReference Include="Microsoft.DotNet.ILCompiler; runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="8.0.0-preview.2.23128.3" />
</ItemGroup>
-->


<Target Name="PublishOnBuild" AfterTargets="Build">
<CallTarget Targets="Publish" />
</Target>

<Target Name="PostBuild" AfterTargets="PublishOnBuild" Condition="Exists($(GameFolder))">
<Target Name="PostBuild" AfterTargets="Publish" Condition="Exists($(GameFolder))">
<ItemGroup>
<Files Include="$(MSBuildProjectDirectory)\$(OutputPath)\native\$(AssemblyName).exe" />
<Files Include="$(MSBuildProjectDirectory)\$(OutputPath)\publish\$(AssemblyName).exe" />
<FilesWin64 Include="$(MSBuildProjectDirectory)\_Root\bin\Win64_Shipping_Client\**\*" />
</ItemGroup>
<Copy SourceFiles="@(FilesWin64)" DestinationFolder="$(GameFolder)\bin\Win64_Shipping_Client" />
<Copy SourceFiles="@(Files)" DestinationFolder="$(GameFolder)\bin\Win64_Shipping_Client" />
<Copy SourceFiles="@(Files)" DestinationFolder="$(GameFolder)\bin\Gaming.Desktop.x64_Shipping_Client" />
</Target>

<ItemGroup>
<Compile Include="..\Bannerlord.BLSE.Loaders.Standalone\**\*.cs" Exclude="..\Bannerlord.BLSE.Loaders.Standalone\obj\**\*.cs" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"Bannerlord.BLSE.NativeAOT.Launcher": {
"commandName": "Project",
"environmentVariables": {

}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,26 @@

<PropertyGroup>
<OutputType>winexe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<PlatformTarget>x64</PlatformTarget>
<TargetFramework>net472</TargetFramework>
<LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable>
<ApplicationIcon>../../resources/BLSE_SMALL.ico</ApplicationIcon>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);LAUNCHEREX;</DefineConstants>
<DefineConstants>$(DefineConstants);LAUNCHEREX;NETCOREHOSTING;_NETFRAMEWORKHOSTING</DefineConstants>
<AssemblyName>Bannerlord.BLSE.LauncherEx</AssemblyName>
</PropertyGroup>

<!--
<PropertyGroup>
<PublishAot>true</PublishAot>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<TrimMode>full</TrimMode>
<DebugType>none</DebugType>
<GenerateRuntimeConfigurationFiles>false</GenerateRuntimeConfigurationFiles>
</PropertyGroup>

<PropertyGroup>
<DebuggerSupport>false</DebuggerSupport>
<AutoreleasePoolSupport>false</AutoreleasePoolSupport>
Expand All @@ -38,29 +43,26 @@
<IlcInvariantGlobalization>true</IlcInvariantGlobalization>
<IlcTrimMetadata>true</IlcTrimMetadata>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\Bannerlord.BLSE.NativeAOT.Standalone\NETCoreLoader.cs">
<Link>NETCoreLoader.cs</Link>
</Compile>
<Compile Include="..\Bannerlord.BLSE.NativeAOT.Standalone\NETFrameworkLoader.cs">
<Link>NETFrameworkLoader.cs</Link>
</Compile>
<Compile Include="..\Bannerlord.BLSE.NativeAOT.Standalone\Program.cs">
<Link>Program.cs</Link>
</Compile>
<PackageReference Include="Microsoft.DotNet.ILCompiler; runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="8.0.0-preview.2.23128.3" />
</ItemGroup>
-->

<Target Name="PublishRoslynExecutableProjects" AfterTargets="Build">
<CallTarget Targets="Publish" />
</Target>

<Target Name="PostBuild" AfterTargets="Publish" Condition="Exists($(GameFolder))">
<ItemGroup>
<Files Include="$(MSBuildProjectDirectory)\$(OutputPath)\native\$(AssemblyName).exe" />
<Files Include="$(MSBuildProjectDirectory)\$(OutputPath)\publish\$(AssemblyName).exe" />
<FilesWin64 Include="$(MSBuildProjectDirectory)\_Root\bin\Win64_Shipping_Client\**\*" />
</ItemGroup>
<Copy SourceFiles="@(FilesWin64)" DestinationFolder="$(GameFolder)\bin\Win64_Shipping_Client" />
<Copy SourceFiles="@(Files)" DestinationFolder="$(GameFolder)\bin\Win64_Shipping_Client" />
<Copy SourceFiles="@(Files)" DestinationFolder="$(GameFolder)\bin\Gaming.Desktop.x64_Shipping_Client" />
</Target>

<ItemGroup>
<Compile Include="..\Bannerlord.BLSE.Loaders.Standalone\**\*.cs" Exclude="..\Bannerlord.BLSE.Loaders.Standalone\obj\**\*.cs" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,26 @@

<PropertyGroup>
<OutputType>winexe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<PlatformTarget>x64</PlatformTarget>
<TargetFramework>net472</TargetFramework>
<LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable>
<ApplicationIcon>../../resources/BLSE_SMALL.ico</ApplicationIcon>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);STANDALONE;</DefineConstants>
<DefineConstants>$(DefineConstants);STANDALONE;NETCOREHOSTING;_NETFRAMEWORKHOSTING</DefineConstants>
<AssemblyName>Bannerlord.BLSE.Standalone</AssemblyName>
</PropertyGroup>

<!--
<PropertyGroup>
<PublishAot>true</PublishAot>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<TrimMode>full</TrimMode>
<DebugType>none</DebugType>
<GenerateRuntimeConfigurationFiles>false</GenerateRuntimeConfigurationFiles>
</PropertyGroup>

<PropertyGroup>
<DebuggerSupport>false</DebuggerSupport>
<AutoreleasePoolSupport>false</AutoreleasePoolSupport>
Expand All @@ -38,15 +43,20 @@
<IlcInvariantGlobalization>true</IlcInvariantGlobalization>
<IlcTrimMetadata>true</IlcTrimMetadata>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.ILCompiler; runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="8.0.0-preview.2.23128.3" />
</ItemGroup>
-->

<Target Name="PublishRoslynExecutableProjects" AfterTargets="Build">
<CallTarget Targets="Publish" />
</Target>

<Target Name="PostBuild" AfterTargets="Publish" Condition="Exists($(GameFolder))">
<ItemGroup>
<Files Include="$(MSBuildProjectDirectory)\$(OutputPath)\native\$(AssemblyName).exe" />
<Files Include="$(MSBuildProjectDirectory)\$(OutputPath)\publish\$(AssemblyName).exe" />
<FilesWin64 Include="$(MSBuildProjectDirectory)\_Root\bin\Win64_Shipping_Client\**\*" />
</ItemGroup>
<Copy SourceFiles="@(FilesWin64)" DestinationFolder="$(GameFolder)\bin\Win64_Shipping_Client" />
<Copy SourceFiles="@(Files)" DestinationFolder="$(GameFolder)\bin\Win64_Shipping_Client" />
<Copy SourceFiles="@(Files)" DestinationFolder="$(GameFolder)\bin\Gaming.Desktop.x64_Shipping_Client" />
</Target>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
using System.Runtime.InteropServices;
#if NETCOREHOSTING
using System;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace Bannerlord.BLSE;

[UnmanagedFunctionPointer(CallingConvention.StdCall)]
file delegate void EntryDelegate(int argc, IntPtr[] argv);

public static partial class NETCoreLoader
public static class NETCoreLoader
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void EntryDelegate(int argc, IntPtr[] argv);

private const string CoreCLRPath = "Microsoft.NETCore.App/coreclr.dll";

[LibraryImport(CoreCLRPath)]
private static partial int coreclr_initialize(IntPtr exePath, IntPtr appDomainFriendlyName, int propertyCount, IntPtr[] propertyKeys, IntPtr[] propertyValues, out IntPtr hostHandle, out IntPtr domainId);
[DllImport(CoreCLRPath)]
private static extern int coreclr_initialize(IntPtr exePath, IntPtr appDomainFriendlyName, int propertyCount, IntPtr[] propertyKeys, IntPtr[] propertyValues, out IntPtr hostHandle, out IntPtr domainId);

[LibraryImport(CoreCLRPath)]
private static partial int coreclr_create_delegate(IntPtr hostHandle, uint domainId, IntPtr entryPointAssemblyName, IntPtr entryPointTypeName, IntPtr entryPointMethodName, out IntPtr @delegate);
[DllImport(CoreCLRPath)]
private static extern int coreclr_create_delegate(IntPtr hostHandle, uint domainId, IntPtr entryPointAssemblyName, IntPtr entryPointTypeName, IntPtr entryPointMethodName, out IntPtr @delegate);

private static IntPtr NativeUTF8(string str)
{
Expand Down Expand Up @@ -89,4 +93,5 @@ public static void Launch(string[] args)
var @delegate = Marshal.GetDelegateForFunctionPointer<EntryDelegate>(pMethod);
@delegate(args.Length, args2);
}
}
}
#endif
Loading

0 comments on commit cff143c

Please sign in to comment.