diff --git a/.github/workflows/build_pr.yml b/.github/workflows/build_pr.yml index 10faf99db..b89e51410 100644 --- a/.github/workflows/build_pr.yml +++ b/.github/workflows/build_pr.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - master + - v5-lts jobs: build: diff --git a/.github/workflows/comment_pr.yml b/.github/workflows/comment_pr.yml index 3a7dde1bb..2bbeab7a8 100644 --- a/.github/workflows/comment_pr.yml +++ b/.github/workflows/comment_pr.yml @@ -40,9 +40,28 @@ jobs: const {owner, repo} = context.repo; const run_id = ${{github.event.workflow_run.id}}; - const pull_requests = ${{ toJSON(github.event.workflow_run.pull_requests) }}; + let pull_requests = ${{ toJSON(github.event.workflow_run.pull_requests) }}; + + if (!pull_requests.length) { + core.info("No PRs in workflow_run payload; resolving by branch head"); + const headBranch = context.payload.workflow_run.head_branch; + + // Search open PRs in base repo and match by branch name (works for many fork cases) + const { data } = await github.rest.pulls.list({ + owner, + repo, + state: "open", + per_page: 100, + }); + + pull_requests = data.filter(pr => { + // pr.head.ref is branch name; for forks also check same branch name + return pr.head.ref === headBranch; + }); + } + if (!pull_requests.length) { - return core.error("This workflow doesn't match any pull requests!"); + return core.error("Could not resolve pull request for this workflow run."); } const artifacts = await github.paginate( diff --git a/BepInEx.Core/Bootstrap/BaseChainloader.cs b/BepInEx.Core/Bootstrap/BaseChainloader.cs index a100d75c6..a266f1c9d 100644 --- a/BepInEx.Core/Bootstrap/BaseChainloader.cs +++ b/BepInEx.Core/Bootstrap/BaseChainloader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -370,7 +370,15 @@ public virtual void Execute() var plugins = DiscoverPlugins(); Logger.Log(LogLevel.Info, $"{plugins.Count} plugin{(plugins.Count == 1 ? "" : "s")} to load"); LoadPlugins(plugins); - Finished?.Invoke(); + + try + { + Finished?.Invoke(); + } + catch (Exception ex) + { + Logger.Log(LogLevel.Error, $"Error occurred in a Chainloader.Finished event handler: {ex}"); + } } catch (Exception ex) { @@ -399,6 +407,7 @@ private IList LoadPlugins(IList plugins) { var dependsOnInvalidPlugin = false; var missingDependencies = new List(); + var incompatibleDependencies = new List>(); foreach (var dependency in plugin.Dependencies) { static bool IsHardDependency(BepInDependency dep) => @@ -414,15 +423,22 @@ static bool IsHardDependency(BepInDependency dep) => pluginVersion = pluginInfo?.Metadata.Version; } - if (!dependencyExists || dependency.VersionRange != null && - !dependency.VersionRange.IsSatisfied(pluginVersion)) + // The dependency is not installed at all. + if (!dependencyExists) { - // If the dependency is hard, collect it into a list to show if (IsHardDependency(dependency)) missingDependencies.Add(dependency); continue; } + // The dependency is installed, but its version does not satisfy the requested range. + if (dependency.VersionRange != null && !dependency.VersionRange.IsSatisfied(pluginVersion)) + { + if (IsHardDependency(dependency)) + incompatibleDependencies.Add(new KeyValuePair(dependency, pluginVersion?.ToString())); + continue; + } + // If the dependency is a hard and is invalid (e.g. has missing dependencies), report that to the user if (invalidPlugins.Contains(dependency.DependencyGUID) && IsHardDependency(dependency)) { @@ -442,13 +458,25 @@ static bool IsHardDependency(BepInDependency dep) => continue; } - if (missingDependencies.Count != 0) + if (missingDependencies.Count != 0 || incompatibleDependencies.Count != 0) { - var message = $@"Could not load [{plugin}] because it has missing dependencies: { - string.Join(", ", missingDependencies.Select(s => s.VersionRange == null ? s.DependencyGUID : $"{s.DependencyGUID} ({s.VersionRange})").ToArray()) - }"; - DependencyErrors.Add(message); - Logger.Log(LogLevel.Error, message); + if (missingDependencies.Count != 0) + { + var message = $@"Could not load [{plugin}] because it has missing dependencies: { + string.Join(", ", missingDependencies.Select(s => s.VersionRange == null ? s.DependencyGUID : $"{s.DependencyGUID} ({s.VersionRange})").ToArray()) + }. Install the listed plugin(s) and restart the game."; + DependencyErrors.Add(message); + Logger.Log(LogLevel.Error, message); + } + + if (incompatibleDependencies.Count != 0) + { + var message = $@"Could not load [{plugin}] because the following dependencies are installed with an incompatible version: { + string.Join(", ", incompatibleDependencies.Select(s => $"{s.Key.DependencyGUID} (found {s.Value}, requires {s.Key.VersionRange})").ToArray()) + }. Update the listed plugin(s) to a version that satisfies the requirement."; + DependencyErrors.Add(message); + Logger.Log(LogLevel.Error, message); + } invalidPlugins.Add(plugin.Metadata.GUID); continue; diff --git a/BepInEx.Core/Configuration/ConfigFile.cs b/BepInEx.Core/Configuration/ConfigFile.cs index e81b0854f..dfa756be9 100644 --- a/BepInEx.Core/Configuration/ConfigFile.cs +++ b/BepInEx.Core/Configuration/ConfigFile.cs @@ -34,7 +34,7 @@ public ConfigFile(string configPath, bool saveOnInit, BepInPlugin ownerMetadata) if (File.Exists(ConfigFilePath)) Reload(); - else if (saveOnInit) Save(); + else if (saveOnInit) TrySave(); } public static ConfigFile CoreConfig { get; } = new(Paths.BepInExConfigPath, true); @@ -92,9 +92,12 @@ public ConfigEntryBase this[ConfigDefinition key] public ConfigEntryBase this[string section, string key] => this[new ConfigDefinition(section, key)]; /// - public IEnumerator> GetEnumerator() => - // We can't really do a read lock for this - Entries.GetEnumerator(); + public IEnumerator> GetEnumerator() + { + // Enumerate a snapshot taken under the lock so a concurrent mutation cannot invalidate the iterator. + lock (_ioLock) + return Entries.ToList().GetEnumerator(); + } IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); @@ -352,6 +355,24 @@ public void Save() } } + /// + /// Writes the config to disk like , but logs and swallows I/O failures (e.g. a read-only + /// or locked config file) instead of throwing. Used only for the creation-time saves (initial file write and + /// new-entry binds), which can run before logging is up; explicit saves and setting changes still throw. + /// + private void TrySave() + { + try + { + Save(); + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) + { + Logger.Log(LogLevel.Warning, + $"Could not write config file {ConfigFilePath}: {e.Message}. Continuing with the in-memory configuration."); + } + } + #endregion #region Wraps @@ -452,7 +473,7 @@ public ConfigEntry Bind(ConfigDefinition configDefinition, } if (SaveOnConfigSet) - Save(); + TrySave(); return entry; } diff --git a/BepInEx.Core/Configuration/TomlTypeConverter.cs b/BepInEx.Core/Configuration/TomlTypeConverter.cs index 41595afbf..a1b2348d8 100644 --- a/BepInEx.Core/Configuration/TomlTypeConverter.cs +++ b/BepInEx.Core/Configuration/TomlTypeConverter.cs @@ -31,11 +31,6 @@ public static class TomlTypeConverter ConvertToString = (obj, type) => obj.ToString().ToLowerInvariant(), ConvertToObject = (str, type) => bool.Parse(str) }, - [typeof(byte)] = new TypeConverter - { - ConvertToString = (obj, type) => obj.ToString(), - ConvertToObject = (str, type) => byte.Parse(str) - }, //integral types diff --git a/BepInEx.Core/Console/Unix/ConsoleWriter.cs b/BepInEx.Core/Console/Unix/ConsoleWriter.cs index 27f13bd55..c3e98c2b9 100644 --- a/BepInEx.Core/Console/Unix/ConsoleWriter.cs +++ b/BepInEx.Core/Console/Unix/ConsoleWriter.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Linq; using System.Reflection; diff --git a/BepInEx.Core/Console/Unix/TtyHandler.cs b/BepInEx.Core/Console/Unix/TtyHandler.cs index 1556b479e..32b024d8b 100644 --- a/BepInEx.Core/Console/Unix/TtyHandler.cs +++ b/BepInEx.Core/Console/Unix/TtyHandler.cs @@ -1,4 +1,4 @@ -// Sections of this code have been abridged from https://github.com/mono/mono/blob/master/mcs/class/corlib/System/TermInfoReader.cs under the MIT license +// Sections of this code have been abridged from https://github.com/mono/mono/blob/master/mcs/class/corlib/System/TermInfoReader.cs under the MIT license using System; using System.IO; diff --git a/BepInEx.Core/Console/Unix/UnixStream.cs b/BepInEx.Core/Console/Unix/UnixStream.cs index 70146d142..f1ee8de0c 100644 --- a/BepInEx.Core/Console/Unix/UnixStream.cs +++ b/BepInEx.Core/Console/Unix/UnixStream.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Runtime.InteropServices; diff --git a/BepInEx.Core/Console/Unix/UnixStreamHelper.cs b/BepInEx.Core/Console/Unix/UnixStreamHelper.cs index a8f185ec1..0f64e447a 100644 --- a/BepInEx.Core/Console/Unix/UnixStreamHelper.cs +++ b/BepInEx.Core/Console/Unix/UnixStreamHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Runtime.InteropServices; using BepInEx.Core; diff --git a/BepInEx.Core/Console/Windows/ConsoleEncoding/ConsoleEncoding.cs b/BepInEx.Core/Console/Windows/ConsoleEncoding/ConsoleEncoding.cs index b70f1e129..b9d7c1c47 100644 --- a/BepInEx.Core/Console/Windows/ConsoleEncoding/ConsoleEncoding.cs +++ b/BepInEx.Core/Console/Windows/ConsoleEncoding/ConsoleEncoding.cs @@ -41,7 +41,7 @@ public static uint ConsoleCodePage public override int GetByteCount(char[] chars, int index, int count) { WriteCharBuffer(chars, index, count); - var result = WideCharToMultiByte(_codePage, 0, chars, count, _zeroByte, 0, IntPtr.Zero, IntPtr.Zero); + var result = WideCharToMultiByte(_codePage, 0, _charBuffer, count, _zeroByte, 0, IntPtr.Zero, IntPtr.Zero); return result; } @@ -50,7 +50,7 @@ public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] var byteCount = GetByteCount(chars, charIndex, charCount); WriteCharBuffer(chars, charIndex, charCount); ExpandByteBuffer(byteCount); - _ = WideCharToMultiByte(_codePage, 0, chars, charCount, _byteBuffer, byteCount, IntPtr.Zero, + _ = WideCharToMultiByte(_codePage, 0, _charBuffer, charCount, _byteBuffer, byteCount, IntPtr.Zero, IntPtr.Zero); var readCount = Math.Min(bytes.Length, byteCount); ReadByteBuffer(bytes, byteIndex, readCount); @@ -60,7 +60,7 @@ public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] public override int GetCharCount(byte[] bytes, int index, int count) { WriteByteBuffer(bytes, index, count); - var result = MultiByteToWideChar(_codePage, 0, bytes, count, _zeroChar, 0); + var result = MultiByteToWideChar(_codePage, 0, _byteBuffer, count, _zeroChar, 0); return result; } @@ -69,7 +69,7 @@ public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] var charCount = GetCharCount(bytes, byteIndex, byteCount); WriteByteBuffer(bytes, byteIndex, byteCount); ExpandCharBuffer(charCount); - _ = MultiByteToWideChar(_codePage, 0, bytes, byteCount, _charBuffer, charCount); + _ = MultiByteToWideChar(_codePage, 0, _byteBuffer, byteCount, _charBuffer, charCount); var readCount = Math.Min(chars.Length, charCount); ReadCharBuffer(chars, charIndex, readCount); return readCount; diff --git a/BepInEx.Core/Console/Windows/ConsoleWindow.cs b/BepInEx.Core/Console/Windows/ConsoleWindow.cs index 20f878c43..37be192e1 100644 --- a/BepInEx.Core/Console/Windows/ConsoleWindow.cs +++ b/BepInEx.Core/Console/Windows/ConsoleWindow.cs @@ -1,4 +1,4 @@ -// -------------------------------------------------- +// -------------------------------------------------- // UnityInjector - ConsoleWindow.cs // Copyright (c) Usagirei 2015 - 2015 // -------------------------------------------------- diff --git a/BepInEx.Core/Console/Windows/WindowsConsoleDriver.cs b/BepInEx.Core/Console/Windows/WindowsConsoleDriver.cs index 7e4da8c39..966104025 100644 --- a/BepInEx.Core/Console/Windows/WindowsConsoleDriver.cs +++ b/BepInEx.Core/Console/Windows/WindowsConsoleDriver.cs @@ -94,8 +94,9 @@ public void CreateConsole(uint codepage) // Make sure of ConsoleEncoding helper class because on some Monos // Encoding.GetEncoding throws NotImplementedException on most codepages // NOTE: We don't set Console.OutputEncoding because it resets any existing Console.Out writers - if (!useManagedEncoder) - ConsoleEncoding.ConsoleCodePage = codepage; + // Always set the console output codepage so the Windows console interprets bytes correctly, + // regardless of whether we use a managed encoder or ConsoleEncoding to produce those bytes. + ConsoleEncoding.ConsoleCodePage = codepage; // If stdout exists, write to it, otherwise make it the same as console out // Not sure if this is needed? Does the original Console.Out still work? @@ -161,7 +162,7 @@ private static Stream OpenFileStream(IntPtr handle) { var windowsConsoleStreamType = Type.GetType("System.ConsolePal+WindowsConsoleStream, System.Console", true); var constructor = AccessTools.Constructor(windowsConsoleStreamType, - new[] { typeof(IntPtr), typeof(FileAccess), typeof(bool) }); + new[] { typeof(IntPtr), typeof(FileAccess), typeof(bool) }); return (Stream)constructor.Invoke(new object[] { handle, FileAccess.Write, true }); } @@ -191,3 +192,4 @@ private IntPtr GetOutHandle() } } } + diff --git a/BepInEx.Core/Contract/Attributes.cs b/BepInEx.Core/Contract/Attributes.cs index 843e1cd48..f8f813bc6 100644 --- a/BepInEx.Core/Contract/Attributes.cs +++ b/BepInEx.Core/Contract/Attributes.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -120,8 +120,18 @@ public BepInDependency(string DependencyGUID, DependencyFlags Flags = Dependency /// not load and an error will be logged instead. /// /// The GUID of the referenced plugin. - /// The version range of the referenced plugin. - /// When version is supplied the dependency is always treated as HardDependency + /// + /// The version requirement of the referenced plugin, parsed as a SemVer range + /// (see ). A plain version such as + /// 1.2.0 requires that exact version; use a range such as >=1.2.0, 1.2.*, + /// ~1.2.0 or ^1.2.0 to accept more than one version. + /// + /// + /// When a version is supplied the dependency is always treated as a hard dependency. + /// Plugins migrating from BepInEx 5 should note a behaviour change: a bare version was previously + /// treated as a minimum (>=), whereas in BepInEx 6 it is an exact match. Use + /// >=1.2.0 to keep the old behaviour. + /// public BepInDependency(string guid, string version) : this(guid) { VersionRange = Range.Parse(version); @@ -266,7 +276,7 @@ internal static IEnumerable GetCustomAttributes(TypeDefiniti var currentType = td; do - { + { result.AddRange(currentType.CustomAttributes.Where(inheritAttribute ? (ca => TypeInheretsFrom(ca.AttributeType, type)) : (ca => ca.AttributeType.FullName == type.FullName))); currentType = currentType.BaseType?.Resolve(); } while (inheritType && currentType?.FullName != "System.Object"); @@ -343,3 +353,4 @@ public static IEnumerable GetDependencies(Type plugin) => } #endregion + diff --git a/BepInEx.Core/PlatformUtils.cs b/BepInEx.Core/PlatformUtils.cs index 7e251d8e7..b3c2a8e0d 100644 --- a/BepInEx.Core/PlatformUtils.cs +++ b/BepInEx.Core/PlatformUtils.cs @@ -97,7 +97,7 @@ internal static class PlatformUtils public static Platform Current { get; private set; } public static bool Is(Platform expected) => (Current & expected) == expected; - public static bool Is(this Platform current, Platform expected) => (current & expected) == expected; + private static bool Is(this Platform current, Platform expected) => (current & expected) == expected; public static T AsDelegate(this IntPtr procAddress) where T : Delegate @@ -140,9 +140,9 @@ public static void SetPlatform() var windowsVersionInfo = new WindowsOSVersionInfoExW(); RtlGetVersion(ref windowsVersionInfo); - WindowsVersion = new Version((int)windowsVersionInfo.dwMajorVersion, - (int)windowsVersionInfo.dwMinorVersion, 0, - (int)windowsVersionInfo.dwBuildNumber); + WindowsVersion = new Version((int) windowsVersionInfo.dwMajorVersion, + (int) windowsVersionInfo.dwMinorVersion, 0, + (int) windowsVersionInfo.dwBuildNumber); var ntDll = LoadLibrary("ntdll.dll"); if (ntDll != IntPtr.Zero) @@ -151,7 +151,12 @@ public static void SetPlatform() if (wineGetVersion != IntPtr.Zero) { current |= Platform.Wine; - var getVersion = wineGetVersion.AsDelegate(); + // It's not safe to use the AsDelegate() extension method here because: + // - It comes from the MonoMod.Utils.DynDll class, defined in MonoMod.Common. + // - The DynDll class has a static constructor that reads PlatformHelper.Current. + // - Reading from that property freezes it: subsequent writes will throw an exception. + // - This method only sets PlatformHelper.Current at the very end. + var getVersion = Marshal.GetDelegateForFunctionPointer(wineGetVersion, typeof(GetWineVersionDelegate)) as GetWineVersionDelegate; WineVersion = getVersion(); } } diff --git a/BepInEx.Core/Utility.cs b/BepInEx.Core/Utility.cs index 89b12864c..cfac10d15 100644 --- a/BepInEx.Core/Utility.cs +++ b/BepInEx.Core/Utility.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -7,6 +7,7 @@ using System.Runtime.Loader; using System.Security.Cryptography; using System.Text; +using BepInEx.Logging; using Mono.Cecil; namespace BepInEx; @@ -343,7 +344,10 @@ public static string HashStrings(params string[] strings) using var md5 = MD5.Create(); foreach (var str in strings) - md5.TransformBlock(Encoding.UTF8.GetBytes(str), 0, str.Length, null, 0); + { + var bytes = Encoding.UTF8.GetBytes(str); + md5.TransformBlock(bytes, 0, bytes.Length, null, 0); + } md5.TransformFinalBlock(new byte[0], 0, 0); @@ -429,11 +433,21 @@ public static IEnumerable GetUniqueFilesInDirectories(IEnumerable(StringComparer.InvariantCultureIgnoreCase); foreach (var directory in directories) - foreach (var file in Directory.GetFiles(directory, pattern)) { - var fileName = Path.GetFileName(file); - if (!result.ContainsKey(fileName)) - result[fileName] = file; + // A configured search directory (e.g. a missing unstripped_corlib) may not exist; warn and skip it + // instead of letting Directory.GetFiles throw DirectoryNotFoundException. + if (!Directory.Exists(directory)) + { + Logger.Log(LogLevel.Warning, $"Skipping search directory that does not exist: {directory}"); + continue; + } + + foreach (var file in Directory.GetFiles(directory, pattern)) + { + var fileName = Path.GetFileName(file); + if (!result.ContainsKey(fileName)) + result[fileName] = file; + } } return result.Values; diff --git a/BepInEx.Preloader.Core/Patching/Attributes.cs b/BepInEx.Preloader.Core/Patching/Attributes.cs index 95b21c424..c8c76c138 100644 --- a/BepInEx.Preloader.Core/Patching/Attributes.cs +++ b/BepInEx.Preloader.Core/Patching/Attributes.cs @@ -82,7 +82,7 @@ internal static PatcherPluginInfoAttribute FromType(Type type) /// /// Defines an assembly that a patch method will target. /// -[AttributeUsage(AttributeTargets.Method)] +[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] public class TargetAssemblyAttribute : Attribute { /// @@ -108,7 +108,7 @@ public TargetAssemblyAttribute(string targetAssembly) /// /// Defines a type that a patch method will target. /// -[AttributeUsage(AttributeTargets.Method)] +[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] public class TargetTypeAttribute : Attribute { /// The short filename of the assembly of which belongs to. diff --git a/README.md b/README.md index 8811299f9..342cda961 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -

+

@@ -64,8 +64,8 @@ A more comprehensive comparison list of features and compatibility is available #### IL2CPP libraries -- [SamboyCoding/Cpp2IL](https://github.com/SamboyCoding/Cpp2IL) - v2022.0.7.2 -- [BepInEx/Il2CppInterop](https://github.com/BepInEx/Il2CppInterop) - v1.4.5 +- [SamboyCoding/Cpp2IL](https://github.com/SamboyCoding/Cpp2IL) - v2022.1.0 +- [BepInEx/Il2CppInterop](https://github.com/BepInEx/Il2CppInterop) - v1.5.3 - [BepInEx/dotnet-runtime](https://github.com/BepInEx/dotnet-runtime) - v6.0.7 ## License diff --git a/Runtimes/NET/BepInEx.NET.CoreCLR/HookEntrypoint.cs b/Runtimes/NET/BepInEx.NET.CoreCLR/HookEntrypoint.cs index d41c88345..5912f5804 100644 --- a/Runtimes/NET/BepInEx.NET.CoreCLR/HookEntrypoint.cs +++ b/Runtimes/NET/BepInEx.NET.CoreCLR/HookEntrypoint.cs @@ -32,17 +32,16 @@ public static void Initialize(string assemblyFilename, string bepinRootPath = nu try { - //#if DEBUG - // filename = - // Path.Combine(Directory.GetCurrentDirectory(), - // Path.GetFileName(Process.GetCurrentProcess().MainModule.FileName)); - // ResolveDirectories.Add(Path.GetDirectoryName(filename)); - - // // for debugging within VS - // ResolveDirectories.Add(Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName)); - //#else - - +//#if DEBUG +// filename = +// Path.Combine(Directory.GetCurrentDirectory(), +// Path.GetFileName(Process.GetCurrentProcess().MainModule.FileName)); +// ResolveDirectories.Add(Path.GetDirectoryName(filename)); + +// // for debugging within VS +// ResolveDirectories.Add(Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName)); +//#else + string gameDirectory = null; if (assemblyFilename != null) @@ -60,11 +59,11 @@ public static void Initialize(string assemblyFilename, string bepinRootPath = nu { throw new Exception("Could not determine game location, or BepInEx install location"); } - + silentExceptionLog = Path.Combine(gameDirectory, silentExceptionLog); - + ResolveDirectories.Add(bepinexCoreDirectory); - //#endif +//#endif AppDomain.CurrentDomain.AssemblyResolve += SharedEntrypoint.RemoteResolve(ResolveDirectories); @@ -183,3 +182,4 @@ internal static void OuterMain(string filename, string bepinRootPath, AssemblyLo } } } + diff --git a/Runtimes/NET/BepInEx.NET.CoreCLR/NetCorePreloader.cs b/Runtimes/NET/BepInEx.NET.CoreCLR/NetCorePreloader.cs index 1cc2904a8..ce8ef5884 100644 --- a/Runtimes/NET/BepInEx.NET.CoreCLR/NetCorePreloader.cs +++ b/Runtimes/NET/BepInEx.NET.CoreCLR/NetCorePreloader.cs @@ -26,7 +26,7 @@ public static void Start() string entrypointAssemblyPath = !Paths.ExecutablePath.EndsWith(StartupHook.DoesNotExistPath) ? Paths.ExecutablePath : null; TypeLoader.SearchDirectories.Add(Paths.GameRootPath); - + Logger.Sources.Add(TraceLogSource.CreateSource()); ChainloaderLogHelper.PrintLogInfo(Log); diff --git a/build/Build.csproj b/build/Build.csproj index 6fb453e26..2b3166f41 100644 --- a/build/Build.csproj +++ b/build/Build.csproj @@ -1,18 +1,18 @@ - - Exe - net10.0 - $(MSBuildProjectDirectory) - false - - - - - - - - - - - + + Exe + net10.0 + $(MSBuildProjectDirectory) + false + + + + + + + + + + + diff --git a/build/Program.cs b/build/Program.cs index 8ef6811c8..c546212f8 100644 --- a/build/Program.cs +++ b/build/Program.cs @@ -102,17 +102,17 @@ public BuildContext(ICakeContext ctx) public string VersionSuffix => BuildType switch { - ProjectBuildType.Release => "", - ProjectBuildType.Development => "dev", + ProjectBuildType.Release => "", + ProjectBuildType.Development => "dev", ProjectBuildType.BleedingEdge => $"be.{BuildId}", - var _ => throw new ArgumentOutOfRangeException() + var _ => throw new ArgumentOutOfRangeException() }; public string BuildPackageVersion => VersionPrefix + BuildType switch { ProjectBuildType.Release => "", - var _ => $"-{VersionSuffix}+{this.GitShortenSha(RootDirectory, CurrentCommit)}", + var _ => $"-{VersionSuffix}+{this.GitShortenSha(RootDirectory, CurrentCommit)}", }; public static string DoorstopZipUrl(string arch) => @@ -356,8 +356,9 @@ public override void Run(BuildContext ctx) if (dist.Engine == "Unity") { - var doorstopPath = - ctx.CacheDirectory.Combine("doorstop").Combine($"doorstop_{dist.Os}").Combine(dist.Arch); + var doorstopPath = dist.Os == "macos" + ? ctx.CacheDirectory.Combine("doorstop").Combine("doorstop_macos").Combine("universal") + : ctx.CacheDirectory.Combine("doorstop").Combine($"doorstop_{dist.Os}").Combine(dist.Arch); foreach (var filePath in ctx.GetFiles(doorstopPath.Combine($"*.{dist.DllExtension}").FullPath)) ctx.CopyFileToDirectory(filePath, targetDir); ctx.CopyFileToDirectory(doorstopPath.CombineWithFilePath(".doorstop_version"), targetDir); @@ -688,3 +689,4 @@ public override void Run(BuildContext ctx) [TaskName("Default")] [IsDependentOn(typeof(CompileTask))] public class DefaultTask : FrostingTask { } +