Move many mods to Deprecated folder, fix spelling

This commit is contained in:
NotAKidoS 2025-04-03 02:57:35 -05:00
parent 5e822cec8d
commit 0042590aa6
539 changed files with 7475 additions and 3120 deletions

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RootNamespace>FuckMLA</RootNamespace>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,142 @@
using System.ComponentModel;
using ABI_RC.Core.Networking;
using ABI_RC.Systems.Communications;
using DarkRift.Client;
using FuckMLA;
using HarmonyLib;
using UnityEngine;
using Unity.Services.Vivox;
using ABI_RC.Core.Player;
using ABI_RC.Core;
namespace NAK.FuckVivox.HarmonyPatches;
internal class VivoxServiceInternalPatches
{
// This is to catch some dumb issue where channel might not exist. There is no return even though the error is logged... -_-
[HarmonyPrefix]
[HarmonyPatch(typeof(VivoxServiceInternal), nameof(VivoxServiceInternal.Set3DPosition),
typeof(Vector3), typeof(Vector3), typeof(Vector3),
typeof(Vector3), typeof(string), typeof(bool))]
private static void Prefix_VivoxServiceInternal_Set3DPosition(
Vector3 speakerPos, Vector3 listenerPos, Vector3 listenerAtOrient, Vector3 listenerUpOrient,
string channelName, bool allowPanning,
ref ILoginSession ___m_LoginSession,
ref bool __runOriginal)
{
__runOriginal = true;
try
{
IChannelSession channelSession = ___m_LoginSession.ChannelSessions.FirstOrDefault(channel =>
channel.Channel.Type == ChannelType.Positional && channel.Channel.Name == channelName);
if (channelSession != null)
return; // no~ fuck you
__runOriginal = false;
FuckVivox.Logger.Msg("Caught an unhandled VivoxServiceInternal error.");
}
catch (Exception e)
{
FuckVivox.Logger.Error(e.ToString());
__runOriginal = false;
}
}
// This is to prevent a race condition between OnLoggedOut and OnConnectionFailedToRecover
[HarmonyPrefix]
[HarmonyPatch(typeof(VivoxServiceManager), nameof(VivoxServiceManager.OnConnectionFailedToRecover))]
private static void Prefix_VivoxServiceInternal_OnConnectionFailedToRecover(ref bool __runOriginal)
{
__runOriginal = false;
FuckVivox.Logger.Msg("(OnConnectionFailedToRecover) Possibly prevented a double re-login attempt!");
}
// This is to log us out until our connection stabilizes
[HarmonyPrefix]
[HarmonyPatch(typeof(NetworkManager), nameof(NetworkManager.ReconnectToGameServer))]
private static void Prefix_NetworkManager_ReconnectToGameServer()
{
//FuckVivox.Logger.Msg("CONNECTION UNSTABLE, PANIC LOGOUT!!!");
//VivoxHelpers.AttemptLogout();
}
[HarmonyPrefix]
[HarmonyPatch(typeof(NetworkManager), nameof(NetworkManager.OnGameNetworkConnected))]
private static void Prefix_NetworkManager_OnGameNetworkConnected()
{
if (VivoxServiceManager.Instance.IsLoggedIn())
return;
//FuckVivox.Logger.Msg("(OnGameNetworkConnected) Not logged into Vivox. Connection is potentially stable now, so attempting to login.");
//VivoxHelpers.AttemptLogin();
}
// This is to potentially fix an issue where on quick restart, we are in a channel before the bind attempts to add it???
[HarmonyPrefix]
[HarmonyPatch(typeof(VivoxServiceInternal), nameof(VivoxServiceInternal.OnChannelPropertyChanged))]
private static void Prefix_VivoxServiceInternal_OnChannelPropertyChanged(
object sender, PropertyChangedEventArgs args,
ref VivoxServiceInternal __instance,
ref bool __runOriginal)
{
__runOriginal = true;
IChannelSession channelSession = (IChannelSession)sender;
if (args.PropertyName != "ChannelState" || channelSession.ChannelState != ConnectionState.Connected)
return;
if (!__instance.m_ActiveChannels.ContainsKey(channelSession.Channel.Name))
return;
FuckVivox.Logger.Warning($"Active Channel already contains key! :: + {channelSession.Channel.Name}");
__runOriginal = false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(InputManager), nameof(InputManager.OnApplicationFocus))]
private static void Prefix_InputManager_OnApplicationFocus(bool hasFocus)
{
FuckVivox.Logger.Msg("OnApplicationFocus: " + hasFocus);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(RootLogic), nameof(RootLogic.CursorLock))]
private static void Prefix_RootLogic_CursorLock(bool value)
{
FuckVivox.Logger.Msg("CursorLock:" + value);
}
private static bool _isFocused = false;
[HarmonyPrefix]
[HarmonyPatch(typeof(InputManager), nameof(InputManager.LateUpdate))]
private static void Prefix_InputManager_LateUpdate()
{
if (Application.isFocused == _isFocused)
return;
_isFocused = Application.isFocused;
FuckVivox.Logger.Msg("Application.isFocused Updated!: " + _isFocused);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(InputManager), nameof(InputManager.Start))]
private static void Prefix_InputManager_Start()
{
Application.focusChanged += Test;
}
private static void Test(bool value)
{
FuckVivox.Logger.Msg("Application.focusChanged! " + value);
}
}

