From 1f99312c22024bc15f405a674649171d82b4203d Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidoS@users.noreply.github.com> Date: Sat, 12 Apr 2025 04:05:48 -0500 Subject: [PATCH] [WindowFocusCheckFix] iniyial push --- WindowFocusCheckFix/Main.cs | 39 +++++++++++++++++++ .../Properties/AssemblyInfo.cs | 32 +++++++++++++++ WindowFocusCheckFix/README.md | 14 +++++++ .../WindowFocusCheckFix.csproj | 6 +++ WindowFocusCheckFix/format.json | 23 +++++++++++ 5 files changed, 114 insertions(+) create mode 100644 WindowFocusCheckFix/Main.cs create mode 100644 WindowFocusCheckFix/Properties/AssemblyInfo.cs create mode 100644 WindowFocusCheckFix/README.md create mode 100644 WindowFocusCheckFix/WindowFocusCheckFix.csproj create mode 100644 WindowFocusCheckFix/format.json diff --git a/WindowFocusCheckFix/Main.cs b/WindowFocusCheckFix/Main.cs new file mode 100644 index 0000000..24d5de5 --- /dev/null +++ b/WindowFocusCheckFix/Main.cs @@ -0,0 +1,39 @@ +using System.Reflection; +using ABI_RC.Core; +using HarmonyLib; +using MelonLoader; +using UnityEngine; + +namespace NAK.WindowFocusCheckFix; + +public class WindowFocusCheckFixMod : MelonMod +{ + #region Melon Events + + public override void OnInitializeMelon() + { + #region WindowFocusManager Patches + + HarmonyInstance.Patch( + typeof(WindowFocusManager).GetMethod(nameof(WindowFocusManager.IsWindowFocused), + BindingFlags.NonPublic | BindingFlags.Static), + prefix: new HarmonyMethod(typeof(WindowFocusCheckFixMod).GetMethod(nameof(OnPreWindowFocusManagerIsWindowFocused), + BindingFlags.NonPublic | BindingFlags.Static)) + ); + + #endregion WindowFocusManager Patches + } + + #endregion Melon Events + + #region Harmony Patches + + // ReSharper disable once RedundantAssignment + private static bool OnPreWindowFocusManagerIsWindowFocused(ref bool __result) + { + __result = Application.isFocused; // use Unity method instead + return false; + } + + #endregion Harmony Patches +} \ No newline at end of file diff --git a/WindowFocusCheckFix/Properties/AssemblyInfo.cs b/WindowFocusCheckFix/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1f95200 --- /dev/null +++ b/WindowFocusCheckFix/Properties/AssemblyInfo.cs @@ -0,0 +1,32 @@ +using MelonLoader; +using NAK.WindowFocusCheckFix.Properties; +using System.Reflection; + +[assembly: AssemblyVersion(AssemblyInfoParams.Version)] +[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)] +[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)] +[assembly: AssemblyTitle(nameof(NAK.WindowFocusCheckFix))] +[assembly: AssemblyCompany(AssemblyInfoParams.Author)] +[assembly: AssemblyProduct(nameof(NAK.WindowFocusCheckFix))] + +[assembly: MelonInfo( + typeof(NAK.WindowFocusCheckFix.WindowFocusCheckFixMod), + nameof(NAK.WindowFocusCheckFix), + AssemblyInfoParams.Version, + AssemblyInfoParams.Author, + downloadLink: "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/WindowFocusCheckFix" +)] + +[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")] +[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] +[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)] +[assembly: MelonColor(255, 246, 25, 99)] // red-pink +[assembly: MelonAuthorColor(255, 158, 21, 32)] // red +[assembly: HarmonyDontPatchAll] + +namespace NAK.WindowFocusCheckFix.Properties; +internal static class AssemblyInfoParams +{ + public const string Version = "1.0.0"; + public const string Author = "NotAKidoS"; +} \ No newline at end of file diff --git a/WindowFocusCheckFix/README.md b/WindowFocusCheckFix/README.md new file mode 100644 index 0000000..5c2dbe0 --- /dev/null +++ b/WindowFocusCheckFix/README.md @@ -0,0 +1,14 @@ +# WindowFocusCheckFix + +Fixes window focus check on specific Linux distribution. ????!??!?! + +--- + +Here is the block of text where I tell you this mod is not affiliated with or endorsed by ABI. +https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games + +> This mod is an independent creation not affiliated with, supported by, or approved by Alpha Blend Interactive. + +> Use of this mod is done so at the user's own risk and the creator cannot be held responsible for any issues arising from its use. + +> To the best of my knowledge, I have adhered to the Modding Guidelines established by Alpha Blend Interactive. diff --git a/WindowFocusCheckFix/WindowFocusCheckFix.csproj b/WindowFocusCheckFix/WindowFocusCheckFix.csproj new file mode 100644 index 0000000..5a8badc --- /dev/null +++ b/WindowFocusCheckFix/WindowFocusCheckFix.csproj @@ -0,0 +1,6 @@ + + + + YouAreMineNow + + diff --git a/WindowFocusCheckFix/format.json b/WindowFocusCheckFix/format.json new file mode 100644 index 0000000..9fe9458 --- /dev/null +++ b/WindowFocusCheckFix/format.json @@ -0,0 +1,23 @@ +{ + "_id": -1, + "name": "WindowFocusCheckFix", + "modversion": "1.0.0", + "gameversion": "2025r179", + "loaderversion": "0.6.1", + "modtype": "Mod", + "author": "NotAKidoS", + "description": "Fixes window focus check on specific Linux distribution. ????!??!?!\n", + "searchtags": [ + "prop", + "spawn", + "friend", + "load" + ], + "requirements": [ + "None" + ], + "downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r46/WindowFocusCheckFix.dll", + "sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/WindowFocusCheckFix/", + "changelog": "- Initial Release", + "embedcolor": "#00FFFF" +} \ No newline at end of file