diff --git a/BepInEx.Core/BepInEx.Core.csproj b/BepInEx.Core/BepInEx.Core.csproj index d4889a6..3fe7096 100644 --- a/BepInEx.Core/BepInEx.Core.csproj +++ b/BepInEx.Core/BepInEx.Core.csproj @@ -3,11 +3,7 @@ BepInEx Core library net35;netstandard2.0 true - BepInEx - BepInEx - ..\bin\Core\ - Unity plugin injection framework - + true diff --git a/BepInEx.Core/Properties/AssemblyInfo.cs b/BepInEx.Core/Properties/AssemblyInfo.cs index c48dd51..749dcc2 100644 --- a/BepInEx.Core/Properties/AssemblyInfo.cs +++ b/BepInEx.Core/Properties/AssemblyInfo.cs @@ -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")] diff --git a/BepInEx.NetCore/BepInEx.NetCore.csproj b/BepInEx.NetCore/BepInEx.NetCore.csproj deleted file mode 100644 index 2c6489e..0000000 --- a/BepInEx.NetCore/BepInEx.NetCore.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - netcoreapp3.1;net6 - - - - - - - - - diff --git a/BepInEx.NetLauncher.Shared/BepInEx.NetLauncher.Shared.shproj b/BepInEx.NetLauncher.Shared/BepInEx.NetLauncher.Shared.shproj deleted file mode 100644 index 12e74f4..0000000 --- a/BepInEx.NetLauncher.Shared/BepInEx.NetLauncher.Shared.shproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - 067bcc8c-fc25-4929-b4f4-c6a5a7496994 - 14.0 - - - - - - - - diff --git a/BepInEx.Preloader.Core/BepInEx.Preloader.Core.csproj b/BepInEx.Preloader.Core/BepInEx.Preloader.Core.csproj index 01fcd96..99a7537 100644 --- a/BepInEx.Preloader.Core/BepInEx.Preloader.Core.csproj +++ b/BepInEx.Preloader.Core/BepInEx.Preloader.Core.csproj @@ -2,9 +2,6 @@ Core classes and utilities for BepInEx Preloader net35;netstandard2.0 - BepInEx.Preloader.Core - BepInEx.Preloader.Core - ..\bin\Core diff --git a/BepInEx.Preloader.Core/Properties/AssemblyInfo.cs b/BepInEx.Preloader.Core/Properties/AssemblyInfo.cs index 321fa22..4a5feb7 100644 --- a/BepInEx.Preloader.Core/Properties/AssemblyInfo.cs +++ b/BepInEx.Preloader.Core/Properties/AssemblyInfo.cs @@ -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")] diff --git a/BepInEx.sln b/BepInEx.sln index a233958..c60101f 100644 --- a/BepInEx.sln +++ b/BepInEx.sln @@ -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} diff --git a/BepInExTests/BepInExTests.csproj b/BepInExTests/BepInExTests.csproj index e7c153c..ec70501 100644 --- a/BepInExTests/BepInExTests.csproj +++ b/BepInExTests/BepInExTests.csproj @@ -30,8 +30,8 @@ - + - + diff --git a/BepInExTests/Configuration/ConfigFileTests.cs b/BepInExTests/Configuration/ConfigFileTests.cs index 124a1d9..46f7c9c 100644 --- a/BepInExTests/Configuration/ConfigFileTests.cs +++ b/BepInExTests/Configuration/ConfigFileTests.cs @@ -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; diff --git a/Directory.Build.props b/Directory.Build.props index 2433fd6..0d2eda9 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -13,13 +13,14 @@ https://github.com/BepInEx/BepInEx git Copyright © 2022 BepInEx Team - ../bin/NuGet + $(SolutionDir)bin + $(BuildDir)/NuGet logo.png true - + diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 0000000..42c44a2 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,5 @@ + + + $(BuildDir)/$(DistributionIdentifier)/ + + diff --git a/BepInEx.NetLauncher.Common/BasePlugin.cs b/Runtimes/NET/BepInEx.NET.Common/BasePlugin.cs similarity index 95% rename from BepInEx.NetLauncher.Common/BasePlugin.cs rename to Runtimes/NET/BepInEx.NET.Common/BasePlugin.cs index 14c8a1c..5d40b10 100644 --- a/BepInEx.NetLauncher.Common/BasePlugin.cs +++ b/Runtimes/NET/BepInEx.NET.Common/BasePlugin.cs @@ -2,7 +2,7 @@ using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; -namespace BepInEx.NetLauncher.Common +namespace BepInEx.NET.Common { public abstract class BasePlugin { diff --git a/BepInEx.NetLauncher.Common/BepInEx.NetLauncher.Common.csproj b/Runtimes/NET/BepInEx.NET.Common/BepInEx.NET.Common.csproj similarity index 69% rename from BepInEx.NetLauncher.Common/BepInEx.NetLauncher.Common.csproj rename to Runtimes/NET/BepInEx.NET.Common/BepInEx.NET.Common.csproj index df57a60..afd49ba 100644 --- a/BepInEx.NetLauncher.Common/BepInEx.NetLauncher.Common.csproj +++ b/Runtimes/NET/BepInEx.NET.Common/BepInEx.NET.Common.csproj @@ -10,8 +10,8 @@ - - + + diff --git a/BepInEx.NetLauncher.Common/NetChainloader.cs b/Runtimes/NET/BepInEx.NET.Common/NetChainloader.cs similarity index 96% rename from BepInEx.NetLauncher.Common/NetChainloader.cs rename to Runtimes/NET/BepInEx.NET.Common/NetChainloader.cs index 95c21e3..5e4af66 100644 --- a/BepInEx.NetLauncher.Common/NetChainloader.cs +++ b/Runtimes/NET/BepInEx.NET.Common/NetChainloader.cs @@ -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 { diff --git a/Runtimes/NET/BepInEx.NET.CoreCLR/BepInEx.NET.CoreCLR.csproj b/Runtimes/NET/BepInEx.NET.CoreCLR/BepInEx.NET.CoreCLR.csproj new file mode 100644 index 0000000..568de2d --- /dev/null +++ b/Runtimes/NET/BepInEx.NET.CoreCLR/BepInEx.NET.CoreCLR.csproj @@ -0,0 +1,14 @@ + + + + netcoreapp3.1 + NET.CoreCLR + + + + + + + + + diff --git a/BepInEx.NetCore/HookEntrypoint.cs b/Runtimes/NET/BepInEx.NET.CoreCLR/HookEntrypoint.cs similarity index 98% rename from BepInEx.NetCore/HookEntrypoint.cs rename to Runtimes/NET/BepInEx.NET.CoreCLR/HookEntrypoint.cs index e89ffe3..6581442 100644 --- a/BepInEx.NetCore/HookEntrypoint.cs +++ b/Runtimes/NET/BepInEx.NET.CoreCLR/HookEntrypoint.cs @@ -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 { diff --git a/BepInEx.NetCore/NetCorePreloader.cs b/Runtimes/NET/BepInEx.NET.CoreCLR/NetCorePreloader.cs similarity index 97% rename from BepInEx.NetCore/NetCorePreloader.cs rename to Runtimes/NET/BepInEx.NET.CoreCLR/NetCorePreloader.cs index 5f659b1..90e7aa7 100644 --- a/BepInEx.NetCore/NetCorePreloader.cs +++ b/Runtimes/NET/BepInEx.NET.CoreCLR/NetCorePreloader.cs @@ -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 { diff --git a/BepInEx.NetLauncher/App.config b/Runtimes/NET/BepInEx.NET.Framework.Launcher/App.config similarity index 100% rename from BepInEx.NetLauncher/App.config rename to Runtimes/NET/BepInEx.NET.Framework.Launcher/App.config diff --git a/BepInEx.NetLauncher/BepInEx.NetLauncher.csproj b/Runtimes/NET/BepInEx.NET.Framework.Launcher/BepInEx.NET.Framework.Launcher.csproj similarity index 55% rename from BepInEx.NetLauncher/BepInEx.NetLauncher.csproj rename to Runtimes/NET/BepInEx.NET.Framework.Launcher/BepInEx.NET.Framework.Launcher.csproj index 4859234..15b064d 100644 --- a/BepInEx.NetLauncher/BepInEx.NetLauncher.csproj +++ b/Runtimes/NET/BepInEx.NET.Framework.Launcher/BepInEx.NET.Framework.Launcher.csproj @@ -4,20 +4,18 @@ Exe net452 true - BepInEx.NetLauncher - BepInEx.NetLauncher false x86 - ..\bin\NetLauncher\ + NET.Framework - - - + + + - + diff --git a/BepInEx.NetLauncher/NetPreloader.cs b/Runtimes/NET/BepInEx.NET.Framework.Launcher/NetPreloader.cs similarity index 98% rename from BepInEx.NetLauncher/NetPreloader.cs rename to Runtimes/NET/BepInEx.NET.Framework.Launcher/NetPreloader.cs index 5945378..f7396bb 100644 --- a/BepInEx.NetLauncher/NetPreloader.cs +++ b/Runtimes/NET/BepInEx.NET.Framework.Launcher/NetPreloader.cs @@ -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 { diff --git a/BepInEx.NetLauncher/Program.cs b/Runtimes/NET/BepInEx.NET.Framework.Launcher/Program.cs similarity index 97% rename from BepInEx.NetLauncher/Program.cs rename to Runtimes/NET/BepInEx.NET.Framework.Launcher/Program.cs index 2d69e4b..1297186 100644 --- a/BepInEx.NetLauncher/Program.cs +++ b/Runtimes/NET/BepInEx.NET.Framework.Launcher/Program.cs @@ -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 { diff --git a/BepInEx.NetLauncher/RuntimeFixes/AssemblyFixes.cs b/Runtimes/NET/BepInEx.NET.Framework.Launcher/RuntimeFixes/AssemblyFixes.cs similarity index 97% rename from BepInEx.NetLauncher/RuntimeFixes/AssemblyFixes.cs rename to Runtimes/NET/BepInEx.NET.Framework.Launcher/RuntimeFixes/AssemblyFixes.cs index 9082618..508a92c 100644 --- a/BepInEx.NetLauncher/RuntimeFixes/AssemblyFixes.cs +++ b/Runtimes/NET/BepInEx.NET.Framework.Launcher/RuntimeFixes/AssemblyFixes.cs @@ -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 { diff --git a/BepInEx.NetLauncher.Shared/BepInEx.NetLauncher.Shared.projitems b/Runtimes/NET/BepInEx.NET.Shared/BepInEx.NET.Shared.projitems similarity index 100% rename from BepInEx.NetLauncher.Shared/BepInEx.NetLauncher.Shared.projitems rename to Runtimes/NET/BepInEx.NET.Shared/BepInEx.NET.Shared.projitems diff --git a/Runtimes/NET/BepInEx.NET.Shared/BepInEx.NET.Shared.shproj b/Runtimes/NET/BepInEx.NET.Shared/BepInEx.NET.Shared.shproj new file mode 100644 index 0000000..779cd4d --- /dev/null +++ b/Runtimes/NET/BepInEx.NET.Shared/BepInEx.NET.Shared.shproj @@ -0,0 +1,13 @@ + + + + 067bcc8c-fc25-4929-b4f4-c6a5a7496994 + 14.0 + + + + + + + + diff --git a/BepInEx.NetLauncher.Shared/SharedEntrypoint.cs b/Runtimes/NET/BepInEx.NET.Shared/SharedEntrypoint.cs similarity index 95% rename from BepInEx.NetLauncher.Shared/SharedEntrypoint.cs rename to Runtimes/NET/BepInEx.NET.Shared/SharedEntrypoint.cs index 2bfe799..819bcb9 100644 --- a/BepInEx.NetLauncher.Shared/SharedEntrypoint.cs +++ b/Runtimes/NET/BepInEx.NET.Shared/SharedEntrypoint.cs @@ -9,16 +9,18 @@ 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 - { + internal static class SharedEntrypoint + { public static ResolveEventHandler RemoteResolve(List resolveDirectories) { return (sender, args) => RemoteResolveInternal(sender, args, resolveDirectories); } - private static Assembly RemoteResolveInternal(object sender, ResolveEventArgs reference, List resolveDirectories) + private static Assembly RemoteResolveInternal(object sender, + ResolveEventArgs reference, + List resolveDirectories) { var assemblyName = new AssemblyName(reference.Name); @@ -60,7 +62,7 @@ namespace BepInEx.NetLauncher.Shared return null; } - + public static Assembly LocalResolve(object sender, ResolveEventArgs args) { var assemblyName = new AssemblyName(args.Name); diff --git a/BepInEx.Unity.Core/BepInEx.Unity.Core.csproj b/Runtimes/Unity/BepInEx.Unity.Common/BepInEx.Unity.Common.csproj similarity index 100% rename from BepInEx.Unity.Core/BepInEx.Unity.Core.csproj rename to Runtimes/Unity/BepInEx.Unity.Common/BepInEx.Unity.Common.csproj diff --git a/BepInEx.Unity.Core/UnityInfo.cs b/Runtimes/Unity/BepInEx.Unity.Common/UnityInfo.cs similarity index 95% rename from BepInEx.Unity.Core/UnityInfo.cs rename to Runtimes/Unity/BepInEx.Unity.Common/UnityInfo.cs index aa3bb87..ae1ad3d 100644 --- a/BepInEx.Unity.Core/UnityInfo.cs +++ b/Runtimes/Unity/BepInEx.Unity.Common/UnityInfo.cs @@ -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; /// /// Various information about the currently executing Unity player. diff --git a/BepInEx.IL2CPP/BasePlugin.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/BasePlugin.cs similarity index 96% rename from BepInEx.IL2CPP/BasePlugin.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/BasePlugin.cs index fc5c3a2..3b51e33 100644 --- a/BepInEx.IL2CPP/BasePlugin.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/BasePlugin.cs @@ -2,7 +2,7 @@ using BepInEx.Logging; using Il2CppInterop.Runtime.InteropTypes; -namespace BepInEx.IL2CPP; +namespace BepInEx.Unity.IL2CPP; public abstract class BasePlugin { diff --git a/BepInEx.IL2CPP/BepInEx.IL2CPP.csproj b/Runtimes/Unity/BepInEx.Unity.IL2CPP/BepInEx.Unity.IL2CPP.csproj similarity index 82% rename from BepInEx.IL2CPP/BepInEx.IL2CPP.csproj rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/BepInEx.Unity.IL2CPP.csproj index 3dcfd37..8d7a0aa 100644 --- a/BepInEx.IL2CPP/BepInEx.IL2CPP.csproj +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/BepInEx.Unity.IL2CPP.csproj @@ -3,16 +3,14 @@ BepInEx support library for Il2Cpp games net6.0 true - BepInEx.IL2CPP - BepInEx.IL2CPP true - ..\bin\IL2CPP\ + Unity.IL2CPP false - - - + + + diff --git a/BepInEx.IL2CPP/DoorstopEntrypoint.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/DoorstopEntrypoint.cs similarity index 90% rename from BepInEx.IL2CPP/DoorstopEntrypoint.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/DoorstopEntrypoint.cs index 97167b9..66e2353 100644 --- a/BepInEx.IL2CPP/DoorstopEntrypoint.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/DoorstopEntrypoint.cs @@ -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 diff --git a/BepInEx.IL2CPP/Hook/BaseNativeDetour.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Hook/BaseNativeDetour.cs similarity index 98% rename from BepInEx.IL2CPP/Hook/BaseNativeDetour.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/Hook/BaseNativeDetour.cs index 431da02..a8b0ae9 100644 --- a/BepInEx.IL2CPP/Hook/BaseNativeDetour.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Hook/BaseNativeDetour.cs @@ -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 : INativeDetour where T : BaseNativeDetour { diff --git a/BepInEx.IL2CPP/Hook/Dobby/DobbyDetour.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Hook/Dobby/DobbyDetour.cs similarity index 93% rename from BepInEx.IL2CPP/Hook/Dobby/DobbyDetour.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/Hook/Dobby/DobbyDetour.cs index fe8ab0a..022de28 100644 --- a/BepInEx.IL2CPP/Hook/Dobby/DobbyDetour.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Hook/Dobby/DobbyDetour.cs @@ -1,6 +1,6 @@ using System; -namespace BepInEx.IL2CPP.Hook.Dobby; +namespace BepInEx.Unity.IL2CPP.Hook.Dobby; internal class DobbyDetour : BaseNativeDetour { diff --git a/BepInEx.IL2CPP/Hook/Dobby/DobbyLib.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Hook/Dobby/DobbyLib.cs similarity index 94% rename from BepInEx.IL2CPP/Hook/Dobby/DobbyLib.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/Hook/Dobby/DobbyLib.cs index fde6422..7da5461 100644 --- a/BepInEx.IL2CPP/Hook/Dobby/DobbyLib.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Hook/Dobby/DobbyLib.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace BepInEx.IL2CPP.Hook.Dobby; +namespace BepInEx.Unity.IL2CPP.Hook.Dobby; internal static unsafe class DobbyLib { diff --git a/BepInEx.IL2CPP/Hook/Funchook/FunchookDetour.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Hook/Funchook/FunchookDetour.cs similarity index 96% rename from BepInEx.IL2CPP/Hook/Funchook/FunchookDetour.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/Hook/Funchook/FunchookDetour.cs index 0711794..019b841 100644 --- a/BepInEx.IL2CPP/Hook/Funchook/FunchookDetour.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Hook/Funchook/FunchookDetour.cs @@ -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 { diff --git a/BepInEx.IL2CPP/Hook/Funchook/FunchookLib.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Hook/Funchook/FunchookLib.cs similarity index 94% rename from BepInEx.IL2CPP/Hook/Funchook/FunchookLib.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/Hook/Funchook/FunchookLib.cs index 9f28524..498aa0f 100644 --- a/BepInEx.IL2CPP/Hook/Funchook/FunchookLib.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Hook/Funchook/FunchookLib.cs @@ -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 { diff --git a/BepInEx.IL2CPP/Hook/INativeDetour.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Hook/INativeDetour.cs similarity index 95% rename from BepInEx.IL2CPP/Hook/INativeDetour.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/Hook/INativeDetour.cs index 7476c3e..7f27660 100644 --- a/BepInEx.IL2CPP/Hook/INativeDetour.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Hook/INativeDetour.cs @@ -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; } diff --git a/BepInEx.IL2CPP/Hook/Il2CppInteropDetourProvider.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Hook/Il2CppInteropDetourProvider.cs similarity index 88% rename from BepInEx.IL2CPP/Hook/Il2CppInteropDetourProvider.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/Hook/Il2CppInteropDetourProvider.cs index db5c10e..822bda3 100644 --- a/BepInEx.IL2CPP/Hook/Il2CppInteropDetourProvider.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Hook/Il2CppInteropDetourProvider.cs @@ -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 { diff --git a/BepInEx.IL2CPP/IL2CPPChainloader.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/IL2CPPChainloader.cs similarity index 95% rename from BepInEx.IL2CPP/IL2CPPChainloader.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/IL2CPPChainloader.cs index 3da4645..8541487 100644 --- a/BepInEx.IL2CPP/IL2CPPChainloader.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/IL2CPPChainloader.cs @@ -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 { diff --git a/BepInEx.IL2CPP/Il2CppInteropManager.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Il2CppInteropManager.cs similarity index 99% rename from BepInEx.IL2CPP/Il2CppInteropManager.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/Il2CppInteropManager.cs index ea76d91..c4b4314 100644 --- a/BepInEx.IL2CPP/Il2CppInteropManager.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Il2CppInteropManager.cs @@ -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 { diff --git a/BepInEx.IL2CPP/Logging/BepInExLoggerProvider.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Logging/BepInExLoggerProvider.cs similarity index 98% rename from BepInEx.IL2CPP/Logging/BepInExLoggerProvider.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/Logging/BepInExLoggerProvider.cs index 7c156b8..49fa977 100644 --- a/BepInEx.IL2CPP/Logging/BepInExLoggerProvider.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Logging/BepInExLoggerProvider.cs @@ -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 { diff --git a/BepInEx.IL2CPP/Logging/IL2CPPLogSource.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Logging/IL2CPPLogSource.cs similarity index 95% rename from BepInEx.IL2CPP/Logging/IL2CPPLogSource.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/Logging/IL2CPPLogSource.cs index b2e46f3..6c3399b 100644 --- a/BepInEx.IL2CPP/Logging/IL2CPPLogSource.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Logging/IL2CPPLogSource.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; using BepInEx.Logging; -namespace BepInEx.IL2CPP.Logging; +namespace BepInEx.Unity.IL2CPP.Logging; public class IL2CPPLogSource : ILogSource { diff --git a/BepInEx.IL2CPP/Logging/IL2CPPUnityLogSource.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Logging/IL2CPPUnityLogSource.cs similarity index 96% rename from BepInEx.IL2CPP/Logging/IL2CPPUnityLogSource.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/Logging/IL2CPPUnityLogSource.cs index dba3df6..53e0d6b 100644 --- a/BepInEx.IL2CPP/Logging/IL2CPPUnityLogSource.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Logging/IL2CPPUnityLogSource.cs @@ -2,7 +2,7 @@ using System; using BepInEx.Logging; using UnityEngine; -namespace BepInEx.IL2CPP.Logging; +namespace BepInEx.Unity.IL2CPP.Logging; public class IL2CPPUnityLogSource : ILogSource { diff --git a/BepInEx.IL2CPP/Preloader.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Preloader.cs similarity index 98% rename from BepInEx.IL2CPP/Preloader.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/Preloader.cs index f6f283b..2694f6f 100644 --- a/BepInEx.IL2CPP/Preloader.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Preloader.cs @@ -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 { diff --git a/BepInEx.IL2CPP/RuntimeFixes/RedirectStdErrFix.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/RuntimeFixes/RedirectStdErrFix.cs similarity index 96% rename from BepInEx.IL2CPP/RuntimeFixes/RedirectStdErrFix.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/RuntimeFixes/RedirectStdErrFix.cs index 03f4f3d..9e41dad 100644 --- a/BepInEx.IL2CPP/RuntimeFixes/RedirectStdErrFix.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/RuntimeFixes/RedirectStdErrFix.cs @@ -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); diff --git a/BepInEx.IL2CPP/UnityEngine/Input.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/UnityEngine/Input.cs similarity index 99% rename from BepInEx.IL2CPP/UnityEngine/Input.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/UnityEngine/Input.cs index 3cc325c..4f383ee 100644 --- a/BepInEx.IL2CPP/UnityEngine/Input.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/UnityEngine/Input.cs @@ -1,4 +1,4 @@ -namespace BepInEx.IL2CPP.UnityEngine; +namespace BepInEx.Unity.IL2CPP.UnityEngine; public enum KeyCode { diff --git a/BepInEx.IL2CPP/UnityPreloadRunner.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/UnityPreloadRunner.cs similarity index 98% rename from BepInEx.IL2CPP/UnityPreloadRunner.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/UnityPreloadRunner.cs index 1b88420..4281a32 100644 --- a/BepInEx.IL2CPP/UnityPreloadRunner.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/UnityPreloadRunner.cs @@ -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 { diff --git a/BepInEx.IL2CPP/Utils/Collections/CollectionExtensions.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/Collections/CollectionExtensions.cs similarity index 92% rename from BepInEx.IL2CPP/Utils/Collections/CollectionExtensions.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/Collections/CollectionExtensions.cs index 482de95..97b6eb8 100644 --- a/BepInEx.IL2CPP/Utils/Collections/CollectionExtensions.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/Collections/CollectionExtensions.cs @@ -1,6 +1,6 @@ using Il2CppSystem.Collections; -namespace BepInEx.IL2CPP.Utils.Collections; +namespace BepInEx.Unity.IL2CPP.Utils.Collections; public static class CollectionExtensions { diff --git a/BepInEx.IL2CPP/Utils/Collections/Il2CppManagedEnumerable.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/Collections/Il2CppManagedEnumerable.cs similarity index 95% rename from BepInEx.IL2CPP/Utils/Collections/Il2CppManagedEnumerable.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/Collections/Il2CppManagedEnumerable.cs index dc8bd70..004324a 100644 --- a/BepInEx.IL2CPP/Utils/Collections/Il2CppManagedEnumerable.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/Collections/Il2CppManagedEnumerable.cs @@ -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 { diff --git a/BepInEx.IL2CPP/Utils/Collections/Il2CppManagedEnumerator.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/Collections/Il2CppManagedEnumerator.cs similarity index 98% rename from BepInEx.IL2CPP/Utils/Collections/Il2CppManagedEnumerator.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/Collections/Il2CppManagedEnumerator.cs index 391099a..d58234f 100644 --- a/BepInEx.IL2CPP/Utils/Collections/Il2CppManagedEnumerator.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/Collections/Il2CppManagedEnumerator.cs @@ -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 { diff --git a/BepInEx.IL2CPP/Utils/Collections/ManagedIl2CppEnumerable.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/Collections/ManagedIl2CppEnumerable.cs similarity index 90% rename from BepInEx.IL2CPP/Utils/Collections/ManagedIl2CppEnumerable.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/Collections/ManagedIl2CppEnumerable.cs index 86ad853..d72074f 100644 --- a/BepInEx.IL2CPP/Utils/Collections/ManagedIl2CppEnumerable.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/Collections/ManagedIl2CppEnumerable.cs @@ -1,7 +1,7 @@ using System; using System.Collections; -namespace BepInEx.IL2CPP.Utils.Collections; +namespace BepInEx.Unity.IL2CPP.Utils.Collections; public class ManagedIl2CppEnumerable : IEnumerable { diff --git a/BepInEx.IL2CPP/Utils/Collections/ManagedIl2CppEnumerator.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/Collections/ManagedIl2CppEnumerator.cs similarity index 94% rename from BepInEx.IL2CPP/Utils/Collections/ManagedIl2CppEnumerator.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/Collections/ManagedIl2CppEnumerator.cs index f3e4114..ea92705 100644 --- a/BepInEx.IL2CPP/Utils/Collections/ManagedIl2CppEnumerator.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/Collections/ManagedIl2CppEnumerator.cs @@ -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 { diff --git a/BepInEx.IL2CPP/Utils/Il2CppUtils.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/Il2CppUtils.cs similarity index 94% rename from BepInEx.IL2CPP/Utils/Il2CppUtils.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/Il2CppUtils.cs index 889344f..419fae6 100644 --- a/BepInEx.IL2CPP/Utils/Il2CppUtils.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/Il2CppUtils.cs @@ -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 { diff --git a/BepInEx.IL2CPP/Utils/MessageBox.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/MessageBox.cs similarity index 93% rename from BepInEx.IL2CPP/Utils/MessageBox.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/MessageBox.cs index afaedef..094eda0 100644 --- a/BepInEx.IL2CPP/Utils/MessageBox.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/MessageBox.cs @@ -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 { diff --git a/BepInEx.IL2CPP/Utils/MonoBehaviourExtensions.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/MonoBehaviourExtensions.cs similarity index 74% rename from BepInEx.IL2CPP/Utils/MonoBehaviourExtensions.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/MonoBehaviourExtensions.cs index 539635a..d1aed43 100644 --- a/BepInEx.IL2CPP/Utils/MonoBehaviourExtensions.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/MonoBehaviourExtensions.cs @@ -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 { diff --git a/BepInEx.IL2CPP/Utils/NotifySend.cs b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/NotifySend.cs similarity index 96% rename from BepInEx.IL2CPP/Utils/NotifySend.cs rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/NotifySend.cs index 1f92da6..46a2950 100644 --- a/BepInEx.IL2CPP/Utils/NotifySend.cs +++ b/Runtimes/Unity/BepInEx.Unity.IL2CPP/Utils/NotifySend.cs @@ -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(); diff --git a/BepInEx.IL2CPP/app.config b/Runtimes/Unity/BepInEx.Unity.IL2CPP/app.config similarity index 100% rename from BepInEx.IL2CPP/app.config rename to Runtimes/Unity/BepInEx.Unity.IL2CPP/app.config diff --git a/BepInEx.Preloader.UnityMono/BepInEx.Preloader.UnityMono.csproj b/Runtimes/Unity/BepInEx.Unity.Mono.Preloader/BepInEx.Unity.Mono.Preloader.csproj similarity index 60% rename from BepInEx.Preloader.UnityMono/BepInEx.Preloader.UnityMono.csproj rename to Runtimes/Unity/BepInEx.Unity.Mono.Preloader/BepInEx.Unity.Mono.Preloader.csproj index 2a2c718..8fcb2df 100644 --- a/BepInEx.Preloader.UnityMono/BepInEx.Preloader.UnityMono.csproj +++ b/Runtimes/Unity/BepInEx.Unity.Mono.Preloader/BepInEx.Unity.Mono.Preloader.csproj @@ -1,20 +1,17 @@  net35;netstandard2.0 - BepInEx.Preloader.UnityMono - BepInEx.Preloader.UnityMono true - BepInEx.Preloader.UnityMono - ..\bin\UnityMono\ + Unity.IL2CPP false - - - + + + diff --git a/BepInEx.Preloader.UnityMono/DoorstopEntrypoint.cs b/Runtimes/Unity/BepInEx.Unity.Mono.Preloader/DoorstopEntrypoint.cs similarity index 89% rename from BepInEx.Preloader.UnityMono/DoorstopEntrypoint.cs rename to Runtimes/Unity/BepInEx.Unity.Mono.Preloader/DoorstopEntrypoint.cs index 2f8e13d..4fb7ea4 100644 --- a/BepInEx.Preloader.UnityMono/DoorstopEntrypoint.cs +++ b/Runtimes/Unity/BepInEx.Unity.Mono.Preloader/DoorstopEntrypoint.cs @@ -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); } diff --git a/BepInEx.Preloader.UnityMono/EntrypointPatcher.cs b/Runtimes/Unity/BepInEx.Unity.Mono.Preloader/EntrypointPatcher.cs similarity index 97% rename from BepInEx.Preloader.UnityMono/EntrypointPatcher.cs rename to Runtimes/Unity/BepInEx.Unity.Mono.Preloader/EntrypointPatcher.cs index 6367f6e..bfb52f0 100644 --- a/BepInEx.Preloader.UnityMono/EntrypointPatcher.cs +++ b/Runtimes/Unity/BepInEx.Unity.Mono.Preloader/EntrypointPatcher.cs @@ -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 { diff --git a/BepInEx.Preloader.UnityMono/RuntimeFixes/TraceFix.cs b/Runtimes/Unity/BepInEx.Unity.Mono.Preloader/RuntimeFixes/TraceFix.cs similarity index 97% rename from BepInEx.Preloader.UnityMono/RuntimeFixes/TraceFix.cs rename to Runtimes/Unity/BepInEx.Unity.Mono.Preloader/RuntimeFixes/TraceFix.cs index 01fc0f3..b88153b 100644 --- a/BepInEx.Preloader.UnityMono/RuntimeFixes/TraceFix.cs +++ b/Runtimes/Unity/BepInEx.Unity.Mono.Preloader/RuntimeFixes/TraceFix.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Reflection; using HarmonyLib; -namespace BepInEx.Preloader.UnityMono.RuntimeFixes; +namespace BepInEx.Unity.Mono.Preloader.RuntimeFixes; /// /// This exists because the Mono implementation of is/was broken, and would call Write directly diff --git a/BepInEx.Preloader.UnityMono/RuntimeFixes/UnityPatches.cs b/Runtimes/Unity/BepInEx.Unity.Mono.Preloader/RuntimeFixes/UnityPatches.cs similarity index 90% rename from BepInEx.Preloader.UnityMono/RuntimeFixes/UnityPatches.cs rename to Runtimes/Unity/BepInEx.Unity.Mono.Preloader/RuntimeFixes/UnityPatches.cs index 0c22522..993a1c7 100644 --- a/BepInEx.Preloader.UnityMono/RuntimeFixes/UnityPatches.cs +++ b/Runtimes/Unity/BepInEx.Unity.Mono.Preloader/RuntimeFixes/UnityPatches.cs @@ -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 { diff --git a/BepInEx.Preloader.UnityMono/RuntimeFixes/XTermFix.cs b/Runtimes/Unity/BepInEx.Unity.Mono.Preloader/RuntimeFixes/XTermFix.cs similarity index 98% rename from BepInEx.Preloader.UnityMono/RuntimeFixes/XTermFix.cs rename to Runtimes/Unity/BepInEx.Unity.Mono.Preloader/RuntimeFixes/XTermFix.cs index b2f9e7c..ab33789 100644 --- a/BepInEx.Preloader.UnityMono/RuntimeFixes/XTermFix.cs +++ b/Runtimes/Unity/BepInEx.Unity.Mono.Preloader/RuntimeFixes/XTermFix.cs @@ -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 { diff --git a/BepInEx.Preloader.UnityMono/UnityPreloader.cs b/Runtimes/Unity/BepInEx.Unity.Mono.Preloader/UnityPreloader.cs similarity index 97% rename from BepInEx.Preloader.UnityMono/UnityPreloader.cs rename to Runtimes/Unity/BepInEx.Unity.Mono.Preloader/UnityPreloader.cs index 1723e0c..6cc3b33 100644 --- a/BepInEx.Preloader.UnityMono/UnityPreloader.cs +++ b/Runtimes/Unity/BepInEx.Unity.Mono.Preloader/UnityPreloader.cs @@ -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; /// /// The main entrypoint of BepInEx, and initializes all patchers and the chainloader. diff --git a/BepInEx.Preloader.UnityMono/UnityPreloaderRunner.cs b/Runtimes/Unity/BepInEx.Unity.Mono.Preloader/UnityPreloaderRunner.cs similarity index 97% rename from BepInEx.Preloader.UnityMono/UnityPreloaderRunner.cs rename to Runtimes/Unity/BepInEx.Unity.Mono.Preloader/UnityPreloaderRunner.cs index 39c8c0f..0bacd38 100644 --- a/BepInEx.Preloader.UnityMono/UnityPreloaderRunner.cs +++ b/Runtimes/Unity/BepInEx.Unity.Mono.Preloader/UnityPreloaderRunner.cs @@ -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 { diff --git a/BepInEx.Preloader.UnityMono/Utils/MonoAssemblyHelper.cs b/Runtimes/Unity/BepInEx.Unity.Mono.Preloader/Utils/MonoAssemblyHelper.cs similarity index 98% rename from BepInEx.Preloader.UnityMono/Utils/MonoAssemblyHelper.cs rename to Runtimes/Unity/BepInEx.Unity.Mono.Preloader/Utils/MonoAssemblyHelper.cs index 52f02cf..3727e33 100644 --- a/BepInEx.Preloader.UnityMono/Utils/MonoAssemblyHelper.cs +++ b/Runtimes/Unity/BepInEx.Unity.Mono.Preloader/Utils/MonoAssemblyHelper.cs @@ -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 { diff --git a/BepInEx.UnityMono/BaseUnityPlugin.cs b/Runtimes/Unity/BepInEx.Unity.Mono/BaseUnityPlugin.cs similarity index 98% rename from BepInEx.UnityMono/BaseUnityPlugin.cs rename to Runtimes/Unity/BepInEx.Unity.Mono/BaseUnityPlugin.cs index 8662eef..4043771 100644 --- a/BepInEx.UnityMono/BaseUnityPlugin.cs +++ b/Runtimes/Unity/BepInEx.Unity.Mono/BaseUnityPlugin.cs @@ -3,7 +3,7 @@ using BepInEx.Configuration; using BepInEx.Logging; using UnityEngine; -namespace BepInEx.UnityMono; +namespace BepInEx.Unity.Mono; /// /// The base plugin type that is used by the BepInEx plugin loader. diff --git a/BepInEx.UnityMono/BepInEx.UnityMono.csproj b/Runtimes/Unity/BepInEx.Unity.Mono/BepInEx.Unity.Mono.csproj similarity index 64% rename from BepInEx.UnityMono/BepInEx.UnityMono.csproj rename to Runtimes/Unity/BepInEx.Unity.Mono/BepInEx.Unity.Mono.csproj index a8b10f7..c1e8c71 100644 --- a/BepInEx.UnityMono/BepInEx.UnityMono.csproj +++ b/Runtimes/Unity/BepInEx.Unity.Mono/BepInEx.Unity.Mono.csproj @@ -2,20 +2,17 @@ BepInEx support library for Mono Unity games net35;netstandard2.0 - BepInEx.UnityMono - BepInEx.UnityMono true - BepInEx.UnityMono - ..\bin\UnityMono\ + Unity.Mono false - - - + + + diff --git a/BepInEx.UnityMono/BepInExInstance.cs b/Runtimes/Unity/BepInEx.Unity.Mono/BepInExInstance.cs similarity index 58% rename from BepInEx.UnityMono/BepInExInstance.cs rename to Runtimes/Unity/BepInEx.Unity.Mono/BepInExInstance.cs index 6fea451..703e6c2 100644 --- a/BepInEx.UnityMono/BepInExInstance.cs +++ b/Runtimes/Unity/BepInEx.Unity.Mono/BepInExInstance.cs @@ -1,6 +1,6 @@ -using BepInEx.UnityMono.Bootstrap; +using BepInEx.Unity.Mono.Bootstrap; -namespace BepInEx.UnityMono; +namespace BepInEx.Unity.Mono; public static class BepInExInstance { diff --git a/BepInEx.UnityMono/Bootstrap/UnityChainloader.cs b/Runtimes/Unity/BepInEx.Unity.Mono/Bootstrap/UnityChainloader.cs similarity index 96% rename from BepInEx.UnityMono/Bootstrap/UnityChainloader.cs rename to Runtimes/Unity/BepInEx.Unity.Mono/Bootstrap/UnityChainloader.cs index 28f3cc1..c08a8de 100644 --- a/BepInEx.UnityMono/Bootstrap/UnityChainloader.cs +++ b/Runtimes/Unity/BepInEx.Unity.Mono/Bootstrap/UnityChainloader.cs @@ -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; /// /// The manager and loader for all plugins, and the entry point for BepInEx plugin system. @@ -33,6 +33,8 @@ public class UnityChainloader : BaseChainloader 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 ChainloaderLogHelper.RewritePreloaderLogs(); - if (ConfigUnityLogging.Value) Logger.Sources.Add(new UnityLogSource()); } diff --git a/BepInEx.UnityMono/Configuration/KeyboardShortcut.cs b/Runtimes/Unity/BepInEx.Unity.Mono/Configuration/KeyboardShortcut.cs similarity index 99% rename from BepInEx.UnityMono/Configuration/KeyboardShortcut.cs rename to Runtimes/Unity/BepInEx.Unity.Mono/Configuration/KeyboardShortcut.cs index 97ee43d..5e7f37b 100644 --- a/BepInEx.UnityMono/Configuration/KeyboardShortcut.cs +++ b/Runtimes/Unity/BepInEx.Unity.Mono/Configuration/KeyboardShortcut.cs @@ -6,7 +6,7 @@ using BepInEx.Logging; using UnityEngine; using Logger = BepInEx.Logging.Logger; -namespace BepInEx.UnityMono.Configuration; +namespace BepInEx.Unity.Mono.Configuration; /// /// A keyboard shortcut that can be used in Update method to check if user presses a key combo. The shortcut is only diff --git a/BepInEx.UnityMono/Logging/UnityLogListener.cs b/Runtimes/Unity/BepInEx.Unity.Mono/Logging/UnityLogListener.cs similarity index 98% rename from BepInEx.UnityMono/Logging/UnityLogListener.cs rename to Runtimes/Unity/BepInEx.Unity.Mono/Logging/UnityLogListener.cs index 6618e7c..5931390 100644 --- a/BepInEx.UnityMono/Logging/UnityLogListener.cs +++ b/Runtimes/Unity/BepInEx.Unity.Mono/Logging/UnityLogListener.cs @@ -7,7 +7,7 @@ using BepInEx.Logging; using UnityEngine; using Logger = BepInEx.Logging.Logger; -namespace BepInEx.UnityMono.Logging +namespace BepInEx.Unity.Mono.Logging { /// /// Logs entries using Unity specific outputs. diff --git a/BepInEx.UnityMono/Logging/UnityLogSource.cs b/Runtimes/Unity/BepInEx.Unity.Mono/Logging/UnityLogSource.cs similarity index 98% rename from BepInEx.UnityMono/Logging/UnityLogSource.cs rename to Runtimes/Unity/BepInEx.Unity.Mono/Logging/UnityLogSource.cs index b1ba196..9d514c4 100644 --- a/BepInEx.UnityMono/Logging/UnityLogSource.cs +++ b/Runtimes/Unity/BepInEx.Unity.Mono/Logging/UnityLogSource.cs @@ -3,7 +3,7 @@ using System.Reflection; using BepInEx.Logging; using UnityEngine; -namespace BepInEx.UnityMono.Logging; +namespace BepInEx.Unity.Mono.Logging; /// /// Logs entries using Unity specific outputs. diff --git a/BepInEx.UnityMono/ThreadingHelper.cs b/Runtimes/Unity/BepInEx.Unity.Mono/ThreadingHelper.cs similarity index 99% rename from BepInEx.UnityMono/ThreadingHelper.cs rename to Runtimes/Unity/BepInEx.Unity.Mono/ThreadingHelper.cs index 7b7a6dc..17260c1 100644 --- a/BepInEx.UnityMono/ThreadingHelper.cs +++ b/Runtimes/Unity/BepInEx.Unity.Mono/ThreadingHelper.cs @@ -8,7 +8,7 @@ using BepInEx.Logging; using UnityEngine; using Logger = BepInEx.Logging.Logger; -namespace BepInEx.UnityMono; +namespace BepInEx.Unity.Mono; /// /// Provides methods for running code on other threads and synchronizing with the main thread. diff --git a/BepInEx.UnityMono/UnityTomlTypeConverters.cs b/Runtimes/Unity/BepInEx.Unity.Mono/UnityTomlTypeConverters.cs similarity index 97% rename from BepInEx.UnityMono/UnityTomlTypeConverters.cs rename to Runtimes/Unity/BepInEx.Unity.Mono/UnityTomlTypeConverters.cs index 43317a2..3f4da2e 100644 --- a/BepInEx.UnityMono/UnityTomlTypeConverters.cs +++ b/Runtimes/Unity/BepInEx.Unity.Mono/UnityTomlTypeConverters.cs @@ -3,7 +3,7 @@ using System.Runtime.CompilerServices; using BepInEx.Configuration; using UnityEngine; -namespace BepInEx.UnityMono; +namespace BepInEx.Unity.Mono; /// /// Config types that are unity specific diff --git a/doorstop/doorstop_config_il2cpp.ini b/Runtimes/Unity/Doorstop/doorstop_config_il2cpp.ini similarity index 82% rename from doorstop/doorstop_config_il2cpp.ini rename to Runtimes/Unity/Doorstop/doorstop_config_il2cpp.ini index 13e3b8c..ed1f29a 100644 --- a/doorstop/doorstop_config_il2cpp.ini +++ b/Runtimes/Unity/Doorstop/doorstop_config_il2cpp.ini @@ -2,19 +2,18 @@ [General] # Enable Doorstop? -enabled=true +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 \output_log.txt -redirect_output_log=false +redirect_output_log = false # If enabled, DOORSTOP_DISABLE env var value is ignored # USE THIS ONLY WHEN ASKED TO OR YOU KNOW WHAT THIS MEANS -ignore_disable_switch=false - +ignore_disable_switch = false # Options specific to running under Unity Mono runtime [UnityMono] @@ -24,26 +23,26 @@ ignore_disable_switch=false # (e.g. mscorlib is stripped in original game) # This option causes Mono to seek mscorlib and core libraries from a different folder before Managed # Original Managed folder is added as a secondary folder in the search path -dll_search_path_override= +dll_search_path_override = # If true, Mono debugger server will be enabled -debug_enabled=false +debug_enabled = false # When debug_enabled is true, this option specifies whether Doorstop should initialize the debugger server # If you experience crashes when starting the debugger on debug UnityPlayer builds, try setting this to false -debug_start_server=true +debug_start_server = true # When debug_enabled is true, specifies the address to use for the debugger server -debug_address=127.0.0.1:10000 +debug_address = 127.0.0.1:10000 # If true and debug_enabled is true, Mono debugger server will suspend the game execution until a debugger is attached -debug_suspend=false +debug_suspend = false # Options sepcific to running under Il2Cpp runtime [Il2Cpp] # Path to coreclr.dll that contains the CoreCLR runtime -coreclr_path=dotnet\coreclr.dll +coreclr_path = dotnet\coreclr.dll # Path to the directory containing the managed core libraries for CoreCLR (mscorlib, System, etc.) -corlib_dir=dotnet +corlib_dir = dotnet diff --git a/doorstop/doorstop_config_mono.ini b/Runtimes/Unity/Doorstop/doorstop_config_mono.ini similarity index 82% rename from doorstop/doorstop_config_mono.ini rename to Runtimes/Unity/Doorstop/doorstop_config_mono.ini index c8ae298..743f430 100644 --- a/doorstop/doorstop_config_mono.ini +++ b/Runtimes/Unity/Doorstop/doorstop_config_mono.ini @@ -2,18 +2,18 @@ [General] # Enable Doorstop? -enabled=true +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 \output_log.txt -redirect_output_log=false +redirect_output_log = false # If enabled, DOORSTOP_DISABLE env var value is ignored # USE THIS ONLY WHEN ASKED TO OR YOU KNOW WHAT THIS MEANS -ignore_disable_switch=false +ignore_disable_switch = false # Options specific to running under Unity Mono runtime [UnityMono] @@ -23,17 +23,17 @@ ignore_disable_switch=false # (e.g. mscorlib is stripped in original game) # This option causes Mono to seek mscorlib and core libraries from a different folder before Managed # Original Managed folder is added as a secondary folder in the search path -dll_search_path_override= +dll_search_path_override = # If true, Mono debugger server will be enabled -debug_enabled=false +debug_enabled = false # When debug_enabled is true, this option specifies whether Doorstop should initialize the debugger server # If you experience crashes when starting the debugger on debug UnityPlayer builds, try setting this to false -debug_start_server=true +debug_start_server = true # When debug_enabled is true, specifies the address to use for the debugger server -debug_address=127.0.0.1:10000 +debug_address = 127.0.0.1:10000 # If true and debug_enabled is true, Mono debugger server will suspend the game execution until a debugger is attached -debug_suspend=false +debug_suspend = false diff --git a/doorstop/run_bepinex_il2cpp.sh b/Runtimes/Unity/Doorstop/run_bepinex_il2cpp.sh similarity index 99% rename from doorstop/run_bepinex_il2cpp.sh rename to Runtimes/Unity/Doorstop/run_bepinex_il2cpp.sh index 91b6326..a2f51d0 100644 --- a/doorstop/run_bepinex_il2cpp.sh +++ b/Runtimes/Unity/Doorstop/run_bepinex_il2cpp.sh @@ -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 diff --git a/doorstop/run_bepinex_mono.sh b/Runtimes/Unity/Doorstop/run_bepinex_mono.sh similarity index 99% rename from doorstop/run_bepinex_mono.sh rename to Runtimes/Unity/Doorstop/run_bepinex_mono.sh index 7ee8cd5..59fca22 100644 --- a/doorstop/run_bepinex_mono.sh +++ b/Runtimes/Unity/Doorstop/run_bepinex_mono.sh @@ -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 diff --git a/assets/logo.png b/assets/logos/logo.png similarity index 100% rename from assets/logo.png rename to assets/logos/logo.png diff --git a/assets/logo.svg b/assets/logos/logo.svg similarity index 100% rename from assets/logo.svg rename to assets/logos/logo.svg diff --git a/build/BuildDependencies.cs b/build/BuildDependencies.cs new file mode 100644 index 0000000..fd34bf0 --- /dev/null +++ b/build/BuildDependencies.cs @@ -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"; +} diff --git a/build/DependencyCache.cs b/build/DependencyCache.cs new file mode 100644 index 0000000..4b1e4f4 --- /dev/null +++ b/build/DependencyCache.cs @@ -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 cache = + CacheFile.Exists() + ? JsonDeserialize>(File.ReadAllText(CacheFile)) + : new Dictionary(); + + 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)); +} diff --git a/build/DistributionTarget.cs b/build/DistributionTarget.cs new file mode 100644 index 0000000..6aed13c --- /dev/null +++ b/build/DistributionTarget.cs @@ -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}") + }; +} diff --git a/build/DownloadTasks.cs b/build/DownloadTasks.cs new file mode 100644 index 0000000..fa767eb --- /dev/null +++ b/build/DownloadTasks.cs @@ -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); + } + } + } +}