Files
UndeadUniversalPatch/Core/Init.cs
2026-05-30 18:28:51 -04:00

53 lines
1.5 KiB
C#

// Undead Universal Patch - for patching Rec Room builds
// Copyright (C) 2026 proxnet.dev (@zombieb)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY
using BepInEx.Logging;
using HarmonyLib;
using System;
using UndeadUniversalPatch.Core.Exceptions;
namespace UndeadUniversalPatch.Core;
public static class Init
{
public static ManualLogSource Log = LoggerUtils.CreateLogSource("Init");
public static bool IsMono;
private static Harmony _hi = new(PluginInfo.Uuid);
public static void Startup(bool isMono)
{
try
{
IsMono = isMono;
if (!GetIsRecRoom()) throw new NotRecRoomException();
Log.LogInfo(LoggerUtils.MultiLine([
"Runtime Information",
$"Is Mono : {IsMono}",
$"Version : {BuildSettings.GetVersion()}",
$"Timestamp : {BuildSettings.GetBuildTimestamp()}"
]));
_hi.PatchAll();
} catch (Exception ex)
{
Log.LogError($"Failed to initialize! Something went terribly wrong!\n{ex}");
}
}
public static bool GetIsRecRoom()
{
return AccessTools.TypeByName("BootSequence") != null;
}
}