Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of SteamworksDirectConnect v1.0.0
SteamworksDirectConnect.dll
Decompiled 10 hours agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Steamworks Direct Connect")] [assembly: AssemblyDescription("Bypasses PlayFab lobby lookup for dedicated IP joins and connects with Steamworks directly.")] [assembly: AssemblyCompany("Zeitsurfer")] [assembly: AssemblyProduct("Steamworks Direct Connect")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SteamworksDirectConnect { [BepInPlugin("de.challengehub.steamworksdirectconnect", "Steamworks Direct Connect", "1.0.0")] public sealed class Plugin : BaseUnityPlugin { public const string PluginGuid = "de.challengehub.steamworksdirectconnect"; public const string PluginName = "Steamworks Direct Connect"; public const string PluginVersion = "1.0.0"; internal static ConfigEntry<bool> Enabled; internal static ManualLogSource Log; private Harmony _harmony; private void Awake() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Connect dedicated IP/domain entries directly through Steamworks without waiting for PlayFab lobby lookup."); _harmony = new Harmony("de.challengehub.steamworksdirectconnect"); _harmony.PatchAll(typeof(FejdStartupJoinServerPatch)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Steamworks Direct Connect 1.0.0 loaded."); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } [HarmonyPatch(typeof(FejdStartup), "JoinServer")] internal static class FejdStartupJoinServerPatch { private static void Postfix(FejdStartup __instance) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Invalid comparison between Unknown and I4 //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) if (Plugin.Enabled == null || !Plugin.Enabled.Value || (Object)(object)__instance == (Object)null) { return; } try { ServerJoinData serverToJoin = __instance.GetServerToJoin(); if (((ServerJoinData)(ref serverToJoin)).IsValid && (int)serverToJoin.m_type == 3) { ServerJoinDataDedicated dedicated = ((ServerJoinData)(ref serverToJoin)).Dedicated; string host = ((ServerJoinDataDedicated)(ref dedicated)).GetHost(); int port = dedicated.m_port; if (string.IsNullOrWhiteSpace(host) || port <= 0) { Plugin.Log.LogWarning((object)"Dedicated join entry had no usable host or port; Steamworks fallback was not applied."); return; } ZNet.SetServerHost(host, port, (OnlineBackendType)0); Plugin.Log.LogInfo((object)$"Direct Steamworks backend selected for dedicated server {host}:{port}; PlayFab lobby lookup is not required."); } } catch (Exception arg) { Plugin.Log.LogError((object)$"Could not apply direct Steamworks backend: {arg}"); } } } }