Lyall / AISomniumFiles2Fix

A MelonLoader mod for the game AI: THE SOMNIUM FILES - nirvanA Initiative that adds support for ultrawide/custom resolutions and more.
MIT License
10 stars 1 forks source link

Desktop mouse shows up during somnium and stays after. #8

Closed Jacob-Vanthof closed 2 years ago

Jacob-Vanthof commented 2 years ago

The desktop mouse cursor seems to show back up for some reason during somniums. It stays there until the game is restarted. Happens at 2560 x 1440 on Borderless, Fullscreen, and Windowed.

Jacob-Vanthof commented 2 years ago

So, I actually did create a semi-solution locally. I added a check for the cursor where you check to apply SMAA. It works okay, but the mouse still does occasionally show up during the Somniums after certain sequences and I have to open/close the menu to get the SMAA check to trigger.

I'm not too familiar with Unity or C# development, but would there be any possible way to check for a trigger that happens when you're in a Somnium section? Kind of curious what forces the cursor to appear again. If that was possible there could be some interesting solutions.

I should clarify as well that I'm trying to play the game with keyboard and mouse.

Lyall commented 2 years ago

Hey, sorry for replying late to this. I've added a toggle to the latest release. If you're interested in how it's done, here is the relevant code. I honestly don't know why they even set it given that the game has it's own in-game cursor.

// Mouse cursor visibility
            [HarmonyPatch(typeof(UnityEngine.Cursor), nameof(UnityEngine.Cursor.visible), MethodType.Setter)]
            [HarmonyPrefix]
            public static void CameraQualityFix(UnityEngine.Cursor __instance, ref bool __0)
            {
                if (bDisableMouseCursor.Value)
                {
                    __0 = false;
                    // Log Spam
                    // Seems to set cursor visibility a lot, :|
                    //MelonLogger.Msg("Forced mouse cursor to be invisible.");
                }
            }
Jacob-Vanthof commented 2 years ago

All good, this is perfect! I actually was toying with it some more and I think the reason why it shows up again in Somnium is because it's trying to load a custom cursor possibly during Somniums but it can't for some reason. In the first game you had the same cursor throughout, but it did appear in Somniums. I don't know why they let there be an invisible mouse floating around during Somnium exploration. The only way to prove my theory though is by extracting assets, but due to fear of spoilers I'm content with leaving this as is.

Thank you so much for the fix though! I'll close this issue.