using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using FlatPlayer;
using MelonLoader;
using Microsoft.CodeAnalysis;
using UniversalFlatPlayerCheck;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Core), "UniversalFlatPlayerCheck", "1.0.1", "NitricAcidDev", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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 UniversalFlatPlayerCheck
{
public sealed class Core : MelonMod
{
public override void OnEarlyInitializeMelon()
{
ConfigureFlatPlayerForVr();
}
private static void ConfigureFlatPlayerForVr()
{
bool flag = IsProcessRunning("vrmonitor");
bool flag2 = IsProcessRunning("OculusDash");
if (flag || flag2)
{
MelonLogger.Warning(((flag && flag2) ? "SteamVR and Oculus Dash" : (flag ? "SteamVR" : "Oculus Dash")) + " is running, opening in VR...");
MelonBase val = (MelonBase)(object)MelonAssembly.FindMelonInstance<FlatBooter>();
if (val == null)
{
MelonLogger.Error("FlatPlayer was not found. Install and enable FlatPlayer before using FlatPlayerCheck.");
}
else
{
val.Unregister("Unregistering FlatPlayer because a VR runtime is active", true);
}
}
else
{
MelonLogger.Warning("Neither SteamVR nor Oculus Dash is running, opening in FlatPlayer...");
}
}
private static bool IsProcessRunning(string processName)
{
try
{
Process[] processesByName = Process.GetProcessesByName(processName);
try
{
return processesByName.Length != 0;
}
finally
{
Process[] array = processesByName;
for (int i = 0; i < array.Length; i++)
{
array[i].Dispose();
}
}
}
catch (Exception ex)
{
MelonLogger.Error("Could not check whether " + processName + " is running: " + ex.Message);
return false;
}
}
}
}