View file

@ -0,0 +1,43 @@
using FuckMLA;
using MelonLoader;
using UnityEngine.Windows;
namespace NAK.FuckVivox;
public class FuckVivox : MelonMod
{
internal static MelonLogger.Instance Logger;
public override void OnInitializeMelon()
{
Logger = LoggerInstance;
ApplyPatches(typeof(HarmonyPatches.VivoxServiceInternalPatches));
WindowFocusManager.OnFocusStateChanged += OnFocusChanged;
}
private void OnFocusChanged(bool value)
{
Logger.Msg("WindowFocusManager.OnFocusStateChanged " + value);
}
public override void OnUpdate()
{
WindowFocusManager.CheckWindowFocusedState();
if (UnityEngine.Input.GetKeyDown(UnityEngine.KeyCode.F11))
VivoxHelpers.PleaseReLoginThankYou();
}
private void ApplyPatches(Type type)
{
try
{
HarmonyInstance.PatchAll(type);
}
catch (Exception e)
{
LoggerInstance.Msg($"Failed while patching {type.Name}!");
LoggerInstance.Error(e);
}
}
}

View file

@ -0,0 +1,32 @@
using MelonLoader;
using NAK.FuckVivox.Properties;
using System.Reflection;
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyTitle(nameof(NAK.FuckVivox))]
[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
[assembly: AssemblyProduct(nameof(NAK.FuckVivox))]
[assembly: MelonInfo(
typeof(NAK.FuckVivox.FuckVivox),
nameof(NAK.FuckVivox),
AssemblyInfoParams.Version,
AssemblyInfoParams.Author,
downloadLink: "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/FuckVivox"
)]
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
[assembly: MelonColor(255, 155, 89, 182)]
[assembly: MelonAuthorColor(255, 158, 21, 32)]
[assembly: HarmonyDontPatchAll]
namespace NAK.FuckVivox.Properties;
internal static class AssemblyInfoParams
{
public const string Version = "1.0.0";
public const string Author = "NotAKidoS";
}

View file

@ -0,0 +1,38 @@
using ABI_RC.Core.IO;
using ABI_RC.Core.Networking;
using ABI_RC.Core.Savior;
using ABI_RC.Systems.Communications;
using NAK.FuckVivox;
namespace FuckMLA;
public static class VivoxHelpers
{
public static void AttemptLogin()
{
if (!AuthManager.IsAuthenticated)
{
FuckVivox.Logger.Msg("Attempted to log in without being authenticated!");
return;
}
VivoxServiceManager.Instance.Login(MetaPort.Instance.ownerId, MetaPort.Instance.blockedUserIds);
}
public static void AttemptLogout()
{
if (!VivoxServiceManager.Instance.IsLoggedIn())
{
FuckVivox.Logger.Msg("Attempted to log out when not logged in.");
return;
}
VivoxServiceManager.Instance.Logout();
}
public static void PleaseReLoginThankYou()
{
FuckVivox.Logger.Msg("PleaseReLoginThankYou!!!");
AttemptLogout();
SchedulerSystem.AddJob(AttemptLogin, 3f, 1, 1);
}
}

View file

@ -0,0 +1,51 @@
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace FuckMLA;
// We are manually checking if the window is focused because Unity is cool:
// Application.isFocused is true on startup, even when launched in background
// Application.focusChanged & MonoBehaviour.OnApplicationFocus is only called on second focus
// :)))))))))))))))
public static class WindowFocusManager
{
[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();
// [DllImport("user32.dll", SetLastError = true)] // detected melon console, that is stinky >:(
// private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
private static bool lastFocusState;
private static IntPtr mainWindowHandle;
public static Action<bool> OnFocusStateChanged;
static WindowFocusManager()
{
Initialize();
}
private static async void Initialize()
{
//await Task.Delay(1000); // delay to ensure the main window handle is available
Process process = Process.GetCurrentProcess();
mainWindowHandle = process.MainWindowHandle;
lastFocusState = IsWindowFocused();
}
private static bool IsWindowFocused()
{
IntPtr foregroundWindow = GetForegroundWindow();
return foregroundWindow == mainWindowHandle;
}
public static void CheckWindowFocusedState()
{
bool currentFocusState = IsWindowFocused();
if (currentFocusState == lastFocusState)
return;
lastFocusState = currentFocusState;
OnFocusStateChanged?.Invoke(currentFocusState);
}
}

View file

@ -0,0 +1,22 @@
{
"_id": -1,
"name": "FuckMLA",
"modversion": "1.0.0",
"gameversion": "2023r172",
"loaderversion": "0.6.1",
"modtype": "Mod",
"author": "NotAKidoS",
"description": "A simple mod that does three basic things:\n\n- Destroys MOUSELOCKALPHA, the script that locks your mouse on startup.\n- Forces mouse to be initially unlocked when launching the game in VR.\n- Fixes mouse rotating player when cursor is unlocked.",
"searchtags": [
"mouse",
"lock",
"no",
"bad"
],
"requirements": [
],
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r21/FuckMLA.dll",
"sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/FuckMLA/",
"changelog": "- Initial CVRMG release",
"embedcolor": "#ffc800"
}