i dont rememebr

This commit is contained in:
NotAKidoS 2024-01-01 11:58:25 -06:00
parent 374ab6c11e
commit 86828a94e2
48 changed files with 1637 additions and 841 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,99 @@
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;
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;
}
}

34
FuckVivox/Main.cs Normal file
View file

@ -0,0 +1,34 @@
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));
}
public override void OnUpdate()
{
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/NotAKidOnSteam/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";
}

38
FuckVivox/VivoxHelpers.cs Normal file
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);
}
}

22
FuckVivox/format.json Normal file
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/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r21/FuckMLA.dll",
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/FuckMLA/",
"changelog": "- Initial CVRMG release",
"embedcolor": "#ffc800"
}