From 476ef7597406584345d1559b59c0abb8992f30a4 Mon Sep 17 00:00:00 2001 From: zznty <94796179+zznty@users.noreply.github.com> Date: Tue, 3 Jun 2025 04:02:11 +0700 Subject: [PATCH] eos support is back --- CringeBootstrap/Program.cs | 1 + CringeBootstrap/packages.lock.json | 17 ++++++++++++++ CringeLauncher/CringeLauncher.csproj | 1 + CringeLauncher/Launcher.cs | 19 ++++++++-------- CringeLauncher/packages.lock.json | 18 +++++++++++++++ SharedCringe/packages.lock.json | 4 ++-- TestPlugin/packages.lock.json | 33 ++++------------------------ 7 files changed, 53 insertions(+), 40 deletions(-) diff --git a/CringeBootstrap/Program.cs b/CringeBootstrap/Program.cs index 634d4a7..66903cb 100644 --- a/CringeBootstrap/Program.cs +++ b/CringeBootstrap/Program.cs @@ -45,6 +45,7 @@ var context = new GameDirectoryAssemblyLoadContext(dir); // a list of assemblies which are not in the game binaries but reference them context.AddDependencyOverride("CringeLauncher"); context.AddDependencyOverride("CringePlugins"); +context.AddDependencyOverride("EOSSDK"); var launcher = context.LoadFromAssemblyName(new AssemblyName("CringeLauncher")); diff --git a/CringeBootstrap/packages.lock.json b/CringeBootstrap/packages.lock.json index be094bb..3a275fa 100644 --- a/CringeBootstrap/packages.lock.json +++ b/CringeBootstrap/packages.lock.json @@ -31,6 +31,14 @@ "resolved": "4.4.0", "contentHash": "cKHI720q+zfEEvzklWVGt6B0TH3AibAyJbpUJl4U6KvTP13tycfnqJpkGHRZ/oQ45BTIoIxIwltHIJVDN+iCqQ==" }, + "EOSSDK": { + "type": "Transitive", + "resolved": "1.0.1", + "contentHash": "KIV+oWbAjUgIm22WmMQEQEFanWQ992F9VASVkP9JDpLHb41rN9Asco3eJM70X1V8j3PZO237KrZur0yKYkO/rg==", + "dependencies": { + "CringePlugins": "0.1.73" + } + }, "Humanizer.Core": { "type": "Transitive", "resolved": "2.14.1", @@ -406,6 +414,7 @@ "Basic.Reference.Assemblies.Net90": "[1.8.0, )", "CringeBootstrap.Abstractions": "[1.0.0, )", "CringePlugins": "[1.0.0, )", + "EOSSDK": "[1.0.1, )", "Microsoft.CodeAnalysis.CSharp": "[4.13.0, )", "Microsoft.Extensions.DependencyInjection": "[9.0.5, )", "Microsoft.Extensions.Http.Polly": "[9.0.5, )", @@ -451,6 +460,14 @@ } }, "net9.0-windows10.0.19041/win-x64": { + "EOSSDK": { + "type": "Transitive", + "resolved": "1.0.1", + "contentHash": "KIV+oWbAjUgIm22WmMQEQEFanWQ992F9VASVkP9JDpLHb41rN9Asco3eJM70X1V8j3PZO237KrZur0yKYkO/rg==", + "dependencies": { + "CringePlugins": "0.1.73" + } + }, "ImGui.NET.DirectX": { "type": "Transitive", "resolved": "1.91.0.1", diff --git a/CringeLauncher/CringeLauncher.csproj b/CringeLauncher/CringeLauncher.csproj index 602312f..cc8d630 100644 --- a/CringeLauncher/CringeLauncher.csproj +++ b/CringeLauncher/CringeLauncher.csproj @@ -25,6 +25,7 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/CringeLauncher/Launcher.cs b/CringeLauncher/Launcher.cs index 62d24eb..3b80268 100644 --- a/CringeLauncher/Launcher.cs +++ b/CringeLauncher/Launcher.cs @@ -1,5 +1,4 @@ -using System.Diagnostics.CodeAnalysis; -using System.Reflection; +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Loader; @@ -10,12 +9,14 @@ using CringePlugins.Loader; using CringePlugins.Render; using CringePlugins.Services; using CringePlugins.Splash; +using Epic.OnlineServices.VRage; using HarmonyLib; using Microsoft.Extensions.DependencyInjection; using NLog; using Polly; using Polly.Extensions.Http; using Sandbox; +using Sandbox.Engine.Multiplayer; using Sandbox.Engine.Networking; using Sandbox.Engine.Platform.VideoMode; using Sandbox.Engine.Utils; @@ -81,6 +82,7 @@ public class Launcher : ICorePlugin // hook up steam as we ship it inside base context as an override if (AssemblyLoadContext.GetLoadContext(typeof(Launcher).Assembly) is ICoreLoadContext coreLoadContext) NativeLibrary.SetDllImportResolver(typeof(Steamworks.Constants).Assembly, (name, _, _) => coreLoadContext.ResolveUnmanagedDll(name)); + NativeLibrary.SetDllImportResolver(typeof(EosService).Assembly, (name, _, _) => NativeLibrary.Load(Path.Join(AppContext.BaseDirectory, name))); _harmony.PatchAll(typeof(Launcher).Assembly); @@ -275,13 +277,12 @@ public class Launcher : ICorePlugin var aggregator = new MyServerDiscoveryAggregator(); MySteamGameService.InitNetworking(false, steamGameService, MyPerGameSettings.GameName, aggregator); - // MyEOSService.InitNetworking(false, false, MyPerGameSettings.GameName, steamGameService, "xyza7891964JhtVD93nm3nZp8t1MbnhC", - // "AKGM16qoFtct0IIIA8RCqEIYG4d4gXPPDNpzGuvlhLA", "24b1cd652a18461fa9b3d533ac8d6b5b", - // "1958fe26c66d4151a327ec162e4d49c8", "07c169b3b641401496d352cad1c905d6", - // "https://retail.epicgames.com/", MyEOSService.CreatePlatform(), - // MyPlatformGameSettings.VERBOSE_NETWORK_LOGGING, ArraySegment.Empty, aggregator, - // MyMultiplayer.Channels); - // EOS networking is disabled due to memory leak, waiting for update with EOSSDK >= 1.15.4 + EosService.InitNetworking(false, false, MyPerGameSettings.GameName, steamGameService, "xyza7891964JhtVD93nm3nZp8t1MbnhC", + "AKGM16qoFtct0IIIA8RCqEIYG4d4gXPPDNpzGuvlhLA", "24b1cd652a18461fa9b3d533ac8d6b5b", + "1958fe26c66d4151a327ec162e4d49c8", "07c169b3b641401496d352cad1c905d6", + "https://retail.epicgames.com/", EosService.CreatePlatform(), + MyPlatformGameSettings.VERBOSE_NETWORK_LOGGING, ArraySegment.Empty, aggregator, + MyMultiplayer.Channels); MyServiceManager.Instance.AddService(aggregator); diff --git a/CringeLauncher/packages.lock.json b/CringeLauncher/packages.lock.json index 0f95c9c..dd80bee 100644 --- a/CringeLauncher/packages.lock.json +++ b/CringeLauncher/packages.lock.json @@ -17,6 +17,15 @@ "resolved": "4.4.0", "contentHash": "cKHI720q+zfEEvzklWVGt6B0TH3AibAyJbpUJl4U6KvTP13tycfnqJpkGHRZ/oQ45BTIoIxIwltHIJVDN+iCqQ==" }, + "EOSSDK": { + "type": "Direct", + "requested": "[1.0.1, )", + "resolved": "1.0.1", + "contentHash": "KIV+oWbAjUgIm22WmMQEQEFanWQ992F9VASVkP9JDpLHb41rN9Asco3eJM70X1V8j3PZO237KrZur0yKYkO/rg==", + "dependencies": { + "CringePlugins": "0.1.73" + } + }, "Krafs.Publicizer": { "type": "Direct", "requested": "[2.3.0, )", @@ -472,6 +481,15 @@ } }, "net9.0-windows10.0.19041/win-x64": { + "EOSSDK": { + "type": "Direct", + "requested": "[1.0.1, )", + "resolved": "1.0.1", + "contentHash": "KIV+oWbAjUgIm22WmMQEQEFanWQ992F9VASVkP9JDpLHb41rN9Asco3eJM70X1V8j3PZO237KrZur0yKYkO/rg==", + "dependencies": { + "CringePlugins": "0.1.73" + } + }, "System.Diagnostics.PerformanceCounter": { "type": "Direct", "requested": "[9.0.4, )", diff --git a/SharedCringe/packages.lock.json b/SharedCringe/packages.lock.json index 53371b2..1aa164f 100644 --- a/SharedCringe/packages.lock.json +++ b/SharedCringe/packages.lock.json @@ -11,8 +11,8 @@ "SpaceEngineersDedicated.ReferenceAssemblies": { "type": "Direct", "requested": "[1.*, )", - "resolved": "1.206.30", - "contentHash": "xk/EgMhbG7oT4fPzW1DcFT8tYkxJFPK3+j+t4vms9a/wz8cCmszbilA2Y+JWIpmauUDcfovX8eqAOKlgz3dpcg==", + "resolved": "1.206.32", + "contentHash": "uFhkUUxmumct/turcfMeM2f+jJHxuiB6jAE4JMGa/AOFKCsWIr+ZWTX9hW2muEoJpUNKrzCbGrxH8ssaJUZpig==", "dependencies": { "SharpDX": "4.2.0-keen-cringe", "protobuf-net": "1.0.0" diff --git a/TestPlugin/packages.lock.json b/TestPlugin/packages.lock.json index 02f4c21..805ec3a 100644 --- a/TestPlugin/packages.lock.json +++ b/TestPlugin/packages.lock.json @@ -6,12 +6,7 @@ "type": "Direct", "requested": "[1.91.0.1, )", "resolved": "1.91.0.1", - "contentHash": "PpW1gQ9g97h6Hm/h/tkSBOmsBYgGwN8wKNmlJomcQFD/zRY1HPkJZz18XRSfRLHPmH2eeh4hhhZv1KHug7dF9g==", - "dependencies": { - "System.Buffers": "4.5.1", - "System.Numerics.Vectors": "4.5.0", - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - } + "contentHash": "PpW1gQ9g97h6Hm/h/tkSBOmsBYgGwN8wKNmlJomcQFD/zRY1HPkJZz18XRSfRLHPmH2eeh4hhhZv1KHug7dF9g==" }, "NLog": { "type": "Direct", @@ -22,8 +17,8 @@ "SpaceEngineersDedicated.ReferenceAssemblies": { "type": "Direct", "requested": "[1.*, )", - "resolved": "1.206.30", - "contentHash": "xk/EgMhbG7oT4fPzW1DcFT8tYkxJFPK3+j+t4vms9a/wz8cCmszbilA2Y+JWIpmauUDcfovX8eqAOKlgz3dpcg==", + "resolved": "1.206.32", + "contentHash": "uFhkUUxmumct/turcfMeM2f+jJHxuiB6jAE4JMGa/AOFKCsWIr+ZWTX9hW2muEoJpUNKrzCbGrxH8ssaJUZpig==", "dependencies": { "SharpDX": "4.2.0-keen-cringe", "protobuf-net": "1.0.0" @@ -38,21 +33,6 @@ "type": "Transitive", "resolved": "4.2.0-keen-cringe", "contentHash": "LaJN3h1Gi1FWVdef2I5WtOH9gwzKCBniH0CragarbkN2QheYY6Lqm+91PcOfp1w/4wdVb+k8Kjv3sO393Tphtw==" - }, - "System.Buffers": { - "type": "Transitive", - "resolved": "4.5.1", - "contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==" - }, - "System.Numerics.Vectors": { - "type": "Transitive", - "resolved": "4.5.0", - "contentHash": "QQTlPTl06J/iiDbJCiepZ4H//BVraReU4O4EoRw1U02H5TLUIT7xn3GnDp9AXPSlJUDyFs4uWjWafNX6WrAojQ==" - }, - "System.Runtime.CompilerServices.Unsafe": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==" } }, "net9.0-windows7.0/win-x64": { @@ -60,12 +40,7 @@ "type": "Direct", "requested": "[1.91.0.1, )", "resolved": "1.91.0.1", - "contentHash": "PpW1gQ9g97h6Hm/h/tkSBOmsBYgGwN8wKNmlJomcQFD/zRY1HPkJZz18XRSfRLHPmH2eeh4hhhZv1KHug7dF9g==", - "dependencies": { - "System.Buffers": "4.5.1", - "System.Numerics.Vectors": "4.5.0", - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - } + "contentHash": "PpW1gQ9g97h6Hm/h/tkSBOmsBYgGwN8wKNmlJomcQFD/zRY1HPkJZz18XRSfRLHPmH2eeh4hhhZv1KHug7dF9g==" } } }