Restructure project names and folder layout

This commit is contained in:
ghorsington committed 2022-08-14 17:19:09 +03:00
1 parent ae18f16803
commit f7857c7994
84 files changed
+342 -211

No files matched your search

+1 -5
View File
@@ -3,11 +3,7 @@
<Description>BepInEx Core library</Description>
<TargetFrameworks>net35;netstandard2.0</TargetFrameworks>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<AssemblyTitle>BepInEx</AssemblyTitle>
<Product>BepInEx</Product>
<OutputPath>..\bin\Core\</OutputPath>
<Description>Unity plugin injection framework</Description>
<!-- Force nuget assembly output on netstandard2.1 -->
<!-- Force nuget assembly output on netstandard2.0 -->
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
+4 -4
View File
@@ -1,8 +1,8 @@
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("BepInEx.Preloader.Core")]
[assembly: InternalsVisibleTo("BepInEx.UnityMono")]
[assembly: InternalsVisibleTo("BepInEx.NetLauncher")]
[assembly: InternalsVisibleTo("BepInEx.NetCore")]
[assembly: InternalsVisibleTo("BepInEx.IL2CPP")]
[assembly: InternalsVisibleTo("BepInEx.Unity.Mono")]
[assembly: InternalsVisibleTo("BepInEx.NET.Framework.Launcher")]
[assembly: InternalsVisibleTo("BepInEx.NET.CoreCLR")]
[assembly: InternalsVisibleTo("BepInEx.Unity.IL2CPP")]
[assembly: InternalsVisibleTo("BepInExTests")]
-13
View File
@@ -1,13 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net6</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\BepInEx.NetLauncher.Common\BepInEx.NetLauncher.Common.csproj" />
<ProjectReference Include="..\BepInEx.Preloader.Core\BepInEx.Preloader.Core.csproj" />
</ItemGroup>
<Import Project="..\BepInEx.NetLauncher.Shared\BepInEx.NetLauncher.Shared.projitems" Label="Shared" />
</Project>
@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>067bcc8c-fc25-4929-b4f4-c6a5a7496994</ProjectGuid>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<PropertyGroup />
<Import Project="BepInEx.NetLauncher.Shared.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>
@@ -2,9 +2,6 @@
<PropertyGroup>
<Description>Core classes and utilities for BepInEx Preloader</Description>
<TargetFrameworks>net35;netstandard2.0</TargetFrameworks>
<AssemblyTitle>BepInEx.Preloader.Core</AssemblyTitle>
<Product>BepInEx.Preloader.Core</Product>
<OutputPath>..\bin\Core</OutputPath>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\BepInEx.Core\BepInEx.Core.csproj"/>
@@ -1,6 +1,6 @@
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("BepInEx.Preloader.UnityMono")]
[assembly: InternalsVisibleTo("BepInEx.NetLauncher")]
[assembly: InternalsVisibleTo("BepInEx.NetCore")]
[assembly: InternalsVisibleTo("BepInEx.IL2CPP")]
[assembly: InternalsVisibleTo("BepInEx.Unity.Mono.Preloader")]
[assembly: InternalsVisibleTo("BepInEx.NET.Framework.Launcher")]
[assembly: InternalsVisibleTo("BepInEx.NET.CoreCLR")]
[assembly: InternalsVisibleTo("BepInEx.Unity.IL2CPP")]
+28 -32
View File
@@ -10,57 +10,52 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BepInExTests", "BepInExTest
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BepInEx.Preloader.Core", "BepInEx.Preloader.Core\BepInEx.Preloader.Core.csproj", "{15F8BC38-A761-4F93-8903-1B531AC5D9F9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BepInEx.UnityMono", "BepInEx.UnityMono\BepInEx.UnityMono.csproj", "{EAE9FAE6-8011-45A3-8B6E-0C7F14210533}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BepInEx.Unity.Mono", "Runtimes\Unity\BepInEx.Unity.Mono\BepInEx.Unity.Mono.csproj", "{EAE9FAE6-8011-45A3-8B6E-0C7F14210533}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BepInEx.Preloader.UnityMono", "BepInEx.Preloader.UnityMono\BepInEx.Preloader.UnityMono.csproj", "{D404C973-441D-48ED-B266-C21320BA0D87}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BepInEx.Unity.Mono.Preloader", "Runtimes\Unity\BepInEx.Unity.Mono.Preloader\BepInEx.Unity.Mono.Preloader.csproj", "{D404C973-441D-48ED-B266-C21320BA0D87}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BepInEx.Core", "BepInEx.Core\BepInEx.Core.csproj", "{4FFBA620-F5ED-47F9-B90C-DAD1316FD9B9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UnityMono", "UnityMono", "{6E2DD21E-0854-4F4A-B925-D90E0016D03D}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Mono", "Mono", "{6E2DD21E-0854-4F4A-B925-D90E0016D03D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BepInEx.NetLauncher", "BepInEx.NetLauncher\BepInEx.NetLauncher.csproj", "{490B052B-7F23-4052-AD04-613856618901}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BepInEx.NET.Framework.Launcher", "Runtimes\NET\BepInEx.NET.Framework.Launcher\BepInEx.NET.Framework.Launcher.csproj", "{490B052B-7F23-4052-AD04-613856618901}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NetFramework", "NetFramework", "{6EC98884-A3DC-4828-85EF-5F10F7519429}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NET", "NET", "{6EC98884-A3DC-4828-85EF-5F10F7519429}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "IL2CPP", "IL2CPP", "{D5F47CFC-E4F3-46EE-B4F3-2474CF7D9E2C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BepInEx.IL2CPP", "BepInEx.IL2CPP\BepInEx.IL2CPP.csproj", "{429D5F83-7FEC-4D09-AB82-E868EB61AF59}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BepInEx.Unity.IL2CPP", "Runtimes\Unity\BepInEx.Unity.IL2CPP\BepInEx.Unity.IL2CPP.csproj", "{429D5F83-7FEC-4D09-AB82-E868EB61AF59}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Markdown", "Markdown", "{68C57430-3E92-4B50-A9A5-208FE9CCD914}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BepInEx.NetLauncher.Common", "BepInEx.NetLauncher.Common\BepInEx.NetLauncher.Common.csproj", "{76EB1952-7826-471C-9CF3-815D094DA077}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BepInEx.NET.Common", "Runtimes\NET\BepInEx.NET.Common\BepInEx.NET.Common.csproj", "{76EB1952-7826-471C-9CF3-815D094DA077}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BepInEx.NetCore", "BepInEx.NetCore\BepInEx.NetCore.csproj", "{08083F40-98AA-4176-BA01-817C18C35C7F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BepInEx.NET.CoreCLR", "Runtimes\NET\BepInEx.NET.CoreCLR\BepInEx.NET.CoreCLR.csproj", "{08083F40-98AA-4176-BA01-817C18C35C7F}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "BepInEx.NetLauncher.Shared", "BepInEx.NetLauncher.Shared\BepInEx.NetLauncher.Shared.shproj", "{067BCC8C-FC25-4929-B4F4-C6A5A7496994}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scripts", "Scripts", "{A6DDBD9E-773C-437A-88AA-995BC5FE90DF}"
ProjectSection(SolutionItems) = preProject
build.bat = build.bat
build.sh = build.sh
build.ps1 = build.ps1
build.cake = build.cake
EndProjectSection
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "BepInEx.NET.Shared", "Runtimes\NET\BepInEx.NET.Shared\BepInEx.NET.Shared.shproj", "{067BCC8C-FC25-4929-B4F4-C6A5A7496994}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{12081C35-76DF-450C-AC83-1E1CB84516AA}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Doorstop", "Doorstop", "{C76B3E16-93A8-4CD7-95A2-18EBF2437001}"
ProjectSection(SolutionItems) = preProject
doorstop\doorstop_config_il2cpp.ini = doorstop\doorstop_config_il2cpp.ini
doorstop\doorstop_config_mono.ini = doorstop\doorstop_config_mono.ini
doorstop\run_bepinex_il2cpp.sh = doorstop\run_bepinex_il2cpp.sh
doorstop\run_bepinex_mono.sh = doorstop\run_bepinex_mono.sh
Directory.Build.targets = Directory.Build.targets
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Unity", "Unity", "{BF8F4E07-3B89-4152-89F4-9EF9D4AAA1E0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BepInEx.Unity.Core", "BepInEx.Unity.Core\BepInEx.Unity.Core.csproj", "{C32E74A3-C0BD-42DE-9E2F-D033D496ACB9}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BepInEx.Unity.Common", "Runtimes\Unity\BepInEx.Unity.Common\BepInEx.Unity.Common.csproj", "{C32E74A3-C0BD-42DE-9E2F-D033D496ACB9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "build\_build.csproj", "{8AC60656-4159-4EFA-A43D-B132564697F3}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "IL2CPP", "IL2CPP", "{E4E75C18-4156-4213-A20C-8677EF6B5312}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Doorstop", "Doorstop", "{CE06453E-44E7-4D50-9A68-AA15F4C1C8D1}"
ProjectSection(SolutionItems) = preProject
Runtimes\Unity\Doorstop\doorstop_config_il2cpp.ini = Runtimes\Unity\Doorstop\doorstop_config_il2cpp.ini
Runtimes\Unity\Doorstop\doorstop_config_mono.ini = Runtimes\Unity\Doorstop\doorstop_config_mono.ini
Runtimes\Unity\Doorstop\run_bepinex_il2cpp.sh = Runtimes\Unity\Doorstop\run_bepinex_il2cpp.sh
Runtimes\Unity\Doorstop\run_bepinex_mono.sh = Runtimes\Unity\Doorstop\run_bepinex_mono.sh
EndProjectSection
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
@@ -83,6 +78,8 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8AC60656-4159-4EFA-A43D-B132564697F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8AC60656-4159-4EFA-A43D-B132564697F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E7CD429A-D057-48E3-8C51-E5C934E8E07B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E7CD429A-D057-48E3-8C51-E5C934E8E07B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7CD429A-D057-48E3-8C51-E5C934E8E07B}.Release_NetFramework|Any CPU.ActiveCfg = Release|Any CPU
@@ -165,16 +162,15 @@ Global
{EAE9FAE6-8011-45A3-8B6E-0C7F14210533} = {6E2DD21E-0854-4F4A-B925-D90E0016D03D}
{D404C973-441D-48ED-B266-C21320BA0D87} = {6E2DD21E-0854-4F4A-B925-D90E0016D03D}
{490B052B-7F23-4052-AD04-613856618901} = {6EC98884-A3DC-4828-85EF-5F10F7519429}
{429D5F83-7FEC-4D09-AB82-E868EB61AF59} = {D5F47CFC-E4F3-46EE-B4F3-2474CF7D9E2C}
{76EB1952-7826-471C-9CF3-815D094DA077} = {6EC98884-A3DC-4828-85EF-5F10F7519429}
{08083F40-98AA-4176-BA01-817C18C35C7F} = {6EC98884-A3DC-4828-85EF-5F10F7519429}
{067BCC8C-FC25-4929-B4F4-C6A5A7496994} = {6EC98884-A3DC-4828-85EF-5F10F7519429}
{68C57430-3E92-4B50-A9A5-208FE9CCD914} = {12081C35-76DF-450C-AC83-1E1CB84516AA}
{A6DDBD9E-773C-437A-88AA-995BC5FE90DF} = {12081C35-76DF-450C-AC83-1E1CB84516AA}
{C76B3E16-93A8-4CD7-95A2-18EBF2437001} = {12081C35-76DF-450C-AC83-1E1CB84516AA}
{D5F47CFC-E4F3-46EE-B4F3-2474CF7D9E2C} = {BF8F4E07-3B89-4152-89F4-9EF9D4AAA1E0}
{6E2DD21E-0854-4F4A-B925-D90E0016D03D} = {BF8F4E07-3B89-4152-89F4-9EF9D4AAA1E0}
{C32E74A3-C0BD-42DE-9E2F-D033D496ACB9} = {BF8F4E07-3B89-4152-89F4-9EF9D4AAA1E0}
{E4E75C18-4156-4213-A20C-8677EF6B5312} = {BF8F4E07-3B89-4152-89F4-9EF9D4AAA1E0}
{429D5F83-7FEC-4D09-AB82-E868EB61AF59} = {E4E75C18-4156-4213-A20C-8677EF6B5312}
{CE06453E-44E7-4D50-9A68-AA15F4C1C8D1} = {BF8F4E07-3B89-4152-89F4-9EF9D4AAA1E0}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {55AC11EF-F568-4C79-A356-7ED9510145B1}
+2 -2
View File
@@ -30,8 +30,8 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BepInEx.Core\BepInEx.Core.csproj"/>
<ProjectReference Include="..\BepInEx.IL2CPP\BepInEx.IL2CPP.csproj"/>
<ProjectReference Include="..\BepInEx.Unity.IL2CPP\BepInEx.Unity.IL2CPP.csproj"/>
<!-- BepInEx.Unity only targets net35 because that's supported by all mono variants. -->
<ProjectReference Include="..\BepInEx.UnityMono\BepInEx.UnityMono.csproj"/>
<ProjectReference Include="..\Runtimes\Unity\BepInEx.Unity.Mono\BepInEx.Unity.Mono.csproj"/>
</ItemGroup>
</Project>
@@ -4,6 +4,7 @@ using System.Collections.Concurrent;
using System.IO;
using System.Linq;
using System.Threading;
using BepInEx.Unity.Mono.Configuration;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using UEC::UnityEngine;
+3 -2
View File
@@ -13,13 +13,14 @@
<RepositoryUrl>https://github.com/BepInEx/BepInEx</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Copyright>Copyright © 2022 BepInEx Team</Copyright>
<PackageOutputPath>../bin/NuGet</PackageOutputPath>
<BuildDir>$(SolutionDir)bin</BuildDir>
<PackageOutputPath>$(BuildDir)/NuGet</PackageOutputPath>
<PackageIcon>logo.png</PackageIcon>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<None Include="..\assets\logo.png" Pack="true" Visible="false" PackagePath=""/>
<None Include="$(SolutionDir)\Assets\logos\logo.png" Pack="true" Visible="false" PackagePath=""/>
</ItemGroup>
</Project>
+5
View File
@@ -0,0 +1,5 @@
<Project>
<PropertyGroup Condition="'$(DistributionIdentifier)' != ''">
<OutDir>$(BuildDir)/$(DistributionIdentifier)/</OutDir>
</PropertyGroup>
</Project>
@@ -2,7 +2,7 @@ using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
namespace BepInEx.NetLauncher.Common
namespace BepInEx.NET.Common
{
public abstract class BasePlugin
{
@@ -10,8 +10,8 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BepInEx.Core\BepInEx.Core.csproj"/>
<ProjectReference Include="..\BepInEx.Preloader.Core\BepInEx.Preloader.Core.csproj"/>
<ProjectReference Include="..\..\..\BepInEx.Core\BepInEx.Core.csproj"/>
<ProjectReference Include="..\..\..\BepInEx.Preloader.Core\BepInEx.Preloader.Core.csproj"/>
</ItemGroup>
</Project>
@@ -3,7 +3,7 @@ using System.Reflection;
using BepInEx.Bootstrap;
using BepInEx.Preloader.Core.Logging;
namespace BepInEx.NetLauncher.Common
namespace BepInEx.NET.Common
{
public class NetChainloader : BaseChainloader<BasePlugin>
{
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<DistributionIdentifier>NET.CoreCLR</DistributionIdentifier>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\BepInEx.NET.Common\BepInEx.NET.Common.csproj"/>
<ProjectReference Include="..\..\..\BepInEx.Preloader.Core\BepInEx.Preloader.Core.csproj"/>
</ItemGroup>
<Import Project="..\BepInEx.NET.Shared\BepInEx.NET.Shared.projitems" Label="Shared"/>
</Project>
@@ -3,8 +3,8 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using BepInEx.Logging;
using BepInEx.NetCore;
using BepInEx.NetLauncher.Shared;
using BepInEx.NET.CoreCLR;
using BepInEx.NET.Shared;
using BepInEx.Preloader.Core;
internal class StartupHook
@@ -139,7 +139,7 @@ internal class StartupHook
}
}
namespace BepInEx.NetCore
namespace BepInEx.NET.CoreCLR
{
internal static class NetCorePreloaderRunner
{
@@ -4,13 +4,13 @@ using System.IO;
using System.Reflection;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using BepInEx.NetLauncher.Common;
using BepInEx.NET.Common;
using BepInEx.Preloader.Core;
using BepInEx.Preloader.Core.Logging;
using BepInEx.Preloader.Core.Patching;
using Mono.Cecil;
namespace BepInEx.NetCore
namespace BepInEx.NET.CoreCLR
{
internal class NetCorePreloader
{
@@ -4,20 +4,18 @@
<OutputType>Exe</OutputType>
<TargetFramework>net452</TargetFramework>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<AssemblyTitle>BepInEx.NetLauncher</AssemblyTitle>
<Product>BepInEx.NetLauncher</Product>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<PlatformTarget>x86</PlatformTarget>
<OutputPath>..\bin\NetLauncher\</OutputPath>
<DistributionIdentifier>NET.Framework</DistributionIdentifier>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\BepInEx.Core\BepInEx.Core.csproj"/>
<ProjectReference Include="..\BepInEx.NetLauncher.Common\BepInEx.NetLauncher.Common.csproj"/>
<ProjectReference Include="..\BepInEx.Preloader.Core\BepInEx.Preloader.Core.csproj" PrivateAssets="All"/>
<ProjectReference Include="..\..\..\BepInEx.Core\BepInEx.Core.csproj"/>
<ProjectReference Include="..\BepInEx.NET.Common\BepInEx.NET.Common.csproj"/>
<ProjectReference Include="..\..\..\BepInEx.Preloader.Core\BepInEx.Preloader.Core.csproj" PrivateAssets="All"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="HarmonyX" Version="2.10.0"/>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="All"/>
</ItemGroup>
<Import Project="..\BepInEx.NetLauncher.Shared\BepInEx.NetLauncher.Shared.projitems" Label="Shared"/>
<Import Project="..\BepInEx.NET.Shared\BepInEx.NET.Shared.projitems" Label="Shared"/>
</Project>
@@ -7,8 +7,8 @@ using System.Runtime.InteropServices;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.NetLauncher.Common;
using BepInEx.NetLauncher.RuntimeFixes;
using BepInEx.NET.Common;
using BepInEx.NET.Framework.Launcher.RuntimeFixes;
using BepInEx.Preloader.Core;
using BepInEx.Preloader.Core.Logging;
using BepInEx.Preloader.Core.Patching;
@@ -16,7 +16,7 @@ using HarmonyLib;
using Mono.Cecil;
using MonoMod.Utils;
namespace BepInEx.NetLauncher;
namespace BepInEx.NET.Framework.Launcher;
public static class NetPreloader
{
@@ -3,10 +3,10 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using BepInEx.Logging;
using BepInEx.NetLauncher.Shared;
using BepInEx.NET.Shared;
using BepInEx.Preloader.Core;
namespace BepInEx.NetLauncher;
namespace BepInEx.NET.Framework.Launcher;
internal class Program
{
@@ -5,7 +5,7 @@ using System.Reflection;
using BepInEx.Logging;
using HarmonyLib;
namespace BepInEx.NetLauncher.RuntimeFixes;
namespace BepInEx.NET.Framework.Launcher.RuntimeFixes;
internal class AssemblyFixes
{
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>067bcc8c-fc25-4929-b4f4-c6a5a7496994</ProjectGuid>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"/>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props"/>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props"/>
<PropertyGroup/>
<Import Project="BepInEx.NetLauncher.Shared.projitems" Label="Shared"/>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets"/>
</Project>
@@ -9,7 +9,7 @@ using System.Reflection;
// and placing this logic inside of an external assembly will cause a crash.
// A shared project is the only way to deduplicate code here
namespace BepInEx.NetLauncher.Shared
namespace BepInEx.NET.Shared
{
internal static class SharedEntrypoint
{
@@ -18,7 +18,9 @@ namespace BepInEx.NetLauncher.Shared
return (sender, args) => RemoteResolveInternal(sender, args, resolveDirectories);
}
private static Assembly RemoteResolveInternal(object sender, ResolveEventArgs reference, List<string> resolveDirectories)
private static Assembly RemoteResolveInternal(object sender,
ResolveEventArgs reference,
List<string> resolveDirectories)
{
var assemblyName = new AssemblyName(reference.Name);
@@ -6,11 +6,11 @@ using System.Text;
using AssetRipper.VersionUtilities;
using MonoMod.Utils;
[assembly: InternalsVisibleTo("BepInEx.Preloader.UnityMono")]
[assembly: InternalsVisibleTo("BepInEx.UnityMono")]
[assembly: InternalsVisibleTo("BepInEx.IL2CPP")]
[assembly: InternalsVisibleTo("BepInEx.Unity.Mono.Preloader")]
[assembly: InternalsVisibleTo("BepInEx.Unity.Mono")]
[assembly: InternalsVisibleTo("BepInEx.Unity.IL2CPP")]
namespace BepInEx.Unity.Core;
namespace BepInEx.Unity.Common;
/// <summary>
/// Various information about the currently executing Unity player.
@@ -2,7 +2,7 @@
using BepInEx.Logging;
using Il2CppInterop.Runtime.InteropTypes;
namespace BepInEx.IL2CPP;
namespace BepInEx.Unity.IL2CPP;
public abstract class BasePlugin
{
@@ -3,16 +3,14 @@
<Description>BepInEx support library for Il2Cpp games</Description>
<TargetFramework>net6.0</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<AssemblyTitle>BepInEx.IL2CPP</AssemblyTitle>
<Product>BepInEx.IL2CPP</Product>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<OutputPath>..\bin\IL2CPP\</OutputPath>
<DistributionIdentifier>Unity.IL2CPP</DistributionIdentifier>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\BepInEx.Core\BepInEx.Core.csproj"/>
<ProjectReference Include="..\BepInEx.Preloader.Core\BepInEx.Preloader.Core.csproj" PrivateAssets="All"/>
<ProjectReference Include="..\BepInEx.Unity.Core\BepInEx.Unity.Core.csproj"/>
<ProjectReference Include="..\..\..\BepInEx.Core\BepInEx.Core.csproj"/>
<ProjectReference Include="..\..\..\BepInEx.Preloader.Core\BepInEx.Preloader.Core.csproj" PrivateAssets="All"/>
<ProjectReference Include="..\BepInEx.Unity.Common\BepInEx.Unity.Common.csproj"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="HarmonyX" Version="2.10.0"/>
@@ -3,11 +3,12 @@ using System.Diagnostics;
using System.IO;
using System.Threading;
using BepInEx;
using BepInEx.IL2CPP;
using BepInEx.IL2CPP.Utils;
using BepInEx.Preloader.Core;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils;
using MonoMod.Utils;
// ReSharper disable once CheckNamespace
namespace Doorstop;
internal static class Entrypoint
@@ -18,7 +19,8 @@ internal static class Entrypoint
public static void Start()
{
// We set it to the current directory first as a fallback, but try to use the same location as the .exe file.
var silentExceptionLog = Environment.GetEnvironmentVariable("BEPINEX_PRELOADER_LOG") ?? $"preloader_{DateTime.Now:yyyyMMdd_HHmmss_fff}.log";
var silentExceptionLog = Environment.GetEnvironmentVariable("BEPINEX_PRELOADER_LOG") ??
$"preloader_{DateTime.Now:yyyyMMdd_HHmmss_fff}.log";
Mutex mutex = null;
try
@@ -4,7 +4,7 @@ using System.Runtime.InteropServices;
using BepInEx.Logging;
using MonoMod.RuntimeDetour;
namespace BepInEx.IL2CPP.Hook;
namespace BepInEx.Unity.IL2CPP.Hook;
internal abstract class BaseNativeDetour<T> : INativeDetour where T : BaseNativeDetour<T>
{
@@ -1,6 +1,6 @@
using System;
namespace BepInEx.IL2CPP.Hook.Dobby;
namespace BepInEx.Unity.IL2CPP.Hook.Dobby;
internal class DobbyDetour : BaseNativeDetour<DobbyDetour>
{
@@ -1,6 +1,6 @@
using System.Runtime.InteropServices;
namespace BepInEx.IL2CPP.Hook.Dobby;
namespace BepInEx.Unity.IL2CPP.Hook.Dobby;
internal static unsafe class DobbyLib
{
@@ -1,7 +1,7 @@
using System;
using System.Runtime.CompilerServices;
namespace BepInEx.IL2CPP.Hook.Funchook;
namespace BepInEx.Unity.IL2CPP.Hook.Funchook;
internal class FunchookDetour : BaseNativeDetour<FunchookDetour>
{
@@ -1,8 +1,6 @@
using System.Runtime.InteropServices;
using BepInEx.IL2CPP.Utils;
using Il2CppSystem.IO;
namespace BepInEx.IL2CPP.Hook.Funchook;
namespace BepInEx.Unity.IL2CPP.Hook.Funchook;
internal enum FunchookResult
{
@@ -1,14 +1,13 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;
using BepInEx.Configuration;
using BepInEx.IL2CPP.Hook.Dobby;
using BepInEx.IL2CPP.Hook.Funchook;
using BepInEx.Unity.IL2CPP.Hook.Dobby;
using BepInEx.Unity.IL2CPP.Hook.Funchook;
using MonoMod.RuntimeDetour;
using MonoMod.Utils;
namespace BepInEx.IL2CPP.Hook;
namespace BepInEx.Unity.IL2CPP.Hook;
public interface INativeDetour : IDetour
{
@@ -38,6 +37,7 @@ public interface INativeDetour : IDetour
{
return new CacheDetourWrapper(detour, target);
}
return detour;
}
@@ -1,7 +1,7 @@
using Il2CppInterop.Runtime.Injection;
using System;
using System;
using Il2CppInterop.Runtime.Injection;
namespace BepInEx.IL2CPP.Hook;
namespace BepInEx.Unity.IL2CPP.Hook;
internal class Il2CppInteropDetourProvider : IDetourProvider
{
@@ -1,23 +1,19 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.IL2CPP.Hook;
using BepInEx.IL2CPP.Logging;
using BepInEx.IL2CPP.Utils;
using BepInEx.Logging;
using BepInEx.Preloader.Core;
using BepInEx.Preloader.Core.Logging;
using BepInEx.Unity.IL2CPP.Hook;
using BepInEx.Unity.IL2CPP.Logging;
using BepInEx.Unity.IL2CPP.Utils;
using Il2CppInterop.Runtime.InteropTypes;
using MonoMod.Utils;
using UnityEngine;
using Logger = BepInEx.Logging.Logger;
namespace BepInEx.IL2CPP;
namespace BepInEx.Unity.IL2CPP;
public class IL2CPPChainloader : BaseChainloader<BasePlugin>
{
@@ -9,10 +9,10 @@ using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx.Configuration;
using BepInEx.IL2CPP.Hook;
using BepInEx.IL2CPP.Logging;
using BepInEx.Logging;
using BepInEx.Unity.Core;
using BepInEx.Unity.Common;
using BepInEx.Unity.IL2CPP.Hook;
using BepInEx.Unity.IL2CPP.Logging;
using Cpp2IL.Core;
using HarmonyLib;
using Il2CppInterop.Common;
@@ -27,7 +27,7 @@ using MonoMod.Utils;
using LogLevel = Microsoft.Extensions.Logging.LogLevel;
using MSLoggerFactory = Microsoft.Extensions.Logging.LoggerFactory;
namespace BepInEx.IL2CPP;
namespace BepInEx.Unity.IL2CPP;
internal static class Il2CppInteropManager
{
@@ -5,7 +5,7 @@ using Microsoft.Extensions.Logging;
using BepInExLogLevel = BepInEx.Logging.LogLevel;
using LogLevel = Microsoft.Extensions.Logging.LogLevel;
namespace BepInEx.IL2CPP.Logging;
namespace BepInEx.Unity.IL2CPP.Logging;
internal class BepInExLoggerProvider : ILoggerProvider
{
@@ -2,7 +2,7 @@
using System.Runtime.InteropServices;
using BepInEx.Logging;
namespace BepInEx.IL2CPP.Logging;
namespace BepInEx.Unity.IL2CPP.Logging;
public class IL2CPPLogSource : ILogSource
{
@@ -2,7 +2,7 @@ using System;
using BepInEx.Logging;
using UnityEngine;
namespace BepInEx.IL2CPP.Logging;
namespace BepInEx.Unity.IL2CPP.Logging;
public class IL2CPPUnityLogSource : ILogSource
{
@@ -7,9 +7,9 @@ using BepInEx.Preloader.Core;
using BepInEx.Preloader.Core.Logging;
using BepInEx.Preloader.Core.Patching;
using BepInEx.Preloader.RuntimeFixes;
using BepInEx.Unity.Core;
using BepInEx.Unity.Common;
namespace BepInEx.IL2CPP;
namespace BepInEx.Unity.IL2CPP;
public static class Preloader
{
@@ -31,7 +31,6 @@ internal static class RedirectStdErrFix
{
if (PlatformHelper.Is(Platform.Windows))
{
Logger.Log(LogLevel.Info, "Redirecting stderr");
var errorFile = CreateFile(Path.Combine(Paths.BepInExRootPath, "ErrorLog.log"), GENERIC_WRITE,
FILE_SHARE_READ,
0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
@@ -1,4 +1,4 @@
namespace BepInEx.IL2CPP.UnityEngine;
namespace BepInEx.Unity.IL2CPP.UnityEngine;
public enum KeyCode
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Reflection;
using BepInEx.Preloader.Core;
namespace BepInEx.IL2CPP;
namespace BepInEx.Unity.IL2CPP;
internal static class UnityPreloaderRunner
{
@@ -1,6 +1,6 @@
using Il2CppSystem.Collections;
namespace BepInEx.IL2CPP.Utils.Collections;
namespace BepInEx.Unity.IL2CPP.Utils.Collections;
public static class CollectionExtensions
{
@@ -5,7 +5,7 @@ using ArgumentNullException = System.ArgumentNullException;
using IEnumerator = Il2CppSystem.Collections.IEnumerator;
using IntPtr = System.IntPtr;
namespace BepInEx.IL2CPP.Utils.Collections;
namespace BepInEx.Unity.IL2CPP.Utils.Collections;
public class Il2CppManagedEnumerable : Object
{
@@ -11,7 +11,7 @@ using IntPtr = System.IntPtr;
using NotSupportedException = System.NotSupportedException;
using Type = System.Type;
namespace BepInEx.IL2CPP.Utils.Collections;
namespace BepInEx.Unity.IL2CPP.Utils.Collections;
public class Il2CppManagedEnumerator : Object
{
@@ -1,7 +1,7 @@
using System;
using System.Collections;
namespace BepInEx.IL2CPP.Utils.Collections;
namespace BepInEx.Unity.IL2CPP.Utils.Collections;
public class ManagedIl2CppEnumerable : IEnumerable
{
@@ -1,9 +1,8 @@
using System;
using System.Collections;
using HarmonyLib;
using MonoMod.Utils;
namespace BepInEx.IL2CPP.Utils.Collections;
namespace BepInEx.Unity.IL2CPP.Utils.Collections;
public class ManagedIl2CppEnumerator : IEnumerator
{
@@ -4,7 +4,7 @@ using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using UnityEngine;
namespace BepInEx.IL2CPP.Utils;
namespace BepInEx.Unity.IL2CPP.Utils;
internal static class Il2CppUtils
{
@@ -3,7 +3,7 @@ using System.ComponentModel;
using System.Runtime.InteropServices;
using MonoMod.Utils;
namespace BepInEx.IL2CPP.Utils;
namespace BepInEx.Unity.IL2CPP.Utils;
internal static class MessageBox
{
@@ -1,8 +1,8 @@
using System.Collections;
using BepInEx.IL2CPP.Utils.Collections;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using UnityEngine;
namespace BepInEx.IL2CPP.Utils;
namespace BepInEx.Unity.IL2CPP.Utils;
public static class MonoBehaviourExtensions
{
@@ -2,12 +2,14 @@ using System;
using System.Diagnostics;
using System.IO;
namespace BepInEx.IL2CPP.Utils;
namespace BepInEx.Unity.IL2CPP.Utils;
internal static class NotifySend
{
private const string EXECUTABLE_NAME = "notify-send";
public static bool IsSupported => Find(EXECUTABLE_NAME) != null;
private static string Find(string fileName)
{
if (File.Exists(fileName))
@@ -27,8 +29,6 @@ internal static class NotifySend
return null;
}
public static bool IsSupported => Find(EXECUTABLE_NAME) != null;
public static void Send(string summary, string body)
{
if (!IsSupported) throw new NotSupportedException();
File renamed without changes.
@@ -1,20 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net35;netstandard2.0</TargetFrameworks>
<AssemblyTitle>BepInEx.Preloader.UnityMono</AssemblyTitle>
<Product>BepInEx.Preloader.UnityMono</Product>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
<RootNamespace>BepInEx.Preloader.UnityMono</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net35'">
<!-- Output only net35 version to distribution; netstadnard is only used for generating NuGet package -->
<OutputPath>..\bin\UnityMono\</OutputPath>
<DistributionIdentifier>Unity.IL2CPP</DistributionIdentifier>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\BepInEx.Core\BepInEx.Core.csproj"/>
<ProjectReference Include="..\BepInEx.Preloader.Core\BepInEx.Preloader.Core.csproj"/>
<ProjectReference Include="..\BepInEx.Unity.Core\BepInEx.Unity.Core.csproj"/>
<ProjectReference Include="..\..\..\BepInEx.Core\BepInEx.Core.csproj"/>
<ProjectReference Include="..\..\..\BepInEx.Preloader.Core\BepInEx.Preloader.Core.csproj"/>
<ProjectReference Include="..\BepInEx.Unity.Common\BepInEx.Unity.Common.csproj"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="All"/>
@@ -1,7 +1,7 @@
using System;
using System.IO;
using BepInEx.Preloader.Core;
using BepInEx.Preloader.UnityMono;
using BepInEx.Unity.Mono.Preloader;
// ReSharper disable once CheckNamespace
namespace Doorstop;
@@ -25,7 +25,7 @@ internal static class Entrypoint
// In some versions of Unity 4, Mono tries to resolve BepInEx.dll prematurely because of the call to Paths.SetExecutablePath
// To prevent that, we have to use reflection and a separate startup class so that we can install required assembly resolvers before the main code
typeof(Entrypoint).Assembly.GetType($"BepInEx.Preloader.UnityMono.{nameof(UnityPreloaderRunner)}")
typeof(Entrypoint).Assembly.GetType($"BepInEx.Unity.Mono.Preloader.{nameof(UnityPreloaderRunner)}")
?.GetMethod(nameof(UnityPreloaderRunner.PreloaderPreMain))
?.Invoke(null, null);
}
@@ -6,11 +6,11 @@ using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.Preloader.Core.Patching;
using BepInEx.Unity.Core;
using BepInEx.Unity.Common;
using Mono.Cecil;
using Mono.Cecil.Cil;
namespace BepInEx.Preloader.UnityMono;
namespace BepInEx.Unity.Mono.Preloader;
[PatcherPluginInfo("io.bepinex.entrypointpatcher", "BepInEx Entrypoint", "1.0")]
internal class EntrypointPatcher : BasePatcher
@@ -60,7 +60,7 @@ internal class EntrypointPatcher : BasePatcher
if (entryType == null)
throw new Exception("The entrypoint type is invalid! Please check your config/BepInEx.cfg file");
var chainloaderAssemblyPath = Path.Combine(Paths.BepInExAssemblyDirectory, "BepInEx.UnityMono.dll");
var chainloaderAssemblyPath = Path.Combine(Paths.BepInExAssemblyDirectory, "BepInEx.Unity.Mono.dll");
var readerParameters = new ReaderParameters
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Reflection;
using HarmonyLib;
namespace BepInEx.Preloader.UnityMono.RuntimeFixes;
namespace BepInEx.Unity.Mono.Preloader.RuntimeFixes;
/// <summary>
/// This exists because the Mono implementation of <see cref="Trace" /> is/was broken, and would call Write directly
@@ -1,9 +1,9 @@
using System.IO;
using System.Reflection;
using BepInEx.Preloader.UnityMono.Utils;
using BepInEx.Unity.Mono.Preloader.Utils;
using HarmonyLib;
namespace BepInEx.Preloader.UnityMono.RuntimeFixes;
namespace BepInEx.Unity.Mono.Preloader.RuntimeFixes;
internal static class UnityPatches
{
@@ -7,7 +7,7 @@ using MonoMod.RuntimeDetour;
using MonoMod.RuntimeDetour.Platforms;
using MonoMod.Utils;
namespace BepInEx.Preloader.UnityMono.RuntimeFixes;
namespace BepInEx.Unity.Mono.Preloader.RuntimeFixes;
internal static class XTermFix
{
@@ -8,11 +8,11 @@ using BepInEx.Preloader.Core;
using BepInEx.Preloader.Core.Logging;
using BepInEx.Preloader.Core.Patching;
using BepInEx.Preloader.RuntimeFixes;
using BepInEx.Preloader.UnityMono.RuntimeFixes;
using BepInEx.Preloader.UnityMono.Utils;
using BepInEx.Unity.Core;
using BepInEx.Unity.Common;
using BepInEx.Unity.Mono.Preloader.RuntimeFixes;
using BepInEx.Unity.Mono.Preloader.Utils;
namespace BepInEx.Preloader.UnityMono;
namespace BepInEx.Unity.Mono.Preloader;
/// <summary>
/// The main entrypoint of BepInEx, and initializes all patchers and the chainloader.
@@ -4,10 +4,10 @@ using System.Linq;
using System.Reflection;
using BepInEx.Preloader.Core;
using BepInEx.Preloader.RuntimeFixes;
using BepInEx.Preloader.UnityMono.RuntimeFixes;
using BepInEx.Preloader.UnityMono.Utils;
using BepInEx.Unity.Mono.Preloader.RuntimeFixes;
using BepInEx.Unity.Mono.Preloader.Utils;
namespace BepInEx.Preloader.UnityMono;
namespace BepInEx.Unity.Mono.Preloader;
internal static class UnityPreloaderRunner
{
@@ -7,7 +7,7 @@ using BepInEx.Preloader.Core;
using Mono.Cecil;
using MonoMod.Utils;
namespace BepInEx.Preloader.UnityMono.Utils;
namespace BepInEx.Unity.Mono.Preloader.Utils;
internal static class MonoAssemblyHelper
{
@@ -3,7 +3,7 @@ using BepInEx.Configuration;
using BepInEx.Logging;
using UnityEngine;
namespace BepInEx.UnityMono;
namespace BepInEx.Unity.Mono;
/// <summary>
/// The base plugin type that is used by the BepInEx plugin loader.
@@ -2,20 +2,17 @@
<PropertyGroup>
<Description>BepInEx support library for Mono Unity games</Description>
<TargetFrameworks>net35;netstandard2.0</TargetFrameworks>
<AssemblyTitle>BepInEx.UnityMono</AssemblyTitle>
<Product>BepInEx.UnityMono</Product>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
<RootNamespace>BepInEx.UnityMono</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net35'">
<!-- Output only net35 version to distribution; netstadnard is only used for generating NuGet package -->
<OutputPath>..\bin\UnityMono\</OutputPath>
<DistributionIdentifier>Unity.Mono</DistributionIdentifier>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\BepInEx.Core\BepInEx.Core.csproj"/>
<ProjectReference Include="..\BepInEx.Preloader.Core\BepInEx.Preloader.Core.csproj" PrivateAssets="All"/>
<ProjectReference Include="..\BepInEx.Preloader.UnityMono\BepInEx.Preloader.UnityMono.csproj" PrivateAssets="All"/>
<ProjectReference Include="..\..\..\BepInEx.Core\BepInEx.Core.csproj"/>
<ProjectReference Include="..\..\..\BepInEx.Preloader.Core\BepInEx.Preloader.Core.csproj" PrivateAssets="All"/>
<ProjectReference Include="..\BepInEx.Unity.Mono.Preloader\BepInEx.Unity.Mono.Preloader.csproj" PrivateAssets="All"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="All"/>
@@ -1,6 +1,6 @@
using BepInEx.UnityMono.Bootstrap;
using BepInEx.Unity.Mono.Bootstrap;
namespace BepInEx.UnityMono;
namespace BepInEx.Unity.Mono;
public static class BepInExInstance
{
@@ -7,8 +7,8 @@ using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.Preloader.Core.Logging;
using BepInEx.Unity.Core;
using BepInEx.UnityMono.Logging;
using BepInEx.Unity.Common;
using BepInEx.Unity.Mono.Logging;
using UnityEngine;
using Logger = BepInEx.Logging.Logger;
using Object = UnityEngine.Object;
@@ -16,7 +16,7 @@ using Object = UnityEngine.Object;
[assembly: InternalsVisibleTo("UnityEngine")]
[assembly: InternalsVisibleTo("UnityEngine.Core")]
namespace BepInEx.UnityMono.Bootstrap;
namespace BepInEx.Unity.Mono.Bootstrap;
/// <summary>
/// The manager and loader for all plugins, and the entry point for BepInEx plugin system.
@@ -33,6 +33,8 @@ public class UnityChainloader : BaseChainloader<BaseUnityPlugin>
false,
"Include unity log messages in log file output.");
private static readonly bool staticStartHasBeenCalled = false;
private string _consoleTitle;
// TODO: Remove once proper instance handling exists
@@ -133,7 +135,6 @@ public class UnityChainloader : BaseChainloader<BaseUnityPlugin>
ChainloaderLogHelper.RewritePreloaderLogs();
if (ConfigUnityLogging.Value)
Logger.Sources.Add(new UnityLogSource());
}
@@ -6,7 +6,7 @@ using BepInEx.Logging;
using UnityEngine;
using Logger = BepInEx.Logging.Logger;
namespace BepInEx.UnityMono.Configuration;
namespace BepInEx.Unity.Mono.Configuration;
/// <summary>
/// A keyboard shortcut that can be used in Update method to check if user presses a key combo. The shortcut is only
@@ -7,7 +7,7 @@ using BepInEx.Logging;
using UnityEngine;
using Logger = BepInEx.Logging.Logger;
namespace BepInEx.UnityMono.Logging
namespace BepInEx.Unity.Mono.Logging
{
/// <summary>
/// Logs entries using Unity specific outputs.
@@ -3,7 +3,7 @@ using System.Reflection;
using BepInEx.Logging;
using UnityEngine;
namespace BepInEx.UnityMono.Logging;
namespace BepInEx.Unity.Mono.Logging;
/// <summary>
/// Logs entries using Unity specific outputs.
@@ -8,7 +8,7 @@ using BepInEx.Logging;
using UnityEngine;
using Logger = BepInEx.Logging.Logger;
namespace BepInEx.UnityMono;
namespace BepInEx.Unity.Mono;
/// <summary>
/// Provides methods for running code on other threads and synchronizing with the main thread.
@@ -3,7 +3,7 @@ using System.Runtime.CompilerServices;
using BepInEx.Configuration;
using UnityEngine;
namespace BepInEx.UnityMono;
namespace BepInEx.Unity.Mono;
/// <summary>
/// Config types that are unity specific
@@ -6,7 +6,7 @@ enabled=true
# Path to the assembly to load and execute
# NOTE: The entrypoint must be of format `static void Doorstop.Entrypoint.Start()`
target_assembly=BepInEx\core\BepInEx.IL2CPP.dll
target_assembly = BepInEx\core\BepInEx.Unity.IL2CPP.dll
# If true, Unity's output log is redirected to <current folder>\output_log.txt
redirect_output_log = false
@@ -15,7 +15,6 @@ redirect_output_log=false
# USE THIS ONLY WHEN ASKED TO OR YOU KNOW WHAT THIS MEANS
ignore_disable_switch = false
# Options specific to running under Unity Mono runtime
[UnityMono]
@@ -6,7 +6,7 @@ enabled=true
# Path to the assembly to load and execute
# NOTE: The entrypoint must be of format `static void Doorstop.Entrypoint.Start()`
target_assembly=BepInEx\core\BepInEx.Preloader.UnityMono.dll
target_assembly = BepInEx\core\BepInEx.Unity.Mono.Preloader.dll
# If true, Unity's output log is redirected to <current folder>\output_log.txt
redirect_output_log = false
@@ -23,7 +23,7 @@ enabled="1"
# Path to the assembly to load and execute
# NOTE: The entrypoint must be of format `static void Doorstop.Entrypoint.Start()`
target_assembly="BepInEx/core/BepInEx.IL2CPP.dll"
target_assembly="BepInEx/core/BepInEx.Unity.IL2CPP.dll"
# If enabled, DOORSTOP_DISABLE env var value is ignored
# USE THIS ONLY WHEN ASKED TO OR YOU KNOW WHAT THIS MEANS
@@ -23,7 +23,7 @@ enabled="1"
# Path to the assembly to load and execute
# NOTE: The entrypoint must be of format `static void Doorstop.Entrypoint.Start()`
target_assembly="BepInEx/core/BepInEx.Preloader.UnityMono.dll"
target_assembly="BepInEx/core/BepInEx.Unity.Mono.Preloader.dll"
# If enabled, DOORSTOP_DISABLE env var value is ignored
# USE THIS ONLY WHEN ASKED TO OR YOU KNOW WHAT THIS MEANS
File renamed without changes.
File renamed without changes.
+15
View File
@@ -0,0 +1,15 @@
static class BuildDependencies
{
public const string DoorstopVersion = "4.0.0-rc.5";
public const string DotnetRuntimeVersion = "6.0.6-test";
public const string DobbyVersion = "1.0.0";
public const string DotnetRuntimeZipUrl =
$"https://github.com/BepInEx/dotnet-runtime/releases/download/{DotnetRuntimeVersion}/mini-coreclr-Release.zip";
public static string DoorstopZipUrl(string arch) =>
$"https://github.com/NeighTools/UnityDoorstop/releases/download/v{DoorstopVersion}/doorstop_{arch}_release_{DoorstopVersion}.zip";
public static string DobbyZipUrl(string arch) =>
$"https://github.com/BepInEx/Dobby/releases/download/v{DobbyVersion}/dobby-{arch}.zip";
}
+22
View File
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.IO;
using Nuke.Common.IO;
using static Nuke.Common.IO.SerializationTasks;
readonly record struct DependencyCache(AbsolutePath CacheFile)
{
readonly IDictionary<string, string> cache =
CacheFile.Exists()
? JsonDeserialize<Dictionary<string, string>>(File.ReadAllText(CacheFile))
: new Dictionary<string, string>();
public void Refresh(string name, string key, Action process)
{
if (cache.TryGetValue(name, out var curKey) && curKey == key) return;
process();
cache[name] = key;
}
public void Save() => File.WriteAllText(CacheFile, JsonSerialize(cache));
}
+34
View File
@@ -0,0 +1,34 @@
using System;
readonly record struct DistributionTarget(string DistributionIdentifier, string RuntimeIndentifier)
{
public readonly string Arch = RuntimeIndentifier.Split('-')[1];
public readonly string Engine = DistributionIdentifier.Split('.')[0];
public readonly string Os = RuntimeIndentifier.Split('-')[0];
public readonly string Runtime = DistributionIdentifier.Split('.')[1];
public readonly string Target = $"{DistributionIdentifier}-{RuntimeIndentifier}";
public string ClearOsName => Os switch
{
"win" => "Windows",
"linux" => "Linux",
"macos" => "macOS",
var _ => throw new NotSupportedException($"OS {Os} is not supported")
};
public string DllExtension => Os switch
{
"win" => "dll",
"linux" => "so",
"macos" => "dylib",
var _ => throw new NotSupportedException($"Unsupported OS: {Os}")
};
public string DllPrefix => Os switch
{
"win" => "",
"linux" => "lib",
"macos" => "lib",
_ => throw new NotSupportedException($"Unsupported OS: {Os}")
};
}
+77
View File
@@ -0,0 +1,77 @@
using System;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Nuke.Common.IO;
using ShellProgressBar;
static class DownloadTasks
{
public static void DownloadFiles(string name, params (string Name, string Url, AbsolutePath Destination)[] files)
{
using var progress = new ProgressBar(files.Length, $"Downloading {name}");
Task.WaitAll(files.Select(t => DownloadFile(progress, t.Name, t.Url, t.Destination)).ToArray());
}
public static void DownloadZipFiles(string name, params (string Name, string Url, AbsolutePath Destination)[] files)
{
using var progress = new ProgressBar(files.Length, $"Downloading {name}");
Task.WaitAll(files.Select(async t =>
{
var zipFilePath = (AbsolutePath) $"{t.Destination}_tmp.zip";
await DownloadFile(progress, t.Name, t.Url, zipFilePath);
await UnzipFile(progress, t.Name, zipFilePath, t.Destination);
File.Delete(zipFilePath!);
}).ToArray());
}
static async Task DownloadFile(ProgressBarBase bar, string name, string url, AbsolutePath destination)
{
using var client = new HttpClient();
await using var fs = File.Create(destination);
var response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead);
if (!response.IsSuccessStatusCode)
throw new Exception($"Failed to download {name}");
await using var stream = await response.Content.ReadAsStreamAsync();
using var childBar = bar.Spawn((int) (response.Content.Headers.ContentLength ?? 1), $"Downloading {name}");
var buffer = new byte[4096];
int read;
while ((read = await stream.ReadAsync(buffer)) > 0)
{
await fs.WriteAsync(buffer.AsMemory(0, read));
childBar.Tick(childBar.CurrentTick + read);
}
}
static async Task UnzipFile(ProgressBarBase bar, string name, AbsolutePath zipFile, AbsolutePath destination)
{
using var zip = ZipFile.OpenRead(zipFile);
using var childBar = bar.Spawn((int) zip.Entries.Select(e => e.Length).Sum(), $"Extracting {name}");
foreach (var entry in zip.Entries)
{
// Use Path.Combine to ensure the trailing slash is preserved.
var fullPath = Path.Combine(destination, entry.FullName);
var fileName = Path.GetFileName(fullPath);
if (string.IsNullOrEmpty(fileName))
{
Directory.CreateDirectory(fullPath);
continue;
}
Directory.CreateDirectory(Path.GetDirectoryName(fullPath) ?? throw new InvalidOperationException());
await using var fs = File.Create(fullPath);
await using var stream = entry.Open();
var buffer = new byte[4096];
int read;
while ((read = await stream.ReadAsync(buffer)) > 0)
{
await fs.WriteAsync(buffer.AsMemory(0, read));
childBar.Tick(childBar.CurrentTick + read);
}
}
}
}