using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using HarmonyLib.Tools; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ultrakillbutitlookslikegarbage")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ultrakillbutitlookslikegarbage")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("01f564ef-5371-465b-8ec5-9e143281b7be")] [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 UltrakillTimerFix; [BepInPlugin("UltrakillTimerFix", "Ultrakill Timer Fix", "1.0.0")] public class TimerFix : BaseUnityPlugin { [HarmonyPatch(typeof(OnLevelStart), "StartLevel")] public class ResetTimer { public static bool Prefix(bool startTimer = true, bool startMusic = true) { if (startTimer) { timestamp = Time.time; } return true; } } [HarmonyPatch(typeof(StatsManager), "Update")] public class PatchUpdateTimer { public static bool Prefix(StatsManager __instance, ref NewMovement ___nm) { if ((Input.GetKeyDown((KeyCode)114) || (!MonoSingleton.Instance.PerformingCheatMenuCombo() && MonoSingleton.Instance.InputSource.Fire1.WasPerformedThisFrame)) && ___nm.hp <= 0 && !___nm.endlessMode && !MonoSingleton.Instance.paused) { __instance.Restart(); } if (__instance.timer) { __instance.seconds = Time.time - timestamp; } else if (__instance.stylePoints < 0) { __instance.stylePoints = 0; } if (!__instance.endlessMode) { DiscordController.UpdateStyle(__instance.stylePoints); } return false; } } [HarmonyPatch(typeof(CutsceneSkip), "LateUpdate")] public class CutsceneFixer { public static bool Prefix(CutsceneSkip __instance, ref bool ___waitingForInput, ref float ___timeLeft, ref bool ___printLengthOfCutscene) { if (___waitingForInput && MonoSingleton.Instance.InputSource.Pause.WasPerformedThisFrame) { ___waitingForInput = false; ___printLengthOfCutscene = false; if (MonoSingleton.Instance.paused) { MonoSingleton.Instance.UnPause(); } __instance.onSkip.Invoke(""); MonoSingleton.Instance.Hide(); if (___timeLeft > 0f) { timestamp -= ___timeLeft; MonoSingleton.Instance.Charge(___timeLeft); } } return false; } } public static float timestamp; private void Awake() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) HarmonyFileLog.Enabled = true; new Harmony("UltrakillTimerFix").PatchAll(); } }