From e6f7f3b98b2f46b3e5de117b6ceff45a50d9bad7 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Thu, 26 Sep 2024 12:05:46 -0600 Subject: [PATCH 01/60] Fixed an issue with older Cpp2IL versions causing a download failure --- Dependencies/Il2CppAssemblyGenerator/Packages/Cpp2IL.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dependencies/Il2CppAssemblyGenerator/Packages/Cpp2IL.cs b/Dependencies/Il2CppAssemblyGenerator/Packages/Cpp2IL.cs index 64700d39..5b84f46e 100644 --- a/Dependencies/Il2CppAssemblyGenerator/Packages/Cpp2IL.cs +++ b/Dependencies/Il2CppAssemblyGenerator/Packages/Cpp2IL.cs @@ -48,8 +48,9 @@ internal Cpp2IL() if (MelonUtils.IsWindows) { if (VersionSem < NetCoreMinVersion) - URL += "-Netframework472"; - URL += ".exe"; + URL += "-Netframework472.zip"; + else + URL += ".exe"; } } From a8033a5b81c695a205149bc38899886e19d981e6 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Thu, 26 Sep 2024 12:52:36 -0600 Subject: [PATCH 02/60] Reimplemented NetFramework Variant of Cpp2IL as fallback --- Dependencies/Il2CppAssemblyGenerator/Core.cs | 11 ++- .../Packages/Cpp2IL.cs | 60 ++--------- .../Packages/Cpp2IL_NetFramework.cs | 99 +++++++++++++++++++ 3 files changed, 114 insertions(+), 56 deletions(-) create mode 100644 Dependencies/Il2CppAssemblyGenerator/Packages/Cpp2IL_NetFramework.cs diff --git a/Dependencies/Il2CppAssemblyGenerator/Core.cs b/Dependencies/Il2CppAssemblyGenerator/Core.cs index 8f35de95..8981f8ce 100644 --- a/Dependencies/Il2CppAssemblyGenerator/Core.cs +++ b/Dependencies/Il2CppAssemblyGenerator/Core.cs @@ -3,6 +3,7 @@ using System.Net; using System.Net.Http; using MelonLoader.Il2CppAssemblyGenerator.Packages; +using MelonLoader.Il2CppAssemblyGenerator.Packages.Models; using MelonLoader.Modules; using MelonLoader.Utils; @@ -16,7 +17,7 @@ internal class Core : MelonModule internal static HttpClient webClient = null; - internal static Cpp2IL cpp2il = null; + internal static ExecutablePackage cpp2il = null; internal static Cpp2IL_StrippedCodeRegSupport cpp2il_scrs = null; internal static Packages.Il2CppInterop il2cppinterop = null; @@ -59,7 +60,13 @@ private static int Run() if (!MelonLaunchOptions.Il2CppAssemblyGenerator.OfflineMode) RemoteAPI.Contact(); - cpp2il = new Cpp2IL(); + Cpp2IL cpp2IL_netcore = new Cpp2IL(); + if (MelonUtils.IsWindows + && (cpp2IL_netcore.VersionSem < Cpp2IL.NetCoreMinVersion)) + cpp2il = new Cpp2IL_NetFramework(); + else + cpp2il = cpp2IL_netcore; + //cpp2il_scrs = new Cpp2IL_StrippedCodeRegSupport(cpp2il); il2cppinterop = new Packages.Il2CppInterop(); diff --git a/Dependencies/Il2CppAssemblyGenerator/Packages/Cpp2IL.cs b/Dependencies/Il2CppAssemblyGenerator/Packages/Cpp2IL.cs index 5b84f46e..1c35323c 100644 --- a/Dependencies/Il2CppAssemblyGenerator/Packages/Cpp2IL.cs +++ b/Dependencies/Il2CppAssemblyGenerator/Packages/Cpp2IL.cs @@ -7,9 +7,8 @@ namespace MelonLoader.Il2CppAssemblyGenerator.Packages { internal class Cpp2IL : Models.ExecutablePackage { - internal static SemVersion NetCoreMinVersion = SemVersion.Parse("2022.1.0-pre-release.17"); - private static SemVersion NewExecutionMinVersion = SemVersion.Parse("2022.0.999"); - private SemVersion VersionSem; + internal static SemVersion NetCoreMinVersion = SemVersion.Parse("2022.1.0-pre-release.18"); + internal SemVersion VersionSem; private string BaseFolder; private static string ReleaseName => @@ -27,10 +26,7 @@ internal Cpp2IL() VersionSem = SemVersion.Parse(Version); Name = nameof(Cpp2IL); - - string filename = Name; - if (MelonUtils.IsWindows) - filename = $"{Name}.exe"; + string filename = $"{Name}.exe"; BaseFolder = Path.Combine(Core.BasePath, Name); if (!Directory.Exists(BaseFolder)) @@ -43,15 +39,7 @@ internal Cpp2IL() OutputFolder = Path.Combine(BaseFolder, "cpp2il_out"); - URL = $"https://github.com/SamboyCoding/{Name}/releases/download/{Version}/{Name}-{Version}-{ReleaseName}"; - - if (MelonUtils.IsWindows) - { - if (VersionSem < NetCoreMinVersion) - URL += "-Netframework472.zip"; - else - URL += ".exe"; - } + URL = $"https://github.com/SamboyCoding/{Name}/releases/download/{Version}/{Name}-{Version}-{ReleaseName}.exe"; } internal override bool ShouldSetup() @@ -64,15 +52,7 @@ internal override void Save() => Save(ref Config.Values.DumperVersion); internal override bool Execute() - { - if (VersionSem <= NewExecutionMinVersion) - return ExecuteOld(); - return ExecuteNew(); - } - - private bool ExecuteNew() - { - if (Execute([ + => Execute([ MelonDebug.IsEnabled() ? "--verbose" : string.Empty, "--game-path", @@ -95,34 +75,6 @@ private bool ExecuteNew() ], false, new Dictionary() { {"NO_COLOR", "1"}, {"DOTNET_BUNDLE_EXTRACT_BASE_DIR", BaseFolder } - })) - return true; - - return false; - } - - private bool ExecuteOld() - { - if (Execute([ - MelonDebug.IsEnabled() ? "--verbose" : string.Empty, - - "--game-path", - "\"" + Path.GetDirectoryName(Core.GameAssemblyPath) + "\"", - - "--exe-name", - "\"" + Process.GetCurrentProcess().ProcessName + "\"", - - "--skip-analysis", - "--skip-metadata-txts", - "--disable-registration-prompts" - - ], false, new Dictionary() { - {"NO_COLOR", "1"}, - {"DOTNET_BUNDLE_EXTRACT_BASE_DIR", BaseFolder } - })) - return true; - - return false; - } + }); } } diff --git a/Dependencies/Il2CppAssemblyGenerator/Packages/Cpp2IL_NetFramework.cs b/Dependencies/Il2CppAssemblyGenerator/Packages/Cpp2IL_NetFramework.cs new file mode 100644 index 00000000..f3ff1922 --- /dev/null +++ b/Dependencies/Il2CppAssemblyGenerator/Packages/Cpp2IL_NetFramework.cs @@ -0,0 +1,99 @@ +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using Semver; + +namespace MelonLoader.Il2CppAssemblyGenerator.Packages +{ + internal class Cpp2IL_NetFramework : Models.ExecutablePackage + { + private static string ReleaseName => "Windows-Netframework472"; + internal Cpp2IL_NetFramework() + { + Version = MelonLaunchOptions.Il2CppAssemblyGenerator.ForceVersion_Dumper; +#if !DEBUG + if (string.IsNullOrEmpty(Version) || Version.Equals("0.0.0.0")) + Version = RemoteAPI.Info.ForceDumperVersion; +#endif + if (string.IsNullOrEmpty(Version) || Version.Equals("0.0.0.0")) + Version = $"2022.1.0-pre-release.15"; + + Name = nameof(Cpp2IL); + Destination = Path.Combine(Core.BasePath, Name); + OutputFolder = Path.Combine(Destination, "cpp2il_out"); + + URL = $"https://github.com/SamboyCoding/{Name}/releases/download/{Version}/{Name}-{Version}-{ReleaseName}.zip"; + ExeFilePath = Path.Combine(Destination, $"{Name}.exe"); + FilePath = Path.Combine(Core.BasePath, $"{Name}_{Version}.zip"); + } + + internal override bool ShouldSetup() + => string.IsNullOrEmpty(Config.Values.DumperVersion) + || !Config.Values.DumperVersion.Equals(Version); + + internal override void Cleanup() { } + + internal override void Save() + => Save(ref Config.Values.DumperVersion); + + internal override bool Execute() + { + if (SemVersion.Parse(Version) <= SemVersion.Parse("2022.0.999")) + return ExecuteOld(); + return ExecuteNew(); + } + + private bool ExecuteNew() + { + if (Execute([ + MelonDebug.IsEnabled() ? "--verbose" : string.Empty, + + "--game-path", + "\"" + Path.GetDirectoryName(Core.GameAssemblyPath) + "\"", + + "--exe-name", + "\"" + Process.GetCurrentProcess().ProcessName + "\"", + + "--output-as", + "dummydll", + + "--use-processor", + "attributeanalyzer", + "attributeinjector", + MelonLaunchOptions.Cpp2IL.CallAnalyzer ? "callanalyzer" : string.Empty, + MelonLaunchOptions.Cpp2IL.NativeMethodDetector ? "nativemethoddetector" : string.Empty, + //"deobfmap", + //"stablenamer", + + ], false, new Dictionary() { + {"NO_COLOR", "1"} + })) + return true; + + return false; + } + + private bool ExecuteOld() + { + if (Execute([ + MelonDebug.IsEnabled() ? "--verbose" : string.Empty, + + "--game-path", + "\"" + Path.GetDirectoryName(Core.GameAssemblyPath) + "\"", + + "--exe-name", + "\"" + Process.GetCurrentProcess().ProcessName + "\"", + + "--skip-analysis", + "--skip-metadata-txts", + "--disable-registration-prompts" + + ], false, new Dictionary() { + {"NO_COLOR", "1"} + })) + return true; + + return false; + } + } +} \ No newline at end of file From bc67213524c4f27566f80247c199189174416fdd Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Thu, 26 Sep 2024 13:25:22 -0600 Subject: [PATCH 03/60] Temporarily removed Start Screen for being broken in most cases Will make a return later. This is just currently causing more issues than its worth. --- .github/workflows/build.yml | 12 ++++++++++ MelonLoader/InternalUtils/MelonStartScreen.cs | 24 +++++++++---------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0d01a209..da2c64c1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -189,6 +189,8 @@ jobs: copy LICENSE.md Output\Debug\x64\MelonLoader\Documentation\ copy NOTICE.txt Output\Debug\x64\MelonLoader\Documentation\ copy README.md Output\Debug\x64\MelonLoader\Documentation\ + del Output\Debug\x64\MelonLoader\net6\MelonStartScreen.dll + del Output\Debug\x64\MelonLoader\net6\MelonStartScreen.deps.json - uses: actions/upload-artifact@v4 name: Upload Zip | Windows - x64 with: @@ -233,6 +235,8 @@ jobs: copy LICENSE.md Output\Debug\x86\MelonLoader\Documentation\ copy NOTICE.txt Output\Debug\x86\MelonLoader\Documentation\ copy README.md Output\Debug\x86\MelonLoader\Documentation\ + del Output\Debug\x86\MelonLoader\net6\MelonStartScreen.dll + del Output\Debug\x86\MelonLoader\net6\MelonStartScreen.deps.json - uses: actions/upload-artifact@v4 name: Upload Zip | Windows - x86 with: @@ -277,6 +281,8 @@ jobs: copy LICENSE.md Output\Release\x64\MelonLoader\Documentation\ copy NOTICE.txt Output\Release\x64\MelonLoader\Documentation\ copy README.md Output\Release\x64\MelonLoader\Documentation\ + del Output\Release\x64\MelonLoader\net6\MelonStartScreen.dll + del Output\Release\x64\MelonLoader\net6\MelonStartScreen.deps.json - uses: actions/upload-artifact@v4 name: Upload Zip | Windows - x64 with: @@ -321,6 +327,8 @@ jobs: copy LICENSE.md Output\Release\x86\MelonLoader\Documentation\ copy NOTICE.txt Output\Release\x86\MelonLoader\Documentation\ copy README.md Output\Release\x86\MelonLoader\Documentation\ + del Output\Release\x86\MelonLoader\net6\MelonStartScreen.dll + del Output\Release\x86\MelonLoader\net6\MelonStartScreen.deps.json - uses: actions/upload-artifact@v4 name: Upload Zip | Windows - x86 with: @@ -362,6 +370,8 @@ jobs: copy LICENSE.md Output\Debug\x64\MelonLoader\Documentation\ copy NOTICE.txt Output\Debug\x64\MelonLoader\Documentation\ copy README.md Output\Debug\x64\MelonLoader\Documentation\ + del Output\Debug\x64\MelonLoader\net6\MelonStartScreen.dll + del Output\Debug\x64\MelonLoader\net6\MelonStartScreen.deps.json - uses: actions/upload-artifact@v4 name: Upload Zip | Linux - x64 with: @@ -403,6 +413,8 @@ jobs: copy LICENSE.md Output\Release\x64\MelonLoader\Documentation\ copy NOTICE.txt Output\Release\x64\MelonLoader\Documentation\ copy README.md Output\Release\x64\MelonLoader\Documentation\ + del Output\Release\x64\MelonLoader\net6\MelonStartScreen.dll + del Output\Release\x64\MelonLoader\net6\MelonStartScreen.deps.json - uses: actions/upload-artifact@v4 name: Upload Zip | Linux - x64 with: diff --git a/MelonLoader/InternalUtils/MelonStartScreen.cs b/MelonLoader/InternalUtils/MelonStartScreen.cs index ee148332..93978780 100644 --- a/MelonLoader/InternalUtils/MelonStartScreen.cs +++ b/MelonLoader/InternalUtils/MelonStartScreen.cs @@ -1,7 +1,7 @@ -using System.IO; -using AssetRipper.VersionUtilities; -using MelonLoader.Modules; -using MelonLoader.Utils; +//using System.IO; +//using AssetRipper.VersionUtilities; +//using MelonLoader.Modules; +//using MelonLoader.Utils; namespace MelonLoader.InternalUtils { @@ -10,20 +10,20 @@ internal class MelonStartScreen // Doesn't support Unity versions lower than 2017.2.0 (yet?) // Doesn't support Unity versions lower than 2018 (Crashing Issue) // Doesn't support Unity versions higher than to 2020.3.21 (Crashing Issue) - internal static readonly MelonModule.Info moduleInfo = new MelonModule.Info($"{MelonEnvironment.OurRuntimeDirectory}{Path.DirectorySeparatorChar}MelonStartScreen.dll" - , () => !MelonLaunchOptions.Core.StartScreen || UnityInformationHandler.EngineVersion < new UnityVersion(2018)); + //internal static readonly MelonModule.Info moduleInfo = new MelonModule.Info($"{MelonEnvironment.OurRuntimeDirectory}{Path.DirectorySeparatorChar}MelonStartScreen.dll" + // , () => !MelonLaunchOptions.Core.StartScreen || UnityInformationHandler.EngineVersion < new UnityVersion(2018)); internal static int LoadAndRun(LemonFunc functionToWaitForAsync) { - var module = MelonModule.Load(moduleInfo); - if (module == null) + //var module = MelonModule.Load(moduleInfo); + //if (module == null) return functionToWaitForAsync(); - var result = module.SendMessage("LoadAndRun", functionToWaitForAsync); - if (result is int resultCode) - return resultCode; + //var result = module.SendMessage("LoadAndRun", functionToWaitForAsync); + //if (result is int resultCode) + // return resultCode; - return -1; + //return -1; } } } From 167493b50cac199daf1d95a0db8fe7075c5e7a99 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Thu, 26 Sep 2024 13:51:39 -0600 Subject: [PATCH 04/60] Bumped Version --- Bootstrap/src/constants.rs | 2 +- MelonLoader/Properties/BuildInfo.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Bootstrap/src/constants.rs b/Bootstrap/src/constants.rs index ced7a3f1..859912f6 100644 --- a/Bootstrap/src/constants.rs +++ b/Bootstrap/src/constants.rs @@ -18,7 +18,7 @@ pub type InvokeFnIl2Cpp = extern "C" fn( pub type InitFnMono = extern "C" fn(*const c_char, *const c_char) -> *mut MonoDomain; pub type InitFnIl2Cpp = extern "C" fn(*const c_char) -> *mut Il2CppDomain; -pub const MELON_VERSION: &str = "0.6.5"; +pub const MELON_VERSION: &str = "0.6.6"; pub const IS_ALPHA: bool = false; diff --git a/MelonLoader/Properties/BuildInfo.cs b/MelonLoader/Properties/BuildInfo.cs index c2ea9782..c6ff6b10 100644 --- a/MelonLoader/Properties/BuildInfo.cs +++ b/MelonLoader/Properties/BuildInfo.cs @@ -6,6 +6,6 @@ public static class BuildInfo public const string Description = "MelonLoader"; public const string Author = "Lava Gang"; public const string Company = "discord.gg/2Wn3N2P"; - public const string Version = "0.6.5"; + public const string Version = "0.6.6"; } } \ No newline at end of file From 5178bba18ff422d4a22a50b20e2ee84e57a3db6c Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Thu, 26 Sep 2024 13:57:41 -0600 Subject: [PATCH 05/60] General Cleanup --- Dependencies/CompatibilityLayers/EOS/Module.cs | 12 ------------ .../EOS/Properties/AssemblyInfo.cs | 13 +++++++++++++ MelonLoader/MelonLoader.csproj | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) create mode 100644 Dependencies/CompatibilityLayers/EOS/Properties/AssemblyInfo.cs diff --git a/Dependencies/CompatibilityLayers/EOS/Module.cs b/Dependencies/CompatibilityLayers/EOS/Module.cs index ff15413c..60281ce0 100644 --- a/Dependencies/CompatibilityLayers/EOS/Module.cs +++ b/Dependencies/CompatibilityLayers/EOS/Module.cs @@ -1,20 +1,8 @@ using MelonLoader.Modules; using MelonLoader.NativeUtils; using System; -using System.Reflection; using System.Runtime.InteropServices; -[assembly: AssemblyTitle(MelonLoader.BuildInfo.Description)] -[assembly: AssemblyDescription(MelonLoader.BuildInfo.Description)] -[assembly: AssemblyCompany(MelonLoader.BuildInfo.Company)] -[assembly: AssemblyProduct(MelonLoader.BuildInfo.Name)] -[assembly: AssemblyCopyright("Created by " + MelonLoader.BuildInfo.Author)] -[assembly: AssemblyTrademark(MelonLoader.BuildInfo.Company)] -[assembly: Guid("5100810A-9842-4073-9658-E5841FDF9D73")] -[assembly: AssemblyVersion(MelonLoader.BuildInfo.Version)] -[assembly: AssemblyFileVersion(MelonLoader.BuildInfo.Version)] -[assembly: MelonLoader.PatchShield] - namespace MelonLoader.CompatibilityLayers { internal class EOS_Module : MelonModule diff --git a/Dependencies/CompatibilityLayers/EOS/Properties/AssemblyInfo.cs b/Dependencies/CompatibilityLayers/EOS/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0f2b1903 --- /dev/null +++ b/Dependencies/CompatibilityLayers/EOS/Properties/AssemblyInfo.cs @@ -0,0 +1,13 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle(MelonLoader.BuildInfo.Description)] +[assembly: AssemblyDescription(MelonLoader.BuildInfo.Description)] +[assembly: AssemblyCompany(MelonLoader.BuildInfo.Company)] +[assembly: AssemblyProduct(MelonLoader.BuildInfo.Name)] +[assembly: AssemblyCopyright("Created by " + MelonLoader.BuildInfo.Author)] +[assembly: AssemblyTrademark(MelonLoader.BuildInfo.Company)] +[assembly: Guid("5100810A-9842-4073-9658-E5841FDF9D73")] +[assembly: AssemblyVersion(MelonLoader.BuildInfo.Version)] +[assembly: AssemblyFileVersion(MelonLoader.BuildInfo.Version)] +[assembly: MelonLoader.PatchShield] \ No newline at end of file diff --git a/MelonLoader/MelonLoader.csproj b/MelonLoader/MelonLoader.csproj index 8e81c7a1..bb91c639 100644 --- a/MelonLoader/MelonLoader.csproj +++ b/MelonLoader/MelonLoader.csproj @@ -11,7 +11,7 @@ true embedded - 0.6.5 + 0.6.6 LavaGang.MelonLoader modding unity https://github.com/LavaGang/MelonLoader From 83434b3062629890a8d71334b857d6a031233444 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Thu, 26 Sep 2024 14:24:22 -0600 Subject: [PATCH 06/60] Removed Useless TODO Warning from Il2CppAssemblyGenerator --- .../Packages/Models/ExecutablePackage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dependencies/Il2CppAssemblyGenerator/Packages/Models/ExecutablePackage.cs b/Dependencies/Il2CppAssemblyGenerator/Packages/Models/ExecutablePackage.cs index c477d790..67fb72fa 100644 --- a/Dependencies/Il2CppAssemblyGenerator/Packages/Models/ExecutablePackage.cs +++ b/Dependencies/Il2CppAssemblyGenerator/Packages/Models/ExecutablePackage.cs @@ -104,7 +104,7 @@ internal bool Execute(string[] args, bool parenthesize_args = true, Dictionary Date: Thu, 26 Sep 2024 14:28:10 -0600 Subject: [PATCH 07/60] General Cleanup --- .../SupportModules/Il2Cpp/Il2Cpp.csproj | 5 ++++ Dependencies/SupportModules/Mono/Mono.csproj | 5 ++++ MelonLoader/Fixes/Il2CppICallInjector.cs | 26 ++++++++++++++++++- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Dependencies/SupportModules/Il2Cpp/Il2Cpp.csproj b/Dependencies/SupportModules/Il2Cpp/Il2Cpp.csproj index 8f8a89e8..99045de0 100644 --- a/Dependencies/SupportModules/Il2Cpp/Il2Cpp.csproj +++ b/Dependencies/SupportModules/Il2Cpp/Il2Cpp.csproj @@ -16,6 +16,11 @@ https://nuget.bepinex.dev/v3/index.json + + + + + Libs\Il2Cppmscorlib.dll diff --git a/Dependencies/SupportModules/Mono/Mono.csproj b/Dependencies/SupportModules/Mono/Mono.csproj index 7c8204b8..99ac434c 100644 --- a/Dependencies/SupportModules/Mono/Mono.csproj +++ b/Dependencies/SupportModules/Mono/Mono.csproj @@ -10,6 +10,11 @@ true embedded + + + + + Libs\UnityEngine.dll diff --git a/MelonLoader/Fixes/Il2CppICallInjector.cs b/MelonLoader/Fixes/Il2CppICallInjector.cs index 1d5a83e3..bc2a8e7d 100644 --- a/MelonLoader/Fixes/Il2CppICallInjector.cs +++ b/MelonLoader/Fixes/Il2CppICallInjector.cs @@ -161,6 +161,30 @@ private static IntPtr il2cpp_resolve_icall_Detour(IntPtr signature) return pair.Item3; } + private static Type FindType(string typeFullName) + { + if (string.IsNullOrEmpty(typeFullName)) + return null; + + Type result = null; + foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies()) + { + if (a == null) + continue; + + result = a.GetValidType($"Il2Cpp.{typeFullName}"); + if (result == null) + result = a.GetValidType($"Il2Cpp{typeFullName}"); + if (result == null) + result = a.GetValidType(typeFullName); + + if (result != null) + break; + } + + return result; + } + private static bool ShouldInject(string signature, out MethodInfo unityShimMethod) { unityShimMethod = null; @@ -170,7 +194,7 @@ private static bool ShouldInject(string signature, out MethodInfo unityShimMetho string typeName = split[0]; // Find Managed Type - Type newType = Il2CppInteropFixes.FixedFindType(typeName); + Type newType = FindType(typeName); if (newType == null) return false; From 3648e682bc1ec364d15345c5ab0415f059741bf9 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Sat, 28 Sep 2024 21:58:26 -0600 Subject: [PATCH 08/60] Updated Il2CppInterop to 1.4.6-ci.554 --- .../Il2CppAssemblyGenerator.csproj | 6 +++--- Dependencies/SupportModules/Il2Cpp/Il2Cpp.csproj | 6 +++--- MelonLoader/MelonLoader.csproj | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Dependencies/Il2CppAssemblyGenerator/Il2CppAssemblyGenerator.csproj b/Dependencies/Il2CppAssemblyGenerator/Il2CppAssemblyGenerator.csproj index 963968d9..a14de330 100644 --- a/Dependencies/Il2CppAssemblyGenerator/Il2CppAssemblyGenerator.csproj +++ b/Dependencies/Il2CppAssemblyGenerator/Il2CppAssemblyGenerator.csproj @@ -15,9 +15,9 @@ - - - + + + diff --git a/Dependencies/SupportModules/Il2Cpp/Il2Cpp.csproj b/Dependencies/SupportModules/Il2Cpp/Il2Cpp.csproj index 99045de0..1ad80556 100644 --- a/Dependencies/SupportModules/Il2Cpp/Il2Cpp.csproj +++ b/Dependencies/SupportModules/Il2Cpp/Il2Cpp.csproj @@ -46,9 +46,9 @@ - - - + + + diff --git a/MelonLoader/MelonLoader.csproj b/MelonLoader/MelonLoader.csproj index bb91c639..afdac6be 100644 --- a/MelonLoader/MelonLoader.csproj +++ b/MelonLoader/MelonLoader.csproj @@ -49,10 +49,10 @@ - - - - + + + + From 86d1f5f56aff4a52a1daaf2ed64e84a7a675622c Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Sat, 28 Sep 2024 23:02:48 -0600 Subject: [PATCH 09/60] Modified Command-Line Argument Logging to show Internal Arguments Only --- MelonLoader/Core.cs | 8 ++++++-- MelonLoader/MelonLaunchOptions.cs | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/MelonLoader/Core.cs b/MelonLoader/Core.cs index d688efc3..3ee54942 100644 --- a/MelonLoader/Core.cs +++ b/MelonLoader/Core.cs @@ -174,9 +174,13 @@ internal static void WelcomeMessage() var archString = MelonUtils.IsGame32Bit() ? "x86" : "x64"; MelonLogger.MsgDirect($"Game Arch: {archString}"); MelonLogger.MsgDirect("------------------------------"); - MelonLogger.MsgDirect($"Command-Line: {string.Join(" ", MelonLaunchOptions.CommandLineArgs)}"); + MelonLogger.MsgDirect("Command-Line: "); + foreach (var pair in MelonLaunchOptions.InternalArguments) + if (string.IsNullOrEmpty(pair.Value)) + MelonLogger.MsgDirect($" {pair.Key}"); + else + MelonLogger.MsgDirect($" {pair.Key} = {pair.Value}"); MelonLogger.MsgDirect("------------------------------"); - MelonEnvironment.PrintEnvironment(); } diff --git a/MelonLoader/MelonLaunchOptions.cs b/MelonLoader/MelonLaunchOptions.cs index c1f413ba..d10efc6d 100644 --- a/MelonLoader/MelonLaunchOptions.cs +++ b/MelonLoader/MelonLaunchOptions.cs @@ -16,6 +16,7 @@ public static class MelonLaunchOptions /// /// public static Dictionary ExternalArguments { get; private set; } = new Dictionary(); + public static Dictionary InternalArguments { get; private set; } = new Dictionary(); /// /// Array of All Command Line Arguments @@ -64,6 +65,7 @@ internal static void Load() // Parse Argumentless Commands if (WithoutArg.TryGetValue(noPrefixCmd, out Action withoutArgFunc)) { + InternalArguments.Add(noPrefixCmd, null); withoutArgFunc(); continue; } @@ -90,6 +92,7 @@ internal static void Load() // Parse Argument Commands if (WithArg.TryGetValue(noPrefixCmd, out Action withArgFunc)) { + InternalArguments.Add(noPrefixCmd, cmdArg); withArgFunc(cmdArg); continue; } From 59fc0b2404a219bc9b5959be25241a39e45df19d Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Sun, 29 Sep 2024 22:04:52 -0600 Subject: [PATCH 10/60] Updated Il2CppInterop to 1.4.6-ci.557 --- .../Il2CppAssemblyGenerator.csproj | 6 +++--- Dependencies/SupportModules/Il2Cpp/Il2Cpp.csproj | 6 +++--- MelonLoader/MelonLoader.csproj | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Dependencies/Il2CppAssemblyGenerator/Il2CppAssemblyGenerator.csproj b/Dependencies/Il2CppAssemblyGenerator/Il2CppAssemblyGenerator.csproj index a14de330..79c3164e 100644 --- a/Dependencies/Il2CppAssemblyGenerator/Il2CppAssemblyGenerator.csproj +++ b/Dependencies/Il2CppAssemblyGenerator/Il2CppAssemblyGenerator.csproj @@ -15,9 +15,9 @@ - - - + + + diff --git a/Dependencies/SupportModules/Il2Cpp/Il2Cpp.csproj b/Dependencies/SupportModules/Il2Cpp/Il2Cpp.csproj index 1ad80556..e90ad235 100644 --- a/Dependencies/SupportModules/Il2Cpp/Il2Cpp.csproj +++ b/Dependencies/SupportModules/Il2Cpp/Il2Cpp.csproj @@ -46,9 +46,9 @@ - - - + + + diff --git a/MelonLoader/MelonLoader.csproj b/MelonLoader/MelonLoader.csproj index afdac6be..61d49ad7 100644 --- a/MelonLoader/MelonLoader.csproj +++ b/MelonLoader/MelonLoader.csproj @@ -49,10 +49,10 @@ - - - - + + + + From 89b28f5bee1fbb9af0be1ba8c0fcc8683f7b1d1c Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Sun, 29 Sep 2024 22:48:00 -0600 Subject: [PATCH 11/60] Fixed an issue with Il2CppInterop not properly logging Trampoline Exceptions --- MelonLoader/Fixes/Il2CppInteropFixes.cs | 29 ++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/MelonLoader/Fixes/Il2CppInteropFixes.cs b/MelonLoader/Fixes/Il2CppInteropFixes.cs index 73eed503..3e110528 100644 --- a/MelonLoader/Fixes/Il2CppInteropFixes.cs +++ b/MelonLoader/Fixes/Il2CppInteropFixes.cs @@ -17,6 +17,7 @@ using MelonLoader.Utils; using Il2CppInterop.Generator.Contexts; using AsmResolver.DotNet; +using Il2CppInterop.HarmonySupport; namespace MelonLoader.Fixes { @@ -26,6 +27,8 @@ namespace MelonLoader.Fixes // fixes the rest of: https://github.com/BepInEx/Il2CppInterop/pull/134 internal unsafe static class Il2CppInteropFixes { + private static MelonLogger.Instance _logger = new("Il2CppInterop"); + private static Dictionary> _assemblyLookup = new(); private static Dictionary _typeLookup = new(); private static Dictionary _typeNameLookup = new(); @@ -59,6 +62,8 @@ internal unsafe static class Il2CppInteropFixes private static MethodInfo _rewriteGlobalContext_GetNewAssemblyForOriginal_Prefix; private static MethodInfo _rewriteGlobalContext_TryGetNewTypeForOriginal; private static MethodInfo _rewriteGlobalContext_TryGetNewTypeForOriginal_Prefix; + private static MethodInfo _reportException; + private static MethodInfo _reportException_Prefix; internal static void Install() { @@ -70,11 +75,16 @@ internal static void Install() Type ilGeneratorEx = typeof(ILGeneratorEx); Type rewriteGlobalContextType = typeof(RewriteGlobalContext); Type il2cppType = typeof(IL2CPP); + Type harmonySupportType = typeof(HarmonySupport); Type injectorHelpersType = classInjectorType.Assembly.GetType("Il2CppInterop.Runtime.Injection.InjectorHelpers"); if (injectorHelpersType == null) throw new Exception("Failed to get InjectorHelpers"); + Type detourMethodPatcherType = harmonySupportType.Assembly.GetType("Il2CppInterop.HarmonySupport.Il2CppDetourMethodPatcher"); + if (detourMethodPatcherType == null) + throw new Exception("Failed to get Il2CppDetourMethodPatcher"); + _systemTypeFromIl2CppType = classInjectorType.GetMethod("SystemTypeFromIl2CppType", BindingFlags.NonPublic | BindingFlags.Static); if (_systemTypeFromIl2CppType == null) throw new Exception("Failed to get ClassInjector.SystemTypeFromIl2CppType"); @@ -137,7 +147,12 @@ internal static void Install() _rewriteGlobalContext_TryGetNewTypeForOriginal = rewriteGlobalContextType.GetMethod("TryGetNewTypeForOriginal", BindingFlags.Public | BindingFlags.Instance); if (_rewriteGlobalContext_TryGetNewTypeForOriginal == null) - throw new Exception("Failed to get RewriteGlobalContext.TryGetNewTypeForOriginal"); + throw new Exception("Failed to get RewriteGlobalContext.TryGetNewTypeForOriginal"); + + _reportException = detourMethodPatcherType.GetMethod("ReportException", + BindingFlags.NonPublic | BindingFlags.Static); + if (_reportException == null) + throw new Exception("Failed to get Il2CppDetourMethodPatcher.ReportException"); _fixedFindType = thisType.GetMethod(nameof(FixedFindType), BindingFlags.NonPublic | BindingFlags.Static); _fixedAddTypeToLookup = thisType.GetMethod(nameof(FixedAddTypeToLookup), BindingFlags.NonPublic | BindingFlags.Static); @@ -154,6 +169,7 @@ internal static void Install() _rewriteGlobalContext_Dispose_Prefix = thisType.GetMethod(nameof(RewriteGlobalContext_Dispose_Prefix), BindingFlags.NonPublic | BindingFlags.Static); _rewriteGlobalContext_GetNewAssemblyForOriginal_Prefix = thisType.GetMethod(nameof(RewriteGlobalContext_GetNewAssemblyForOriginal_Prefix), BindingFlags.NonPublic | BindingFlags.Static); _rewriteGlobalContext_TryGetNewTypeForOriginal_Prefix = thisType.GetMethod(nameof(RewriteGlobalContext_TryGetNewTypeForOriginal_Prefix), BindingFlags.NonPublic | BindingFlags.Static); + _reportException_Prefix = thisType.GetMethod(nameof(ReportException_Prefix), BindingFlags.NonPublic | BindingFlags.Static); MelonDebug.Msg("Patching Il2CppInterop ClassInjector.SystemTypeFromIl2CppType..."); Core.HarmonyInstance.Patch(_systemTypeFromIl2CppType, @@ -202,6 +218,10 @@ internal static void Install() MelonDebug.Msg("Patching Il2CppInterop RewriteGlobalContext.TryGetNewTypeForOriginal..."); Core.HarmonyInstance.Patch(_rewriteGlobalContext_TryGetNewTypeForOriginal, new HarmonyMethod(_rewriteGlobalContext_TryGetNewTypeForOriginal_Prefix)); + + MelonDebug.Msg("Patching Il2CppInterop Il2CppDetourMethodPatcher.ReportException..."); + Core.HarmonyInstance.Patch(_reportException, + new HarmonyMethod(_reportException_Prefix)); } catch (Exception e) { @@ -275,6 +295,13 @@ private static void FixedAddTypeToLookup(Type type, IntPtr typePointer) _typeLookup.Add(typePointer, type); } + private static bool ReportException_Prefix(Exception __0) + { + _logger.Error("During invoking native->managed trampoline", __0); + + return false; + } + private static bool EmitObjectToPointer_Prefix(bool __7, ref bool __8) { __8 = __7; From 1a33c452322f9d8fcbdd2e3be7235acde6d76422 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Mon, 30 Sep 2024 00:12:54 -0600 Subject: [PATCH 12/60] Implemented a RegisterTypeInIl2CppWithInterfaces attribute --- .../SupportModules/Il2Cpp/InteropInterface.cs | 3 +- .../RegisterTypeInIl2CppWithInterfaces.cs | 87 +++++++++++++++++++ MelonLoader/Core.cs | 1 + MelonLoader/Melons/MelonAssembly.cs | 1 + MelonLoader/Utils/InteropSupport.cs | 20 ++++- 5 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 MelonLoader/Attributes/RegisterTypeInIl2CppWithInterfaces.cs diff --git a/Dependencies/SupportModules/Il2Cpp/InteropInterface.cs b/Dependencies/SupportModules/Il2Cpp/InteropInterface.cs index 60ad6092..06668b90 100644 --- a/Dependencies/SupportModules/Il2Cpp/InteropInterface.cs +++ b/Dependencies/SupportModules/Il2Cpp/InteropInterface.cs @@ -3,7 +3,6 @@ using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; -using Il2CppInterop.Runtime.Runtime; using System; using System.Reflection; @@ -28,6 +27,8 @@ public FieldInfo MethodBaseToIl2CppFieldInfo(MethodBase method) public void RegisterTypeInIl2CppDomain(Type type, bool logSuccess) => ClassInjector.RegisterTypeInIl2Cpp(type, new() { LogSuccess = logSuccess }); + public void RegisterTypeInIl2CppDomainWithInterfaces(Type type, Type[] interfaces, bool logSuccess) + => ClassInjector.RegisterTypeInIl2Cpp(type, new() { LogSuccess = logSuccess, Interfaces = interfaces }); public bool IsInheritedFromIl2CppObjectBase(Type type) => (type != null) && type.IsSubclassOf(typeof(Il2CppObjectBase)); diff --git a/MelonLoader/Attributes/RegisterTypeInIl2CppWithInterfaces.cs b/MelonLoader/Attributes/RegisterTypeInIl2CppWithInterfaces.cs new file mode 100644 index 00000000..d0bbc1d1 --- /dev/null +++ b/MelonLoader/Attributes/RegisterTypeInIl2CppWithInterfaces.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; + +namespace MelonLoader +{ + [AttributeUsage(AttributeTargets.Class)] + public class RegisterTypeInIl2CppWithInterfaces : Attribute //Naming violation? + { + internal static List registrationQueue = new List(); + internal static bool ready; + internal bool LogSuccess = true; + internal Type[] Interfaces; + internal bool GetInterfacesFromType; + + public RegisterTypeInIl2CppWithInterfaces() + { + GetInterfacesFromType = true; + } + + public RegisterTypeInIl2CppWithInterfaces(bool logSuccess) + { + LogSuccess = logSuccess; + GetInterfacesFromType = true; + } + + public RegisterTypeInIl2CppWithInterfaces(params Type[] interfaces) + { + Interfaces = interfaces; + } + + public RegisterTypeInIl2CppWithInterfaces(bool logSuccess, params Type[] interfaces) + { + LogSuccess = logSuccess; + Interfaces = interfaces; + } + + public static void RegisterAssembly(Assembly asm) + { + if (!MelonUtils.IsGameIl2Cpp()) + return; + + if (!ready) + { + registrationQueue.Add(asm); + return; + } + + IEnumerable typeTbl = asm.GetValidTypes(); + if ((typeTbl == null) || (typeTbl.Count() <= 0)) + return; + + foreach (Type type in typeTbl) + { + object[] attTbl = type.GetCustomAttributes(typeof(RegisterTypeInIl2CppWithInterfaces), false); + if ((attTbl == null) || (attTbl.Length <= 0)) + continue; + + RegisterTypeInIl2CppWithInterfaces att = (RegisterTypeInIl2CppWithInterfaces)attTbl[0]; + if (att == null) + continue; + + Type[] interfaceArr = att.GetInterfacesFromType + ? type.GetInterfaces() + : att.Interfaces; + + InteropSupport.RegisterTypeInIl2CppDomainWithInterfaces(type, + interfaceArr, + att.LogSuccess); + } + } + + internal static void SetReady() + { + ready = true; + + if (registrationQueue == null) + return; + + foreach (var asm in registrationQueue) + RegisterAssembly(asm); + + registrationQueue = null; + } + } +} \ No newline at end of file diff --git a/MelonLoader/Core.cs b/MelonLoader/Core.cs index 3ee54942..241e9491 100644 --- a/MelonLoader/Core.cs +++ b/MelonLoader/Core.cs @@ -143,6 +143,7 @@ internal static int Start() AddUnityDebugLog(); RegisterTypeInIl2Cpp.SetReady(); + RegisterTypeInIl2CppWithInterfaces.SetReady(); MelonEvents.MelonHarmonyInit.Invoke(); MelonEvents.OnApplicationStart.Invoke(); diff --git a/MelonLoader/Melons/MelonAssembly.cs b/MelonLoader/Melons/MelonAssembly.cs index 18449b19..fd985a10 100644 --- a/MelonLoader/Melons/MelonAssembly.cs +++ b/MelonLoader/Melons/MelonAssembly.cs @@ -291,6 +291,7 @@ public void LoadMelons() } RegisterTypeInIl2Cpp.RegisterAssembly(Assembly); + RegisterTypeInIl2CppWithInterfaces.RegisterAssembly(Assembly); if (rottenMelons.Count != 0) { diff --git a/MelonLoader/Utils/InteropSupport.cs b/MelonLoader/Utils/InteropSupport.cs index 2d738ad7..dd11bab9 100644 --- a/MelonLoader/Utils/InteropSupport.cs +++ b/MelonLoader/Utils/InteropSupport.cs @@ -13,6 +13,7 @@ public interface Interface FieldInfo MethodBaseToIl2CppFieldInfo(MethodBase method); int? GetIl2CppMethodCallerCount(MethodBase method); void RegisterTypeInIl2CppDomain(Type type, bool logSuccess); + void RegisterTypeInIl2CppDomainWithInterfaces(Type type, Type[] interfaces, bool logSuccess); IntPtr CopyMethodInfoStruct(IntPtr ptr); } internal static Interface SMInterface; @@ -89,7 +90,9 @@ public static T Il2CppObjectPtrToIl2CppObject(IntPtr ptr) return SMInterface.GetIl2CppMethodCallerCount(method); } - public static void RegisterTypeInIl2CppDomain(Type type) => RegisterTypeInIl2CppDomain(type, true); + public static void RegisterTypeInIl2CppDomain(Type type) + => RegisterTypeInIl2CppDomain(type, true); + public static void RegisterTypeInIl2CppDomain(Type type, bool logSuccess) { ValidateInterface(); @@ -98,6 +101,21 @@ public static void RegisterTypeInIl2CppDomain(Type type, bool logSuccess) SMInterface.RegisterTypeInIl2CppDomain(type, logSuccess); } + public static void RegisterTypeInIl2CppDomainWithInterfaces(Type type, Type[] interfaces) + => RegisterTypeInIl2CppDomainWithInterfaces(type, interfaces, true); + + public static void RegisterTypeInIl2CppDomainWithInterfaces(Type type, Type[] interfaces, bool logSuccess) + { + ValidateInterface(); + if (type == null) + throw new NullReferenceException("The type cannot be null."); + if (interfaces == null) + throw new NullReferenceException("The interfaces cannot be null."); + if (interfaces.Length <= 0) + throw new NullReferenceException("The interfaces cannot be empty."); + SMInterface.RegisterTypeInIl2CppDomainWithInterfaces(type, interfaces, logSuccess); + } + public static IntPtr CopyMethodInfoStruct(IntPtr ptr) { ValidateInterface(); From 3512c92a944a68812fa200e9679f3503e01752d8 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Mon, 30 Sep 2024 00:16:12 -0600 Subject: [PATCH 13/60] Fixed an issue with Il2Cpp Class Injection Attributes causing exceptions to be thrown on Mono games --- MelonLoader/Attributes/RegisterTypeInIl2CppWithInterfaces.cs | 1 + MelonLoader/Core.cs | 3 +++ MelonLoader/Melons/MelonAssembly.cs | 2 ++ 3 files changed, 6 insertions(+) diff --git a/MelonLoader/Attributes/RegisterTypeInIl2CppWithInterfaces.cs b/MelonLoader/Attributes/RegisterTypeInIl2CppWithInterfaces.cs index d0bbc1d1..5a1c679d 100644 --- a/MelonLoader/Attributes/RegisterTypeInIl2CppWithInterfaces.cs +++ b/MelonLoader/Attributes/RegisterTypeInIl2CppWithInterfaces.cs @@ -11,6 +11,7 @@ public class RegisterTypeInIl2CppWithInterfaces : Attribute //Naming violation? internal static List registrationQueue = new List(); internal static bool ready; internal bool LogSuccess = true; + internal Type[] Interfaces; internal bool GetInterfacesFromType; diff --git a/MelonLoader/Core.cs b/MelonLoader/Core.cs index 241e9491..d385ba6a 100644 --- a/MelonLoader/Core.cs +++ b/MelonLoader/Core.cs @@ -142,8 +142,11 @@ internal static int Start() return 1; AddUnityDebugLog(); + +#if NET6_0_OR_GREATER RegisterTypeInIl2Cpp.SetReady(); RegisterTypeInIl2CppWithInterfaces.SetReady(); +#endif MelonEvents.MelonHarmonyInit.Invoke(); MelonEvents.OnApplicationStart.Invoke(); diff --git a/MelonLoader/Melons/MelonAssembly.cs b/MelonLoader/Melons/MelonAssembly.cs index fd985a10..8806bdc0 100644 --- a/MelonLoader/Melons/MelonAssembly.cs +++ b/MelonLoader/Melons/MelonAssembly.cs @@ -290,8 +290,10 @@ public void LoadMelons() } } +#if NET6_0_OR_GREATER RegisterTypeInIl2Cpp.RegisterAssembly(Assembly); RegisterTypeInIl2CppWithInterfaces.RegisterAssembly(Assembly); +#endif if (rottenMelons.Count != 0) { From 23be1946b72b6882a0d88724eb0c1bee5c7005b2 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Sun, 6 Oct 2024 12:03:33 -0600 Subject: [PATCH 14/60] Updated Il2CppInterop to 1.4.6-ci.579 --- .../Il2CppAssemblyGenerator.csproj | 6 +++--- Dependencies/SupportModules/Il2Cpp/Il2Cpp.csproj | 6 +++--- MelonLoader/MelonLoader.csproj | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Dependencies/Il2CppAssemblyGenerator/Il2CppAssemblyGenerator.csproj b/Dependencies/Il2CppAssemblyGenerator/Il2CppAssemblyGenerator.csproj index 79c3164e..09f20a55 100644 --- a/Dependencies/Il2CppAssemblyGenerator/Il2CppAssemblyGenerator.csproj +++ b/Dependencies/Il2CppAssemblyGenerator/Il2CppAssemblyGenerator.csproj @@ -15,9 +15,9 @@ - - - + + + diff --git a/Dependencies/SupportModules/Il2Cpp/Il2Cpp.csproj b/Dependencies/SupportModules/Il2Cpp/Il2Cpp.csproj index e90ad235..53f3003c 100644 --- a/Dependencies/SupportModules/Il2Cpp/Il2Cpp.csproj +++ b/Dependencies/SupportModules/Il2Cpp/Il2Cpp.csproj @@ -46,9 +46,9 @@ - - - + + + diff --git a/MelonLoader/MelonLoader.csproj b/MelonLoader/MelonLoader.csproj index 61d49ad7..7b13fc50 100644 --- a/MelonLoader/MelonLoader.csproj +++ b/MelonLoader/MelonLoader.csproj @@ -49,10 +49,10 @@ - - - - + + + + From ec20f9e08213de39ab5352902963a578b57fa58c Mon Sep 17 00:00:00 2001 From: Attila Date: Sun, 6 Oct 2024 19:07:48 -0700 Subject: [PATCH 15/60] Add stale bot --- .github/workflows/stale.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 00000000..15a1db8f --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,30 @@ +# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time. +# +# You can adjust the behavior by modifying this file. +# For more information, see: +# https://github.com/actions/stale +name: Close inactive issues + +on: + schedule: + - cron: '4 20 * * *' + +jobs: + stale: + + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + + steps: + - uses: actions/stale@v9 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + days-before-issue-stale: 120 + days-before-issue-close: 14 + stale-issue-message: "This issue is stale because it has been open for 4 months with no activity. If this is still an issue then please leave a comment, or else this will close in 2 weeks." + close-issue-message: "This issue was closed because it has been 2 weeks since being marked as stale." + days-before-pr-stale: -1 + days-before-pr-close: -1 + exempt-issue-labels: "Work-in-Progress,Planned" From 6d2c5b8d3a753831d77b9c72f794ca693da738b9 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Mon, 7 Oct 2024 12:59:33 -0600 Subject: [PATCH 16/60] Fixed an issue with the Bootstrap not reading --melonloader.basedir correctly --- Bootstrap/src/melonenv/paths.rs | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/Bootstrap/src/melonenv/paths.rs b/Bootstrap/src/melonenv/paths.rs index 2498cc2c..3c8179d3 100644 --- a/Bootstrap/src/melonenv/paths.rs +++ b/Bootstrap/src/melonenv/paths.rs @@ -11,10 +11,17 @@ lazy_static! { pub static ref BASE_DIR: W = { let args: Vec = std::env::args().collect(); let mut base_dir = std::env::current_dir().unwrap_or_else(|e|internal_failure!("Failed to get base dir: {e}")); - for arg in args.iter() { + let mut iterator = args.iter(); + while let Some(mut arg) = iterator.next() { if arg.starts_with("--melonloader.basedir") { - let a: Vec<&str> = arg.split("=").collect(); - base_dir = PathBuf::from(a[1]); + if arg.contains("=") { + let a: Vec<&str> = arg.split("=").collect(); + base_dir = PathBuf::from(a[1]); + } + else { + arg = iterator.next().unwrap(); + base_dir = PathBuf::from(arg); + } } } @@ -23,10 +30,17 @@ lazy_static! { pub static ref GAME_DIR: W = { let args: Vec = std::env::args().collect(); let mut base_dir = std::env::current_dir().unwrap_or_else(|e|internal_failure!("Failed to get game dir: {e}")); - for arg in args.iter() { + let mut iterator = args.iter(); + while let Some(mut arg) = iterator.next() { if arg.starts_with("--melonloader.basedir") { - let a: Vec<&str> = arg.split("=").collect(); - base_dir = PathBuf::from(a[1]); + if arg.contains("=") { + let a: Vec<&str> = arg.split("=").collect(); + base_dir = PathBuf::from(a[1]); + } + else { + arg = iterator.next().unwrap(); + base_dir = PathBuf::from(arg); + } } } @@ -75,7 +89,7 @@ pub fn get_managed_dir() -> Result { match managed_path.exists() { true => Ok(managed_path), - false => Err("Failed to find the managed directory!")?, + false => Err("Failed to find the Managed directory!")?, } } } From d6435ad396e803fdd319b444f8bc39e0fb1ec0a6 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Mon, 7 Oct 2024 15:38:54 -0600 Subject: [PATCH 17/60] Rust Cleanup, Fixed an issue with Loading dobby in some cases --- Bootstrap/Cargo.toml | 3 +- Bootstrap/src/base_assembly/mono.rs | 2 +- Bootstrap/src/lib.rs | 15 +--------- Bootstrap/src/melonenv/paths.rs | 17 +---------- Cargo.lock | 4 +-- MelonProxy/Cargo.toml | 2 +- MelonProxy/src/core.rs | 24 ++++++++++++++++ MelonProxy/src/lib.rs | 24 +++------------- MelonProxy/src/utils/files.rs | 44 +++++++++++++++++++++++++++++ README.md | 6 ++-- 10 files changed, 83 insertions(+), 58 deletions(-) diff --git a/Bootstrap/Cargo.toml b/Bootstrap/Cargo.toml index 0e176012..8bfda0c8 100755 --- a/Bootstrap/Cargo.toml +++ b/Bootstrap/Cargo.toml @@ -1,12 +1,11 @@ [package] name = "Bootstrap" -version = "0.1.0" +version = "0.6.6" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -#unity-rs = { path = "C:/Users/sarah/Documents/rust/Ferrex/unity/" } unity-rs = { git = "https://github.com/RinLovesYou/Ferrex/", rev = "77d114c" } ctor = "0.2.6" chrono = "0.4.23" diff --git a/Bootstrap/src/base_assembly/mono.rs b/Bootstrap/src/base_assembly/mono.rs index 54905af5..8923d78a 100644 --- a/Bootstrap/src/base_assembly/mono.rs +++ b/Bootstrap/src/base_assembly/mono.rs @@ -26,7 +26,7 @@ pub fn init(runtime: &FerrexRuntime) -> Result<(), DynErr> { let _runtime_dir = paths::runtime_dir()?; //get MelonLoader.dll's path and confirm it exists - let mut melonloader_dll = _runtime_dir.join("MelonLoader.dll"); + let melonloader_dll = _runtime_dir.join("MelonLoader.dll"); if !melonloader_dll.exists() { return Err("MelonLoader.dll not found".into()); diff --git a/Bootstrap/src/lib.rs b/Bootstrap/src/lib.rs index 8b04c1f3..ef3dbad6 100755 --- a/Bootstrap/src/lib.rs +++ b/Bootstrap/src/lib.rs @@ -1,17 +1,4 @@ -// #![allow(non_snake_case)] -// #![deny( -// missing_debug_implementations, -// unused_results, -// warnings, -// clippy::extra_unused_lifetimes, -// clippy::from_over_into, -// clippy::needless_borrow, -// clippy::new_without_default, -// clippy::useless_conversion -// )] -// #![forbid(rust_2018_idioms)] -// #![allow(clippy::inherent_to_string, clippy::type_complexity, improper_ctypes)] -// #![cfg_attr(docsrs, feature(doc_cfg))] +#![allow(non_snake_case)] pub mod base_assembly; pub mod console; diff --git a/Bootstrap/src/melonenv/paths.rs b/Bootstrap/src/melonenv/paths.rs index 3c8179d3..ca65b5f3 100644 --- a/Bootstrap/src/melonenv/paths.rs +++ b/Bootstrap/src/melonenv/paths.rs @@ -28,22 +28,7 @@ lazy_static! { W(base_dir) }; pub static ref GAME_DIR: W = { - let args: Vec = std::env::args().collect(); - let mut base_dir = std::env::current_dir().unwrap_or_else(|e|internal_failure!("Failed to get game dir: {e}")); - let mut iterator = args.iter(); - while let Some(mut arg) = iterator.next() { - if arg.starts_with("--melonloader.basedir") { - if arg.contains("=") { - let a: Vec<&str> = arg.split("=").collect(); - base_dir = PathBuf::from(a[1]); - } - else { - arg = iterator.next().unwrap(); - base_dir = PathBuf::from(arg); - } - } - } - + let base_dir = std::env::current_dir().unwrap_or_else(|e|internal_failure!("Failed to get game dir: {e}")); W(base_dir) }; pub static ref MELONLOADER_FOLDER: W = W(BASE_DIR.join("MelonLoader")); diff --git a/Cargo.lock b/Cargo.lock index fc296188..dba7e627 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = 3 [[package]] name = "Bootstrap" -version = "0.1.0" +version = "0.6.6" dependencies = [ "chrono", "clap", @@ -24,7 +24,7 @@ dependencies = [ [[package]] name = "MelonProxy" -version = "0.1.0" +version = "0.6.6" dependencies = [ "ctor", "libloading 0.8.1", diff --git a/MelonProxy/Cargo.toml b/MelonProxy/Cargo.toml index 71b542fc..26e2b1aa 100644 --- a/MelonProxy/Cargo.toml +++ b/MelonProxy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "MelonProxy" -version = "0.1.0" +version = "0.6.6" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/MelonProxy/src/core.rs b/MelonProxy/src/core.rs index 46092032..8f978b0f 100644 --- a/MelonProxy/src/core.rs +++ b/MelonProxy/src/core.rs @@ -34,6 +34,7 @@ pub fn init() -> Result<(), Box> { return Ok(()); } + let game_dir = base_dir.clone(); let mut iterator = args.iter(); while let Some(mut arg) = iterator.next() { if arg.starts_with("--melonloader.basedir") { @@ -57,6 +58,10 @@ pub fn init() -> Result<(), Box> { if no_mods { return Ok(()); } + + //fix dobby_rs link + let dobby_path = files::get_dobby_dir(base_dir.clone(), game_dir)?; + add_dll_directory(dobby_path); let bootstrap_path = files::get_bootstrap_path(&base_dir)?; @@ -66,3 +71,22 @@ pub fn init() -> Result<(), Box> { Ok(()) } + +fn add_dll_directory(native_lib_dir: PathBuf) { + // Determine the correct environment variable and separator + let lib_var = if cfg!(target_os = "windows") { "PATH" } else { "LD_LIBRARY_PATH" }; + let separator = if cfg!(target_os = "windows") { ";" } else { ":" }; + + // Get the current value of the library path + let current_path = std::env::var(lib_var).unwrap_or_else(|_| String::new()); + + // Append the new directory to the existing paths + let new_path = if current_path.is_empty() { + native_lib_dir.display().to_string() + } else { + format!("{}{}{}", native_lib_dir.display(), separator, current_path) + }; + + // Set the new value of the library path + std::env::set_var(lib_var, new_path); +} \ No newline at end of file diff --git a/MelonProxy/src/lib.rs b/MelonProxy/src/lib.rs index d32d52ca..2100718b 100644 --- a/MelonProxy/src/lib.rs +++ b/MelonProxy/src/lib.rs @@ -6,7 +6,6 @@ #![allow(named_asm_labels)] #![allow(non_snake_case)] #![feature(asm_const)] -#![feature(lazy_cell)] #![feature(fn_ptr_trait)] #[cfg(target_os = "windows")] @@ -32,33 +31,18 @@ pub use proxied_exports::*; use export_indices::TOTAL_EXPORTS; #[cfg(target_os = "windows")] use orig_exports::load_dll_funcs; -#[cfg(target_arch="x86_64")] -#[cfg(target_os = "windows")] -use std::arch::x86_64::_mm_pause; -#[cfg(target_arch="x86")] -#[cfg(target_os = "windows")] -use std::arch::x86::_mm_pause; #[cfg(target_os = "windows")] use std::ffi::OsString; #[cfg(target_os = "windows")] -use std::os::windows::prelude::{AsRawHandle, OsStringExt}; +use std::os::windows::prelude::OsStringExt; #[cfg(target_os = "windows")] use winapi::{ ctypes::c_void, - shared::{ - minwindef::{FARPROC, HMODULE}, - ntdef::LPCSTR, - }, + shared::minwindef::HMODULE, um::{ - consoleapi::AllocConsole, + libloaderapi::{GetModuleFileNameW}, errhandlingapi::GetLastError, - libloaderapi::{DisableThreadLibraryCalls, FreeLibrary, GetModuleFileNameW, LoadLibraryA}, - processenv::SetStdHandle, - processthreadsapi::{CreateThread, GetCurrentProcess, TerminateProcess}, - winbase::{STD_ERROR_HANDLE, STD_OUTPUT_HANDLE}, - winnt::{DLL_PROCESS_ATTACH, DLL_PROCESS_DETACH}, - winuser::{MessageBoxA, MB_OK}, sysinfoapi::GetSystemDirectoryW, }, }; @@ -152,7 +136,7 @@ unsafe fn get_system32_path() -> Option { /// Called when the thread is spawned #[cfg(target_os = "windows")] unsafe extern "system" fn init(_: *mut c_void) -> u32 { - use std::{path::PathBuf, ffi::{c_char, CString, CStr}}; + use std::path::PathBuf; use libloading::Library; diff --git a/MelonProxy/src/utils/files.rs b/MelonProxy/src/utils/files.rs index fc5fff8c..a86b1b2d 100644 --- a/MelonProxy/src/utils/files.rs +++ b/MelonProxy/src/utils/files.rs @@ -22,6 +22,50 @@ pub fn get_bootstrap_path(base_path: &PathBuf) -> Result { )) } +/// search for Bootstrap in the given path +pub fn get_dobby_dir(base_path: PathBuf, game_dir: PathBuf) -> Result { + let dobby_names = ["dobby", "libdobby"]; //by convention, on unix, the library is prefixed with "lib" + + for name in dobby_names.iter() { + let dobby_path = game_dir.join(name).with_extension(DLL_EXTENSION); + + if dobby_path.exists() { + return Ok(game_dir); + } + } + + for name in dobby_names.iter() { + let dobby_path = base_path.join(name).with_extension(DLL_EXTENSION); + + if dobby_path.exists() { + return Ok(game_dir); + } + } + + let mut path = base_path.join("MelonLoader"); + for name in dobby_names.iter() { + let dobby_path = path.join(name).with_extension(DLL_EXTENSION); + + if dobby_path.exists() { + return Ok(path); + } + } + + path = base_path.join("MelonLoader").join("Dependencies"); + for name in dobby_names.iter() { + let dobby_path = path.join(name).with_extension(DLL_EXTENSION); + + if dobby_path.exists() { + return Ok(path); + } + } + + Err(io::Error::new( + ErrorKind::NotFound, + "Failed to find MelonLoader dobby", + )) +} + pub fn is_unity(file_path: &PathBuf) -> Result> { let file_name = file_path .file_stem() diff --git a/README.md b/README.md index f8b4b8f7..de1fb4a5 100644 --- a/README.md +++ b/README.md @@ -232,7 +232,9 @@ These additional steps below are OPTIONAL if you want to do a FULL UN-INSTALL. MelonLoader is licensed under the Apache License, Version 2.0. See [LICENSE](https://github.com/LavaGang/MelonLoader/blob/master/LICENSE.md) for the full License. Third-party Libraries used as Source Code and/or bundled in Binary Form: -- [Research Detours Package](https://github.com/microsoft/Detours) is licensed under the MIT License. See [LICENSE](https://github.com/LavaGang/MelonLoader/blob/master/Bootstrap/Base/MSDetours/LICENSE.md) for the full License. +- [dobby-rs](https://github.com/RinLovesYou/dobby-rs) is licensed under the Apache License, Version 2.0. See [LICENSE](https://github.com/RinLovesYou/dobby-rs/blob/master/LICENSE) for the full License. +- [dobby-sys](https://github.com/RinLovesYou/dobby-sys) is licensed under the Apache License, Version 2.0. See [LICENSE](https://github.com/RinLovesYou/dobby-sys/blob/master/LICENSE) for the full License. +- [unity-rs](https://github.com/RinLovesYou/unity-rs) is licensed under the Apache License, Version 2.0. See [LICENSE](https://github.com/RinLovesYou/unity-rs/blob/master/LICENSE.txt) for the full License. - [Mono](https://github.com/Unity-Technologies/mono) is licensed under multiple licenses. See [LICENSE](https://github.com/Unity-Technologies/mono/blob/unity-master/LICENSE) for full details. - [HarmonyX](https://github.com/BepInEx/HarmonyX) is licensed under the MIT License. See [LICENSE](https://github.com/BepInEx/HarmonyX/blob/master/LICENSE) for the full License. - [MonoMod](https://github.com/MonoMod/MonoMod) is licensed under the MIT License. See [LICENSE](https://github.com/MonoMod/MonoMod/blob/master/LICENSE) for the full License. @@ -256,7 +258,7 @@ Third-party Libraries used as Source Code and/or bundled in Binary Form: - [ValueTupleBridge](https://github.com/OrangeCube/MinimumAsyncBridge) is licensed under the MIT License. See [LICENSE](https://github.com/OrangeCube/MinimumAsyncBridge/blob/master/LICENSE) for the full License. - [WebSocketDotNet](https://github.com/SamboyCoding/WebSocketDotNet) is licensed under the MIT License. See [LICENSE](https://github.com/SamboyCoding/WebSocketDotNet/blob/master/LICENSE) for the full License. - [Pastel](https://github.com/silkfire/Pastel) is licensed under the MIT License. See [LICENSE](https://github.com/silkfire/Pastel/blob/master/LICENSE) for the full License. -- [Il2CppInterop](https://github.com/BepInEx/Il2CppInterop) is licensed under LGPLv3 License. See [LICENSE](https://github.com/BepInEx/Il2CppInterop/blob/master/LICENSE) for the full License. +- [Il2CppInterop](https://github.com/BepInEx/Il2CppInterop) is licensed under the LGPLv3 License. See [LICENSE](https://github.com/BepInEx/Il2CppInterop/blob/master/LICENSE) for the full License. External Libraries and Tools that are downloaded and used at Runtime: From 54c84457e44c2d757b2ab348653d9a659c722ed3 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Mon, 7 Oct 2024 22:22:55 -0600 Subject: [PATCH 18/60] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index de1fb4a5..5051f163 100644 --- a/README.md +++ b/README.md @@ -232,6 +232,7 @@ These additional steps below are OPTIONAL if you want to do a FULL UN-INSTALL. MelonLoader is licensed under the Apache License, Version 2.0. See [LICENSE](https://github.com/LavaGang/MelonLoader/blob/master/LICENSE.md) for the full License. Third-party Libraries used as Source Code and/or bundled in Binary Form: +- [Dobby](https://github.com/jmpews/Dobby) is licensed under the Apache License, Version 2.0. See [LICENSE](https://github.com/jmpews/Dobby/blob/master/LICENSE) for the full License. - [dobby-rs](https://github.com/RinLovesYou/dobby-rs) is licensed under the Apache License, Version 2.0. See [LICENSE](https://github.com/RinLovesYou/dobby-rs/blob/master/LICENSE) for the full License. - [dobby-sys](https://github.com/RinLovesYou/dobby-sys) is licensed under the Apache License, Version 2.0. See [LICENSE](https://github.com/RinLovesYou/dobby-sys/blob/master/LICENSE) for the full License. - [unity-rs](https://github.com/RinLovesYou/unity-rs) is licensed under the Apache License, Version 2.0. See [LICENSE](https://github.com/RinLovesYou/unity-rs/blob/master/LICENSE.txt) for the full License. @@ -259,8 +260,8 @@ Third-party Libraries used as Source Code and/or bundled in Binary Form: - [WebSocketDotNet](https://github.com/SamboyCoding/WebSocketDotNet) is licensed under the MIT License. See [LICENSE](https://github.com/SamboyCoding/WebSocketDotNet/blob/master/LICENSE) for the full License. - [Pastel](https://github.com/silkfire/Pastel) is licensed under the MIT License. See [LICENSE](https://github.com/silkfire/Pastel/blob/master/LICENSE) for the full License. - [Il2CppInterop](https://github.com/BepInEx/Il2CppInterop) is licensed under the LGPLv3 License. See [LICENSE](https://github.com/BepInEx/Il2CppInterop/blob/master/LICENSE) for the full License. - - + + External Libraries and Tools that are downloaded and used at Runtime: - [Cpp2IL](https://github.com/SamboyCoding/Cpp2IL) is licensed under the MIT License. See [LICENSE](https://github.com/SamboyCoding/Cpp2IL/blob/master/LICENSE) for the full License. - Unity Runtime Libraries from [Unity-Runtime-Libraries](https://github.com/LavaGang/Unity-Runtime-Libraries) are part of Unity Software. From ac0141a8824d783852964b29b1fe5971e5d6dcbe Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Mon, 7 Oct 2024 22:33:32 -0600 Subject: [PATCH 19/60] Update lib.rs --- MelonProxy/src/lib.rs | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/MelonProxy/src/lib.rs b/MelonProxy/src/lib.rs index 2100718b..d32d52ca 100644 --- a/MelonProxy/src/lib.rs +++ b/MelonProxy/src/lib.rs @@ -6,6 +6,7 @@ #![allow(named_asm_labels)] #![allow(non_snake_case)] #![feature(asm_const)] +#![feature(lazy_cell)] #![feature(fn_ptr_trait)] #[cfg(target_os = "windows")] @@ -31,18 +32,33 @@ pub use proxied_exports::*; use export_indices::TOTAL_EXPORTS; #[cfg(target_os = "windows")] use orig_exports::load_dll_funcs; +#[cfg(target_arch="x86_64")] +#[cfg(target_os = "windows")] +use std::arch::x86_64::_mm_pause; +#[cfg(target_arch="x86")] +#[cfg(target_os = "windows")] +use std::arch::x86::_mm_pause; #[cfg(target_os = "windows")] use std::ffi::OsString; #[cfg(target_os = "windows")] -use std::os::windows::prelude::OsStringExt; +use std::os::windows::prelude::{AsRawHandle, OsStringExt}; #[cfg(target_os = "windows")] use winapi::{ ctypes::c_void, - shared::minwindef::HMODULE, + shared::{ + minwindef::{FARPROC, HMODULE}, + ntdef::LPCSTR, + }, um::{ - libloaderapi::{GetModuleFileNameW}, + consoleapi::AllocConsole, errhandlingapi::GetLastError, + libloaderapi::{DisableThreadLibraryCalls, FreeLibrary, GetModuleFileNameW, LoadLibraryA}, + processenv::SetStdHandle, + processthreadsapi::{CreateThread, GetCurrentProcess, TerminateProcess}, + winbase::{STD_ERROR_HANDLE, STD_OUTPUT_HANDLE}, + winnt::{DLL_PROCESS_ATTACH, DLL_PROCESS_DETACH}, + winuser::{MessageBoxA, MB_OK}, sysinfoapi::GetSystemDirectoryW, }, }; @@ -136,7 +152,7 @@ unsafe fn get_system32_path() -> Option { /// Called when the thread is spawned #[cfg(target_os = "windows")] unsafe extern "system" fn init(_: *mut c_void) -> u32 { - use std::path::PathBuf; + use std::{path::PathBuf, ffi::{c_char, CString, CStr}}; use libloading::Library; From 87241786347e8f3badd539afeb6160139d257503 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Mon, 7 Oct 2024 22:45:06 -0600 Subject: [PATCH 20/60] Revert a few things --- Bootstrap/Cargo.toml | 5 +++-- Bootstrap/src/lib.rs | 14 ++++++++++++++ Cargo.lock | 4 ++-- MelonProxy/Cargo.toml | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Bootstrap/Cargo.toml b/Bootstrap/Cargo.toml index 8bfda0c8..4599ff4d 100755 --- a/Bootstrap/Cargo.toml +++ b/Bootstrap/Cargo.toml @@ -1,11 +1,12 @@ [package] name = "Bootstrap" -version = "0.6.6" +version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +#unity-rs = { path = "C:/Users/sarah/Documents/rust/Ferrex/unity/" } unity-rs = { git = "https://github.com/RinLovesYou/Ferrex/", rev = "77d114c" } ctor = "0.2.6" chrono = "0.4.23" @@ -28,4 +29,4 @@ windows = { version = "0.52.0", features = [ ]} [lib] -crate-type = ["dylib"] \ No newline at end of file +crate-type = ["dylib"] diff --git a/Bootstrap/src/lib.rs b/Bootstrap/src/lib.rs index ef3dbad6..e086ebea 100755 --- a/Bootstrap/src/lib.rs +++ b/Bootstrap/src/lib.rs @@ -1,5 +1,19 @@ #![allow(non_snake_case)] +// #![deny( +// missing_debug_implementations, +// unused_results, +// warnings, +// clippy::extra_unused_lifetimes, +// clippy::from_over_into, +// clippy::needless_borrow, +// clippy::new_without_default, +// clippy::useless_conversion +// )] +// #![forbid(rust_2018_idioms)] +// #![allow(clippy::inherent_to_string, clippy::type_complexity, improper_ctypes)] +// #![cfg_attr(docsrs, feature(doc_cfg))] + pub mod base_assembly; pub mod console; pub mod constants; diff --git a/Cargo.lock b/Cargo.lock index dba7e627..fc296188 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = 3 [[package]] name = "Bootstrap" -version = "0.6.6" +version = "0.1.0" dependencies = [ "chrono", "clap", @@ -24,7 +24,7 @@ dependencies = [ [[package]] name = "MelonProxy" -version = "0.6.6" +version = "0.1.0" dependencies = [ "ctor", "libloading 0.8.1", diff --git a/MelonProxy/Cargo.toml b/MelonProxy/Cargo.toml index 26e2b1aa..71b542fc 100644 --- a/MelonProxy/Cargo.toml +++ b/MelonProxy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "MelonProxy" -version = "0.6.6" +version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html From cdeac348f28c715689842a45a60d4a0defffba06 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Mon, 7 Oct 2024 23:15:23 -0600 Subject: [PATCH 21/60] pineapple --- Bootstrap/Cargo.toml | 5 ++--- Cargo.lock | 4 ++-- MelonProxy/Cargo.toml | 2 +- MelonProxy/src/lib.rs | 24 ++++-------------------- 4 files changed, 9 insertions(+), 26 deletions(-) diff --git a/Bootstrap/Cargo.toml b/Bootstrap/Cargo.toml index 4599ff4d..8bfda0c8 100755 --- a/Bootstrap/Cargo.toml +++ b/Bootstrap/Cargo.toml @@ -1,12 +1,11 @@ [package] name = "Bootstrap" -version = "0.1.0" +version = "0.6.6" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -#unity-rs = { path = "C:/Users/sarah/Documents/rust/Ferrex/unity/" } unity-rs = { git = "https://github.com/RinLovesYou/Ferrex/", rev = "77d114c" } ctor = "0.2.6" chrono = "0.4.23" @@ -29,4 +28,4 @@ windows = { version = "0.52.0", features = [ ]} [lib] -crate-type = ["dylib"] +crate-type = ["dylib"] \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index fc296188..dba7e627 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = 3 [[package]] name = "Bootstrap" -version = "0.1.0" +version = "0.6.6" dependencies = [ "chrono", "clap", @@ -24,7 +24,7 @@ dependencies = [ [[package]] name = "MelonProxy" -version = "0.1.0" +version = "0.6.6" dependencies = [ "ctor", "libloading 0.8.1", diff --git a/MelonProxy/Cargo.toml b/MelonProxy/Cargo.toml index 71b542fc..26e2b1aa 100644 --- a/MelonProxy/Cargo.toml +++ b/MelonProxy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "MelonProxy" -version = "0.1.0" +version = "0.6.6" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/MelonProxy/src/lib.rs b/MelonProxy/src/lib.rs index d32d52ca..2100718b 100644 --- a/MelonProxy/src/lib.rs +++ b/MelonProxy/src/lib.rs @@ -6,7 +6,6 @@ #![allow(named_asm_labels)] #![allow(non_snake_case)] #![feature(asm_const)] -#![feature(lazy_cell)] #![feature(fn_ptr_trait)] #[cfg(target_os = "windows")] @@ -32,33 +31,18 @@ pub use proxied_exports::*; use export_indices::TOTAL_EXPORTS; #[cfg(target_os = "windows")] use orig_exports::load_dll_funcs; -#[cfg(target_arch="x86_64")] -#[cfg(target_os = "windows")] -use std::arch::x86_64::_mm_pause; -#[cfg(target_arch="x86")] -#[cfg(target_os = "windows")] -use std::arch::x86::_mm_pause; #[cfg(target_os = "windows")] use std::ffi::OsString; #[cfg(target_os = "windows")] -use std::os::windows::prelude::{AsRawHandle, OsStringExt}; +use std::os::windows::prelude::OsStringExt; #[cfg(target_os = "windows")] use winapi::{ ctypes::c_void, - shared::{ - minwindef::{FARPROC, HMODULE}, - ntdef::LPCSTR, - }, + shared::minwindef::HMODULE, um::{ - consoleapi::AllocConsole, + libloaderapi::{GetModuleFileNameW}, errhandlingapi::GetLastError, - libloaderapi::{DisableThreadLibraryCalls, FreeLibrary, GetModuleFileNameW, LoadLibraryA}, - processenv::SetStdHandle, - processthreadsapi::{CreateThread, GetCurrentProcess, TerminateProcess}, - winbase::{STD_ERROR_HANDLE, STD_OUTPUT_HANDLE}, - winnt::{DLL_PROCESS_ATTACH, DLL_PROCESS_DETACH}, - winuser::{MessageBoxA, MB_OK}, sysinfoapi::GetSystemDirectoryW, }, }; @@ -152,7 +136,7 @@ unsafe fn get_system32_path() -> Option { /// Called when the thread is spawned #[cfg(target_os = "windows")] unsafe extern "system" fn init(_: *mut c_void) -> u32 { - use std::{path::PathBuf, ffi::{c_char, CString, CStr}}; + use std::path::PathBuf; use libloading::Library; From 6cb88119509376ce572ebc35b06f5ec324634e46 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Mon, 7 Oct 2024 23:24:35 -0600 Subject: [PATCH 22/60] Update files.rs --- MelonProxy/src/utils/files.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MelonProxy/src/utils/files.rs b/MelonProxy/src/utils/files.rs index a86b1b2d..bc5e79c3 100644 --- a/MelonProxy/src/utils/files.rs +++ b/MelonProxy/src/utils/files.rs @@ -38,7 +38,7 @@ pub fn get_dobby_dir(base_path: PathBuf, game_dir: PathBuf) -> Result Date: Mon, 7 Oct 2024 23:39:13 -0600 Subject: [PATCH 23/60] Revert --- Bootstrap/Cargo.toml | 5 +++-- Bootstrap/src/base_assembly/mono.rs | 2 +- Bootstrap/src/lib.rs | 3 +-- Cargo.lock | 4 ++-- MelonProxy/Cargo.toml | 2 +- MelonProxy/src/core.rs | 24 ------------------------ MelonProxy/src/lib.rs | 24 ++++++++++++++++++++---- MelonProxy/src/utils/files.rs | 4 +++- 8 files changed, 31 insertions(+), 37 deletions(-) diff --git a/Bootstrap/Cargo.toml b/Bootstrap/Cargo.toml index 8bfda0c8..4599ff4d 100755 --- a/Bootstrap/Cargo.toml +++ b/Bootstrap/Cargo.toml @@ -1,11 +1,12 @@ [package] name = "Bootstrap" -version = "0.6.6" +version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +#unity-rs = { path = "C:/Users/sarah/Documents/rust/Ferrex/unity/" } unity-rs = { git = "https://github.com/RinLovesYou/Ferrex/", rev = "77d114c" } ctor = "0.2.6" chrono = "0.4.23" @@ -28,4 +29,4 @@ windows = { version = "0.52.0", features = [ ]} [lib] -crate-type = ["dylib"] \ No newline at end of file +crate-type = ["dylib"] diff --git a/Bootstrap/src/base_assembly/mono.rs b/Bootstrap/src/base_assembly/mono.rs index 8923d78a..54905af5 100644 --- a/Bootstrap/src/base_assembly/mono.rs +++ b/Bootstrap/src/base_assembly/mono.rs @@ -26,7 +26,7 @@ pub fn init(runtime: &FerrexRuntime) -> Result<(), DynErr> { let _runtime_dir = paths::runtime_dir()?; //get MelonLoader.dll's path and confirm it exists - let melonloader_dll = _runtime_dir.join("MelonLoader.dll"); + let mut melonloader_dll = _runtime_dir.join("MelonLoader.dll"); if !melonloader_dll.exists() { return Err("MelonLoader.dll not found".into()); diff --git a/Bootstrap/src/lib.rs b/Bootstrap/src/lib.rs index e086ebea..8b04c1f3 100755 --- a/Bootstrap/src/lib.rs +++ b/Bootstrap/src/lib.rs @@ -1,5 +1,4 @@ -#![allow(non_snake_case)] - +// #![allow(non_snake_case)] // #![deny( // missing_debug_implementations, // unused_results, diff --git a/Cargo.lock b/Cargo.lock index dba7e627..fc296188 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = 3 [[package]] name = "Bootstrap" -version = "0.6.6" +version = "0.1.0" dependencies = [ "chrono", "clap", @@ -24,7 +24,7 @@ dependencies = [ [[package]] name = "MelonProxy" -version = "0.6.6" +version = "0.1.0" dependencies = [ "ctor", "libloading 0.8.1", diff --git a/MelonProxy/Cargo.toml b/MelonProxy/Cargo.toml index 26e2b1aa..71b542fc 100644 --- a/MelonProxy/Cargo.toml +++ b/MelonProxy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "MelonProxy" -version = "0.6.6" +version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/MelonProxy/src/core.rs b/MelonProxy/src/core.rs index 8f978b0f..17148eb5 100644 --- a/MelonProxy/src/core.rs +++ b/MelonProxy/src/core.rs @@ -34,7 +34,6 @@ pub fn init() -> Result<(), Box> { return Ok(()); } - let game_dir = base_dir.clone(); let mut iterator = args.iter(); while let Some(mut arg) = iterator.next() { if arg.starts_with("--melonloader.basedir") { @@ -58,10 +57,6 @@ pub fn init() -> Result<(), Box> { if no_mods { return Ok(()); } - - //fix dobby_rs link - let dobby_path = files::get_dobby_dir(base_dir.clone(), game_dir)?; - add_dll_directory(dobby_path); let bootstrap_path = files::get_bootstrap_path(&base_dir)?; @@ -70,23 +65,4 @@ pub fn init() -> Result<(), Box> { } Ok(()) -} - -fn add_dll_directory(native_lib_dir: PathBuf) { - // Determine the correct environment variable and separator - let lib_var = if cfg!(target_os = "windows") { "PATH" } else { "LD_LIBRARY_PATH" }; - let separator = if cfg!(target_os = "windows") { ";" } else { ":" }; - - // Get the current value of the library path - let current_path = std::env::var(lib_var).unwrap_or_else(|_| String::new()); - - // Append the new directory to the existing paths - let new_path = if current_path.is_empty() { - native_lib_dir.display().to_string() - } else { - format!("{}{}{}", native_lib_dir.display(), separator, current_path) - }; - - // Set the new value of the library path - std::env::set_var(lib_var, new_path); } \ No newline at end of file diff --git a/MelonProxy/src/lib.rs b/MelonProxy/src/lib.rs index 2100718b..d32d52ca 100644 --- a/MelonProxy/src/lib.rs +++ b/MelonProxy/src/lib.rs @@ -6,6 +6,7 @@ #![allow(named_asm_labels)] #![allow(non_snake_case)] #![feature(asm_const)] +#![feature(lazy_cell)] #![feature(fn_ptr_trait)] #[cfg(target_os = "windows")] @@ -31,18 +32,33 @@ pub use proxied_exports::*; use export_indices::TOTAL_EXPORTS; #[cfg(target_os = "windows")] use orig_exports::load_dll_funcs; +#[cfg(target_arch="x86_64")] +#[cfg(target_os = "windows")] +use std::arch::x86_64::_mm_pause; +#[cfg(target_arch="x86")] +#[cfg(target_os = "windows")] +use std::arch::x86::_mm_pause; #[cfg(target_os = "windows")] use std::ffi::OsString; #[cfg(target_os = "windows")] -use std::os::windows::prelude::OsStringExt; +use std::os::windows::prelude::{AsRawHandle, OsStringExt}; #[cfg(target_os = "windows")] use winapi::{ ctypes::c_void, - shared::minwindef::HMODULE, + shared::{ + minwindef::{FARPROC, HMODULE}, + ntdef::LPCSTR, + }, um::{ - libloaderapi::{GetModuleFileNameW}, + consoleapi::AllocConsole, errhandlingapi::GetLastError, + libloaderapi::{DisableThreadLibraryCalls, FreeLibrary, GetModuleFileNameW, LoadLibraryA}, + processenv::SetStdHandle, + processthreadsapi::{CreateThread, GetCurrentProcess, TerminateProcess}, + winbase::{STD_ERROR_HANDLE, STD_OUTPUT_HANDLE}, + winnt::{DLL_PROCESS_ATTACH, DLL_PROCESS_DETACH}, + winuser::{MessageBoxA, MB_OK}, sysinfoapi::GetSystemDirectoryW, }, }; @@ -136,7 +152,7 @@ unsafe fn get_system32_path() -> Option { /// Called when the thread is spawned #[cfg(target_os = "windows")] unsafe extern "system" fn init(_: *mut c_void) -> u32 { - use std::path::PathBuf; + use std::{path::PathBuf, ffi::{c_char, CString, CStr}}; use libloading::Library; diff --git a/MelonProxy/src/utils/files.rs b/MelonProxy/src/utils/files.rs index bc5e79c3..14414956 100644 --- a/MelonProxy/src/utils/files.rs +++ b/MelonProxy/src/utils/files.rs @@ -22,7 +22,8 @@ pub fn get_bootstrap_path(base_path: &PathBuf) -> Result { )) } -/// search for Bootstrap in the given path +/// search for dobby in the given path +/* pub fn get_dobby_dir(base_path: PathBuf, game_dir: PathBuf) -> Result { let dobby_names = ["dobby", "libdobby"]; //by convention, on unix, the library is prefixed with "lib" @@ -65,6 +66,7 @@ pub fn get_dobby_dir(base_path: PathBuf, game_dir: PathBuf) -> Result Result> { let file_name = file_path From c9891f0e1f23d607944307067ecc902c59421452 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Mon, 7 Oct 2024 23:42:17 -0600 Subject: [PATCH 24/60] Revert "Revert" This reverts commit 633bb4eaab37fffa549021b4fbaf3c897e3abac7. --- Bootstrap/Cargo.toml | 5 ++--- Bootstrap/src/base_assembly/mono.rs | 2 +- Bootstrap/src/lib.rs | 3 ++- Cargo.lock | 4 ++-- MelonProxy/Cargo.toml | 2 +- MelonProxy/src/core.rs | 24 ++++++++++++++++++++++++ MelonProxy/src/lib.rs | 24 ++++-------------------- MelonProxy/src/utils/files.rs | 4 +--- 8 files changed, 37 insertions(+), 31 deletions(-) diff --git a/Bootstrap/Cargo.toml b/Bootstrap/Cargo.toml index 4599ff4d..8bfda0c8 100755 --- a/Bootstrap/Cargo.toml +++ b/Bootstrap/Cargo.toml @@ -1,12 +1,11 @@ [package] name = "Bootstrap" -version = "0.1.0" +version = "0.6.6" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -#unity-rs = { path = "C:/Users/sarah/Documents/rust/Ferrex/unity/" } unity-rs = { git = "https://github.com/RinLovesYou/Ferrex/", rev = "77d114c" } ctor = "0.2.6" chrono = "0.4.23" @@ -29,4 +28,4 @@ windows = { version = "0.52.0", features = [ ]} [lib] -crate-type = ["dylib"] +crate-type = ["dylib"] \ No newline at end of file diff --git a/Bootstrap/src/base_assembly/mono.rs b/Bootstrap/src/base_assembly/mono.rs index 54905af5..8923d78a 100644 --- a/Bootstrap/src/base_assembly/mono.rs +++ b/Bootstrap/src/base_assembly/mono.rs @@ -26,7 +26,7 @@ pub fn init(runtime: &FerrexRuntime) -> Result<(), DynErr> { let _runtime_dir = paths::runtime_dir()?; //get MelonLoader.dll's path and confirm it exists - let mut melonloader_dll = _runtime_dir.join("MelonLoader.dll"); + let melonloader_dll = _runtime_dir.join("MelonLoader.dll"); if !melonloader_dll.exists() { return Err("MelonLoader.dll not found".into()); diff --git a/Bootstrap/src/lib.rs b/Bootstrap/src/lib.rs index 8b04c1f3..e086ebea 100755 --- a/Bootstrap/src/lib.rs +++ b/Bootstrap/src/lib.rs @@ -1,4 +1,5 @@ -// #![allow(non_snake_case)] +#![allow(non_snake_case)] + // #![deny( // missing_debug_implementations, // unused_results, diff --git a/Cargo.lock b/Cargo.lock index fc296188..dba7e627 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = 3 [[package]] name = "Bootstrap" -version = "0.1.0" +version = "0.6.6" dependencies = [ "chrono", "clap", @@ -24,7 +24,7 @@ dependencies = [ [[package]] name = "MelonProxy" -version = "0.1.0" +version = "0.6.6" dependencies = [ "ctor", "libloading 0.8.1", diff --git a/MelonProxy/Cargo.toml b/MelonProxy/Cargo.toml index 71b542fc..26e2b1aa 100644 --- a/MelonProxy/Cargo.toml +++ b/MelonProxy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "MelonProxy" -version = "0.1.0" +version = "0.6.6" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/MelonProxy/src/core.rs b/MelonProxy/src/core.rs index 17148eb5..8f978b0f 100644 --- a/MelonProxy/src/core.rs +++ b/MelonProxy/src/core.rs @@ -34,6 +34,7 @@ pub fn init() -> Result<(), Box> { return Ok(()); } + let game_dir = base_dir.clone(); let mut iterator = args.iter(); while let Some(mut arg) = iterator.next() { if arg.starts_with("--melonloader.basedir") { @@ -57,6 +58,10 @@ pub fn init() -> Result<(), Box> { if no_mods { return Ok(()); } + + //fix dobby_rs link + let dobby_path = files::get_dobby_dir(base_dir.clone(), game_dir)?; + add_dll_directory(dobby_path); let bootstrap_path = files::get_bootstrap_path(&base_dir)?; @@ -65,4 +70,23 @@ pub fn init() -> Result<(), Box> { } Ok(()) +} + +fn add_dll_directory(native_lib_dir: PathBuf) { + // Determine the correct environment variable and separator + let lib_var = if cfg!(target_os = "windows") { "PATH" } else { "LD_LIBRARY_PATH" }; + let separator = if cfg!(target_os = "windows") { ";" } else { ":" }; + + // Get the current value of the library path + let current_path = std::env::var(lib_var).unwrap_or_else(|_| String::new()); + + // Append the new directory to the existing paths + let new_path = if current_path.is_empty() { + native_lib_dir.display().to_string() + } else { + format!("{}{}{}", native_lib_dir.display(), separator, current_path) + }; + + // Set the new value of the library path + std::env::set_var(lib_var, new_path); } \ No newline at end of file diff --git a/MelonProxy/src/lib.rs b/MelonProxy/src/lib.rs index d32d52ca..2100718b 100644 --- a/MelonProxy/src/lib.rs +++ b/MelonProxy/src/lib.rs @@ -6,7 +6,6 @@ #![allow(named_asm_labels)] #![allow(non_snake_case)] #![feature(asm_const)] -#![feature(lazy_cell)] #![feature(fn_ptr_trait)] #[cfg(target_os = "windows")] @@ -32,33 +31,18 @@ pub use proxied_exports::*; use export_indices::TOTAL_EXPORTS; #[cfg(target_os = "windows")] use orig_exports::load_dll_funcs; -#[cfg(target_arch="x86_64")] -#[cfg(target_os = "windows")] -use std::arch::x86_64::_mm_pause; -#[cfg(target_arch="x86")] -#[cfg(target_os = "windows")] -use std::arch::x86::_mm_pause; #[cfg(target_os = "windows")] use std::ffi::OsString; #[cfg(target_os = "windows")] -use std::os::windows::prelude::{AsRawHandle, OsStringExt}; +use std::os::windows::prelude::OsStringExt; #[cfg(target_os = "windows")] use winapi::{ ctypes::c_void, - shared::{ - minwindef::{FARPROC, HMODULE}, - ntdef::LPCSTR, - }, + shared::minwindef::HMODULE, um::{ - consoleapi::AllocConsole, + libloaderapi::{GetModuleFileNameW}, errhandlingapi::GetLastError, - libloaderapi::{DisableThreadLibraryCalls, FreeLibrary, GetModuleFileNameW, LoadLibraryA}, - processenv::SetStdHandle, - processthreadsapi::{CreateThread, GetCurrentProcess, TerminateProcess}, - winbase::{STD_ERROR_HANDLE, STD_OUTPUT_HANDLE}, - winnt::{DLL_PROCESS_ATTACH, DLL_PROCESS_DETACH}, - winuser::{MessageBoxA, MB_OK}, sysinfoapi::GetSystemDirectoryW, }, }; @@ -152,7 +136,7 @@ unsafe fn get_system32_path() -> Option { /// Called when the thread is spawned #[cfg(target_os = "windows")] unsafe extern "system" fn init(_: *mut c_void) -> u32 { - use std::{path::PathBuf, ffi::{c_char, CString, CStr}}; + use std::path::PathBuf; use libloading::Library; diff --git a/MelonProxy/src/utils/files.rs b/MelonProxy/src/utils/files.rs index 14414956..bc5e79c3 100644 --- a/MelonProxy/src/utils/files.rs +++ b/MelonProxy/src/utils/files.rs @@ -22,8 +22,7 @@ pub fn get_bootstrap_path(base_path: &PathBuf) -> Result { )) } -/// search for dobby in the given path -/* +/// search for Bootstrap in the given path pub fn get_dobby_dir(base_path: PathBuf, game_dir: PathBuf) -> Result { let dobby_names = ["dobby", "libdobby"]; //by convention, on unix, the library is prefixed with "lib" @@ -66,7 +65,6 @@ pub fn get_dobby_dir(base_path: PathBuf, game_dir: PathBuf) -> Result Result> { let file_name = file_path From b73c427b5174c0a2e7953171d55c0d25dc0b6d3c Mon Sep 17 00:00:00 2001 From: Attila Date: Tue, 8 Oct 2024 01:14:25 -0700 Subject: [PATCH 25/60] Update stale.yml to exempt Improvement [skip ci] --- .github/workflows/stale.yml | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 15a1db8f..e52ebba4 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -7,24 +7,35 @@ name: Close inactive issues on: schedule: - - cron: '4 20 * * *' + - cron: '4 20 * * *' + workflow_dispatch: + +permissions: + issues: write + pull-requests: write + +concurrency: + group: stale jobs: stale: - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - steps: - - uses: actions/stale@v9 + - uses: actions/stale@main with: - repo-token: ${{ secrets.GITHUB_TOKEN }} days-before-issue-stale: 120 days-before-issue-close: 14 stale-issue-message: "This issue is stale because it has been open for 4 months with no activity. If this is still an issue then please leave a comment, or else this will close in 2 weeks." close-issue-message: "This issue was closed because it has been 2 weeks since being marked as stale." days-before-pr-stale: -1 days-before-pr-close: -1 - exempt-issue-labels: "Work-in-Progress,Planned" + exempt-issue-labels: "Work-in-Progress,Planned,Improvement" + operations-per-run: 100 + lock: + runs-on: ubuntu-latest + steps: + - uses: dessant/lock-threads@v5.0.1 + with: + issue-inactive-days: '365' + issue-lock-reason: 'resolved' + process-only: 'issues' From b760cb2505d466549ef5e733cc727bf034978a3b Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Tue, 8 Oct 2024 12:54:23 -0600 Subject: [PATCH 26/60] Update Cargo.lock --- Cargo.lock | 1316 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 751 insertions(+), 565 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dba7e627..b049345b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "Bootstrap" @@ -19,7 +19,7 @@ dependencies = [ "netcorehost", "thiserror", "unity-rs", - "windows 0.52.0", + "windows", ] [[package]] @@ -27,7 +27,7 @@ name = "MelonProxy" version = "0.6.6" dependencies = [ "ctor", - "libloading 0.8.1", + "libloading 0.8.5", "msgbox", "proxygen-macros", "winapi", @@ -35,24 +35,24 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.20.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "aes" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ "cfg-if", "cipher", @@ -76,9 +76,18 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.72" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" + +[[package]] +name = "arbitrary" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" +dependencies = [ + "derive_arbitrary", +] [[package]] name = "atk" @@ -87,7 +96,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c3d816ce6f0e2909a96830d6911c2aff044370b1ef92d7f267b43bae5addedd" dependencies = [ "atk-sys", - "bitflags 1.3.2", + "bitflags", "glib", "libc", ] @@ -106,36 +115,30 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" -version = "0.3.68" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] name = "base64" -version = "0.21.2" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" - -[[package]] -name = "base64ct" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bitflags" @@ -143,12 +146,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "bitflags" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" - [[package]] name = "block" version = "0.1.6" @@ -181,21 +178,21 @@ checksum = "832133bbabbbaa9fbdba793456a2827627a7d2b8fb96032fa1e7666d7895832b" [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.4.0" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" [[package]] name = "bzip2" @@ -224,7 +221,7 @@ version = "0.15.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c76ee391b03d35510d9fa917357c7f1855bd9a6659c95a1b392e33f49b3369bc" dependencies = [ - "bitflags 1.3.2", + "bitflags", "cairo-sys-rs", "glib", "libc", @@ -250,19 +247,20 @@ checksum = "1582e1c9e755dd6ad6b224dcffb135d199399a4568d454bd89fe515ca8425695" [[package]] name = "cc" -version = "1.0.82" +version = "1.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" +checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1" dependencies = [ "jobserver", "libc", + "shlex", ] [[package]] name = "cfg-expr" -version = "0.15.4" +version = "0.15.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b40ccee03b5175c18cde8f37e7d2a33bcef6f8ec8f7cc0d81090d1bb380949c9" +checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" dependencies = [ "smallvec", "target-lexicon", @@ -276,16 +274,16 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -303,7 +301,7 @@ name = "clap" version = "4.1.8" source = "git+https://github.com/RinLovesYou/clap#f959816de9a07eaf9867f0419a1484353e0629f6" dependencies = [ - "bitflags 1.3.2", + "bitflags", "clap_derive", "clap_lex", "is-terminal", @@ -317,7 +315,7 @@ name = "clap_derive" version = "4.1.8" source = "git+https://github.com/RinLovesYou/clap#f959816de9a07eaf9867f0419a1484353e0629f6" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro-error", "proc-macro2", "quote", @@ -338,7 +336,7 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" dependencies = [ - "bitflags 1.3.2", + "bitflags", "block", "cocoa-foundation", "core-foundation", @@ -350,41 +348,39 @@ dependencies = [ [[package]] name = "cocoa-foundation" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931d3837c286f56e3c58423ce4eba12d08db2374461a785c86f672b08b5650d6" +checksum = "8c6234cbb2e4c785b456c0644748b1ac416dd045799740356f8363dfe00c93f7" dependencies = [ - "bitflags 1.3.2", + "bitflags", "block", "core-foundation", "core-graphics-types", - "foreign-types", "libc", "objc", ] [[package]] name = "colored" -version = "2.0.4" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" dependencies = [ - "is-terminal", "lazy_static", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "constant_time_eq" -version = "0.1.5" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -392,9 +388,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "core-graphics" @@ -402,7 +398,7 @@ version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" dependencies = [ - "bitflags 1.3.2", + "bitflags", "core-foundation", "core-graphics-types", "foreign-types", @@ -411,11 +407,11 @@ dependencies = [ [[package]] name = "core-graphics-types" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bb142d41022986c1d8ff29103a1411c8a3dfad3552f87a4f8dc50d61d4f4e33" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" dependencies = [ - "bitflags 1.3.2", + "bitflags", "core-foundation", "libc", ] @@ -431,31 +427,43 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" dependencies = [ "libc", ] [[package]] -name = "crc32fast" -version = "1.3.2" +name = "crc" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" dependencies = [ - "cfg-if", + "crc-catalog", ] [[package]] -name = "crossbeam-utils" -version = "0.8.16" +name = "crc-catalog" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + [[package]] name = "crypto-common" version = "0.1.6" @@ -468,9 +476,9 @@ dependencies = [ [[package]] name = "cstr" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8aa998c33a6d3271e3678950a22134cd7dd27cef86dee1b611b5b14207d1d90b" +checksum = "68523903c8ae5aacfa32a0d9ae60cadeb764e1da14ee0d26b1f3089f13a54636" dependencies = [ "proc-macro2", "quote", @@ -478,12 +486,12 @@ dependencies = [ [[package]] name = "ctor" -version = "0.2.6" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d2b3721e861707777e3195b0158f950ae6dc4a27e4d02ff9f67e3eb3de199e" +checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f" dependencies = [ "quote", - "syn 2.0.44", + "syn 2.0.79", ] [[package]] @@ -492,21 +500,41 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" +[[package]] +name = "deflate64" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da692b8d1080ea3045efaab14434d40468c3d8657e42abddfffca87b428f4c1b" + [[package]] name = "deranged" -version = "0.3.7" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7684a49fb1af197853ef7b2ee694bc1f5b4179556f1e5710e1760c5db6f5e929" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "derive_arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] [[package]] name = "derive_more" -version = "0.99.17" +version = "0.99.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.79", ] [[package]] @@ -526,7 +554,7 @@ checksum = "133a7fa5cffeec6867fb2847335ec2d688f5bbee6318889d2a137ce1d226b180" dependencies = [ "proc-macro2", "quote", - "syn 2.0.44", + "syn 2.0.79", ] [[package]] @@ -549,6 +577,17 @@ dependencies = [ "subtle", ] +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + [[package]] name = "dlopen2" version = "0.6.1" @@ -569,7 +608,7 @@ checksum = "f2b99bf03862d7f545ebc28ddd33a665b50865f4dfd84031a393823879bd4c54" dependencies = [ "proc-macro2", "quote", - "syn 2.0.44", + "syn 2.0.79", ] [[package]] @@ -586,33 +625,24 @@ name = "dobby-sys" version = "0.1.0" source = "git+https://github.com/RinLovesYou/dobby-sys.git#3001d5debc9a8b53fdbd7bf7224b16c584c26fbf" -[[package]] -name = "encoding_rs" -version = "0.8.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" -dependencies = [ - "cfg-if", -] - [[package]] name = "enum-map" -version = "2.6.1" +version = "2.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9705d8de4776df900a4a0b2384f8b0ab42f775e93b083b42f8ce71bdc32a47e3" +checksum = "6866f3bfdf8207509a033af1a75a7b08abda06bbaaeae6669323fd5a097df2e9" dependencies = [ "enum-map-derive", ] [[package]] name = "enum-map-derive" -version = "0.13.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccb14d927583dd5c2eac0f2cf264fc4762aefe1ae14c47a8a20fc1939d3a5fc0" +checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.44", + "syn 2.0.79", ] [[package]] @@ -621,34 +651,13 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" -[[package]] -name = "errno" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "exe" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37f6e4213f515539932c53cd36a87ad8296bb8b2bea7f71b27438b811ad64392" dependencies = [ - "bitflags 1.3.2", + "bitflags", "byteorder", "chrono", "hex", @@ -656,7 +665,7 @@ dependencies = [ "num-traits", "pkbuffer", "sha-1", - "sha2 0.9.9", + "sha2", "widestring", ] @@ -678,9 +687,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.26" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" +checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" dependencies = [ "crc32fast", "miniz_oxide", @@ -709,33 +718,34 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", + "futures-sink", ] [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -744,42 +754,31 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" - -[[package]] -name = "futures-macro" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.44", -] +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-core", "futures-io", - "futures-macro", + "futures-sink", "futures-task", "memchr", "pin-project-lite", @@ -793,7 +792,7 @@ version = "0.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6e05c1f572ab0e1f15be94217f0dc29088c248b14f792a5ff0af0d84bcda9e8" dependencies = [ - "bitflags 1.3.2", + "bitflags", "cairo-rs", "gdk-pixbuf", "gdk-sys", @@ -809,7 +808,7 @@ version = "0.15.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad38dd9cc8b099cceecdf41375bb6d481b1b5a7cd5cd603e10a69a9383f8619a" dependencies = [ - "bitflags 1.3.2", + "bitflags", "gdk-pixbuf-sys", "gio", "glib", @@ -856,11 +855,22 @@ dependencies = [ "version_check", ] +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + [[package]] name = "gimli" -version = "0.27.3" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "gio" @@ -868,7 +878,7 @@ version = "0.15.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68fdbc90312d462781a395f7a16d96a2b379bb6ef8cd6310a2df272771c4283b" dependencies = [ - "bitflags 1.3.2", + "bitflags", "futures-channel", "futures-core", "futures-io", @@ -898,7 +908,7 @@ version = "0.15.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edb0306fbad0ab5428b0ca674a23893db909a98582969c9b537be4ced78c505d" dependencies = [ - "bitflags 1.3.2", + "bitflags", "futures-channel", "futures-core", "futures-executor", @@ -919,7 +929,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "10c6ae9f6fa26f4fb2ac16b528d138d971ead56141de489f8111e259b9df3c4a" dependencies = [ "anyhow", - "heck", + "heck 0.4.1", "proc-macro-crate", "proc-macro-error", "proc-macro2", @@ -955,7 +965,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92e3004a2d5d6d8b5057d2b57b3712c9529b62e82c77f25c1fecde1fd5c23bd0" dependencies = [ "atk", - "bitflags 1.3.2", + "bitflags", "cairo-rs", "field-offset", "futures-channel", @@ -1004,47 +1014,34 @@ dependencies = [ ] [[package]] -name = "h2" -version = "0.3.20" +name = "hashbrown" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap 1.9.3", - "slab", - "tokio", - "tokio-util", - "tracing", -] +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" [[package]] -name = "hashbrown" -version = "0.12.3" +name = "heck" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] -name = "hashbrown" -version = "0.14.0" +name = "heck" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] -name = "heck" -version = "0.4.1" +name = "hermit-abi" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" [[package]] name = "hex" @@ -1074,9 +1071,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.9" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -1085,77 +1082,101 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.5" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", "http", - "pin-project-lite", ] [[package]] -name = "httparse" -version = "1.8.0" +name = "http-body-util" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", +] [[package]] -name = "httpdate" -version = "1.0.3" +name = "httparse" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "hyper" -version = "0.14.27" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" dependencies = [ "bytes", "futures-channel", - "futures-core", "futures-util", - "h2", "http", "http-body", "httparse", - "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.9", + "smallvec", "tokio", - "tower-service", - "tracing", "want", ] [[package]] name = "hyper-rustls" -version = "0.24.1" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", "http", "hyper", + "hyper-util", "rustls", + "rustls-pki-types", "tokio", "tokio-rustls", + "tower-service", + "webpki-roots", +] + +[[package]] +name = "hyper-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", ] [[package]] name = "iana-time-zone" -version = "0.1.57" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows 0.48.0", + "windows-core", ] [[package]] @@ -1169,9 +1190,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1179,22 +1200,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - -[[package]] -name = "indexmap" -version = "2.0.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.14.0", + "hashbrown", ] [[package]] @@ -1208,56 +1219,56 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.8.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b" dependencies = [ - "hermit-abi", - "rustix", - "windows-sys", + "hermit-abi 0.4.0", + "libc", + "windows-sys 0.52.0", ] [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.26" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" dependencies = [ "wasm-bindgen", ] [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "libc-stdhandle" @@ -1281,25 +1292,35 @@ dependencies = [ [[package]] name = "libloading" -version = "0.8.1" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c571b676ddfc9a8c12f1f3d3085a7b163966a8fd8098a90640953ce5f6170161" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-sys", + "windows-targets 0.52.6", ] [[package]] -name = "linux-raw-sys" -version = "0.4.5" +name = "lockfree-object-pool" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" +checksum = "9374ef4228402d4b7e403e5838cb880d9ee663314b0a900d5a6aabf0c213552e" [[package]] name = "log" -version = "0.4.20" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "lzma-rs" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "297e814c836ae64db86b36cf2a557ba54368d03f6afcd7d947c266692f71115e" +dependencies = [ + "byteorder", + "crc", +] [[package]] name = "malloc_buf" @@ -1323,15 +1344,15 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "memoffset" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" dependencies = [ "autocfg", ] @@ -1344,22 +1365,23 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ - "adler", + "adler2", ] [[package]] name = "mio" -version = "0.8.8" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ + "hermit-abi 0.3.9", "libc", "wasi", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1398,9 +1420,9 @@ dependencies = [ [[package]] name = "nethost-sys" -version = "0.6.3" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45882ffd272817567a1743af759c2ab840e0dde3f89ef30c4e0d17268838fe50" +checksum = "f095c263277d8ded0f7385063e89539f8ead508b186ec8944bd672beb7ae593d" dependencies = [ "build-target", "cargo-emit", @@ -1413,22 +1435,18 @@ dependencies = [ ] [[package]] -name = "num-traits" -version = "0.2.17" +name = "num-conv" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" -dependencies = [ - "autocfg", -] +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] -name = "num_cpus" -version = "1.16.0" +name = "num-traits" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ - "hermit-abi", - "libc", + "autocfg", ] [[package]] @@ -1448,7 +1466,7 @@ checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.44", + "syn 2.0.79", ] [[package]] @@ -1462,30 +1480,30 @@ dependencies = [ [[package]] name = "object" -version = "0.31.1" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.18.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "opaque-debug" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "os_str_bytes" -version = "6.5.1" +version = "6.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" +checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" [[package]] name = "pango" @@ -1493,7 +1511,7 @@ version = "0.15.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22e4045548659aee5313bde6c582b0d83a627b7904dd20dc2d9ef0895d414e4f" dependencies = [ - "bitflags 1.3.2", + "bitflags", "glib", "libc", "once_cell", @@ -1512,40 +1530,27 @@ dependencies = [ "system-deps", ] -[[package]] -name = "password-hash" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" -dependencies = [ - "base64ct", - "rand_core", - "subtle", -] - [[package]] name = "pbkdf2" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ "digest 0.10.7", "hmac", - "password-hash", - "sha2 0.10.7", ] [[package]] name = "percent-encoding" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project-lite" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -1576,9 +1581,24 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" + +[[package]] +name = "powerfmt" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] [[package]] name = "proc-macro-crate" @@ -1587,7 +1607,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" dependencies = [ "once_cell", - "toml_edit", + "toml_edit 0.19.15", ] [[package]] @@ -1616,53 +1636,126 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.73" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dd5e8a1f1029c43224ad5898e50140c2aebb1705f19e67c918ebf5b9e797fe1" +checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" dependencies = [ "unicode-ident", ] [[package]] name = "proxygen-macros" -version = "0.5.0" -source = "git+https://github.com/RinLovesYou/proxygen#c549e4fad7cd50e1d3db252c97f2e1e94713d869" +version = "0.5.1" +source = "git+https://github.com/RinLovesYou/proxygen#4fb48af618a815b49c4f72afce0d51b6d76f11f0" dependencies = [ "quote", - "syn 2.0.44", + "syn 2.0.79", +] + +[[package]] +name = "quinn" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684" +dependencies = [ + "bytes", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "quinn-proto" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6" +dependencies = [ + "bytes", + "rand", + "ring", + "rustc-hash", + "rustls", + "slab", + "thiserror", + "tinyvec", + "tracing", +] + +[[package]] +name = "quinn-udp" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fe68c2e9e1a1234e218683dbdf9f9dfcb094113c5ac2b938dfcb9bab4c4140b" +dependencies = [ + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.59.0", ] [[package]] name = "quote" -version = "1.0.34" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22a37c9326af5ed140c86a46655b5278de879853be5573c01df185b6f49a580a" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] [[package]] name = "reqwest" -version = "0.11.18" +version = "0.12.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" +checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b" dependencies = [ "base64", "bytes", - "encoding_rs", + "futures-channel", "futures-core", "futures-util", - "h2", "http", "http-body", + "http-body-util", "hyper", "hyper-rustls", + "hyper-util", "ipnet", "js-sys", "log", @@ -1670,11 +1763,14 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", + "quinn", "rustls", "rustls-pemfile", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", + "sync_wrapper", "tokio", "tokio-rustls", "tower-service", @@ -1683,141 +1779,134 @@ dependencies = [ "wasm-bindgen-futures", "web-sys", "webpki-roots", - "winreg", + "windows-registry", ] [[package]] name = "ring" -version = "0.16.20" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", + "cfg-if", + "getrandom", "libc", - "once_cell", "spin", "untrusted", - "web-sys", - "winapi", + "windows-sys 0.52.0", ] [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] -name = "rustc_version" -version = "0.4.0" +name = "rustc-hash" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" [[package]] -name = "rustix" -version = "0.38.8" +name = "rustc_version" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ - "bitflags 2.4.1", - "errno", - "libc", - "linux-raw-sys", - "windows-sys", + "semver", ] [[package]] name = "rustls" -version = "0.21.6" +version = "0.23.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1feddffcfcc0b33f5c6ce9a29e341e4cd59c3f78e7ee45f4a40c038b1d6cbb" +checksum = "415d9944693cb90382053259f89fbb077ea730ad7273047ec63b19bc9b160ba8" dependencies = [ - "log", + "once_cell", "ring", + "rustls-pki-types", "rustls-webpki", - "sct", + "subtle", + "zeroize", ] [[package]] name = "rustls-pemfile" -version = "1.0.3" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" dependencies = [ - "base64", + "rustls-pki-types", ] +[[package]] +name = "rustls-pki-types" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55" + [[package]] name = "rustls-webpki" -version = "0.101.3" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "261e9e0888cba427c3316e6322805653c9425240b6fd96cee7cb671ab70ab8d0" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ "ring", + "rustls-pki-types", "untrusted", ] [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" - -[[package]] -name = "sct" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" -dependencies = [ - "ring", - "untrusted", -] +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "semver" -version = "1.0.18" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.183" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.183" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.44", + "syn 2.0.79", ] [[package]] name = "serde_json" -version = "1.0.104" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] [[package]] name = "serde_spanned" -version = "0.6.3" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] @@ -1849,9 +1938,9 @@ dependencies = [ [[package]] name = "sha1" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", @@ -1872,56 +1961,47 @@ dependencies = [ ] [[package]] -name = "sha2" -version = "0.10.7" +name = "shlex" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.7", -] +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] [[package]] name = "smallvec" -version = "1.11.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" - -[[package]] -name = "socket2" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" -dependencies = [ - "libc", - "winapi", -] +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.5.3" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "spin" -version = "0.5.2" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "strsim" @@ -1931,9 +2011,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1948,23 +2028,32 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.44" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d27c2c202598d05175a6dd3af46824b7f747f8d8e9b14c623f19fa5069735d" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] + [[package]] name = "system-deps" -version = "6.1.1" +version = "6.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30c2de8a4d8f4b823d634affc9cd2a74ec98c53a756f317e529a48046cbf71f3" +checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" dependencies = [ "cfg-expr", - "heck", + "heck 0.5.0", "pkg-config", "toml", "version-compare", @@ -1972,61 +2061,63 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.11" +version = "0.12.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "termcolor" -version = "1.2.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] [[package]] name = "thiserror" -version = "1.0.44" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.44" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.44", + "syn 2.0.79", ] [[package]] name = "time" -version = "0.3.25" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fdd63d58b18d663fbdf70e049f00a22c8e42be082203be7f26589213cd75ea" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", + "num-conv", + "powerfmt", "serde", "time-core", ] [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" dependencies = [ "tinyvec_macros", ] @@ -2039,133 +2130,129 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.31.0" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40de3a2ba249dcb097e01be5e67a5ff53cf250397715a071a81543e8a832a920" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" dependencies = [ "backtrace", "bytes", "libc", "mio", - "num_cpus", "pin-project-lite", - "socket2 0.5.3", - "windows-sys", + "socket2", + "windows-sys 0.52.0", ] [[package]] name = "tokio-rustls" -version = "0.24.1" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ "rustls", + "rustls-pki-types", "tokio", ] -[[package]] -name = "tokio-util" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", - "tracing", -] - [[package]] name = "toml" -version = "0.7.6" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit", + "toml_edit 0.22.22", ] [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.19.14" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap", + "toml_datetime", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ - "indexmap 2.0.0", + "indexmap", "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.6.20", ] [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "pin-project-lite", "tracing-core", ] [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", ] [[package]] name = "try-lock" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] @@ -2183,15 +2270,15 @@ dependencies = [ [[package]] name = "untrusted" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.4.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", @@ -2200,15 +2287,15 @@ dependencies = [ [[package]] name = "version-compare" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29" +checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "want" @@ -2227,34 +2314,35 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.44", + "syn 2.0.79", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.37" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" dependencies = [ "cfg-if", "js-sys", @@ -2264,9 +2352,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2274,57 +2362,47 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.44", + "syn 2.0.79", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" dependencies = [ "js-sys", "wasm-bindgen", ] -[[package]] -name = "webpki" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "webpki-roots" -version = "0.22.6" +version = "0.26.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" +checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" dependencies = [ - "webpki", + "rustls-pki-types", ] [[package]] name = "widestring" -version = "1.0.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" +checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" [[package]] name = "winapi" @@ -2344,11 +2422,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "winapi", + "windows-sys 0.59.0", ] [[package]] @@ -2357,15 +2435,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" -dependencies = [ - "windows-targets 0.48.5", -] - [[package]] name = "windows" version = "0.52.0" @@ -2373,7 +2442,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" dependencies = [ "windows-core", - "windows-targets 0.52.0", + "windows-targets 0.52.6", ] [[package]] @@ -2382,7 +2451,37 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", ] [[package]] @@ -2394,6 +2493,24 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -2411,17 +2528,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2432,9 +2550,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -2444,9 +2562,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -2456,9 +2574,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -2468,9 +2592,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -2480,9 +2604,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -2492,9 +2616,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -2504,74 +2628,136 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.5.10" +version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5504cc7644f4b593cbc05c4a55bf9bd4e94b867c3c0bd440934174d50482427d" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" dependencies = [ "memchr", ] [[package]] -name = "winreg" -version = "0.10.1" +name = "winnow" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ - "winapi", + "memchr", +] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", ] [[package]] name = "zip" -version = "0.6.6" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +checksum = "dc5e4288ea4057ae23afc69a4472434a87a2495cafce6632fd1c4ec9f5cf3494" dependencies = [ "aes", - "byteorder", + "arbitrary", "bzip2", "constant_time_eq", "crc32fast", "crossbeam-utils", + "deflate64", + "displaydoc", "flate2", "hmac", + "indexmap", + "lzma-rs", + "memchr", "pbkdf2", + "rand", "sha1", + "thiserror", "time", + "zeroize", + "zopfli", "zstd", ] +[[package]] +name = "zopfli" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5019f391bac5cf252e93bbcc53d039ffd62c7bfb7c150414d61369afe57e946" +dependencies = [ + "bumpalo", + "crc32fast", + "lockfree-object-pool", + "log", + "once_cell", + "simd-adler32", +] + [[package]] name = "zstd" -version = "0.11.2+zstd.1.5.2" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" +version = "7.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059" dependencies = [ - "libc", "zstd-sys", ] [[package]] name = "zstd-sys" -version = "2.0.8+zstd.1.5.5" +version = "2.0.13+zstd.1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5556e6ee25d32df2586c098bbfa278803692a20d0ab9565e049480d52707ec8c" +checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" dependencies = [ "cc", - "libc", "pkg-config", ] From 011d848a6d84bd3d62652fe5db0aafed5214b7ee Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Fri, 11 Oct 2024 00:31:30 -0600 Subject: [PATCH 27/60] Attempt to Standardize Assembly Searching and Resolving --- Bootstrap/src/base_assembly/mono.rs | 2 +- .../Melon/AssemblyResolveInfo.cs | 7 ++ .../Melon/MonoLibrary.cs | 11 +++ .../Melon/MonoResolveManager.cs | 39 ++++++++++ MelonLoader/Core.cs | 36 +++++----- .../Fixes/DotnetLoadFromManagedFolderFix.cs | 72 ------------------- .../AssemblyResolveInfo.cs | 4 +- MelonLoader/InternalUtils/DependencyGraph.cs | 21 +++--- .../MelonAssemblyResolver.cs} | 58 +++++++++++---- .../MonoLibrary.cs | 7 +- .../Resolver}/AssemblyManager.cs | 39 +++++++--- .../Resolver}/SearchDirectoryManager.cs | 27 ++++++- 12 files changed, 191 insertions(+), 132 deletions(-) create mode 100644 MelonLoader/BackwardsCompatibility/Melon/AssemblyResolveInfo.cs create mode 100644 MelonLoader/BackwardsCompatibility/Melon/MonoLibrary.cs create mode 100644 MelonLoader/BackwardsCompatibility/Melon/MonoResolveManager.cs delete mode 100644 MelonLoader/Fixes/DotnetLoadFromManagedFolderFix.cs rename MelonLoader/{MonoInternals => InternalUtils}/AssemblyResolveInfo.cs (94%) rename MelonLoader/{MonoInternals/MonoResolveManager.cs => InternalUtils/MelonAssemblyResolver.cs} (68%) rename MelonLoader/{MonoInternals => InternalUtils}/MonoLibrary.cs (95%) rename MelonLoader/{MonoInternals/ResolveInternals => InternalUtils/Resolver}/AssemblyManager.cs (79%) rename MelonLoader/{MonoInternals/ResolveInternals => InternalUtils/Resolver}/SearchDirectoryManager.cs (85%) diff --git a/Bootstrap/src/base_assembly/mono.rs b/Bootstrap/src/base_assembly/mono.rs index 8923d78a..cc08c075 100644 --- a/Bootstrap/src/base_assembly/mono.rs +++ b/Bootstrap/src/base_assembly/mono.rs @@ -42,7 +42,7 @@ pub fn init(runtime: &FerrexRuntime) -> Result<(), DynErr> { //get the AssemblyManager class and grab some methods from it let assemblymanager_class = melonloader_assembly.get_class( - "MelonLoader.MonoInternals.ResolveInternals", + "MelonLoader.InternalUtils.Resolver", "AssemblyManager", runtime, )?; diff --git a/MelonLoader/BackwardsCompatibility/Melon/AssemblyResolveInfo.cs b/MelonLoader/BackwardsCompatibility/Melon/AssemblyResolveInfo.cs new file mode 100644 index 00000000..b88d4472 --- /dev/null +++ b/MelonLoader/BackwardsCompatibility/Melon/AssemblyResolveInfo.cs @@ -0,0 +1,7 @@ +using System; + +namespace MelonLoader.MonoInternals +{ + [Obsolete("MelonLoader.MonoInternals.AssemblyResolveInfo is Only Here for Compatibility Reasons. Please use MelonLoader.InternalUtils.AssemblyResolveInfo instead.")] + public class AssemblyResolveInfo : InternalUtils.AssemblyResolveInfo { } +} diff --git a/MelonLoader/BackwardsCompatibility/Melon/MonoLibrary.cs b/MelonLoader/BackwardsCompatibility/Melon/MonoLibrary.cs new file mode 100644 index 00000000..c1791526 --- /dev/null +++ b/MelonLoader/BackwardsCompatibility/Melon/MonoLibrary.cs @@ -0,0 +1,11 @@ +#if !NET6_0_OR_GREATER + +using System; + +namespace MelonLoader.MonoInternals +{ + [Obsolete("MelonLoader.MonoInternals.MonoLibrary is Only Here for Compatibility Reasons. Please use MelonLoader.InternalUtils.MonoLibrary instead.")] + public class MonoLibrary : InternalUtils.MonoLibrary { } +} + +#endif \ No newline at end of file diff --git a/MelonLoader/BackwardsCompatibility/Melon/MonoResolveManager.cs b/MelonLoader/BackwardsCompatibility/Melon/MonoResolveManager.cs new file mode 100644 index 00000000..c1f4fe7e --- /dev/null +++ b/MelonLoader/BackwardsCompatibility/Melon/MonoResolveManager.cs @@ -0,0 +1,39 @@ +using System; +using System.Reflection; + +namespace MelonLoader.MonoInternals +{ + [Obsolete("MelonLoader.MonoInternals.MonoResolveManager is Only Here for Compatibility Reasons. Please use MelonLoader.InternalUtils.MelonAssemblyResolver instead.")] + public static class MonoResolveManager + { + [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.AddSearchDirectory is Only Here for Compatibility Reasons. Please use MelonLoader.InternalUtils.MelonAssemblyResolver.AddSearchDirectory instead.")] + public static void AddSearchDirectory(string path, int priority = 0) + => InternalUtils.Resolver.SearchDirectoryManager.Add(path, priority); + + [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.RemoveSearchDirectory is Only Here for Compatibility Reasons. Please use MelonLoader.InternalUtils.MelonAssemblyResolver.RemoveSearchDirectory instead.")] + public static void RemoveSearchDirectory(string path) + => InternalUtils.Resolver.SearchDirectoryManager.Remove(path); + + [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.OnAssemblyLoadHandler is Only Here for Compatibility Reasons. Please use MelonLoader.InternalUtils.MelonAssemblyResolver.dOnAssemblyLoad instead.")] + public delegate void OnAssemblyLoadHandler(Assembly assembly); + [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.OnAssemblyLoad is Only Here for Compatibility Reasons. Please use MelonLoader.InternalUtils.MelonAssemblyResolver.OnAssemblyLoad instead.")] + public static event OnAssemblyLoadHandler OnAssemblyLoad; + internal static void SafeInvoke_OnAssemblyLoad(Assembly assembly) + => OnAssemblyLoad?.Invoke(assembly); + + [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.OnAssemblyResolveHandler is Only Here for Compatibility Reasons. Please use MelonLoader.InternalUtils.MelonAssemblyResolver.dOnAssemblyResolve instead.")] + public delegate Assembly OnAssemblyResolveHandler(string name, Version version); + [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.OnAssemblyLoad is Only Here for Compatibility Reasons. Please use MelonLoader.InternalUtils.MelonAssemblyResolver.OnAssemblyLoad instead.")] + public static event OnAssemblyResolveHandler OnAssemblyResolve; + internal static Assembly SafeInvoke_OnAssemblyResolve(string name, Version version) + => OnAssemblyResolve?.Invoke(name, version); + + [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.GetAssemblyResolveInfo is Only Here for Compatibility Reasons. Please use MelonLoader.InternalUtils.MelonAssemblyResolver.GetAssemblyResolveInfo instead.")] + public static AssemblyResolveInfo GetAssemblyResolveInfo(string name) + => (AssemblyResolveInfo)InternalUtils.Resolver.AssemblyManager.GetInfo(name); + + [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.LoadInfoFromAssembly is Only Here for Compatibility Reasons. Please use MelonLoader.InternalUtils.MelonAssemblyResolver.LoadInfoFromAssembly instead.")] + public static void LoadInfoFromAssembly(Assembly assembly) + => InternalUtils.Resolver.AssemblyManager.LoadInfo(assembly); + } +} diff --git a/MelonLoader/Core.cs b/MelonLoader/Core.cs index d385ba6a..a70901fe 100644 --- a/MelonLoader/Core.cs +++ b/MelonLoader/Core.cs @@ -41,10 +41,6 @@ internal static int Initialize() if (MelonUtils.IsUnderWineOrSteamProton()) Pastel.ConsoleExtensions.Disable(); -#if NET6_0_OR_GREATER - Fixes.DotnetLoadFromManagedFolderFix.Install(); -#endif - Fixes.UnhandledException.Install(AppDomain.CurrentDomain); Fixes.ServerCertificateValidation.Install(); Assertions.LemonAssertMapping.Setup(); @@ -53,28 +49,35 @@ internal static int Initialize() BootstrapInterop.SetDefaultConsoleTitleWithGameName(UnityInformationHandler.GameName, UnityInformationHandler.GameVersion); + MelonAssemblyResolver.Setup(); + +#if NET6_0_OR_GREATER + + if (MelonLaunchOptions.Core.UserWantsDebugger && MelonEnvironment.IsDotnetRuntime) + { + MelonLogger.Msg("[Init] User requested debugger, attempting to launch now..."); + Debugger.Launch(); + } + + Environment.SetEnvironmentVariable("IL2CPP_INTEROP_DATABASES_LOCATION", MelonEnvironment.Il2CppAssembliesDirectory); + +#else + try { - if (!MonoLibrary.Setup() - || !MonoResolveManager.Setup()) + if (!InternalUtils.MonoLibrary.Setup()) { _success = false; return 1; } } - catch (SecurityException) - { - MelonDebug.Msg("[MonoLibrary] Caught SecurityException, assuming not running under mono and continuing with init"); - } - -#if NET6_0_OR_GREATER - if (MelonLaunchOptions.Core.UserWantsDebugger && MelonEnvironment.IsDotnetRuntime) + catch (Exception ex) { - MelonLogger.Msg("[Init] User requested debugger, attempting to launch now..."); - Debugger.Launch(); + MelonDebug.Msg($"[MonoLibrary] Caught Exception: {ex}"); + _success = false; + return 1; } - Environment.SetEnvironmentVariable("IL2CPP_INTEROP_DATABASES_LOCATION", MelonEnvironment.Il2CppAssembliesDirectory); #endif HarmonyInstance = new HarmonyLib.Harmony(BuildInfo.Name); @@ -107,6 +110,7 @@ internal static int Initialize() MelonHandler.LoadUserlibs(MelonEnvironment.UserLibsDirectory); MelonHandler.LoadMelonsFromDirectory(MelonEnvironment.PluginsDirectory); + MelonEvents.MelonHarmonyEarlyInit.Invoke(); MelonEvents.OnPreInitialization.Invoke(); diff --git a/MelonLoader/Fixes/DotnetLoadFromManagedFolderFix.cs b/MelonLoader/Fixes/DotnetLoadFromManagedFolderFix.cs deleted file mode 100644 index 0b3e69b5..00000000 --- a/MelonLoader/Fixes/DotnetLoadFromManagedFolderFix.cs +++ /dev/null @@ -1,72 +0,0 @@ -#if NET6_0_OR_GREATER -using MelonLoader.Utils; -using System.IO; -using System.Reflection; -using System.Runtime.Loader; - -namespace MelonLoader.Fixes -{ - internal static class DotnetLoadFromManagedFolderFix - { - //TODO Update for non-windows platforms in future, or when updating runtime - private static readonly string OurRuntimeDir = Path.Combine(MelonEnvironment.OurRuntimeDirectory, "runtimes", "win", "lib", "net6.0"); - - internal static void Install() - { - AssemblyLoadContext.Default.Resolving += OnResolve; - } - - private static Assembly TryLoad(AssemblyLoadContext alc, string path) - { - if (File.Exists(path)) - { - MelonDebug.Msg($"[DotnetManagedFolder] Loading from {path}..."); - return alc.LoadFromAssemblyPath(path); - } - return null; - } - - private static Assembly OnResolve(AssemblyLoadContext alc, AssemblyName name) - { - var ret = TryFind(alc, name); - if (ret == null) - MelonDebug.Msg($"[DotnetManagedFolder] Failed to find {name.Name} in any of the known search directories"); - return ret; - } - - internal static Assembly TryFind(AssemblyLoadContext alc, AssemblyName name) - { - // Redirect ModHandler to main MelonLoader dll (us) - if (name.Name == "MelonLoader.ModHandler") - return Assembly.GetExecutingAssembly(); - - var ret = TryLoadFromFolders(alc, name.Name + ".dll"); - if (ret == null) - TryLoadFromFolders(alc, name.Name + ".exe"); - - return ret; - } - - private static Assembly TryLoadFromFolders(AssemblyLoadContext alc, string filename) - { - var osSpecificPath = Path.Combine(OurRuntimeDir, filename); - var il2cppPath = Path.Combine(MelonEnvironment.Il2CppAssembliesDirectory, filename); - var managedPath = Path.Combine(MelonEnvironment.MelonManagedDirectory, filename); - var modsPath = Path.Combine(MelonEnvironment.ModsDirectory, filename); - var userlibsPath = Path.Combine(MelonEnvironment.UserLibsDirectory, filename); - var gameRootPath = Path.Combine(MelonEnvironment.GameRootDirectory, filename); - var runtimeSpecificPath = Path.Combine(MelonEnvironment.OurRuntimeDirectory, filename); - - var ret = TryLoad(alc, osSpecificPath) - ?? TryLoad(alc, il2cppPath) - ?? TryLoad(alc, managedPath) - ?? TryLoad(alc, modsPath) - ?? TryLoad(alc, userlibsPath) - ?? TryLoad(alc, runtimeSpecificPath) - ?? TryLoad(alc, gameRootPath); - - return ret; - } - } -} -#endif \ No newline at end of file diff --git a/MelonLoader/MonoInternals/AssemblyResolveInfo.cs b/MelonLoader/InternalUtils/AssemblyResolveInfo.cs similarity index 94% rename from MelonLoader/MonoInternals/AssemblyResolveInfo.cs rename to MelonLoader/InternalUtils/AssemblyResolveInfo.cs index 7cc1df4e..fa97cc4a 100644 --- a/MelonLoader/MonoInternals/AssemblyResolveInfo.cs +++ b/MelonLoader/InternalUtils/AssemblyResolveInfo.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Reflection; -namespace MelonLoader.MonoInternals +namespace MelonLoader.InternalUtils { public class AssemblyResolveInfo { @@ -17,7 +17,7 @@ internal Assembly Resolve(Version requested_version) return Override; // Check for Requested Version - if ((requested_version != null) + if (requested_version != null && GetVersionSpecific(requested_version, out Assembly assembly)) return assembly; diff --git a/MelonLoader/InternalUtils/DependencyGraph.cs b/MelonLoader/InternalUtils/DependencyGraph.cs index db9b81f1..97002a00 100644 --- a/MelonLoader/InternalUtils/DependencyGraph.cs +++ b/MelonLoader/InternalUtils/DependencyGraph.cs @@ -3,16 +3,10 @@ using System.Text; using System.Reflection; using System.IO; +using MelonLoader.InternalUtils.Resolver; -#if NET35 - -using MelonLoader.MonoInternals.ResolveInternals; - -#elif NET6_0_OR_GREATER - -using MelonLoader.Fixes; +#if NET6_0_OR_GREATER using System.Runtime.Loader; - #endif namespace MelonLoader.InternalUtils @@ -145,7 +139,12 @@ private static bool TryLoad(AssemblyName assembly) { try { - Assembly asm = Assembly.Load(assembly); +#if NET6_0_OR_GREATER + var asm = AssemblyLoadContext.Default.LoadFromAssemblyName(assembly); +#else + var asm = Assembly.Load(assembly); +#endif + if (asm == null) return false; return true; @@ -163,11 +162,7 @@ private static bool TryResolve(AssemblyName assembly) { try { -#if NET35 Assembly asm = SearchDirectoryManager.Scan(assembly.Name); -#elif NET6_0_OR_GREATER - Assembly asm = DotnetLoadFromManagedFolderFix.TryFind(AssemblyLoadContext.Default, assembly); -#endif if (asm == null) return false; return true; diff --git a/MelonLoader/MonoInternals/MonoResolveManager.cs b/MelonLoader/InternalUtils/MelonAssemblyResolver.cs similarity index 68% rename from MelonLoader/MonoInternals/MonoResolveManager.cs rename to MelonLoader/InternalUtils/MelonAssemblyResolver.cs index 34d7b812..aa915318 100644 --- a/MelonLoader/MonoInternals/MonoResolveManager.cs +++ b/MelonLoader/InternalUtils/MelonAssemblyResolver.cs @@ -1,17 +1,21 @@ using System; using System.IO; using System.Reflection; -using MelonLoader.MonoInternals.ResolveInternals; +using MelonLoader.InternalUtils.Resolver; using MelonLoader.Utils; -namespace MelonLoader.MonoInternals +#if NET6_0_OR_GREATER +using System.Runtime.Loader; +#endif + +namespace MelonLoader.InternalUtils { - public static class MonoResolveManager + internal class MelonAssemblyResolver { - internal static bool Setup() + internal static void Setup() { if (!AssemblyManager.Setup()) - return false; + return; // Setup Search Directories string[] searchdirlist = @@ -22,11 +26,12 @@ internal static bool Setup() MelonEnvironment.MelonBaseDirectory, MelonEnvironment.GameRootDirectory, MelonEnvironment.OurRuntimeDirectory, + MelonEnvironment.Il2CppAssembliesDirectory, MelonEnvironment.UnityGameManagedDirectory, }; foreach (string path in searchdirlist) AddSearchDirectory(path); - + ForceResolveRuntime("Mono.Cecil.dll"); ForceResolveRuntime("MonoMod.exe"); ForceResolveRuntime("MonoMod.Utils.dll"); @@ -38,13 +43,11 @@ internal static bool Setup() "MelonLoader", "MelonLoader.ModHandler", }; - Assembly base_assembly = typeof(MonoResolveManager).Assembly; + Assembly base_assembly = typeof(MelonAssemblyResolver).Assembly; foreach (string assemblyName in assembly_list) GetAssemblyResolveInfo(assemblyName).Override = base_assembly; - MelonDebug.Msg("[MonoResolveManager] Setup Successful!"); - - return true; + MelonDebug.Msg("[MelonAssemblyResolver] Setup Successful!"); } private static void ForceResolveRuntime(string fileName) @@ -54,9 +57,16 @@ private static void ForceResolveRuntime(string fileName) return; Assembly assembly = null; - try { assembly = Assembly.LoadFrom(filePath); } + try + { +#if NET6_0_OR_GREATER + assembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(filePath); +#else + assembly = Assembly.LoadFrom(filePath); +#endif + } catch { assembly = null; } - + if (assembly == null) return; @@ -73,12 +83,32 @@ public static void RemoveSearchDirectory(string path) public delegate void OnAssemblyLoadHandler(Assembly assembly); public static event OnAssemblyLoadHandler OnAssemblyLoad; internal static void SafeInvoke_OnAssemblyLoad(Assembly assembly) - => OnAssemblyLoad?.Invoke(assembly); + { +#if !NET6_0_OR_GREATER + // Backwards Compatibility + MonoInternals.MonoResolveManager.SafeInvoke_OnAssemblyLoad(assembly); +#endif + OnAssemblyLoad?.Invoke(assembly); + } public delegate Assembly OnAssemblyResolveHandler(string name, Version version); public static event OnAssemblyResolveHandler OnAssemblyResolve; internal static Assembly SafeInvoke_OnAssemblyResolve(string name, Version version) - => OnAssemblyResolve?.Invoke(name, version); + { +#if NET6_0_OR_GREATER + + return OnAssemblyResolve?.Invoke(name, version); + +#else + + // Backwards Compatibility + var assembly = MonoInternals.MonoResolveManager.SafeInvoke_OnAssemblyResolve(name, version); + if (assembly == null) + assembly = OnAssemblyResolve?.Invoke(name, version); + return assembly; + +#endif + } public static AssemblyResolveInfo GetAssemblyResolveInfo(string name) => AssemblyManager.GetInfo(name); diff --git a/MelonLoader/MonoInternals/MonoLibrary.cs b/MelonLoader/InternalUtils/MonoLibrary.cs similarity index 95% rename from MelonLoader/MonoInternals/MonoLibrary.cs rename to MelonLoader/InternalUtils/MonoLibrary.cs index 04107b73..59d83e26 100644 --- a/MelonLoader/MonoInternals/MonoLibrary.cs +++ b/MelonLoader/InternalUtils/MonoLibrary.cs @@ -1,9 +1,11 @@ -using System; +#if !NET6_0_OR_GREATER + +using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -namespace MelonLoader.MonoInternals +namespace MelonLoader.InternalUtils { public class MonoLibrary { @@ -50,3 +52,4 @@ internal static bool Setup() public dmono_assembly_get_object mono_assembly_get_object = null; } } +#endif \ No newline at end of file diff --git a/MelonLoader/MonoInternals/ResolveInternals/AssemblyManager.cs b/MelonLoader/InternalUtils/Resolver/AssemblyManager.cs similarity index 79% rename from MelonLoader/MonoInternals/ResolveInternals/AssemblyManager.cs rename to MelonLoader/InternalUtils/Resolver/AssemblyManager.cs index 2d97578c..4a151fcb 100644 --- a/MelonLoader/MonoInternals/ResolveInternals/AssemblyManager.cs +++ b/MelonLoader/InternalUtils/Resolver/AssemblyManager.cs @@ -1,11 +1,17 @@ using System; using System.Collections.Generic; using System.Reflection; + +#if NET6_0_OR_GREATER +using System.Runtime.Loader; +#else +using System.IO; using System.Runtime.CompilerServices; +#endif -namespace MelonLoader.MonoInternals.ResolveInternals +namespace MelonLoader.InternalUtils.Resolver { - internal static class AssemblyManager + internal class AssemblyManager { internal static Dictionary InfoDict = new Dictionary(); @@ -29,11 +35,6 @@ internal static AssemblyResolveInfo GetInfo(string name) return InfoDict[name]; } - private static Assembly Resolve(string requested_name, ushort major, ushort minor, ushort build, ushort revision, bool is_preload) - { - Version requested_version = new Version(major, minor, build, revision); - return Resolve(requested_name, requested_version, is_preload); - } private static Assembly Resolve(string requested_name, Version requested_version, bool is_preload) { // Get Resolve Information Object @@ -44,7 +45,7 @@ private static Assembly Resolve(string requested_name, Version requested_version // Run Passthrough Events if (assembly == null) - assembly = MonoResolveManager.SafeInvoke_OnAssemblyResolve(requested_name, requested_version); + assembly = MelonAssemblyResolver.SafeInvoke_OnAssemblyResolve(requested_name, requested_version); // Search Directories if (is_preload && (assembly == null)) @@ -70,10 +71,30 @@ internal static void LoadInfo(Assembly assembly) resolveInfo.SetVersionSpecific(assemblyName.Version, assembly); // Run Passthrough Events - MonoResolveManager.SafeInvoke_OnAssemblyLoad(assembly); + MelonAssemblyResolver.SafeInvoke_OnAssemblyLoad(assembly); + } + +#if NET6_0_OR_GREATER + + private static Assembly? Resolve(AssemblyLoadContext alc, AssemblyName name) + => Resolve(name.Name, name.Version, false); + + private static void InstallHooks() + { + AssemblyLoadContext.Default.Resolving += Resolve; + } + +#else + + private static Assembly Resolve(string requested_name, ushort major, ushort minor, ushort build, ushort revision, bool is_preload) + { + Version requested_version = new Version(major, minor, build, revision); + return Resolve(requested_name, requested_version, is_preload); } [MethodImpl(MethodImplOptions.InternalCall)] private extern static void InstallHooks(); + +#endif } } diff --git a/MelonLoader/MonoInternals/ResolveInternals/SearchDirectoryManager.cs b/MelonLoader/InternalUtils/Resolver/SearchDirectoryManager.cs similarity index 85% rename from MelonLoader/MonoInternals/ResolveInternals/SearchDirectoryManager.cs rename to MelonLoader/InternalUtils/Resolver/SearchDirectoryManager.cs index 1c08dbd1..755db943 100644 --- a/MelonLoader/MonoInternals/ResolveInternals/SearchDirectoryManager.cs +++ b/MelonLoader/InternalUtils/Resolver/SearchDirectoryManager.cs @@ -1,11 +1,20 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; + +#if NET6_0_OR_GREATER + +using System.Runtime.Loader; + +#else + +using System; using System.Runtime.InteropServices; -namespace MelonLoader.MonoInternals.ResolveInternals +#endif + +namespace MelonLoader.InternalUtils.Resolver { internal static class SearchDirectoryManager { @@ -24,6 +33,9 @@ internal static void Add(string path, int priority = 0) if (path.ContainsExtension()) return; + if (!Directory.Exists(path)) + return; + SearchDirectoryInfo searchDirectory = SearchDirectoryList.FirstOrDefault(x => x.Path.Equals(path)); if (searchDirectory != null) return; @@ -72,6 +84,13 @@ internal static Assembly Scan(string requested_name) if (string.IsNullOrEmpty(filepath)) continue; + MelonDebug.Msg($"[MelonAssemblyResolver] Loading from {filepath}..."); + +#if NET6_0_OR_GREATER + + return AssemblyLoadContext.Default.LoadFromAssemblyPath(filepath); + +#else IntPtr filePathPtr = Marshal.StringToHGlobalAnsi(filepath); if (filePathPtr == IntPtr.Zero) continue; @@ -89,8 +108,10 @@ internal static Assembly Scan(string requested_name) continue; return MonoLibrary.CastManagedAssemblyPtr(assemblyReflectionPtr); +#endif } + MelonDebug.Msg($"[MelonAssemblyResolver] Failed to find {requested_name} in any of the known search directories"); return null; } From d1d93eb42c01342d0844bd9fbab7a64cb7409136 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Fri, 11 Oct 2024 00:39:09 -0600 Subject: [PATCH 28/60] Implemented Melon Folders with extended UserLib Resolving #647 --- MelonLoader/Core.cs | 4 +-- MelonLoader/Melons/MelonHandler.cs | 45 +++++++++++++++++++++++++----- 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/MelonLoader/Core.cs b/MelonLoader/Core.cs index a70901fe..29b81da5 100644 --- a/MelonLoader/Core.cs +++ b/MelonLoader/Core.cs @@ -109,7 +109,7 @@ internal static int Initialize() bHapticsManager.Connect(BuildInfo.Name, UnityInformationHandler.GameName); MelonHandler.LoadUserlibs(MelonEnvironment.UserLibsDirectory); - MelonHandler.LoadMelonsFromDirectory(MelonEnvironment.PluginsDirectory); + MelonHandler.LoadMelonFolders(MelonEnvironment.PluginsDirectory); MelonEvents.MelonHarmonyEarlyInit.Invoke(); MelonEvents.OnPreInitialization.Invoke(); @@ -139,7 +139,7 @@ internal static int Start() return 1; MelonEvents.OnPreModsLoaded.Invoke(); - MelonHandler.LoadMelonsFromDirectory(MelonEnvironment.ModsDirectory); + MelonHandler.LoadMelonFolders(MelonEnvironment.ModsDirectory); MelonEvents.OnPreSupportModule.Invoke(); if (!SupportModule.Setup()) diff --git a/MelonLoader/Melons/MelonHandler.cs b/MelonLoader/Melons/MelonHandler.cs index d0d23027..d3eee106 100644 --- a/MelonLoader/Melons/MelonHandler.cs +++ b/MelonLoader/Melons/MelonHandler.cs @@ -42,7 +42,7 @@ public static void LoadMelonsFromDirectory(string path) where T : MelonTypeBa bool hasWroteLine = false; - var files = Directory.GetFiles(path, "*.dll"); + var files = Directory.GetFiles(path, "*.dll", SearchOption.TopDirectoryOnly); var melonAssemblies = new List(); foreach (var f in files) { @@ -101,9 +101,7 @@ public static void LoadUserlibs(string path) MelonLogger.Msg(loadingMsg); bool hasWroteLine = false; - - var files = Directory.GetFiles(path, "*.dll"); - var melonAssemblies = new List(); + var files = Directory.GetFiles(path, "*.dll", SearchOption.AllDirectories); foreach (var f in files) { if (!hasWroteLine) @@ -112,11 +110,44 @@ public static void LoadUserlibs(string path) MelonLogger.WriteLine(Color.Magenta); } - var asm = MelonAssembly.LoadMelonAssembly(f, false); - if (asm == null) + MelonAssembly.LoadMelonAssembly(f, false); + } + } + + public static void LoadMelonFolders(string path) where T : MelonTypeBase + { + bool isMod = typeof(T) == typeof(MelonMod); + + // Load Base Folder + LoadMelonsFromDirectory(path); + + // Scan for all Directories + var directories = Directory.GetDirectories(path, "*", SearchOption.TopDirectoryOnly); + foreach (var dir in directories) + { + // Skip Disabled Folders + if (dir.ToLowerInvariant().EndsWith("disabled")) continue; - melonAssemblies.Add(asm); + // Check for UserLibs + string melonUserLibs = Path.Combine(dir, "UserLibs"); + if (Directory.Exists(melonUserLibs)) + { + InternalUtils.MelonAssemblyResolver.AddSearchDirectory(melonUserLibs); + LoadUserlibs(melonUserLibs); + } + + // Load Everything in Base of Melon Folder + InternalUtils.MelonAssemblyResolver.AddSearchDirectory(dir); + LoadMelonsFromDirectory(dir); + + // Check for Plugins/Mods + string melonMelonFolder = Path.Combine(dir, isMod ? "Mods" : "Plugins"); + if (Directory.Exists(melonMelonFolder)) + { + InternalUtils.MelonAssemblyResolver.AddSearchDirectory(melonMelonFolder); + LoadMelonsFromDirectory(melonMelonFolder); + } } } From 92bfdb822dbba9c15a3e30a43eff902c156163ca Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Fri, 11 Oct 2024 00:54:03 -0600 Subject: [PATCH 29/60] Update MelonHandler.cs --- MelonLoader/Melons/MelonHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MelonLoader/Melons/MelonHandler.cs b/MelonLoader/Melons/MelonHandler.cs index d3eee106..8119024d 100644 --- a/MelonLoader/Melons/MelonHandler.cs +++ b/MelonLoader/Melons/MelonHandler.cs @@ -101,7 +101,7 @@ public static void LoadUserlibs(string path) MelonLogger.Msg(loadingMsg); bool hasWroteLine = false; - var files = Directory.GetFiles(path, "*.dll", SearchOption.AllDirectories); + var files = Directory.GetFiles(path, "*.dll", SearchOption.TopDirectoryOnly); foreach (var f in files) { if (!hasWroteLine) From 0adbf65acb3ecdf1fffc57cbc4dcd0d8f3177978 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Fri, 11 Oct 2024 03:18:34 -0600 Subject: [PATCH 30/60] Reworked Melon Folders to Scan Recursively --- .../CompatibilityLayers/IPA/Module.cs | 5 +- .../Muse_Dash_Mono/Module.cs | 4 +- Dependencies/SupportModules/Il2Cpp/Main.cs | 6 +- Dependencies/SupportModules/SceneHandler.cs | 2 + MelonLoader/Fixes/Il2CppInteropFixes.cs | 2 + .../InternalUtils/MelonAssemblyResolver.cs | 4 +- .../InternalUtils/Resolver/AssemblyManager.cs | 2 + MelonLoader/Melons/MelonFolderHandler.cs | 138 ++++++++++++++++++ MelonLoader/Melons/MelonHandler.cs | 39 +---- 9 files changed, 156 insertions(+), 46 deletions(-) create mode 100644 MelonLoader/Melons/MelonFolderHandler.cs diff --git a/Dependencies/CompatibilityLayers/IPA/Module.cs b/Dependencies/CompatibilityLayers/IPA/Module.cs index 9a8dcce1..4c2db831 100644 --- a/Dependencies/CompatibilityLayers/IPA/Module.cs +++ b/Dependencies/CompatibilityLayers/IPA/Module.cs @@ -2,9 +2,8 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; -using MelonLoader.MonoInternals; +using MelonLoader.InternalUtils; using IllusionPlugin; -using System.IO; using IllusionInjector; using MelonLoader.Modules; @@ -26,7 +25,7 @@ public override void OnInitialize() }; Assembly base_assembly = typeof(IPA_Module).Assembly; foreach (string assemblyName in assembly_list) - MonoResolveManager.GetAssemblyResolveInfo(assemblyName).Override = base_assembly; + MelonAssemblyResolver.GetAssemblyResolveInfo(assemblyName).Override = base_assembly; MelonAssembly.CustomMelonResolvers += Resolve; } diff --git a/Dependencies/CompatibilityLayers/Muse_Dash_Mono/Module.cs b/Dependencies/CompatibilityLayers/Muse_Dash_Mono/Module.cs index 6a0e9d42..27a3813c 100644 --- a/Dependencies/CompatibilityLayers/Muse_Dash_Mono/Module.cs +++ b/Dependencies/CompatibilityLayers/Muse_Dash_Mono/Module.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Reflection; using MelonLoader.Modules; -using MelonLoader.MonoInternals; +using MelonLoader.InternalUtils; using ModHelper; namespace MelonLoader.CompatibilityLayers @@ -24,7 +24,7 @@ public override void OnInitialize() }; Assembly base_assembly = typeof(Muse_Dash_Mono_Module).Assembly; foreach (string assemblyName in assembly_list) - MonoResolveManager.GetAssemblyResolveInfo(assemblyName).Override = base_assembly; + MelonAssemblyResolver.GetAssemblyResolveInfo(assemblyName).Override = base_assembly; MelonAssembly.CustomMelonResolvers += Resolve; } diff --git a/Dependencies/SupportModules/Il2Cpp/Main.cs b/Dependencies/SupportModules/Il2Cpp/Main.cs index bf4bf2ef..49f65d0c 100644 --- a/Dependencies/SupportModules/Il2Cpp/Main.cs +++ b/Dependencies/SupportModules/Il2Cpp/Main.cs @@ -3,19 +3,17 @@ using Il2CppInterop.Runtime.Startup; using MelonLoader.Support.Preferences; using System; -using System.Collections.Generic; -using System.Linq; using System.Reflection; using System.Runtime.InteropServices; -using HarmonyLib; using MelonLoader.CoreClrUtils; using UnityEngine; using Il2CppInterop.Common; -using Il2CppInterop.Runtime.InteropTypes; using Microsoft.Extensions.Logging; using MelonLoader.Utils; using System.IO; +#pragma warning disable CS0618 // Type or member is obsolete + namespace MelonLoader.Support { internal static class Main diff --git a/Dependencies/SupportModules/SceneHandler.cs b/Dependencies/SupportModules/SceneHandler.cs index e959f4b0..01c4e45f 100644 --- a/Dependencies/SupportModules/SceneHandler.cs +++ b/Dependencies/SupportModules/SceneHandler.cs @@ -5,6 +5,8 @@ using UnityEngine.Events; #endif +#pragma warning disable CA2013 + namespace MelonLoader.Support { internal static class SceneHandler diff --git a/MelonLoader/Fixes/Il2CppInteropFixes.cs b/MelonLoader/Fixes/Il2CppInteropFixes.cs index 3e110528..ea58d70a 100644 --- a/MelonLoader/Fixes/Il2CppInteropFixes.cs +++ b/MelonLoader/Fixes/Il2CppInteropFixes.cs @@ -19,6 +19,8 @@ using AsmResolver.DotNet; using Il2CppInterop.HarmonySupport; +#pragma warning disable CS8632 + namespace MelonLoader.Fixes { // fixes: https://github.com/BepInEx/Il2CppInterop/pull/103 diff --git a/MelonLoader/InternalUtils/MelonAssemblyResolver.cs b/MelonLoader/InternalUtils/MelonAssemblyResolver.cs index aa915318..ed99b571 100644 --- a/MelonLoader/InternalUtils/MelonAssemblyResolver.cs +++ b/MelonLoader/InternalUtils/MelonAssemblyResolver.cs @@ -8,9 +8,11 @@ using System.Runtime.Loader; #endif +#pragma warning disable CS0618 // Type or member is obsolete + namespace MelonLoader.InternalUtils { - internal class MelonAssemblyResolver + public class MelonAssemblyResolver { internal static void Setup() { diff --git a/MelonLoader/InternalUtils/Resolver/AssemblyManager.cs b/MelonLoader/InternalUtils/Resolver/AssemblyManager.cs index 4a151fcb..8dea8a24 100644 --- a/MelonLoader/InternalUtils/Resolver/AssemblyManager.cs +++ b/MelonLoader/InternalUtils/Resolver/AssemblyManager.cs @@ -9,6 +9,8 @@ using System.Runtime.CompilerServices; #endif +#pragma warning disable CS8632 + namespace MelonLoader.InternalUtils.Resolver { internal class AssemblyManager diff --git a/MelonLoader/Melons/MelonFolderHandler.cs b/MelonLoader/Melons/MelonFolderHandler.cs new file mode 100644 index 00000000..9b6acf7a --- /dev/null +++ b/MelonLoader/Melons/MelonFolderHandler.cs @@ -0,0 +1,138 @@ +using System.Collections.Generic; +using System.Drawing; +using System.IO; + +namespace MelonLoader.Melons +{ + internal class MelonFolderHandler + { + internal static void Scan(string path) where T : MelonTypeBase + { + path = Path.GetFullPath(path); + + var loadingMsg = $"Loading {MelonTypeBase.TypeName}s from '{path}'..."; + MelonLogger.WriteSpacer(); + MelonLogger.Msg(loadingMsg); + + bool hasWroteLine = false; + List melonAssemblies = new(); + ProcessFolder(path, ref hasWroteLine, ref melonAssemblies); + + var melons = new List(); + foreach (var asm in melonAssemblies) + { + asm.LoadMelons(); + foreach (var m in asm.LoadedMelons) + { + if (m is T t) + { + melons.Add(t); + } + else + { + MelonLogger.Warning($"Failed to load Melon '{m.Info.Name}' from '{path}': The given Melon is a {m.MelonTypeName} and cannot be loaded as a {MelonTypeBase.TypeName}. Make sure it's in the right folder."); + continue; + } + } + } + + if (hasWroteLine) + MelonLogger.WriteSpacer(); + + MelonBase.RegisterSorted(melons); + + if (hasWroteLine) + MelonLogger.WriteLine(Color.Magenta); + + var count = MelonTypeBase._registeredMelons.Count; + MelonLogger.Msg($"{count} {MelonTypeBase.TypeName.MakePlural(count)} loaded."); + if (MelonHandler.firstSpacer || (typeof(T) == typeof(MelonMod))) + MelonLogger.WriteSpacer(); + MelonHandler.firstSpacer = true; + } + + private static void LoadMelonsFromFolder(string path, + bool addToList, + ref bool hasWroteLine, + ref List melonAssemblies) where T : MelonTypeBase + { + var files = Directory.GetFiles(path, "*.dll", SearchOption.TopDirectoryOnly); + foreach (var f in files) + { + if (!hasWroteLine) + { + hasWroteLine = true; + MelonLogger.WriteLine(Color.Magenta); + } + + var asm = MelonAssembly.LoadMelonAssembly(f, false); + if (asm == null) + continue; + + if (addToList) + melonAssemblies.Add(asm); + } + } + + private static bool IsValidFolder(string path) + { + string dirName = Path.GetDirectoryName(path); + string dirNameLower = dirName.ToLowerInvariant(); + if (dirNameLower.EndsWith("disabled") + || dirNameLower.Equals("userlibs") + || dirNameLower.Equals("plugins") + || dirNameLower.Equals("mods")) + return false; + return true; + } + + private static void ProcessFolder(string path, + ref bool hasWroteLine, + ref List melonAssemblies) where T : MelonTypeBase + { + if (!Directory.Exists(path)) + return; + + // Skip Disabled Folders + if (!IsValidFolder(path)) + return; + + InternalUtils.MelonAssemblyResolver.AddSearchDirectory(path); + LoadMelonsFromFolder(path, true, ref hasWroteLine, ref melonAssemblies); + + // Scan Directories + var directories = Directory.GetDirectories(path, "*", SearchOption.TopDirectoryOnly); + foreach (var dir in directories) + ProcessPath(dir, ref hasWroteLine, ref melonAssemblies); + } + + private static void ProcessPath(string path, + ref bool hasWroteLine, + ref List melonAssemblies) where T : MelonTypeBase + { + // Skip Disabled Folders + if (!IsValidFolder(path)) + return; + + // Check for UserLibs + string melonUserLibs = Path.Combine(path, "UserLibs"); + if (Directory.Exists(melonUserLibs)) + { + InternalUtils.MelonAssemblyResolver.AddSearchDirectory(melonUserLibs); + LoadMelonsFromFolder(melonUserLibs, false, ref hasWroteLine, ref melonAssemblies); + } + + // Check for Plugins/Mods + string melonMelonFolder = Path.Combine(path, (typeof(T) == typeof(MelonMod)) ? "Mods" : "Plugins"); + if (Directory.Exists(melonMelonFolder)) + { + InternalUtils.MelonAssemblyResolver.AddSearchDirectory(melonMelonFolder); + ProcessFolder(melonUserLibs, ref hasWroteLine, ref melonAssemblies); + } + + // Load Everything in Base of Melon Folder + InternalUtils.MelonAssemblyResolver.AddSearchDirectory(path); + ProcessFolder(path, ref hasWroteLine, ref melonAssemblies); + } + } +} diff --git a/MelonLoader/Melons/MelonHandler.cs b/MelonLoader/Melons/MelonHandler.cs index 8119024d..80725eaf 100644 --- a/MelonLoader/Melons/MelonHandler.cs +++ b/MelonLoader/Melons/MelonHandler.cs @@ -4,6 +4,7 @@ using System.IO; using System.Linq; using System.Reflection; +using MelonLoader.Melons; using MelonLoader.Utils; namespace MelonLoader @@ -31,7 +32,7 @@ internal static void Setup() Directory.CreateDirectory(MelonEnvironment.ModsDirectory); } - private static bool firstSpacer = false; + internal static bool firstSpacer = false; public static void LoadMelonsFromDirectory(string path) where T : MelonTypeBase { path = Path.GetFullPath(path); @@ -115,41 +116,7 @@ public static void LoadUserlibs(string path) } public static void LoadMelonFolders(string path) where T : MelonTypeBase - { - bool isMod = typeof(T) == typeof(MelonMod); - - // Load Base Folder - LoadMelonsFromDirectory(path); - - // Scan for all Directories - var directories = Directory.GetDirectories(path, "*", SearchOption.TopDirectoryOnly); - foreach (var dir in directories) - { - // Skip Disabled Folders - if (dir.ToLowerInvariant().EndsWith("disabled")) - continue; - - // Check for UserLibs - string melonUserLibs = Path.Combine(dir, "UserLibs"); - if (Directory.Exists(melonUserLibs)) - { - InternalUtils.MelonAssemblyResolver.AddSearchDirectory(melonUserLibs); - LoadUserlibs(melonUserLibs); - } - - // Load Everything in Base of Melon Folder - InternalUtils.MelonAssemblyResolver.AddSearchDirectory(dir); - LoadMelonsFromDirectory(dir); - - // Check for Plugins/Mods - string melonMelonFolder = Path.Combine(dir, isMod ? "Mods" : "Plugins"); - if (Directory.Exists(melonMelonFolder)) - { - InternalUtils.MelonAssemblyResolver.AddSearchDirectory(melonMelonFolder); - LoadMelonsFromDirectory(melonMelonFolder); - } - } - } + => MelonFolderHandler.Scan(path); #region Obsolete Members /// From 107ef73a8345b3d8c30b82357775841771b7446c Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Fri, 11 Oct 2024 03:26:27 -0600 Subject: [PATCH 31/60] Fixed an issue with Compatibility Layers getting Garbage Collected while still in use --- .../CompatibilityLayers/MelonCompatibilityLayer.cs | 2 +- MelonLoader/Modules/MelonModule.cs | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/MelonLoader/CompatibilityLayers/MelonCompatibilityLayer.cs b/MelonLoader/CompatibilityLayers/MelonCompatibilityLayer.cs index 7113e457..464b6bdb 100644 --- a/MelonLoader/CompatibilityLayers/MelonCompatibilityLayer.cs +++ b/MelonLoader/CompatibilityLayers/MelonCompatibilityLayer.cs @@ -64,7 +64,7 @@ internal static void LoadModules() continue; MelonDebug.Msg($"Loading MelonModule '{m.fullPath}'"); - MelonModule.Load(m); + m.moduleGC = MelonModule.Load(m); } foreach (var file in Directory.GetFiles(baseDirectory)) diff --git a/MelonLoader/Modules/MelonModule.cs b/MelonLoader/Modules/MelonModule.cs index 46a46afb..ee23a5f8 100644 --- a/MelonLoader/Modules/MelonModule.cs +++ b/MelonLoader/Modules/MelonModule.cs @@ -4,6 +4,10 @@ using System.Linq; using System.Reflection; +#if NET6_0_OR_GREATER +using System.Runtime.Loader; +#endif + namespace MelonLoader.Modules { /// @@ -53,7 +57,11 @@ internal static MelonModule Load(Info moduleInfo) Assembly asm; try { +#if NET6_0_OR_GREATER + asm = AssemblyLoadContext.Default.LoadFromAssemblyPath(moduleInfo.fullPath); +#else asm = Assembly.LoadFrom(moduleInfo.fullPath); +#endif } catch (Exception ex) { @@ -115,6 +123,7 @@ public class Info public readonly string fullPath; internal readonly Func shouldBeRemoved; internal readonly Func shouldBeIgnored; + internal MelonModule moduleGC; internal Info(string path, Func shouldBeIgnored = null, Func shouldBeRemoved = null) { From 934b1d7f55850d0d8dd13765ef7fdbdd5097372c Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Fri, 11 Oct 2024 03:29:20 -0600 Subject: [PATCH 32/60] Moved dobby.dll to "MelonLoader\Dependencies\" for easier reinstallation --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index da2c64c1..d2da10f6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -180,7 +180,7 @@ jobs: xcopy BaseLibs\net6 Output\Debug\x64\MelonLoader\net6\ /E /H /Y echo. echo Copying Dobby x64... - xcopy BaseLibs\dobby_x64.dll Output\Debug\x64\dobby.dll* + xcopy BaseLibs\dobby_x64.dll Output\Debug\x64\MelonLoader\Dependencies\dobby.dll* echo. echo Copying documentation files... copy NOTICE.txt Output\Debug\x64 @@ -226,7 +226,7 @@ jobs: xcopy BaseLibs\net6 Output\Debug\x86\MelonLoader\net6\ /E /H /Y echo. echo Copying Dobby x86... - xcopy BaseLibs\dobby_x86.dll Output\Debug\x86\dobby.dll* + xcopy BaseLibs\dobby_x86.dll Output\Debug\x86\MelonLoader\Dependencies\dobby.dll* echo. echo Copying documentation files... copy NOTICE.txt Output\Debug\x86 @@ -272,7 +272,7 @@ jobs: xcopy BaseLibs\net6 Output\Release\x64\MelonLoader\net6\ /E /H /Y echo. echo Copying Dobby x64... - xcopy BaseLibs\dobby_x64.dll Output\Release\x64\dobby.dll* + xcopy BaseLibs\dobby_x64.dll Output\Release\x64\MelonLoader\Dependencies\dobby.dll* echo. echo Copying documentation files... copy NOTICE.txt Output\Release\x64 @@ -318,7 +318,7 @@ jobs: xcopy BaseLibs\net6 Output\Release\x86\MelonLoader\net6\ /E /H /Y echo. echo Copying Dobby x86... - xcopy BaseLibs\dobby_x86.dll Output\Release\x86\dobby.dll* + xcopy BaseLibs\dobby_x86.dll Output\Release\x86\MelonLoader\Dependencies\dobby.dll* echo. echo Copying documentation files... copy NOTICE.txt Output\Release\x86 From e239e7aded5ba1b9f649b1f31d6b7fcc1cdff689 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Fri, 11 Oct 2024 03:30:38 -0600 Subject: [PATCH 33/60] Moved dobby scan to check Game Directory after Base Directory --- MelonProxy/src/utils/files.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/MelonProxy/src/utils/files.rs b/MelonProxy/src/utils/files.rs index bc5e79c3..1fdea916 100644 --- a/MelonProxy/src/utils/files.rs +++ b/MelonProxy/src/utils/files.rs @@ -25,14 +25,6 @@ pub fn get_bootstrap_path(base_path: &PathBuf) -> Result { /// search for Bootstrap in the given path pub fn get_dobby_dir(base_path: PathBuf, game_dir: PathBuf) -> Result { let dobby_names = ["dobby", "libdobby"]; //by convention, on unix, the library is prefixed with "lib" - - for name in dobby_names.iter() { - let dobby_path = game_dir.join(name).with_extension(DLL_EXTENSION); - - if dobby_path.exists() { - return Ok(game_dir); - } - } for name in dobby_names.iter() { let dobby_path = base_path.join(name).with_extension(DLL_EXTENSION); @@ -59,6 +51,14 @@ pub fn get_dobby_dir(base_path: PathBuf, game_dir: PathBuf) -> Result Date: Fri, 11 Oct 2024 04:17:28 -0600 Subject: [PATCH 34/60] Added UserLibs folder as Native Library Search Directory #185 --- MelonLoader/MelonUtils.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/MelonLoader/MelonUtils.cs b/MelonLoader/MelonUtils.cs index ff2203a3..fa0e6497 100644 --- a/MelonLoader/MelonUtils.cs +++ b/MelonLoader/MelonUtils.cs @@ -45,6 +45,7 @@ internal static void Setup(AppDomain domain) if (!Directory.Exists(MelonEnvironment.UserLibsDirectory)) Directory.CreateDirectory(MelonEnvironment.UserLibsDirectory); + AddNativeDLLDirectory(MelonEnvironment.UserLibsDirectory); MelonHandler.Setup(); UnityInformationHandler.Setup(); @@ -485,6 +486,21 @@ public static string GetFileProductName(string filepath) return null; } + public static void AddNativeDLLDirectory(string path) + { + if (!IsWindows && !IsUnix) + return; + + path = Path.GetFullPath(path); + if (!Directory.Exists(path)) + return; + + string envName = IsWindows ? "PATH" : "LD_LIBRARY_PATH"; + string envSep = IsWindows ? ";" : ":"; + string envPaths = Environment.GetEnvironmentVariable(envName); + Environment.SetEnvironmentVariable(envName, $"{envPaths}{envSep}{path}"); + } + internal static void SetupWineCheck() { if (IsUnix || IsMac) @@ -504,7 +520,6 @@ internal static void SetupWineCheck() ); } - [DllImport("ntdll.dll", SetLastError = true)] internal static extern uint RtlGetVersion(out OsVersionInfo versionInformation); // return type should be the NtStatus enum From 6e62831fa228904e485a9d97707ec9e99cc98877 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Fri, 11 Oct 2024 04:40:27 -0600 Subject: [PATCH 35/60] Fixed an issue with EOS Compatibility Layer causing Crashes #764 --- .../CompatibilityLayers/EOS/Module.cs | 50 ++++++++++--------- .../MelonCompatibilityLayer.cs | 3 -- MelonLoader/Properties/AssemblyInfo.cs | 3 +- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Dependencies/CompatibilityLayers/EOS/Module.cs b/Dependencies/CompatibilityLayers/EOS/Module.cs index 60281ce0..0ba16686 100644 --- a/Dependencies/CompatibilityLayers/EOS/Module.cs +++ b/Dependencies/CompatibilityLayers/EOS/Module.cs @@ -1,5 +1,4 @@ using MelonLoader.Modules; -using MelonLoader.NativeUtils; using System; using System.Runtime.InteropServices; @@ -7,10 +6,10 @@ namespace MelonLoader.CompatibilityLayers { internal class EOS_Module : MelonModule { - private delegate IntPtr LoadLibraryDetour(IntPtr path); - private NativeHook _hookWin; + private delegate IntPtr dLoadLibrary(IntPtr path); + private dLoadLibrary _loadLibrary; - public override void OnInitialize() + public unsafe override void OnInitialize() { var platform = Environment.OSVersion.Platform; switch (platform) @@ -19,17 +18,10 @@ public override void OnInitialize() case PlatformID.Win32Windows: case PlatformID.Win32NT: case PlatformID.WinCE: - NativeLibrary lib = NativeLibrary.Load("kernel32"); - if (lib != null) - { - IntPtr loadLibraryWPtr = lib.GetExport("LoadLibraryW"); - if (loadLibraryWPtr != IntPtr.Zero) - { - IntPtr detourPtr = Marshal.GetFunctionPointerForDelegate((LoadLibraryDetour)DetourWin); - _hookWin = new NativeHook(loadLibraryWPtr, detourPtr); - _hookWin.Attach(); - } - } + IntPtr trampoline = Marshal.GetFunctionPointerForDelegate((dLoadLibrary)LoadLibrary); + IntPtr detour = Marshal.GetFunctionPointerForDelegate((dLoadLibrary)DetourWin); + MelonUtils.NativeHookAttach((IntPtr)(&trampoline), detour); + _loadLibrary = (dLoadLibrary)Marshal.GetDelegateForFunctionPointer(trampoline, typeof(dLoadLibrary)); break; case PlatformID.Unix: @@ -44,29 +36,39 @@ public override void OnInitialize() } } - private IntPtr DetourWin(IntPtr path) + private unsafe IntPtr DetourWin(IntPtr path) { if (path == IntPtr.Zero) - return _hookWin.Trampoline(path); + return IntPtr.Zero; var pathString = Marshal.PtrToStringUni(path); if (string.IsNullOrEmpty(pathString)) - return _hookWin.Trampoline(path); - + return IntPtr.Zero; + if (pathString.EndsWith("EOSOVH-Win64-Shipping.dll") || pathString.EndsWith("EOSOVH-Win32-Shipping.dll")) { - _hookWin.Detach(); + IntPtr trampoline = Marshal.GetFunctionPointerForDelegate((dLoadLibrary)LoadLibrary); + IntPtr detour = Marshal.GetFunctionPointerForDelegate((dLoadLibrary)DetourWin); + MelonUtils.NativeHookDetach((IntPtr)(&trampoline), detour); return IntPtr.Zero; } - return _hookWin.Trampoline(path); + return _loadLibrary(path); } - ~EOS_Module() + unsafe ~EOS_Module() { - _hookWin?.Detach(); - _hookWin = null; + if (_loadLibrary != null) + { + IntPtr trampoline = Marshal.GetFunctionPointerForDelegate((dLoadLibrary)LoadLibrary); + IntPtr detour = Marshal.GetFunctionPointerForDelegate((dLoadLibrary)DetourWin); + MelonUtils.NativeHookDetach((IntPtr)(&trampoline), detour); + _loadLibrary = null; + } } + + [DllImport("kernel32")] + private static extern IntPtr LoadLibrary(IntPtr lpLibFileName); } } diff --git a/MelonLoader/CompatibilityLayers/MelonCompatibilityLayer.cs b/MelonLoader/CompatibilityLayers/MelonCompatibilityLayer.cs index 464b6bdb..0f47349a 100644 --- a/MelonLoader/CompatibilityLayers/MelonCompatibilityLayer.cs +++ b/MelonLoader/CompatibilityLayers/MelonCompatibilityLayer.cs @@ -13,9 +13,6 @@ public static class MelonCompatibilityLayer private static List layers = new List() { - // Il2Cpp Unity Tls - No longer needed in CoreCLR - // new MelonModule.Info(Path.Combine(baseDirectory, "Il2CppUnityTls.dll"), () => !MelonUtils.IsGameIl2Cpp()), - // Illusion Plugin Architecture new MelonModule.Info(Path.Combine(baseDirectory, "IPA.dll"), MelonUtils.IsGameIl2Cpp), new MelonModule.Info(Path.Combine(baseDirectory, "EOS.dll"), () => !MelonUtils.IsWindows) diff --git a/MelonLoader/Properties/AssemblyInfo.cs b/MelonLoader/Properties/AssemblyInfo.cs index 6d54a613..3277cba2 100644 --- a/MelonLoader/Properties/AssemblyInfo.cs +++ b/MelonLoader/Properties/AssemblyInfo.cs @@ -17,4 +17,5 @@ [assembly: InternalsVisibleTo("Il2CppAssemblyGenerator")] [assembly: InternalsVisibleTo("Il2CppUnityTls")] [assembly: InternalsVisibleTo("Il2Cpp")] -[assembly: InternalsVisibleTo("MelonStartScreen")] \ No newline at end of file +[assembly: InternalsVisibleTo("MelonStartScreen")] +[assembly: InternalsVisibleTo("EOS")] \ No newline at end of file From 1426562cb38494fd56c8954f1861dcf8fbd93b07 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Fri, 11 Oct 2024 04:51:41 -0600 Subject: [PATCH 36/60] Added UserLibs Folders inside Melon Folders to Native Library Search --- MelonLoader/Melons/MelonFolderHandler.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/MelonLoader/Melons/MelonFolderHandler.cs b/MelonLoader/Melons/MelonFolderHandler.cs index 9b6acf7a..2fb7750d 100644 --- a/MelonLoader/Melons/MelonFolderHandler.cs +++ b/MelonLoader/Melons/MelonFolderHandler.cs @@ -118,6 +118,7 @@ private static void ProcessPath(string path, string melonUserLibs = Path.Combine(path, "UserLibs"); if (Directory.Exists(melonUserLibs)) { + MelonUtils.AddNativeDLLDirectory(melonUserLibs); InternalUtils.MelonAssemblyResolver.AddSearchDirectory(melonUserLibs); LoadMelonsFromFolder(melonUserLibs, false, ref hasWroteLine, ref melonAssemblies); } From 32849cad54cf3be4c325c631e0fee026730e4805 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Fri, 11 Oct 2024 10:37:15 -0600 Subject: [PATCH 37/60] Fixed an issue with MelonLoader Internal Calls being Incorrect --- Bootstrap/src/icalls/mod.rs | 8 ++++---- MelonLoader/InternalUtils/Resolver/AssemblyManager.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Bootstrap/src/icalls/mod.rs b/Bootstrap/src/icalls/mod.rs index 0729ebc1..ca8ed453 100644 --- a/Bootstrap/src/icalls/mod.rs +++ b/Bootstrap/src/icalls/mod.rs @@ -14,10 +14,10 @@ pub fn init(runtime: &FerrexRuntime) -> Result<(), DynErr> { runtime.add_internal_call("MelonLoader.MelonUtils::IsGame32Bit", melon_utils::is_32_bit as MethodPointer)?; runtime.add_internal_call("MelonLoader.BootstrapInterop::NativeHookAttach", bootstrap_interop::attach as MethodPointer)?; runtime.add_internal_call("MelonLoader.BootstrapInterop::NativeHookDetach", bootstrap_interop::detach as MethodPointer)?; - runtime.add_internal_call("MelonLoader.MonoInternals.MonoLibrary::GetLibPtr", mono_library::get_lib_ptr as MethodPointer)?; - runtime.add_internal_call("MelonLoader.MonoInternals.MonoLibrary::CastManagedAssemblyPtr", mono_library::cast_assembly_ptr as MethodPointer)?; - runtime.add_internal_call("MelonLoader.MonoInternals.MonoLibrary::GetRootDomainPtr", mono_library::get_domain_ptr as MethodPointer)?; - runtime.add_internal_call("MelonLoader.MonoInternals.ResolveInternals.AssemblyManager::InstallHooks", resolve_internals::install_hooks as MethodPointer)?; + runtime.add_internal_call("MelonLoader.InternalUtils.MonoLibrary::GetLibPtr", mono_library::get_lib_ptr as MethodPointer)?; + runtime.add_internal_call("MelonLoader.InternalUtils.MonoLibrary::CastManagedAssemblyPtr", mono_library::cast_assembly_ptr as MethodPointer)?; + runtime.add_internal_call("MelonLoader.InternalUtils.MonoLibrary::GetRootDomainPtr", mono_library::get_domain_ptr as MethodPointer)?; + runtime.add_internal_call("MelonLoader.InternalUtils.Resolver.AssemblyManager::InstallHooks", resolve_internals::install_hooks as MethodPointer)?; runtime.add_internal_call("MelonLoader.Support.Preload::GetManagedDirectory", preload::get_managed_dir as MethodPointer)?; Ok(()) diff --git a/MelonLoader/InternalUtils/Resolver/AssemblyManager.cs b/MelonLoader/InternalUtils/Resolver/AssemblyManager.cs index 8dea8a24..90865ef1 100644 --- a/MelonLoader/InternalUtils/Resolver/AssemblyManager.cs +++ b/MelonLoader/InternalUtils/Resolver/AssemblyManager.cs @@ -3,9 +3,9 @@ using System.Reflection; #if NET6_0_OR_GREATER +using System.IO; using System.Runtime.Loader; #else -using System.IO; using System.Runtime.CompilerServices; #endif From 15da0b54a7a7928fdd295d26f78bab400ea8cbc9 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Fri, 11 Oct 2024 17:43:07 -0600 Subject: [PATCH 38/60] Attempt to fix EOS Module Crashes #764 --- .../CompatibilityLayers/EOS/Module.cs | 57 ++++++++++--------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/Dependencies/CompatibilityLayers/EOS/Module.cs b/Dependencies/CompatibilityLayers/EOS/Module.cs index 0ba16686..d563be9a 100644 --- a/Dependencies/CompatibilityLayers/EOS/Module.cs +++ b/Dependencies/CompatibilityLayers/EOS/Module.cs @@ -1,4 +1,5 @@ -using MelonLoader.Modules; +using MelonLoader.Modules; +using MelonLoader.NativeUtils; using System; using System.Runtime.InteropServices; @@ -6,10 +7,13 @@ namespace MelonLoader.CompatibilityLayers { internal class EOS_Module : MelonModule { - private delegate IntPtr dLoadLibrary(IntPtr path); - private dLoadLibrary _loadLibrary; + private delegate IntPtr LoadLibraryDetour(IntPtr path); + private static NativeHook _hookWin; - public unsafe override void OnInitialize() + ~EOS_Module() + => Detach(); + + public override void OnInitialize() { var platform = Environment.OSVersion.Platform; switch (platform) @@ -18,10 +22,17 @@ public unsafe override void OnInitialize() case PlatformID.Win32Windows: case PlatformID.Win32NT: case PlatformID.WinCE: - IntPtr trampoline = Marshal.GetFunctionPointerForDelegate((dLoadLibrary)LoadLibrary); - IntPtr detour = Marshal.GetFunctionPointerForDelegate((dLoadLibrary)DetourWin); - MelonUtils.NativeHookAttach((IntPtr)(&trampoline), detour); - _loadLibrary = (dLoadLibrary)Marshal.GetDelegateForFunctionPointer(trampoline, typeof(dLoadLibrary)); + NativeLibrary lib = NativeLibrary.Load("kernel32"); + if (lib != null) + { + IntPtr loadLibraryWPtr = lib.GetExport("LoadLibraryW"); + if (loadLibraryWPtr != IntPtr.Zero) + { + IntPtr detourPtr = Marshal.GetFunctionPointerForDelegate((LoadLibraryDetour)DetourWin); + _hookWin = new NativeHook(loadLibraryWPtr, detourPtr); + _hookWin.Attach(); + } + } break; case PlatformID.Unix: @@ -36,39 +47,29 @@ public unsafe override void OnInitialize() } } - private unsafe IntPtr DetourWin(IntPtr path) + private static IntPtr DetourWin(IntPtr path) { if (path == IntPtr.Zero) - return IntPtr.Zero; - + return _hookWin.Trampoline(path); + var pathString = Marshal.PtrToStringUni(path); if (string.IsNullOrEmpty(pathString)) - return IntPtr.Zero; + return _hookWin.Trampoline(path); if (pathString.EndsWith("EOSOVH-Win64-Shipping.dll") || pathString.EndsWith("EOSOVH-Win32-Shipping.dll")) { - IntPtr trampoline = Marshal.GetFunctionPointerForDelegate((dLoadLibrary)LoadLibrary); - IntPtr detour = Marshal.GetFunctionPointerForDelegate((dLoadLibrary)DetourWin); - MelonUtils.NativeHookDetach((IntPtr)(&trampoline), detour); + Detach(); return IntPtr.Zero; } - return _loadLibrary(path); + return _hookWin.Trampoline(path); } - unsafe ~EOS_Module() + private static void Detach() { - if (_loadLibrary != null) - { - IntPtr trampoline = Marshal.GetFunctionPointerForDelegate((dLoadLibrary)LoadLibrary); - IntPtr detour = Marshal.GetFunctionPointerForDelegate((dLoadLibrary)DetourWin); - MelonUtils.NativeHookDetach((IntPtr)(&trampoline), detour); - _loadLibrary = null; - } + _hookWin?.Detach(); + _hookWin = null; } - - [DllImport("kernel32")] - private static extern IntPtr LoadLibrary(IntPtr lpLibFileName); } -} +} \ No newline at end of file From 8510e0b1a8c550bcf14f7841be41ca3277111e68 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Sat, 12 Oct 2024 16:30:27 -0600 Subject: [PATCH 39/60] Fixed Search Directory Issue --- MelonLoader/InternalUtils/Resolver/AssemblyManager.cs | 2 +- .../InternalUtils/Resolver/SearchDirectoryManager.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MelonLoader/InternalUtils/Resolver/AssemblyManager.cs b/MelonLoader/InternalUtils/Resolver/AssemblyManager.cs index 90865ef1..f78d9a90 100644 --- a/MelonLoader/InternalUtils/Resolver/AssemblyManager.cs +++ b/MelonLoader/InternalUtils/Resolver/AssemblyManager.cs @@ -79,7 +79,7 @@ internal static void LoadInfo(Assembly assembly) #if NET6_0_OR_GREATER private static Assembly? Resolve(AssemblyLoadContext alc, AssemblyName name) - => Resolve(name.Name, name.Version, false); + => Resolve(name.Name, name.Version, true); private static void InstallHooks() { diff --git a/MelonLoader/InternalUtils/Resolver/SearchDirectoryManager.cs b/MelonLoader/InternalUtils/Resolver/SearchDirectoryManager.cs index 755db943..188eb337 100644 --- a/MelonLoader/InternalUtils/Resolver/SearchDirectoryManager.cs +++ b/MelonLoader/InternalUtils/Resolver/SearchDirectoryManager.cs @@ -33,9 +33,6 @@ internal static void Add(string path, int priority = 0) if (path.ContainsExtension()) return; - if (!Directory.Exists(path)) - return; - SearchDirectoryInfo searchDirectory = SearchDirectoryList.FirstOrDefault(x => x.Path.Equals(path)); if (searchDirectory != null) return; @@ -72,6 +69,9 @@ internal static Assembly Scan(string requested_name) while (enumerator.MoveNext()) { string folderpath = enumerator.Current.Path; + if (folderpath.ContainsExtension() + || !Directory.Exists(folderpath)) + continue; string filepath = Directory.GetFiles(folderpath).Where(x => !string.IsNullOrEmpty(x) From 77e97085f2faec8d748b23df2eba01b5d13dcf85 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Sat, 12 Oct 2024 17:14:06 -0600 Subject: [PATCH 40/60] Fixed an issue with Disabled folders not working correctly --- MelonLoader/Melons/MelonFolderHandler.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/MelonLoader/Melons/MelonFolderHandler.cs b/MelonLoader/Melons/MelonFolderHandler.cs index 2fb7750d..647756d6 100644 --- a/MelonLoader/Melons/MelonFolderHandler.cs +++ b/MelonLoader/Melons/MelonFolderHandler.cs @@ -76,7 +76,7 @@ private static void LoadMelonsFromFolder(string path, private static bool IsValidFolder(string path) { - string dirName = Path.GetDirectoryName(path); + string dirName = new DirectoryInfo(path).Name; string dirNameLower = dirName.ToLowerInvariant(); if (dirNameLower.EndsWith("disabled") || dirNameLower.Equals("userlibs") @@ -90,11 +90,9 @@ private static void ProcessFolder(string path, ref bool hasWroteLine, ref List melonAssemblies) where T : MelonTypeBase { - if (!Directory.Exists(path)) - return; - // Skip Disabled Folders - if (!IsValidFolder(path)) + if (!Directory.Exists(path) + || !IsValidFolder(path)) return; InternalUtils.MelonAssemblyResolver.AddSearchDirectory(path); @@ -111,7 +109,8 @@ private static void ProcessPath(string path, ref List melonAssemblies) where T : MelonTypeBase { // Skip Disabled Folders - if (!IsValidFolder(path)) + if (!Directory.Exists(path) + || !IsValidFolder(path)) return; // Check for UserLibs From 11285dce31e68a8792c0a016c06df25a877929da Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Sat, 12 Oct 2024 18:57:44 -0600 Subject: [PATCH 41/60] Removed EOS Compatibility Layer for being Unneeded --- .../CompatibilityLayers/EOS/EOS.csproj | 16 ---- .../CompatibilityLayers/EOS/Module.cs | 75 ------------------- .../EOS/Properties/AssemblyInfo.cs | 13 ---- MelonLoader.sln | 15 ---- .../MelonCompatibilityLayer.cs | 2 - 5 files changed, 121 deletions(-) delete mode 100644 Dependencies/CompatibilityLayers/EOS/EOS.csproj delete mode 100644 Dependencies/CompatibilityLayers/EOS/Module.cs delete mode 100644 Dependencies/CompatibilityLayers/EOS/Properties/AssemblyInfo.cs diff --git a/Dependencies/CompatibilityLayers/EOS/EOS.csproj b/Dependencies/CompatibilityLayers/EOS/EOS.csproj deleted file mode 100644 index cc4d68ba..00000000 --- a/Dependencies/CompatibilityLayers/EOS/EOS.csproj +++ /dev/null @@ -1,16 +0,0 @@ - - - MelonLoader.CompatibilityLayers - net35 - Latest - true - false - false - $(SolutionDir)Output\$(Configuration)\MelonLoader\Dependencies\CompatibilityLayers\ - true - embedded - - - - - \ No newline at end of file diff --git a/Dependencies/CompatibilityLayers/EOS/Module.cs b/Dependencies/CompatibilityLayers/EOS/Module.cs deleted file mode 100644 index d563be9a..00000000 --- a/Dependencies/CompatibilityLayers/EOS/Module.cs +++ /dev/null @@ -1,75 +0,0 @@ -using MelonLoader.Modules; -using MelonLoader.NativeUtils; -using System; -using System.Runtime.InteropServices; - -namespace MelonLoader.CompatibilityLayers -{ - internal class EOS_Module : MelonModule - { - private delegate IntPtr LoadLibraryDetour(IntPtr path); - private static NativeHook _hookWin; - - ~EOS_Module() - => Detach(); - - public override void OnInitialize() - { - var platform = Environment.OSVersion.Platform; - switch (platform) - { - case PlatformID.Win32S: - case PlatformID.Win32Windows: - case PlatformID.Win32NT: - case PlatformID.WinCE: - NativeLibrary lib = NativeLibrary.Load("kernel32"); - if (lib != null) - { - IntPtr loadLibraryWPtr = lib.GetExport("LoadLibraryW"); - if (loadLibraryWPtr != IntPtr.Zero) - { - IntPtr detourPtr = Marshal.GetFunctionPointerForDelegate((LoadLibraryDetour)DetourWin); - _hookWin = new NativeHook(loadLibraryWPtr, detourPtr); - _hookWin.Attach(); - } - } - break; - - case PlatformID.Unix: - case PlatformID.MacOSX: - - // TO-DO - - // libdl.so.2 - // dlopen - - break; - } - } - - private static IntPtr DetourWin(IntPtr path) - { - if (path == IntPtr.Zero) - return _hookWin.Trampoline(path); - - var pathString = Marshal.PtrToStringUni(path); - if (string.IsNullOrEmpty(pathString)) - return _hookWin.Trampoline(path); - - if (pathString.EndsWith("EOSOVH-Win64-Shipping.dll") - || pathString.EndsWith("EOSOVH-Win32-Shipping.dll")) - { - Detach(); - return IntPtr.Zero; - } - - return _hookWin.Trampoline(path); - } - - private static void Detach() - { - _hookWin?.Detach(); - _hookWin = null; - } - } -} \ No newline at end of file diff --git a/Dependencies/CompatibilityLayers/EOS/Properties/AssemblyInfo.cs b/Dependencies/CompatibilityLayers/EOS/Properties/AssemblyInfo.cs deleted file mode 100644 index 0f2b1903..00000000 --- a/Dependencies/CompatibilityLayers/EOS/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle(MelonLoader.BuildInfo.Description)] -[assembly: AssemblyDescription(MelonLoader.BuildInfo.Description)] -[assembly: AssemblyCompany(MelonLoader.BuildInfo.Company)] -[assembly: AssemblyProduct(MelonLoader.BuildInfo.Name)] -[assembly: AssemblyCopyright("Created by " + MelonLoader.BuildInfo.Author)] -[assembly: AssemblyTrademark(MelonLoader.BuildInfo.Company)] -[assembly: Guid("5100810A-9842-4073-9658-E5841FDF9D73")] -[assembly: AssemblyVersion(MelonLoader.BuildInfo.Version)] -[assembly: AssemblyFileVersion(MelonLoader.BuildInfo.Version)] -[assembly: MelonLoader.PatchShield] \ No newline at end of file diff --git a/MelonLoader.sln b/MelonLoader.sln index 7b720c2f..a432ca00 100644 --- a/MelonLoader.sln +++ b/MelonLoader.sln @@ -59,8 +59,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MelonLoader.NativeHost", "M EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Preload", "Dependencies\SupportModules\Preload\Preload.csproj", "{81172B93-0ADE-47A5-9CC4-9833676C2D38}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EOS", "Dependencies\CompatibilityLayers\EOS\EOS.csproj", "{DB9D4AFC-E266-42C8-909A-21C14EEB8A5B}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -203,18 +201,6 @@ Global {81172B93-0ADE-47A5-9CC4-9833676C2D38}.Release|Windows - x64.Build.0 = Release|Any CPU {81172B93-0ADE-47A5-9CC4-9833676C2D38}.Release|Windows - x86.ActiveCfg = Release|Any CPU {81172B93-0ADE-47A5-9CC4-9833676C2D38}.Release|Windows - x86.Build.0 = Release|Any CPU - {DB9D4AFC-E266-42C8-909A-21C14EEB8A5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DB9D4AFC-E266-42C8-909A-21C14EEB8A5B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DB9D4AFC-E266-42C8-909A-21C14EEB8A5B}.Debug|Windows - x64.ActiveCfg = Debug|Any CPU - {DB9D4AFC-E266-42C8-909A-21C14EEB8A5B}.Debug|Windows - x64.Build.0 = Debug|Any CPU - {DB9D4AFC-E266-42C8-909A-21C14EEB8A5B}.Debug|Windows - x86.ActiveCfg = Debug|Any CPU - {DB9D4AFC-E266-42C8-909A-21C14EEB8A5B}.Debug|Windows - x86.Build.0 = Debug|Any CPU - {DB9D4AFC-E266-42C8-909A-21C14EEB8A5B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DB9D4AFC-E266-42C8-909A-21C14EEB8A5B}.Release|Any CPU.Build.0 = Release|Any CPU - {DB9D4AFC-E266-42C8-909A-21C14EEB8A5B}.Release|Windows - x64.ActiveCfg = Release|Any CPU - {DB9D4AFC-E266-42C8-909A-21C14EEB8A5B}.Release|Windows - x64.Build.0 = Release|Any CPU - {DB9D4AFC-E266-42C8-909A-21C14EEB8A5B}.Release|Windows - x86.ActiveCfg = Release|Any CPU - {DB9D4AFC-E266-42C8-909A-21C14EEB8A5B}.Release|Windows - x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -231,7 +217,6 @@ Global {3AF58371-2E0A-4256-B3A3-C100DB07E599} = {AB4D471C-9AB2-4A5F-93E1-8929E436C121} {1DB3679C-DCCA-492D-A725-75604A379C7A} = {AB4D471C-9AB2-4A5F-93E1-8929E436C121} {81172B93-0ADE-47A5-9CC4-9833676C2D38} = {8D8A18CB-7319-4220-BED8-6B3E23E6C19F} - {DB9D4AFC-E266-42C8-909A-21C14EEB8A5B} = {AB4D471C-9AB2-4A5F-93E1-8929E436C121} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4AB93B1D-1C52-4A80-809D-C28770140E0A} diff --git a/MelonLoader/CompatibilityLayers/MelonCompatibilityLayer.cs b/MelonLoader/CompatibilityLayers/MelonCompatibilityLayer.cs index 0f47349a..0f380aa4 100644 --- a/MelonLoader/CompatibilityLayers/MelonCompatibilityLayer.cs +++ b/MelonLoader/CompatibilityLayers/MelonCompatibilityLayer.cs @@ -1,7 +1,6 @@ using MelonLoader.Modules; using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using MelonLoader.Utils; @@ -15,7 +14,6 @@ public static class MelonCompatibilityLayer { // Illusion Plugin Architecture new MelonModule.Info(Path.Combine(baseDirectory, "IPA.dll"), MelonUtils.IsGameIl2Cpp), - new MelonModule.Info(Path.Combine(baseDirectory, "EOS.dll"), () => !MelonUtils.IsWindows) }; private static void CheckGameLayerWithPlatform(string name, Func shouldBeIgnored) From b9038b3e7f53b5a6bdfc8505a4d59a618c81439e Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Sun, 13 Oct 2024 18:18:22 -0600 Subject: [PATCH 42/60] Fixed Melon Loading Issue --- MelonLoader/Melons/MelonFolderHandler.cs | 49 ++++++------------------ 1 file changed, 11 insertions(+), 38 deletions(-) diff --git a/MelonLoader/Melons/MelonFolderHandler.cs b/MelonLoader/Melons/MelonFolderHandler.cs index 647756d6..be456916 100644 --- a/MelonLoader/Melons/MelonFolderHandler.cs +++ b/MelonLoader/Melons/MelonFolderHandler.cs @@ -78,10 +78,7 @@ private static bool IsValidFolder(string path) { string dirName = new DirectoryInfo(path).Name; string dirNameLower = dirName.ToLowerInvariant(); - if (dirNameLower.EndsWith("disabled") - || dirNameLower.Equals("userlibs") - || dirNameLower.Equals("plugins") - || dirNameLower.Equals("mods")) + if (dirNameLower.EndsWith("disabled")) return false; return true; } @@ -91,48 +88,24 @@ private static void ProcessFolder(string path, ref List melonAssemblies) where T : MelonTypeBase { // Skip Disabled Folders - if (!Directory.Exists(path) - || !IsValidFolder(path)) + if (!Directory.Exists(path)) + return; + + string dirName = new DirectoryInfo(path).Name; + string dirNameLower = dirName.ToLowerInvariant(); + if (dirNameLower.EndsWith("disabled")) return; InternalUtils.MelonAssemblyResolver.AddSearchDirectory(path); - LoadMelonsFromFolder(path, true, ref hasWroteLine, ref melonAssemblies); + LoadMelonsFromFolder(path, !dirNameLower.Equals("userlibs"), ref hasWroteLine, ref melonAssemblies); // Scan Directories var directories = Directory.GetDirectories(path, "*", SearchOption.TopDirectoryOnly); foreach (var dir in directories) - ProcessPath(dir, ref hasWroteLine, ref melonAssemblies); - } - - private static void ProcessPath(string path, - ref bool hasWroteLine, - ref List melonAssemblies) where T : MelonTypeBase - { - // Skip Disabled Folders - if (!Directory.Exists(path) - || !IsValidFolder(path)) - return; - - // Check for UserLibs - string melonUserLibs = Path.Combine(path, "UserLibs"); - if (Directory.Exists(melonUserLibs)) { - MelonUtils.AddNativeDLLDirectory(melonUserLibs); - InternalUtils.MelonAssemblyResolver.AddSearchDirectory(melonUserLibs); - LoadMelonsFromFolder(melonUserLibs, false, ref hasWroteLine, ref melonAssemblies); + InternalUtils.MelonAssemblyResolver.AddSearchDirectory(dir); + ProcessFolder(dir, ref hasWroteLine, ref melonAssemblies); } - - // Check for Plugins/Mods - string melonMelonFolder = Path.Combine(path, (typeof(T) == typeof(MelonMod)) ? "Mods" : "Plugins"); - if (Directory.Exists(melonMelonFolder)) - { - InternalUtils.MelonAssemblyResolver.AddSearchDirectory(melonMelonFolder); - ProcessFolder(melonUserLibs, ref hasWroteLine, ref melonAssemblies); - } - - // Load Everything in Base of Melon Folder - InternalUtils.MelonAssemblyResolver.AddSearchDirectory(path); - ProcessFolder(path, ref hasWroteLine, ref melonAssemblies); } } -} +} \ No newline at end of file From 1d0edfa525ae765641883bd6eb35ee54596e8fb0 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Sun, 13 Oct 2024 18:18:36 -0600 Subject: [PATCH 43/60] Update MelonFolderHandler.cs --- MelonLoader/Melons/MelonFolderHandler.cs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/MelonLoader/Melons/MelonFolderHandler.cs b/MelonLoader/Melons/MelonFolderHandler.cs index be456916..e041e694 100644 --- a/MelonLoader/Melons/MelonFolderHandler.cs +++ b/MelonLoader/Melons/MelonFolderHandler.cs @@ -74,15 +74,6 @@ private static void LoadMelonsFromFolder(string path, } } - private static bool IsValidFolder(string path) - { - string dirName = new DirectoryInfo(path).Name; - string dirNameLower = dirName.ToLowerInvariant(); - if (dirNameLower.EndsWith("disabled")) - return false; - return true; - } - private static void ProcessFolder(string path, ref bool hasWroteLine, ref List melonAssemblies) where T : MelonTypeBase From dd3e0b4ee73d1ee82939be3c6f1287d3785502af Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Sun, 13 Oct 2024 21:15:21 -0600 Subject: [PATCH 44/60] Fixed an issue with Native Libraries not resolving from UserLibs when inside of Melon Folders --- MelonLoader/Melons/MelonFolderHandler.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/MelonLoader/Melons/MelonFolderHandler.cs b/MelonLoader/Melons/MelonFolderHandler.cs index e041e694..6b3cda60 100644 --- a/MelonLoader/Melons/MelonFolderHandler.cs +++ b/MelonLoader/Melons/MelonFolderHandler.cs @@ -87,16 +87,20 @@ private static void ProcessFolder(string path, if (dirNameLower.EndsWith("disabled")) return; + bool loadMelons = true; + if (dirNameLower.EndsWith("userlibs")) + { + loadMelons = false; + MelonUtils.AddNativeDLLDirectory(path); + } + InternalUtils.MelonAssemblyResolver.AddSearchDirectory(path); - LoadMelonsFromFolder(path, !dirNameLower.Equals("userlibs"), ref hasWroteLine, ref melonAssemblies); + LoadMelonsFromFolder(path, loadMelons, ref hasWroteLine, ref melonAssemblies); // Scan Directories var directories = Directory.GetDirectories(path, "*", SearchOption.TopDirectoryOnly); foreach (var dir in directories) - { - InternalUtils.MelonAssemblyResolver.AddSearchDirectory(dir); ProcessFolder(dir, ref hasWroteLine, ref melonAssemblies); - } } } } \ No newline at end of file From 29d0771c00e1fcdec63dbe7b1a7911d6d9450280 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Sun, 13 Oct 2024 21:36:00 -0600 Subject: [PATCH 45/60] Rewrote Melon Folder Loading and Resolving to work correctly --- MelonLoader/Melons/MelonFolderHandler.cs | 71 ++++++++++++++++-------- 1 file changed, 49 insertions(+), 22 deletions(-) diff --git a/MelonLoader/Melons/MelonFolderHandler.cs b/MelonLoader/Melons/MelonFolderHandler.cs index 6b3cda60..9174c916 100644 --- a/MelonLoader/Melons/MelonFolderHandler.cs +++ b/MelonLoader/Melons/MelonFolderHandler.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Drawing; using System.IO; @@ -8,42 +8,53 @@ internal class MelonFolderHandler { internal static void Scan(string path) where T : MelonTypeBase { + // Get Full Directory Path path = Path.GetFullPath(path); + // Log Loading Message var loadingMsg = $"Loading {MelonTypeBase.TypeName}s from '{path}'..."; MelonLogger.WriteSpacer(); MelonLogger.Msg(loadingMsg); + // Parse Folders bool hasWroteLine = false; List melonAssemblies = new(); ProcessFolder(path, ref hasWroteLine, ref melonAssemblies); + // Parse Queue var melons = new List(); foreach (var asm in melonAssemblies) { + // Load Melons from Assembly asm.LoadMelons(); + + // Parse Loaded Melons foreach (var m in asm.LoadedMelons) { + // Validate Type if (m is T t) { melons.Add(t); - } - else - { - MelonLogger.Warning($"Failed to load Melon '{m.Info.Name}' from '{path}': The given Melon is a {m.MelonTypeName} and cannot be loaded as a {MelonTypeBase.TypeName}. Make sure it's in the right folder."); continue; } + + // Log Failure + MelonLogger.Warning($"Failed to load Melon '{m.Info.Name}' from '{path}': The given Melon is a {m.MelonTypeName} and cannot be loaded as a {MelonTypeBase.TypeName}. Make sure it's in the right folder."); } } + // Log if (hasWroteLine) MelonLogger.WriteSpacer(); + // Register and Sort Melons MelonBase.RegisterSorted(melons); + // Log if (hasWroteLine) MelonLogger.WriteLine(Color.Magenta); + // Log Melon Count var count = MelonTypeBase._registeredMelons.Count; MelonLogger.Msg($"{count} {MelonTypeBase.TypeName.MakePlural(count)} loaded."); if (MelonHandler.firstSpacer || (typeof(T) == typeof(MelonMod))) @@ -51,24 +62,28 @@ internal static void Scan(string path) where T : MelonTypeBase MelonHandler.firstSpacer = true; } - private static void LoadMelonsFromFolder(string path, + private static void LoadFolder(string path, bool addToList, ref bool hasWroteLine, ref List melonAssemblies) where T : MelonTypeBase { + // Get DLLs in Directory var files = Directory.GetFiles(path, "*.dll", SearchOption.TopDirectoryOnly); foreach (var f in files) { + // Log if (!hasWroteLine) { hasWroteLine = true; MelonLogger.WriteLine(Color.Magenta); } - var asm = MelonAssembly.LoadMelonAssembly(f, false); + // Load Assembly + var asm = MelonAssembly.LoadMelonAssembly(f, addToList); if (asm == null) continue; + // Queue Assembly for Melon Parsing if (addToList) melonAssemblies.Add(asm); } @@ -78,29 +93,41 @@ private static void ProcessFolder(string path, ref bool hasWroteLine, ref List melonAssemblies) where T : MelonTypeBase { - // Skip Disabled Folders + // Validate Path if (!Directory.Exists(path)) return; - string dirName = new DirectoryInfo(path).Name; - string dirNameLower = dirName.ToLowerInvariant(); - if (dirNameLower.EndsWith("disabled")) - return; + // Get Directories + var directories = Directory.GetDirectories(path, "*", SearchOption.AllDirectories); - bool loadMelons = true; - if (dirNameLower.EndsWith("userlibs")) + // Load UserLibs + foreach (var dir in directories) { - loadMelons = false; - MelonUtils.AddNativeDLLDirectory(path); - } + // Skip any folders that doesn't end with or isn't equal to UserLibs + string dirName = new DirectoryInfo(dir).Name; + string dirNameLower = dirName.ToLowerInvariant(); + if (!dirNameLower.EndsWith("userlibs")) + continue; - InternalUtils.MelonAssemblyResolver.AddSearchDirectory(path); - LoadMelonsFromFolder(path, loadMelons, ref hasWroteLine, ref melonAssemblies); + // Load Assemblies + LoadFolder(dir, false, ref hasWroteLine, ref melonAssemblies); + } - // Scan Directories - var directories = Directory.GetDirectories(path, "*", SearchOption.TopDirectoryOnly); + // Load Melons from Extended Folders foreach (var dir in directories) - ProcessFolder(dir, ref hasWroteLine, ref melonAssemblies); + { + // Skip any folders that ends with or is equal to Disabled + string dirName = new DirectoryInfo(dir).Name; + string dirNameLower = dirName.ToLowerInvariant(); + if (dirNameLower.EndsWith("disabled")) + continue; + + // Load Assemblies + LoadFolder(dir, true, ref hasWroteLine, ref melonAssemblies); + } + + // Load Melons from Base Path + LoadFolder(path, true, ref hasWroteLine, ref melonAssemblies); } } } \ No newline at end of file From 7828f4e140e31d9d52537286a260976e9d349951 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Sun, 13 Oct 2024 21:38:37 -0600 Subject: [PATCH 46/60] Update MelonFolderHandler.cs --- MelonLoader/Melons/MelonFolderHandler.cs | 52 ++++++++++++++---------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/MelonLoader/Melons/MelonFolderHandler.cs b/MelonLoader/Melons/MelonFolderHandler.cs index 9174c916..a753ac54 100644 --- a/MelonLoader/Melons/MelonFolderHandler.cs +++ b/MelonLoader/Melons/MelonFolderHandler.cs @@ -99,31 +99,41 @@ private static void ProcessFolder(string path, // Get Directories var directories = Directory.GetDirectories(path, "*", SearchOption.AllDirectories); - - // Load UserLibs - foreach (var dir in directories) + if ((directories != null) && (directories.Length > 0)) { - // Skip any folders that doesn't end with or isn't equal to UserLibs - string dirName = new DirectoryInfo(dir).Name; - string dirNameLower = dirName.ToLowerInvariant(); - if (!dirNameLower.EndsWith("userlibs")) - continue; + // Load UserLibs + foreach (var dir in directories) + { + // Validate Path + if (!Directory.Exists(dir)) + continue; - // Load Assemblies - LoadFolder(dir, false, ref hasWroteLine, ref melonAssemblies); - } + // Skip any folders that doesn't end with or isn't equal to UserLibs + string dirName = new DirectoryInfo(dir).Name; + string dirNameLower = dirName.ToLowerInvariant(); + if (!dirNameLower.EndsWith("userlibs")) + continue; - // Load Melons from Extended Folders - foreach (var dir in directories) - { - // Skip any folders that ends with or is equal to Disabled - string dirName = new DirectoryInfo(dir).Name; - string dirNameLower = dirName.ToLowerInvariant(); - if (dirNameLower.EndsWith("disabled")) - continue; + // Load Assemblies + LoadFolder(dir, false, ref hasWroteLine, ref melonAssemblies); + } + + // Load Melons from Extended Folders + foreach (var dir in directories) + { + // Validate Path + if (!Directory.Exists(dir)) + continue; - // Load Assemblies - LoadFolder(dir, true, ref hasWroteLine, ref melonAssemblies); + // Skip any folders that ends with or is equal to Disabled + string dirName = new DirectoryInfo(dir).Name; + string dirNameLower = dirName.ToLowerInvariant(); + if (dirNameLower.EndsWith("disabled")) + continue; + + // Load Melons from Extended Folder + LoadFolder(dir, true, ref hasWroteLine, ref melonAssemblies); + } } // Load Melons from Base Path From dd25e4898b189d3e0d1005524d3e076857d68f07 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Sun, 13 Oct 2024 21:50:19 -0600 Subject: [PATCH 47/60] Fixed Accidental Regression --- MelonLoader/Melons/MelonFolderHandler.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MelonLoader/Melons/MelonFolderHandler.cs b/MelonLoader/Melons/MelonFolderHandler.cs index a753ac54..df905862 100644 --- a/MelonLoader/Melons/MelonFolderHandler.cs +++ b/MelonLoader/Melons/MelonFolderHandler.cs @@ -97,6 +97,8 @@ private static void ProcessFolder(string path, if (!Directory.Exists(path)) return; + InternalUtils.MelonAssemblyResolver.AddSearchDirectory(path); + // Get Directories var directories = Directory.GetDirectories(path, "*", SearchOption.AllDirectories); if ((directories != null) && (directories.Length > 0)) @@ -115,6 +117,8 @@ private static void ProcessFolder(string path, continue; // Load Assemblies + MelonUtils.AddNativeDLLDirectory(dir); + InternalUtils.MelonAssemblyResolver.AddSearchDirectory(dir); LoadFolder(dir, false, ref hasWroteLine, ref melonAssemblies); } @@ -132,6 +136,7 @@ private static void ProcessFolder(string path, continue; // Load Melons from Extended Folder + InternalUtils.MelonAssemblyResolver.AddSearchDirectory(dir); LoadFolder(dir, true, ref hasWroteLine, ref melonAssemblies); } } From 350884e41a0055a4663f2ca236b99e66df53b983 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Sun, 13 Oct 2024 22:13:50 -0600 Subject: [PATCH 48/60] Update MelonFolderHandler.cs --- MelonLoader/Melons/MelonFolderHandler.cs | 26 ++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/MelonLoader/Melons/MelonFolderHandler.cs b/MelonLoader/Melons/MelonFolderHandler.cs index df905862..3bcd3398 100644 --- a/MelonLoader/Melons/MelonFolderHandler.cs +++ b/MelonLoader/Melons/MelonFolderHandler.cs @@ -79,7 +79,7 @@ private static void LoadFolder(string path, } // Load Assembly - var asm = MelonAssembly.LoadMelonAssembly(f, addToList); + var asm = MelonAssembly.LoadMelonAssembly(f, false); if (asm == null) continue; @@ -97,12 +97,33 @@ private static void ProcessFolder(string path, if (!Directory.Exists(path)) return; + // Add Base Path to Resolver InternalUtils.MelonAssemblyResolver.AddSearchDirectory(path); // Get Directories var directories = Directory.GetDirectories(path, "*", SearchOption.AllDirectories); + + // Add Directories to Resolver if ((directories != null) && (directories.Length > 0)) { + foreach (var dir in directories) + { + // Validate Path + if (!Directory.Exists(dir)) + continue; + + // Skip any folders that doesn't end with or isn't equal to UserLibs + string dirName = new DirectoryInfo(dir).Name; + string dirNameLower = dirName.ToLowerInvariant(); + if (dirNameLower.EndsWith("disabled")) + continue; + + // Load Assemblies + if (dirNameLower.EndsWith("userlibs")) + MelonUtils.AddNativeDLLDirectory(dir); + InternalUtils.MelonAssemblyResolver.AddSearchDirectory(dir); + } + // Load UserLibs foreach (var dir in directories) { @@ -117,8 +138,6 @@ private static void ProcessFolder(string path, continue; // Load Assemblies - MelonUtils.AddNativeDLLDirectory(dir); - InternalUtils.MelonAssemblyResolver.AddSearchDirectory(dir); LoadFolder(dir, false, ref hasWroteLine, ref melonAssemblies); } @@ -136,7 +155,6 @@ private static void ProcessFolder(string path, continue; // Load Melons from Extended Folder - InternalUtils.MelonAssemblyResolver.AddSearchDirectory(dir); LoadFolder(dir, true, ref hasWroteLine, ref melonAssemblies); } } From eafab462317b787594e137ac5a4c19ddc52d4394 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Mon, 14 Oct 2024 00:19:06 -0600 Subject: [PATCH 49/60] Fixed an issue with Melons and UserLibs becoming File Locked after Loading --- MelonLoader/Melons/MelonAssembly.cs | 7 +------ MelonLoader/Melons/MelonFolderHandler.cs | 3 +-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/MelonLoader/Melons/MelonAssembly.cs b/MelonLoader/Melons/MelonAssembly.cs index 8806bdc0..901f5059 100644 --- a/MelonLoader/Melons/MelonAssembly.cs +++ b/MelonLoader/Melons/MelonAssembly.cs @@ -80,12 +80,7 @@ public static MelonAssembly LoadMelonAssembly(string path, bool loadMelons = tru try { -#if NET6_0_OR_GREATER - var assembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(path); -#else - var assembly = Assembly.LoadFrom(path); -#endif - return LoadMelonAssembly(path, assembly, loadMelons); + return LoadRawMelonAssembly(path, File.ReadAllBytes(path), null, loadMelons); } catch (Exception ex) { diff --git a/MelonLoader/Melons/MelonFolderHandler.cs b/MelonLoader/Melons/MelonFolderHandler.cs index 3bcd3398..457c7c44 100644 --- a/MelonLoader/Melons/MelonFolderHandler.cs +++ b/MelonLoader/Melons/MelonFolderHandler.cs @@ -102,10 +102,9 @@ private static void ProcessFolder(string path, // Get Directories var directories = Directory.GetDirectories(path, "*", SearchOption.AllDirectories); - - // Add Directories to Resolver if ((directories != null) && (directories.Length > 0)) { + // Add Directories to Resolver foreach (var dir in directories) { // Validate Path From 30b8638f8c51ba71db39930233bcdefadd66490f Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Mon, 14 Oct 2024 00:20:50 -0600 Subject: [PATCH 50/60] Revert "Fixed an issue with Melons and UserLibs becoming File Locked after Loading" This reverts commit eafab462317b787594e137ac5a4c19ddc52d4394. --- MelonLoader/Melons/MelonAssembly.cs | 7 ++++++- MelonLoader/Melons/MelonFolderHandler.cs | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/MelonLoader/Melons/MelonAssembly.cs b/MelonLoader/Melons/MelonAssembly.cs index 901f5059..8806bdc0 100644 --- a/MelonLoader/Melons/MelonAssembly.cs +++ b/MelonLoader/Melons/MelonAssembly.cs @@ -80,7 +80,12 @@ public static MelonAssembly LoadMelonAssembly(string path, bool loadMelons = tru try { - return LoadRawMelonAssembly(path, File.ReadAllBytes(path), null, loadMelons); +#if NET6_0_OR_GREATER + var assembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(path); +#else + var assembly = Assembly.LoadFrom(path); +#endif + return LoadMelonAssembly(path, assembly, loadMelons); } catch (Exception ex) { diff --git a/MelonLoader/Melons/MelonFolderHandler.cs b/MelonLoader/Melons/MelonFolderHandler.cs index 457c7c44..3bcd3398 100644 --- a/MelonLoader/Melons/MelonFolderHandler.cs +++ b/MelonLoader/Melons/MelonFolderHandler.cs @@ -102,9 +102,10 @@ private static void ProcessFolder(string path, // Get Directories var directories = Directory.GetDirectories(path, "*", SearchOption.AllDirectories); + + // Add Directories to Resolver if ((directories != null) && (directories.Length > 0)) { - // Add Directories to Resolver foreach (var dir in directories) { // Validate Path From 77889af4eabc44390c77a90c8e459551a7ba5cda Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Mon, 14 Oct 2024 18:38:46 -0600 Subject: [PATCH 51/60] Fixed Regression with LemonMD5, LemonSHA256, and LemonSHA512 --- MelonLoader/Lemons/Cryptography/LemonMD5.cs | 9 +++++++-- MelonLoader/Lemons/Cryptography/LemonSHA256.cs | 9 +++++++-- MelonLoader/Lemons/Cryptography/LemonSHA512.cs | 9 +++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/MelonLoader/Lemons/Cryptography/LemonMD5.cs b/MelonLoader/Lemons/Cryptography/LemonMD5.cs index 5e0b37ff..475b655c 100644 --- a/MelonLoader/Lemons/Cryptography/LemonMD5.cs +++ b/MelonLoader/Lemons/Cryptography/LemonMD5.cs @@ -6,14 +6,19 @@ namespace MelonLoader.Lemons.Cryptography public class LemonMD5 { private HashAlgorithm algorithm; + private static LemonMD5 static_algorithm = new(); - public LemonMD5() + public LemonMD5() { algorithm = (HashAlgorithm)CryptoConfig.CreateFromName("System.Security.Cryptography.MD5"); algorithm.SetHashSizeValue(256); } - public byte[] ComputeHash(byte[] buffer) => algorithm.ComputeHash(buffer); + public static byte[] ComputeMD5Hash(byte[] buffer) => static_algorithm.ComputeHash(buffer); + public static byte[] ComputeMD5Hash(byte[] buffer, int offset, int count) => static_algorithm.ComputeHash(buffer, offset, count); + public static byte[] ComputeMD5Hash(Stream inputStream) => static_algorithm.ComputeHash(inputStream); + + public byte[] ComputeHash(byte[] buffer) => algorithm.ComputeHash(buffer); public byte[] ComputeHash(byte[] buffer, int offset, int count) => algorithm.ComputeHash(buffer, offset, count); public byte[] ComputeHash(Stream inputStream) => algorithm.ComputeHash(inputStream); } diff --git a/MelonLoader/Lemons/Cryptography/LemonSHA256.cs b/MelonLoader/Lemons/Cryptography/LemonSHA256.cs index 91be6a6e..be2ab611 100644 --- a/MelonLoader/Lemons/Cryptography/LemonSHA256.cs +++ b/MelonLoader/Lemons/Cryptography/LemonSHA256.cs @@ -7,14 +7,19 @@ namespace MelonLoader.Lemons.Cryptography public class LemonSHA256 { private HashAlgorithm algorithm; + private static LemonSHA256 static_algorithm = new(); - public LemonSHA256() + public LemonSHA256() { algorithm = (HashAlgorithm)CryptoConfig.CreateFromName("System.Security.Cryptography.SHA256"); algorithm.SetHashSizeValue(256); } - public byte[] ComputeHash(byte[] buffer) => algorithm.ComputeHash(buffer); + public static byte[] ComputeSHA256Hash(byte[] buffer) => static_algorithm.ComputeHash(buffer); + public static byte[] ComputeSHA256Hash(byte[] buffer, int offset, int count) => static_algorithm.ComputeHash(buffer, offset, count); + public static byte[] ComputeSHA256Hash(Stream inputStream) => static_algorithm.ComputeHash(inputStream); + + public byte[] ComputeHash(byte[] buffer) => algorithm.ComputeHash(buffer); public byte[] ComputeHash(byte[] buffer, int offset, int count) => algorithm.ComputeHash(buffer, offset, count); public byte[] ComputeHash(Stream inputStream) => algorithm.ComputeHash(inputStream); } diff --git a/MelonLoader/Lemons/Cryptography/LemonSHA512.cs b/MelonLoader/Lemons/Cryptography/LemonSHA512.cs index 6bec548b..fac01910 100644 --- a/MelonLoader/Lemons/Cryptography/LemonSHA512.cs +++ b/MelonLoader/Lemons/Cryptography/LemonSHA512.cs @@ -6,12 +6,17 @@ namespace MelonLoader.Lemons.Cryptography public class LemonSHA512 { private HashAlgorithm algorithm; + private static LemonSHA512 static_algorithm = new(); - public LemonSHA512() + public LemonSHA512() { algorithm = (HashAlgorithm)CryptoConfig.CreateFromName("System.Security.Cryptography.SHA512"); algorithm.SetHashSizeValue(512); - } + } + + public static byte[] ComputeSHA512Hash(byte[] buffer) => static_algorithm.ComputeHash(buffer); + public static byte[] ComputeSHA512Hash(byte[] buffer, int offset, int count) => static_algorithm.ComputeHash(buffer, offset, count); + public static byte[] ComputeSHA512Hash(Stream inputStream) => static_algorithm.ComputeHash(inputStream); public byte[] ComputeHash(byte[] buffer) => algorithm.ComputeHash(buffer); public byte[] ComputeHash(byte[] buffer, int offset, int count) => algorithm.ComputeHash(buffer, offset, count); From 1f8c5585e8109cab8703dda2309be75f25a3e83f Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Mon, 14 Oct 2024 19:35:41 -0600 Subject: [PATCH 52/60] General Cleanup, Moved Resolver Related Classes to MelonLoader.Resolver Namespace, Moved MonoLibrary class to MelonLoader.Utils Namespace --- .../CompatibilityLayers/IPA/Module.cs | 2 +- .../Muse_Dash_Mono/Module.cs | 2 +- .../Melon/AssemblyResolveInfo.cs | 4 +-- .../Melon/MonoLibrary.cs | 4 +-- .../Melon/MonoResolveManager.cs | 26 +++++++++---------- MelonLoader/Core.cs | 12 ++++----- MelonLoader/InternalUtils/DependencyGraph.cs | 2 +- MelonLoader/Melons/MelonFolderHandler.cs | 6 ++--- .../Resolver/AssemblyManager.cs | 7 +++-- .../AssemblyResolveInfo.cs | 2 +- .../MelonAssemblyResolver.cs | 3 +-- .../Resolver/SearchDirectoryManager.cs | 15 +++++------ .../{InternalUtils => Utils}/MonoLibrary.cs | 2 +- 13 files changed, 40 insertions(+), 47 deletions(-) rename MelonLoader/{InternalUtils => }/Resolver/AssemblyManager.cs (93%) rename MelonLoader/{InternalUtils => Resolver}/AssemblyResolveInfo.cs (97%) rename MelonLoader/{InternalUtils => Resolver}/MelonAssemblyResolver.cs (98%) rename MelonLoader/{InternalUtils => }/Resolver/SearchDirectoryManager.cs (93%) rename MelonLoader/{InternalUtils => Utils}/MonoLibrary.cs (98%) diff --git a/Dependencies/CompatibilityLayers/IPA/Module.cs b/Dependencies/CompatibilityLayers/IPA/Module.cs index 4c2db831..018263c9 100644 --- a/Dependencies/CompatibilityLayers/IPA/Module.cs +++ b/Dependencies/CompatibilityLayers/IPA/Module.cs @@ -2,10 +2,10 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; -using MelonLoader.InternalUtils; using IllusionPlugin; using IllusionInjector; using MelonLoader.Modules; +using MelonLoader.Resolver; namespace MelonLoader.CompatibilityLayers { diff --git a/Dependencies/CompatibilityLayers/Muse_Dash_Mono/Module.cs b/Dependencies/CompatibilityLayers/Muse_Dash_Mono/Module.cs index 27a3813c..0551542a 100644 --- a/Dependencies/CompatibilityLayers/Muse_Dash_Mono/Module.cs +++ b/Dependencies/CompatibilityLayers/Muse_Dash_Mono/Module.cs @@ -3,8 +3,8 @@ using System.Linq; using System.Reflection; using MelonLoader.Modules; -using MelonLoader.InternalUtils; using ModHelper; +using MelonLoader.Resolver; namespace MelonLoader.CompatibilityLayers { diff --git a/MelonLoader/BackwardsCompatibility/Melon/AssemblyResolveInfo.cs b/MelonLoader/BackwardsCompatibility/Melon/AssemblyResolveInfo.cs index b88d4472..f4ab132f 100644 --- a/MelonLoader/BackwardsCompatibility/Melon/AssemblyResolveInfo.cs +++ b/MelonLoader/BackwardsCompatibility/Melon/AssemblyResolveInfo.cs @@ -2,6 +2,6 @@ namespace MelonLoader.MonoInternals { - [Obsolete("MelonLoader.MonoInternals.AssemblyResolveInfo is Only Here for Compatibility Reasons. Please use MelonLoader.InternalUtils.AssemblyResolveInfo instead.")] - public class AssemblyResolveInfo : InternalUtils.AssemblyResolveInfo { } + [Obsolete("MelonLoader.MonoInternals.AssemblyResolveInfo is Only Here for Compatibility Reasons. Please use MelonLoader.Resolver.AssemblyResolveInfo instead.")] + public class AssemblyResolveInfo : Resolver.AssemblyResolveInfo { } } diff --git a/MelonLoader/BackwardsCompatibility/Melon/MonoLibrary.cs b/MelonLoader/BackwardsCompatibility/Melon/MonoLibrary.cs index c1791526..e6cc2719 100644 --- a/MelonLoader/BackwardsCompatibility/Melon/MonoLibrary.cs +++ b/MelonLoader/BackwardsCompatibility/Melon/MonoLibrary.cs @@ -4,8 +4,8 @@ namespace MelonLoader.MonoInternals { - [Obsolete("MelonLoader.MonoInternals.MonoLibrary is Only Here for Compatibility Reasons. Please use MelonLoader.InternalUtils.MonoLibrary instead.")] - public class MonoLibrary : InternalUtils.MonoLibrary { } + [Obsolete("MelonLoader.MonoInternals.MonoLibrary is Only Here for Compatibility Reasons. Please use MelonLoader.Utils.MonoLibrary instead.")] + public class MonoLibrary : Utils.MonoLibrary { } } #endif \ No newline at end of file diff --git a/MelonLoader/BackwardsCompatibility/Melon/MonoResolveManager.cs b/MelonLoader/BackwardsCompatibility/Melon/MonoResolveManager.cs index c1f4fe7e..03c0ba13 100644 --- a/MelonLoader/BackwardsCompatibility/Melon/MonoResolveManager.cs +++ b/MelonLoader/BackwardsCompatibility/Melon/MonoResolveManager.cs @@ -3,37 +3,37 @@ namespace MelonLoader.MonoInternals { - [Obsolete("MelonLoader.MonoInternals.MonoResolveManager is Only Here for Compatibility Reasons. Please use MelonLoader.InternalUtils.MelonAssemblyResolver instead.")] + [Obsolete("MelonLoader.MonoInternals.MonoResolveManager is Only Here for Compatibility Reasons. Please use MelonLoader.Resolver.MelonAssemblyResolver instead.")] public static class MonoResolveManager { - [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.AddSearchDirectory is Only Here for Compatibility Reasons. Please use MelonLoader.InternalUtils.MelonAssemblyResolver.AddSearchDirectory instead.")] + [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.AddSearchDirectory is Only Here for Compatibility Reasons. Please use MelonLoader.Resolver.MelonAssemblyResolver.AddSearchDirectory instead.")] public static void AddSearchDirectory(string path, int priority = 0) - => InternalUtils.Resolver.SearchDirectoryManager.Add(path, priority); + => Resolver.SearchDirectoryManager.Add(path, priority); - [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.RemoveSearchDirectory is Only Here for Compatibility Reasons. Please use MelonLoader.InternalUtils.MelonAssemblyResolver.RemoveSearchDirectory instead.")] + [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.RemoveSearchDirectory is Only Here for Compatibility Reasons. Please use MelonLoader.Resolver.MelonAssemblyResolver.RemoveSearchDirectory instead.")] public static void RemoveSearchDirectory(string path) - => InternalUtils.Resolver.SearchDirectoryManager.Remove(path); + => Resolver.SearchDirectoryManager.Remove(path); - [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.OnAssemblyLoadHandler is Only Here for Compatibility Reasons. Please use MelonLoader.InternalUtils.MelonAssemblyResolver.dOnAssemblyLoad instead.")] + [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.OnAssemblyLoadHandler is Only Here for Compatibility Reasons. Please use MelonLoader.Resolver.MelonAssemblyResolver.dOnAssemblyLoad instead.")] public delegate void OnAssemblyLoadHandler(Assembly assembly); - [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.OnAssemblyLoad is Only Here for Compatibility Reasons. Please use MelonLoader.InternalUtils.MelonAssemblyResolver.OnAssemblyLoad instead.")] + [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.OnAssemblyLoad is Only Here for Compatibility Reasons. Please use MelonLoader.Resolver.MelonAssemblyResolver.OnAssemblyLoad instead.")] public static event OnAssemblyLoadHandler OnAssemblyLoad; internal static void SafeInvoke_OnAssemblyLoad(Assembly assembly) => OnAssemblyLoad?.Invoke(assembly); - [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.OnAssemblyResolveHandler is Only Here for Compatibility Reasons. Please use MelonLoader.InternalUtils.MelonAssemblyResolver.dOnAssemblyResolve instead.")] + [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.OnAssemblyResolveHandler is Only Here for Compatibility Reasons. Please use MelonLoader.Resolver.MelonAssemblyResolver.dOnAssemblyResolve instead.")] public delegate Assembly OnAssemblyResolveHandler(string name, Version version); - [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.OnAssemblyLoad is Only Here for Compatibility Reasons. Please use MelonLoader.InternalUtils.MelonAssemblyResolver.OnAssemblyLoad instead.")] + [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.OnAssemblyLoad is Only Here for Compatibility Reasons. Please use MelonLoader.Resolver.MelonAssemblyResolver.OnAssemblyLoad instead.")] public static event OnAssemblyResolveHandler OnAssemblyResolve; internal static Assembly SafeInvoke_OnAssemblyResolve(string name, Version version) => OnAssemblyResolve?.Invoke(name, version); - [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.GetAssemblyResolveInfo is Only Here for Compatibility Reasons. Please use MelonLoader.InternalUtils.MelonAssemblyResolver.GetAssemblyResolveInfo instead.")] + [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.GetAssemblyResolveInfo is Only Here for Compatibility Reasons. Please use MelonLoader.Resolver.MelonAssemblyResolver.GetAssemblyResolveInfo instead.")] public static AssemblyResolveInfo GetAssemblyResolveInfo(string name) - => (AssemblyResolveInfo)InternalUtils.Resolver.AssemblyManager.GetInfo(name); + => (AssemblyResolveInfo)Resolver.AssemblyManager.GetInfo(name); - [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.LoadInfoFromAssembly is Only Here for Compatibility Reasons. Please use MelonLoader.InternalUtils.MelonAssemblyResolver.LoadInfoFromAssembly instead.")] + [Obsolete("MelonLoader.MonoInternals.MonoResolveManager.LoadInfoFromAssembly is Only Here for Compatibility Reasons. Please use MelonLoader.Resolver.MelonAssemblyResolver.LoadInfoFromAssembly instead.")] public static void LoadInfoFromAssembly(Assembly assembly) - => InternalUtils.Resolver.AssemblyManager.LoadInfo(assembly); + => Resolver.AssemblyManager.LoadInfo(assembly); } } diff --git a/MelonLoader/Core.cs b/MelonLoader/Core.cs index 29b81da5..5f5819b1 100644 --- a/MelonLoader/Core.cs +++ b/MelonLoader/Core.cs @@ -1,19 +1,17 @@ using System; using System.Diagnostics; using System.Reflection; -using System.Security; -using MelonLoader.InternalUtils; -using MelonLoader.MonoInternals; -using MelonLoader.Utils; using System.IO; using bHapticsLib; using System.Threading; -using System.Linq; +using MelonLoader.Resolver; +using MelonLoader.Utils; +using MelonLoader.InternalUtils; #pragma warning disable IDE0051 // Prevent the IDE from complaining about private unreferenced methods namespace MelonLoader { - internal static class Core + internal static class Core { private static bool _success = true; @@ -65,7 +63,7 @@ internal static int Initialize() try { - if (!InternalUtils.MonoLibrary.Setup()) + if (!MonoLibrary.Setup()) { _success = false; return 1; diff --git a/MelonLoader/InternalUtils/DependencyGraph.cs b/MelonLoader/InternalUtils/DependencyGraph.cs index 97002a00..546fbdba 100644 --- a/MelonLoader/InternalUtils/DependencyGraph.cs +++ b/MelonLoader/InternalUtils/DependencyGraph.cs @@ -3,7 +3,7 @@ using System.Text; using System.Reflection; using System.IO; -using MelonLoader.InternalUtils.Resolver; +using MelonLoader.Resolver; #if NET6_0_OR_GREATER using System.Runtime.Loader; diff --git a/MelonLoader/Melons/MelonFolderHandler.cs b/MelonLoader/Melons/MelonFolderHandler.cs index 3bcd3398..c8166934 100644 --- a/MelonLoader/Melons/MelonFolderHandler.cs +++ b/MelonLoader/Melons/MelonFolderHandler.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Drawing; using System.IO; @@ -98,7 +98,7 @@ private static void ProcessFolder(string path, return; // Add Base Path to Resolver - InternalUtils.MelonAssemblyResolver.AddSearchDirectory(path); + Resolver.MelonAssemblyResolver.AddSearchDirectory(path); // Get Directories var directories = Directory.GetDirectories(path, "*", SearchOption.AllDirectories); @@ -121,7 +121,7 @@ private static void ProcessFolder(string path, // Load Assemblies if (dirNameLower.EndsWith("userlibs")) MelonUtils.AddNativeDLLDirectory(dir); - InternalUtils.MelonAssemblyResolver.AddSearchDirectory(dir); + Resolver.MelonAssemblyResolver.AddSearchDirectory(dir); } // Load UserLibs diff --git a/MelonLoader/InternalUtils/Resolver/AssemblyManager.cs b/MelonLoader/Resolver/AssemblyManager.cs similarity index 93% rename from MelonLoader/InternalUtils/Resolver/AssemblyManager.cs rename to MelonLoader/Resolver/AssemblyManager.cs index f78d9a90..97043db0 100644 --- a/MelonLoader/InternalUtils/Resolver/AssemblyManager.cs +++ b/MelonLoader/Resolver/AssemblyManager.cs @@ -3,7 +3,6 @@ using System.Reflection; #if NET6_0_OR_GREATER -using System.IO; using System.Runtime.Loader; #else using System.Runtime.CompilerServices; @@ -11,7 +10,7 @@ #pragma warning disable CS8632 -namespace MelonLoader.InternalUtils.Resolver +namespace MelonLoader.Resolver { internal class AssemblyManager { @@ -50,7 +49,7 @@ private static Assembly Resolve(string requested_name, Version requested_version assembly = MelonAssemblyResolver.SafeInvoke_OnAssemblyResolve(requested_name, requested_version); // Search Directories - if (is_preload && (assembly == null)) + if (is_preload && assembly == null) assembly = SearchDirectoryManager.Scan(requested_name); // Load if Valid Assembly @@ -78,7 +77,7 @@ internal static void LoadInfo(Assembly assembly) #if NET6_0_OR_GREATER - private static Assembly? Resolve(AssemblyLoadContext alc, AssemblyName name) + private static Assembly Resolve(AssemblyLoadContext alc, AssemblyName name) => Resolve(name.Name, name.Version, true); private static void InstallHooks() diff --git a/MelonLoader/InternalUtils/AssemblyResolveInfo.cs b/MelonLoader/Resolver/AssemblyResolveInfo.cs similarity index 97% rename from MelonLoader/InternalUtils/AssemblyResolveInfo.cs rename to MelonLoader/Resolver/AssemblyResolveInfo.cs index fa97cc4a..eb975cfb 100644 --- a/MelonLoader/InternalUtils/AssemblyResolveInfo.cs +++ b/MelonLoader/Resolver/AssemblyResolveInfo.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Reflection; -namespace MelonLoader.InternalUtils +namespace MelonLoader.Resolver { public class AssemblyResolveInfo { diff --git a/MelonLoader/InternalUtils/MelonAssemblyResolver.cs b/MelonLoader/Resolver/MelonAssemblyResolver.cs similarity index 98% rename from MelonLoader/InternalUtils/MelonAssemblyResolver.cs rename to MelonLoader/Resolver/MelonAssemblyResolver.cs index ed99b571..d4062503 100644 --- a/MelonLoader/InternalUtils/MelonAssemblyResolver.cs +++ b/MelonLoader/Resolver/MelonAssemblyResolver.cs @@ -1,7 +1,6 @@ using System; using System.IO; using System.Reflection; -using MelonLoader.InternalUtils.Resolver; using MelonLoader.Utils; #if NET6_0_OR_GREATER @@ -10,7 +9,7 @@ #pragma warning disable CS0618 // Type or member is obsolete -namespace MelonLoader.InternalUtils +namespace MelonLoader.Resolver { public class MelonAssemblyResolver { diff --git a/MelonLoader/InternalUtils/Resolver/SearchDirectoryManager.cs b/MelonLoader/Resolver/SearchDirectoryManager.cs similarity index 93% rename from MelonLoader/InternalUtils/Resolver/SearchDirectoryManager.cs rename to MelonLoader/Resolver/SearchDirectoryManager.cs index 188eb337..f7fc99f8 100644 --- a/MelonLoader/InternalUtils/Resolver/SearchDirectoryManager.cs +++ b/MelonLoader/Resolver/SearchDirectoryManager.cs @@ -4,17 +4,14 @@ using System.Reflection; #if NET6_0_OR_GREATER - using System.Runtime.Loader; - #else - using System; using System.Runtime.InteropServices; - +using MelonLoader.Utils; #endif -namespace MelonLoader.InternalUtils.Resolver +namespace MelonLoader.Resolver { internal static class SearchDirectoryManager { @@ -75,10 +72,10 @@ internal static Assembly Scan(string requested_name) string filepath = Directory.GetFiles(folderpath).Where(x => !string.IsNullOrEmpty(x) - && ((Path.GetExtension(x).ToLowerInvariant().Equals(".dll") - && Path.GetFileName(x).Equals($"{requested_name}.dll")) - || (Path.GetExtension(x).ToLowerInvariant().Equals(".exe") - && Path.GetFileName(x).Equals($"{requested_name}.exe"))) + && (Path.GetExtension(x).ToLowerInvariant().Equals(".dll") + && Path.GetFileName(x).Equals($"{requested_name}.dll") + || Path.GetExtension(x).ToLowerInvariant().Equals(".exe") + && Path.GetFileName(x).Equals($"{requested_name}.exe")) ).FirstOrDefault(); if (string.IsNullOrEmpty(filepath)) diff --git a/MelonLoader/InternalUtils/MonoLibrary.cs b/MelonLoader/Utils/MonoLibrary.cs similarity index 98% rename from MelonLoader/InternalUtils/MonoLibrary.cs rename to MelonLoader/Utils/MonoLibrary.cs index 59d83e26..a6f4ba7c 100644 --- a/MelonLoader/InternalUtils/MonoLibrary.cs +++ b/MelonLoader/Utils/MonoLibrary.cs @@ -5,7 +5,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -namespace MelonLoader.InternalUtils +namespace MelonLoader.Utils { public class MonoLibrary { From db47c398081811fd96163033e56c2380c8cd0036 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Mon, 14 Oct 2024 19:39:35 -0600 Subject: [PATCH 53/60] Fixed Merge Issues --- MelonLoader/Resolver/AssemblyManager.cs | 4 ++-- MelonLoader/Resolver/SearchDirectoryManager.cs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/MelonLoader/Resolver/AssemblyManager.cs b/MelonLoader/Resolver/AssemblyManager.cs index 97043db0..f0d9b583 100644 --- a/MelonLoader/Resolver/AssemblyManager.cs +++ b/MelonLoader/Resolver/AssemblyManager.cs @@ -49,7 +49,7 @@ private static Assembly Resolve(string requested_name, Version requested_version assembly = MelonAssemblyResolver.SafeInvoke_OnAssemblyResolve(requested_name, requested_version); // Search Directories - if (is_preload && assembly == null) + if (is_preload && (assembly == null)) assembly = SearchDirectoryManager.Scan(requested_name); // Load if Valid Assembly @@ -77,7 +77,7 @@ internal static void LoadInfo(Assembly assembly) #if NET6_0_OR_GREATER - private static Assembly Resolve(AssemblyLoadContext alc, AssemblyName name) + private static Assembly? Resolve(AssemblyLoadContext alc, AssemblyName name) => Resolve(name.Name, name.Version, true); private static void InstallHooks() diff --git a/MelonLoader/Resolver/SearchDirectoryManager.cs b/MelonLoader/Resolver/SearchDirectoryManager.cs index f7fc99f8..8f1ff4da 100644 --- a/MelonLoader/Resolver/SearchDirectoryManager.cs +++ b/MelonLoader/Resolver/SearchDirectoryManager.cs @@ -71,11 +71,11 @@ internal static Assembly Scan(string requested_name) continue; string filepath = Directory.GetFiles(folderpath).Where(x => - !string.IsNullOrEmpty(x) - && (Path.GetExtension(x).ToLowerInvariant().Equals(".dll") - && Path.GetFileName(x).Equals($"{requested_name}.dll") - || Path.GetExtension(x).ToLowerInvariant().Equals(".exe") - && Path.GetFileName(x).Equals($"{requested_name}.exe")) + (!string.IsNullOrEmpty(x) + && ((Path.GetExtension(x).ToLowerInvariant().Equals(".dll") + && Path.GetFileName(x).Equals($"{requested_name}.dll")) + || (Path.GetExtension(x).ToLowerInvariant().Equals(".exe") + && Path.GetFileName(x).Equals($"{requested_name}.exe")))) ).FirstOrDefault(); if (string.IsNullOrEmpty(filepath)) From a498403c28a57c03a3b1f0a2906b285ac16fab83 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Mon, 14 Oct 2024 19:52:01 -0600 Subject: [PATCH 54/60] Update CHANGELOG.md --- CHANGELOG.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4c377a4..9be1b978 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ | Versions: | | - | +| [v0.6.6](#v066) | | [v0.6.5](#v065) | | [v0.6.4](#v064) | | [v0.6.3](#v063) | @@ -37,6 +38,31 @@ --- +### v0.6.6 + +1. Updated Il2CppInterop to 1.4.6-ci.579 +2. Implemented a RegisterTypeInIl2CppWithInterfaces attribute +3. Implemented Recursive Melon Folders with extended UserLib Resolving +4. Reimplemented NetFramework Variant of Cpp2IL as fallback +5. Standardized Assembly Searching and Resolving to work on both Mono and Il2Cpp Games +6. Temporarily removed Start Screen for being broken in most cases +7. Modified Command-Line Argument Logging to show Internal Arguments Only +8. Added UserLibs folders to Native Library Search Directories +9. Moved `dobby.dll` to `MelonLoader\Dependencies` +10. Moved Assembly Resolver Related Classes to `MelonLoader.Resolver` Namespace +11. Moved `MonoLibrary` class to `MelonLoader.Utils` Namespace +12. Removed Useless TODO Warning from Il2CppAssemblyGenerator +13. Removed EOS Compatibility Layer for being Unneeded +14. Fixed Regression with LemonMD5, LemonSHA256, and LemonSHA512 +15. Fixed an issue with older Cpp2IL versions causing a download failure +16. Fixed an issue with Il2CppInterop not properly logging Trampoline Exceptions +17. Fixed an issue with Il2Cpp Class Injection Attributes causing exceptions to be thrown on Mono games +18. Fixed an issue with the Bootstrap not reading --melonloader.basedir correctly +19. Fixed an issue with Loading Dobby in some rare cases +20. Fixed an issue with Compatibility Layers getting Garbage Collected while still in use + +--- + ### v0.6.5 1. Updated Il2CppInterop to 1.4.6-ci.545 From 380dde8ff8f648f818c7420770e2fc64401222aa Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Mon, 14 Oct 2024 20:02:50 -0600 Subject: [PATCH 55/60] Update CHANGELOG.md --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9be1b978..da8e3655 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,8 +57,8 @@ 15. Fixed an issue with older Cpp2IL versions causing a download failure 16. Fixed an issue with Il2CppInterop not properly logging Trampoline Exceptions 17. Fixed an issue with Il2Cpp Class Injection Attributes causing exceptions to be thrown on Mono games -18. Fixed an issue with the Bootstrap not reading --melonloader.basedir correctly -19. Fixed an issue with Loading Dobby in some rare cases +18. Fixed an issue with the Bootstrap not reading `--melonloader.basedir` correctly +19. Fixed an issue with Loading `dobby.dll` in some rare cases 20. Fixed an issue with Compatibility Layers getting Garbage Collected while still in use --- From e06d0e70307b5089978e1d10831ca4e9d1460633 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Mon, 14 Oct 2024 20:05:54 -0600 Subject: [PATCH 56/60] Update mod.rs --- Bootstrap/src/icalls/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Bootstrap/src/icalls/mod.rs b/Bootstrap/src/icalls/mod.rs index ca8ed453..932f78bc 100644 --- a/Bootstrap/src/icalls/mod.rs +++ b/Bootstrap/src/icalls/mod.rs @@ -14,10 +14,10 @@ pub fn init(runtime: &FerrexRuntime) -> Result<(), DynErr> { runtime.add_internal_call("MelonLoader.MelonUtils::IsGame32Bit", melon_utils::is_32_bit as MethodPointer)?; runtime.add_internal_call("MelonLoader.BootstrapInterop::NativeHookAttach", bootstrap_interop::attach as MethodPointer)?; runtime.add_internal_call("MelonLoader.BootstrapInterop::NativeHookDetach", bootstrap_interop::detach as MethodPointer)?; - runtime.add_internal_call("MelonLoader.InternalUtils.MonoLibrary::GetLibPtr", mono_library::get_lib_ptr as MethodPointer)?; - runtime.add_internal_call("MelonLoader.InternalUtils.MonoLibrary::CastManagedAssemblyPtr", mono_library::cast_assembly_ptr as MethodPointer)?; - runtime.add_internal_call("MelonLoader.InternalUtils.MonoLibrary::GetRootDomainPtr", mono_library::get_domain_ptr as MethodPointer)?; - runtime.add_internal_call("MelonLoader.InternalUtils.Resolver.AssemblyManager::InstallHooks", resolve_internals::install_hooks as MethodPointer)?; + runtime.add_internal_call("MelonLoader.Utils.MonoLibrary::GetLibPtr", mono_library::get_lib_ptr as MethodPointer)?; + runtime.add_internal_call("MelonLoader.Utils.MonoLibrary::CastManagedAssemblyPtr", mono_library::cast_assembly_ptr as MethodPointer)?; + runtime.add_internal_call("MelonLoader.Utils.MonoLibrary::GetRootDomainPtr", mono_library::get_domain_ptr as MethodPointer)?; + runtime.add_internal_call("MelonLoader.Resolver.AssemblyManager::InstallHooks", resolve_internals::install_hooks as MethodPointer)?; runtime.add_internal_call("MelonLoader.Support.Preload::GetManagedDirectory", preload::get_managed_dir as MethodPointer)?; Ok(()) From f6e44ea84de3da2c49862ab7de6b9130ca1a1268 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Mon, 14 Oct 2024 20:32:16 -0600 Subject: [PATCH 57/60] Update MelonFolderHandler.cs --- MelonLoader/Melons/MelonFolderHandler.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/MelonLoader/Melons/MelonFolderHandler.cs b/MelonLoader/Melons/MelonFolderHandler.cs index c8166934..492ef749 100644 --- a/MelonLoader/Melons/MelonFolderHandler.cs +++ b/MelonLoader/Melons/MelonFolderHandler.cs @@ -115,7 +115,10 @@ private static void ProcessFolder(string path, // Skip any folders that doesn't end with or isn't equal to UserLibs string dirName = new DirectoryInfo(dir).Name; string dirNameLower = dirName.ToLowerInvariant(); - if (dirNameLower.EndsWith("disabled")) + if (dirNameLower.StartsWith("disabled") + || dirNameLower.EndsWith("disabled") + || dirNameLower.StartsWith("old") + || dirNameLower.EndsWith("old")) continue; // Load Assemblies @@ -134,6 +137,12 @@ private static void ProcessFolder(string path, // Skip any folders that doesn't end with or isn't equal to UserLibs string dirName = new DirectoryInfo(dir).Name; string dirNameLower = dirName.ToLowerInvariant(); + if (dirNameLower.StartsWith("disabled") + || dirNameLower.EndsWith("disabled") + || dirNameLower.StartsWith("old") + || dirNameLower.EndsWith("old")) + continue; + if (!dirNameLower.EndsWith("userlibs")) continue; @@ -151,7 +160,10 @@ private static void ProcessFolder(string path, // Skip any folders that ends with or is equal to Disabled string dirName = new DirectoryInfo(dir).Name; string dirNameLower = dirName.ToLowerInvariant(); - if (dirNameLower.EndsWith("disabled")) + if (dirNameLower.StartsWith("disabled") + || dirNameLower.EndsWith("disabled") + || dirNameLower.StartsWith("old") + || dirNameLower.EndsWith("old")) continue; // Load Melons from Extended Folder From a91670123bd650ae4d82cac7c36a7212fb9d6ce1 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Mon, 14 Oct 2024 20:40:16 -0600 Subject: [PATCH 58/60] Update mono.rs --- Bootstrap/src/base_assembly/mono.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bootstrap/src/base_assembly/mono.rs b/Bootstrap/src/base_assembly/mono.rs index cc08c075..1db090d4 100644 --- a/Bootstrap/src/base_assembly/mono.rs +++ b/Bootstrap/src/base_assembly/mono.rs @@ -42,7 +42,7 @@ pub fn init(runtime: &FerrexRuntime) -> Result<(), DynErr> { //get the AssemblyManager class and grab some methods from it let assemblymanager_class = melonloader_assembly.get_class( - "MelonLoader.InternalUtils.Resolver", + "MelonLoader.Resolver", "AssemblyManager", runtime, )?; From d40b26a65f5766a30f7f2f7c99887e818b826615 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Mon, 14 Oct 2024 20:45:32 -0600 Subject: [PATCH 59/60] Update MelonFolderHandler.cs --- MelonLoader/Melons/MelonFolderHandler.cs | 48 ++++++++++++------------ 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/MelonLoader/Melons/MelonFolderHandler.cs b/MelonLoader/Melons/MelonFolderHandler.cs index 492ef749..49db6198 100644 --- a/MelonLoader/Melons/MelonFolderHandler.cs +++ b/MelonLoader/Melons/MelonFolderHandler.cs @@ -89,6 +89,21 @@ private static void LoadFolder(string path, } } + private static bool IsUserLibsFolder(string dirNameLower) + => dirNameLower.StartsWith("userlibs") + || dirNameLower.EndsWith("userlibs"); + + private static bool IsDisabledFolder(string path, + out string dirNameLower) + { + string dirName = new DirectoryInfo(path).Name; + dirNameLower = dirName.ToLowerInvariant(); + return dirNameLower.StartsWith("disabled") + || dirNameLower.EndsWith("disabled") + || dirNameLower.StartsWith("old") + || dirNameLower.EndsWith("old"); + } + private static void ProcessFolder(string path, ref bool hasWroteLine, ref List melonAssemblies) where T : MelonTypeBase @@ -112,17 +127,12 @@ private static void ProcessFolder(string path, if (!Directory.Exists(dir)) continue; - // Skip any folders that doesn't end with or isn't equal to UserLibs - string dirName = new DirectoryInfo(dir).Name; - string dirNameLower = dirName.ToLowerInvariant(); - if (dirNameLower.StartsWith("disabled") - || dirNameLower.EndsWith("disabled") - || dirNameLower.StartsWith("old") - || dirNameLower.EndsWith("old")) + // Skip Disabled Folders + if (IsDisabledFolder(dir, out string dirNameLower)) continue; // Load Assemblies - if (dirNameLower.EndsWith("userlibs")) + if (IsUserLibsFolder(dirNameLower)) MelonUtils.AddNativeDLLDirectory(dir); Resolver.MelonAssemblyResolver.AddSearchDirectory(dir); } @@ -134,16 +144,9 @@ private static void ProcessFolder(string path, if (!Directory.Exists(dir)) continue; - // Skip any folders that doesn't end with or isn't equal to UserLibs - string dirName = new DirectoryInfo(dir).Name; - string dirNameLower = dirName.ToLowerInvariant(); - if (dirNameLower.StartsWith("disabled") - || dirNameLower.EndsWith("disabled") - || dirNameLower.StartsWith("old") - || dirNameLower.EndsWith("old")) - continue; - - if (!dirNameLower.EndsWith("userlibs")) + // Skip Disabled Folders and any folders that doesn't end with or isn't equal to UserLibs + if (IsDisabledFolder(dir, out string dirNameLower) + || !IsUserLibsFolder(dirNameLower)) continue; // Load Assemblies @@ -157,13 +160,8 @@ private static void ProcessFolder(string path, if (!Directory.Exists(dir)) continue; - // Skip any folders that ends with or is equal to Disabled - string dirName = new DirectoryInfo(dir).Name; - string dirNameLower = dirName.ToLowerInvariant(); - if (dirNameLower.StartsWith("disabled") - || dirNameLower.EndsWith("disabled") - || dirNameLower.StartsWith("old") - || dirNameLower.EndsWith("old")) + // Skip Disabled Folders + if (IsDisabledFolder(dir, out _)) continue; // Load Melons from Extended Folder From 86828259cfa46aebeb33c335f47569083f0072ee Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Mon, 14 Oct 2024 21:44:04 -0600 Subject: [PATCH 60/60] Update nuget.yml --- .github/workflows/nuget.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml index 8fad867a..78042b0a 100644 --- a/.github/workflows/nuget.yml +++ b/.github/workflows/nuget.yml @@ -23,4 +23,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: MelonLoaderNuGetPackage - path: MelonLoader/Output/Release/MelonLoader/LavaGang.MelonLoader.0.6.5.nupkg \ No newline at end of file + path: MelonLoader/Output/Release/MelonLoader/LavaGang.MelonLoader.0.6.6.nupkg \ No newline at end of file