using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Steamworks;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("PublicHostingFix")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PublicHostingFix")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("28a60a37-ef96-4e46-aa6c-c1731de418ef")]
[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")]
namespace PublicHostingFix;
[BepInPlugin("com.real.publichostingfix", "Public Hosting Fix", "1.0.0")]
public class MyBepInExPlugin : BaseUnityPlugin
{
private static ManualLogSource logger;
private void Awake()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
logger = ((BaseUnityPlugin)this).Logger;
logger.LogInfo((object)"Plugin is loaded!");
Harmony val = new Harmony("com.real.publichostingfix");
val.PatchAll(typeof(MyBepInExPlugin));
}
[HarmonyPatch(typeof(SteamLobbyHandler), "HostMatch")]
[HarmonyPrefix]
private static bool HostMatchPatch(SteamLobbyHandler __instance, Action<ulong> _action, bool privateMatch)
{
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
FieldInfo fieldInfo = AccessTools.Field(typeof(SteamLobbyHandler), "m_Joined");
FieldInfo fieldInfo2 = AccessTools.Field(typeof(SteamLobbyHandler), "OnHostedAction");
FieldInfo fieldInfo3 = AccessTools.Field(typeof(SteamLobbyHandler), "m_MaxPlayers");
FieldInfo fieldInfo4 = AccessTools.Field(typeof(SteamLobbyHandler), "m_OnLobbyCreatedCallBack");
fieldInfo.SetValue(__instance, false);
fieldInfo2.SetValue(__instance, _action);
SteamAPICall_t val = SteamMatchmaking.CreateLobby((ELobbyType)2, (int)fieldInfo3.GetValue(__instance));
fieldInfo4.GetValue(__instance).GetType().GetMethod("Set")
.Invoke(fieldInfo4.GetValue(__instance), new object[2] { val, null });
return false;
}
}