示例#1
0
        private IEnumerator VRCToolsSetup()
        {
            yield return(VRCUiManagerUtils.WaitForUiManagerInit());

            yield return(DependenciesDownloader.CheckDownloadFiles());

            yield return(VRCModLoaderUpdater.CheckVRCModLoaderHash());

            if (ModPrefs.GetBool("vrctools", "enablediscordrichpresence"))
            {
                DiscordManager.Init();
            }
            yield return(CheckForPermissions());

            if (ModPrefs.GetBool("vrctools", "enableramexploitpatch"))
            {
                RamExploitPatcher.Patch();
            }
            VRCModNetworkStatus.Setup();
            ModConfigPage.Setup();
            ModdedUsersManager.Init();
            if (ModPrefs.GetBool("vrctools", "enablestealerdetector"))
            {
                AvatarStealerChecker.Setup();
            }


            VRCFlowManagerUtils.EnableVRCFlowManager();

            initialising = false;
            Initialised  = true;
        }
示例#2
0
        private IEnumerator VRCToolsSetup()
        {
            VRCModLogger.Log("[VRCTools] Waiting for UI Manager...");
            yield return(VRCUiManagerUtils.WaitForUiManagerInit());

            VRCModLogger.Log("[VRCTools] UIManager initialised ! Resuming setup");

            VRCModLogger.Log("[VRCTools] CheckDownloadFiles");
            yield return(DependenciesDownloader.CheckDownloadFiles());

            VRCModLogger.Log("[VRCTools] CheckVRCModLoaderHash");
            yield return(VRCModLoaderUpdater.CheckVRCModLoaderHash());

            if (ModPrefs.GetBool("vrctools", "enablediscordrichpresence"))
            {
                VRCModLogger.Log("[VRCTools] DiscordManager Init");
                DiscordManager.Init();
            }
            VRCModLogger.Log("[VRCTools] CheckForPermissions");
            yield return(CheckForPermissions());

            VRCModLogger.Log("[VRCTools] VRCModNetworkStatus Setup");
            VRCModNetworkStatus.Setup();
            VRCModLogger.Log("[VRCTools] ModConfigPage Setup");
            ModConfigPage.Setup();
            VRCModLogger.Log("[VRCTools] ModdedUsersManager Init");
            ModdedUsersManager.Init();

            VRCModLogger.Log("[VRCTools] Init done !");

            VRCFlowManagerUtils.EnableVRCFlowManager();

            initialising = false;
            Initialised  = true;
        }
示例#3
0
        public static string RoomChanged(string worldName, string worldAndRoomId, string roomIdWithTags, ApiWorldInstance.AccessType accessType, int maxPlayers)
        {
            if (!running)
            {
                return(null);
            }
            if (!worldAndRoomId.Equals(""))
            {
                if (accessType == ApiWorldInstance.AccessType.InviteOnly || accessType == ApiWorldInstance.AccessType.InvitePlus)
                {
                    presence.state          = "In a private world";
                    presence.partyId        = "";
                    presence.startTimestamp = 0;
                    if (ModPrefs.GetBool("vrctools", "allowdiscordjoinrequests") && (accessType == ApiWorldInstance.AccessType.InvitePlus))
                    {
                        presence.joinSecret = GenerateRandomString(127);
                    }
                }
                else
                {
                    string accessString = " [Unknown]";
                    if (accessType == ApiWorldInstance.AccessType.FriendsOfGuests)
                    {
                        accessString = " [Friends+]";
                    }
                    else if (accessType == ApiWorldInstance.AccessType.FriendsOnly)
                    {
                        accessString = " [Friends]";
                    }
                    else if (accessType == ApiWorldInstance.AccessType.Public)
                    {
                        accessString = "";
                    }

                    presence.state          = "in " + worldName + accessString;
                    presence.partyId        = worldAndRoomId;
                    presence.partyMax       = maxPlayers;
                    presence.startTimestamp = (long)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;

                    if (ModPrefs.GetBool("vrctools", "allowdiscordjoinrequests"))
                    {
                        presence.joinSecret = GenerateRandomString(127);
                    }
                }
            }
            else
            {
                presence.state          = "Not in a world";
                presence.partyId        = "";
                presence.partyMax       = 0;
                presence.startTimestamp = (long)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
                presence.joinSecret     = "";
            }

            DiscordRpc.UpdatePresence(ref presence);
            return(presence.joinSecret);
        }
示例#4
0
        private void OnApplicationStart()
        {
            if (!ApiCredentials.Load())
            {
                VRCModLogger.Log("No credential founds");
            }
            else
            {
                VRCModLogger.Log("Credentials:\n - Token: " + ApiCredentials.GetAuthToken() + "\n - Provider: " + ApiCredentials.GetAuthTokenProvider() + "\n - UserId: " + ApiCredentials.GetAuthTokenProviderUserId());
            }


            String lp    = "";
            bool   first = true;

            foreach (var lp2 in Environment.GetCommandLineArgs())
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    lp += " " + lp2;
                }
            }
            VRCModLogger.Log("Launch parameters:" + lp);

            ModPrefs.RegisterCategory("vrctools", "VRCTools");
            ModPrefs.RegisterPrefBool("vrctools", "remoteauthcheckasked", false, null, true);
            ModPrefs.RegisterPrefBool("vrctools", "remoteauthcheck", false, "Allow VRCModNetwork Auth");
            ModPrefs.RegisterPrefBool("vrctools", "avatarfavdownloadasked", false, null, true);
            ModPrefs.RegisterPrefBool("vrctools", "avatarfavdownload", false, "Enable AvatarFav Updater");

            ModPrefs.RegisterPrefBool("vrctools", "enablediscordrichpresence", true, "Enable Discord RichPresence");
            ModPrefs.RegisterPrefBool("vrctools", "enabledebugconsole", false, "Enable Debug Console");

            ModPrefs.RegisterPrefBool("vrctools", "hasvrcmnwtoken", false, null, true);

            ModPrefs.RegisterPrefBool("vrctools", "allowdiscordjoinrequests", true, "Allow Discord join requests");

            //Reset the credentials to ask login again if this is the first time the user login to the VRCMNW
            if (!ModPrefs.GetBool("vrctools", "hasvrcmnwtoken"))
            {
                ApiCredentials.Clear();
            }
        }
示例#5
0
        private void AddUserSpecificVolume()
        {
            if (!ModPrefs.GetBool("vrcextended", "userSpecificVolume"))
            {
                return;
            }
            if (VRCEUi.UserInfoScreen == null)
            {
                ExtendedLogger.LogError("Failed to find UserInfo screen!");
                return;
            }

            // -550 - 250f, 230f - 280f
            volVoice  = new VRCEUiVolumeControl("volumeVoice", new Vector2(-620f, -230f), "Voice", 1f, VRCEUi.UserInfoScreen.transform);
            volAvatar = new VRCEUiVolumeControl("volumeAvatar", new Vector2(-290f, -230f), "Avatar", 1f, VRCEUi.UserInfoScreen.transform);
            if (!volVoice.Success || !volAvatar.Success)
            {
                ExtendedLogger.LogError("Failed to create volume sliders on UserInfo!");
                return;
            }

            // Setup volume events
            volVoice.Slider.onValueChanged.AddListener(delegate(float volume)
            {
                if (Patch_PageUserInfo.SelectedAPI == null)
                {
                    return;
                }
                ExtendedUser user = ExtendedServer.Users.FirstOrDefault(a => a.APIUser.id == Patch_PageUserInfo.SelectedAPI.id);

                if (user == null)
                {
                    return;
                }
                user.VolumeVoice = volume;
            });

            /*volAvatar.Slider.onValueChanged.AddListener(delegate (float volume)
             * {
             *  if (Patch_PageUserInfo.SelectedUser == null)
             *      return;
             *  Patch_PageUserInfo.SelectedUser.VolumeAvatar = volume;
             * });*/
        }
示例#6
0
        private static IEnumerator CheckForPermissions()
        {
            if (!ModPrefs.GetBool("vrctools", "remoteauthcheckasked"))
            {
                VRCModLogger.Log("[VRCTools] Asking for auth");
                yield return(ShowAuthAgreePopup());

                ModPrefs.SetBool("vrctools", "remoteauthcheckasked", true);
            }
            if (ModPrefs.GetBool("vrctools", "remoteauthcheck"))
            {
                VRCModNetworkManager.ConnectAsync();
                VRCModLogger.Log("[VRCTools] Key remoteauthcheck found (true)");
                yield return(AvatarFavUpdater.CheckForAvatarFavUpdate());
            }
            else
            {
                VRCModLogger.Log("[VRCTools] Key remoteauthcheck found (false)");
            }
        }
示例#7
0
        void OnLevelWasLoaded(int level) // Level 0 = Loading Screen, Level 1 = Login Screen, Level -1 = Game
        {
            if (level == 0)
            {
                return;
            }

            if (level == 1 && !_initialized)
            {
                // Setup FPS manager
                FrameRate = Application.targetFrameRate;
                ExtendedLogger.Log("Captured default FPS: " + FrameRate);
                if (ModPrefs.GetBool("vrcextended", "unlimitedFPS"))
                {
                    Application.targetFrameRate = 0;
                }

                // Setup systems
                VRCPlayerManager.Setup();
                VRCEPlayer.Setup();

                VRCPlayerManager.OnPlayerJoined += delegate(VRCEPlayer player)
                {
                    ExtendedServer.Users.Add(new ExtendedUser(player));
                    ExtendedLogger.Log("Player joined: " + player.APIUser.displayName);
                };
                VRCPlayerManager.OnPlayerLeft += delegate(VRCEPlayer player)
                {
                    ExtendedServer.Users.Remove(new ExtendedUser(player));
                    ExtendedLogger.Log("Player left: " + player.APIUser.displayName);
                };

                _initialized = true;
                return;
            }
            ExtendedServer.Users.Clear();
        }
示例#8
0
 public static void UserChanged(string displayName)
 {
     if (!running)
     {
         return;
     }
     if (!displayName.Equals(""))
     {
         if (ModPrefs.GetBool("vrctools", "hidenameondiscord"))
         {
             presence.details = "Logged in" + " (" + (VRCTrackingManager.IsInVRMode() ? "VR" : "PC") + ")";
         }
         else
         {
             presence.details = "as " + displayName + " (" + (VRCTrackingManager.IsInVRMode() ? "VR" : "PC") + ")";
         }
         DiscordRpc.UpdatePresence(ref presence);
     }
     else
     {
         presence.details = "Not logged in" + " (" + (VRCTrackingManager.IsInVRMode() ? "VR" : "PC") + ")";
         RoomChanged("", "", "", 0, 0);
     }
 }
示例#9
0
        public static IEnumerator CheckForAvatarFavUpdate()
        {
            string avatarfavPath = Values.ModsPath + "AvatarFav.dll";

            VRCModLogger.Log("AvatarFav.dll path: " + avatarfavPath);
            string fileHash = "";

            if (ModPrefs.GetBool("vrctools", "avatarfavdownloadasked"))
            {
                VRCModLogger.Log("vrctools.avatarfavdownload: " + ModPrefs.GetBool("vrctools", "avatarfavdownload"));
                if (ModPrefs.GetBool("vrctools", "avatarfavdownload"))
                {
                    if (File.Exists(avatarfavPath))
                    {
                        using (var md5 = MD5.Create())
                        {
                            using (var stream = File.OpenRead(avatarfavPath))
                            {
                                var hash = md5.ComputeHash(stream);
                                fileHash = BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
                            }
                        }
                        VRCModLogger.Log("[VRCToolsUpdater] Local AvatarFav file hash: " + fileHash);

                        WWW hashCheckWWW = new WWW(ModValues.avatarfavCheckLink + "?localhash=" + fileHash);
                        yield return(hashCheckWWW);

                        while (!hashCheckWWW.isDone)
                        {
                            yield return(null);
                        }
                        int responseCode = WebRequestsUtils.GetResponseCode(hashCheckWWW);
                        VRCModLogger.Log("[VRCToolsUpdater] hash check webpage returned [" + responseCode + "] \"" + hashCheckWWW.text + "\"");
                        if (responseCode != 200)
                        {
                            popupClosed = false;
                            VRCUiPopupManagerUtils.ShowPopup("AvatarFav Updater", "Unable to check AvatarFav file hash", "OK", () =>
                            {
                                VRCUiPopupManagerUtils.GetVRCUiPopupManager().HideCurrentPopup();
                                popupClosed = true;
                            });
                            while (!popupClosed)
                            {
                                yield return(null);
                            }
                        }
                        else if (hashCheckWWW.text.Equals("OUTOFDATE"))
                        {
                            popupClosed = false;
                            bool download = false;
                            VRCUiPopupManagerUtils.ShowPopup("VRCTools", "An AvatarFav update is available", "Update", () =>
                            {
                                download    = true;
                                popupClosed = true;
                            }, "Ignore", () =>
                            {
                                VRCUiPopupManagerUtils.GetVRCUiPopupManager().HideCurrentPopup();
                                popupClosed = true;
                            });
                            while (!popupClosed)
                            {
                                yield return(null);
                            }

                            if (download)
                            {
                                yield return(DownloadAvatarFav(avatarfavPath));
                            }
                        }
                    }
                    else
                    {
                        yield return(DownloadAvatarFav(avatarfavPath));
                    }
                }
                else
                {
                    VRCFlowManagerUtils.EnableVRCFlowManager();
                }
            }
            else
            {
                popupClosed = false;
                bool download = false;
                VRCUiPopupManagerUtils.ShowPopup("VRCTools", "Do you want to install the AvatarFav mod ?", "Accept", () => {
                    ModPrefs.SetBool("vrctools", "avatarfavdownload", true);
                    download    = true;
                    popupClosed = true;
                }, "Deny", () => {
                    ModPrefs.SetBool("vrctools", "avatarfavdownload", false);
                    VRCUiPopupManagerUtils.GetVRCUiPopupManager().HideCurrentPopup();
                    popupClosed = true;
                });
                while (!popupClosed)
                {
                    yield return(null);
                }
                ModPrefs.SetBool("vrctools", "avatarfavdownloadasked", true);

                if (download)
                {
                    yield return(DownloadAvatarFav(avatarfavPath));
                }
            }
        }
示例#10
0
        private IEnumerator VRCToolsSetup()
        {
            initialising = true;
            VRCModLogger.Log("[VRCTools] Initialising VRCTools");
            try
            {
                OculusUtils.ApplyPatches();
            }
            catch (Exception e)
            {
                VRCModLogger.Log("[VRCTools] Error while applying Oculus patches: " + e);
            }
            yield return(VRCUiManagerUtils.WaitForUiManagerInit());

            VRCModLogger.Log("[VRCTools] Overwriting login button event");
            VRCUiPageAuthentication[] authpages = Resources.FindObjectsOfTypeAll <VRCUiPageAuthentication>();
            VRCUiPageAuthentication   loginPage = authpages.First((page) => page.gameObject.name == "LoginUserPass");

            if (loginPage != null)
            {
                Button loginButton = loginPage.transform.Find("ButtonDone (1)")?.GetComponent <Button>();
                if (loginButton != null)
                {
                    ButtonClickedEvent bce = loginButton.onClick;
                    loginButton.onClick = new ButtonClickedEvent();
                    loginButton.onClick.AddListener(() => {
                        VRCModNetworkManager.SetCredentials(GetTextFromUiInputField(loginPage.loginUserName) + ":" + GetTextFromUiInputField(loginPage.loginPassword));
                        bce?.Invoke();
                    });
                }
                else
                {
                    VRCModLogger.Log("[VRCTools] Unable to find login button in login page");
                }
            }
            else
            {
                VRCModLogger.Log("[VRCTools] Unable to find login page");
            }

            yield return(DependenciesDownloader.CheckDownloadFiles());

            yield return(VRCModLoaderUpdater.CheckVRCModLoaderHash());

            if (ModPrefs.GetBool("vrctools", "enablediscordrichpresence"))
            {
                DiscordManager.Init();
            }

            yield return(AvatarFavUpdater.CheckForAvatarFavUpdate());

            VRCModNetworkStatus.Setup();
            ModConfigPage.Setup();
            ModdedUsersManager.Init();

            /*
             * if (ApiCredentials.Load())
             * {
             *  VRCModLogger.Log("ApiCredentials.GetAuthTokenProviderUserId() => " + ApiCredentials.());
             *  if (!SecurePlayerPrefs.HasKey("vrcmnw_token_" + ApiCredentials.GetAuthTokenProviderUserId()))
             *  {
             *      ApiCredentials.Clear();
             *  }
             * }
             */
            ApiCredentials.Clear();


            VRCModLogger.Log("[VRCTools] Init done !");

            VRCUiPopupManagerUtils.GetVRCUiPopupManager().HideCurrentPopup();

            VRCFlowManagerUtils.EnableVRCFlowManager();

            initialising = false;
            Initialised  = true;

            VRCModNetworkManager.ConnectAsync();
        }
示例#11
0
        private IEnumerator VRCToolsSetup()
        {
            VRCModLogger.Log("[VRCTools] Waiting for UI Manager...");
            yield return(VRCUiManagerUtils.WaitForUiManagerInit());

            VRCModLogger.Log("[VRCTools] UIManager initialised ! Resuming setup");

            VRCModLogger.Log("[VRCTools] Overwriting login button event");
            VRCUiPageAuthentication[] authpages = Resources.FindObjectsOfTypeAll <VRCUiPageAuthentication>();
            VRCUiPageAuthentication   loginPage = authpages.First((page) => page.gameObject.name == "LoginUserPass");

            if (loginPage != null)
            {
                Button loginButton = loginPage.transform.Find("ButtonDone (1)")?.GetComponent <Button>();
                if (loginButton != null)
                {
                    ButtonClickedEvent bce = loginButton.onClick;
                    loginButton.onClick = new ButtonClickedEvent();
                    loginButton.onClick.AddListener(() => {
                        VRCModNetworkManager.SetCredentials(GetTextFromUiInputField(loginPage.loginUserName) + ":" + GetTextFromUiInputField(loginPage.loginPassword));
                        bce?.Invoke();
                    });
                }
                else
                {
                    VRCModLogger.Log("[VRCTools] Unable to find login button in login page");
                }
            }
            else
            {
                VRCModLogger.Log("[VRCTools] Unable to find login page");
            }

            VRCModLogger.Log("[VRCTools] CheckDownloadFiles");
            yield return(DependenciesDownloader.CheckDownloadFiles());

            VRCModLogger.Log("[VRCTools] CheckVRCModLoaderHash");
            yield return(VRCModLoaderUpdater.CheckVRCModLoaderHash());

            if (ModPrefs.GetBool("vrctools", "enablediscordrichpresence"))
            {
                VRCModLogger.Log("[VRCTools] DiscordManager Init");
                DiscordManager.Init();
            }
            VRCModLogger.Log("[VRCTools] CheckForPermissions");
            yield return(CheckForPermissions());

            VRCModLogger.Log("[VRCTools] VRCModNetworkStatus Setup");
            VRCModNetworkStatus.Setup();
            VRCModLogger.Log("[VRCTools] ModConfigPage Setup");
            ModConfigPage.Setup();
            VRCModLogger.Log("[VRCTools] ModdedUsersManager Init");
            ModdedUsersManager.Init();

            VRCUiManagerUtils.OnPageShown += (page) => {
                VRCModLogger.Log("[VRCTools] OnPageShown: " + page.screenType + " " + (string.IsNullOrEmpty(page.displayName) ? "" : page.displayName + " ") + "(" + page.GetType() + ")");
            };

            VRCModLogger.Log("[VRCTools] Init done !");

            VRCFlowManagerUtils.EnableVRCFlowManager();

            initialising = false;
            Initialised  = true;

            //DebugUtils.PrintHierarchy(VRCUiManagerUtils.GetVRCUiManager().transform.root, 0);
        }
示例#12
0
        void OnApplicationStart()
        {
            ExtendedLogger.Log("Loading VRCExtended...");

            // Setup config
            ModPrefs.RegisterCategory("vrcextended", "VRCExtended");

            // VRCExtended
            ModPrefs.RegisterPrefBool("vrcextended", "useDTFormat", false, "Use American format");
            ModPrefs.RegisterPrefBool("vrcextended", "fpsManagement", false, "FPS management");
            ModPrefs.RegisterPrefBool("vrcextended", "unlimitedFPS", false, "Unlimited FPS");

            // Exploits
            ModPrefs.RegisterPrefBool("vrcextended", "askUsePortal", true, "Ask to use portal");
            ModPrefs.RegisterPrefBool("vrcextended", "disablePortal", false, "Disable portals");
            ModPrefs.RegisterPrefBool("vrcextended", "antiCrasher", false, "Prevent crashers");
#if DEBUG
            ModPrefs.RegisterPrefBool("vrcextended", "avatarLimiter", false, "Avatar limiter"); // TODO
#else
            ModPrefs.RegisterPrefBool("vrcextended", "avatarLimiter", false, "Avatar limiter", true);
#endif

            // Avatar
            ModPrefs.RegisterPrefBool("vrcextended", "localColliders", false, "Local colliders");
            ModPrefs.RegisterPrefBool("vrcextended", "multiLocalColliders", false, "Others have local colliders");
            ModPrefs.RegisterPrefBool("vrcextended", "selfLocalColliders", true, "Others can touch you");
            ModPrefs.RegisterPrefBool("vrcextended", "targetHandColliders", true, "Target only hand colliders");
            ModPrefs.RegisterPrefBool("vrcextended", "fakeColliders", false, "Add fake colliders to self");
            ModPrefs.RegisterPrefBool("vrcextended", "fakeCollidersOthers", false, "Add fake colliders to others");
            ModPrefs.RegisterPrefBool("vrcextended", "ignoreInsideColliders", true, "Ignore pull colliders");
#if DEBUG
            ModPrefs.RegisterPrefBool("vrcextended", "smartColliders", false, "Use smart colliders"); // TODO
#else
            ModPrefs.RegisterPrefBool("vrcextended", "smartColliders", false, "Use smart colliders", true);
#endif

            // Players
#if DEBUG
            ModPrefs.RegisterPrefBool("vrcextended", "userSpecificVolume", false, "User specific volumes");
#else
            ModPrefs.RegisterPrefBool("vrcextended", "userSpecificVolume", false, "User specific volumes", true); // Can't get this shit to work
#endif

            // Grab the previous data
            p_anticrash             = ModPrefs.GetBool("vrcextended", "antiCrasher");
            p_localcolliders        = ModPrefs.GetBool("vrcextended", "localColliders");
            p_multilocalcolliders   = ModPrefs.GetBool("vrcextended", "multiLocalColliders");
            p_selflocalcolliders    = ModPrefs.GetBool("vrcextended", "selfLocalColliders");
            p_targetHandColliders   = ModPrefs.GetBool("vrcextended", "targetHandColliders");
            p_fakeColliders         = ModPrefs.GetBool("vrcextended", "fakeColliders");
            p_fakeCollidersOthers   = ModPrefs.GetBool("vrcextended", "fakeCollidersOthers");
            p_smartColliders        = ModPrefs.GetBool("vrcextended", "smartColliders");
            p_ignoreInsideColliders = ModPrefs.GetBool("vrcextended", "ignoreInsideColliders");
            p_unlimitedFPS          = ModPrefs.GetBool("vrcextended", "unlimitedFPS");

            // Add scripts
            ScriptObject = new GameObject();
            ScriptObject.AddComponent <PauseDetection>();
            GameObject.DontDestroyOnLoad(ScriptObject);

            // Get AntiCrasher config
            if (File.Exists("antiCrash.json"))
            {
                try
                {
                    if (JsonConvert.DeserializeObject <AntiCrasherConfig>(File.ReadAllText("antiCrash.json")).CheckBackwardsCompatibility())
                    {
                        File.WriteAllText("antiCrash.json", JsonConvert.SerializeObject(AntiCrasherConfig.Instance, Formatting.Indented));
                        ExtendedLogger.Log("Saved AntiCrasher config!");
                    }
                    ExtendedLogger.Log("Loaded AntiCrasher config!");
                }
                catch (Exception ex)
                {
                    ExtendedLogger.LogError("Failed to read/parse AntiCrasher config! Using default values...", ex);

                    AntiCrasherConfig.CreateDefault();
                }
            }
            else
            {
                AntiCrasherConfig.CreateDefault();
                ExtendedLogger.Log("Loaded default AntiCrasher config!");
            }
            if (ModManager.Mods.Any(a => a.Name == "QuitFix" && a.Author == "Herp Derpinstine") && !File.Exists("antiCrash.json"))
            {
                File.WriteAllText("antiCrash.json", JsonConvert.SerializeObject(AntiCrasherConfig.Instance, Formatting.Indented));
                ExtendedLogger.Log("Saved AntiCrasher config!");
            }

            // Get VolumeControl config
            VolumeControl.Setup();

            // Run patches
            Patch_PortalInternal.Setup();
            Patch_PageUserInfo.Setup();

            // Run coroutines
            ModManager.StartCoroutine(WaitForUIManager());
            if (ModPrefs.GetBool("vrcextended", "antiCrasher") && AntiCrasherConfig.Instance.UseOnlineBlacklist == true)
            {
                ModManager.StartCoroutine(LoadShaderBlacklist());
            }

            ExtendedLogger.Log("Loaded VRCExtended!");
        }
示例#13
0
        void OnLateUpdate()
        {
            if (p_anticrash != ModPrefs.GetBool("vrcextended", "antiCrasher"))
            {
                if (ModPrefs.GetBool("vrcextended", "antiCrasher"))
                {
                    foreach (ExtendedUser user in ExtendedServer.Users)
                    {
                        if (user == null || user.Avatar == null)
                        {
                            continue;
                        }

                        try
                        {
                            user.RemoveCrashShaders();
                            user.LimitParticles();
                            user.RemoveCrashMesh();
                        }
                        catch (Exception ex)
                        {
                            ExtendedLogger.LogError("Error enabeling anti-crasher for user " + user.APIUser.displayName, ex);
                        }
                    }
                    ExtendedLogger.Log("Enabled anti crasher!");
                }
                else
                {
                    foreach (ExtendedUser user in ExtendedServer.Users)
                    {
                        if (user == null || user.Avatar == null || user.APIUser == null)
                        {
                            continue;
                        }

                        try
                        {
                            user.RestoreCrashShaders();
                            user.RestoreParticleLimits();
                            user.RestoreCrashMesh();
                        }
                        catch (Exception ex)
                        {
                            ExtendedLogger.LogError("Error disabling anti-crasher for user " + user.APIUser.displayName, ex);
                        }
                    }
                    ExtendedLogger.Log("Disabled anti crasher!");
                }

                p_anticrash = ModPrefs.GetBool("vrcextended", "antiCrasher");
            }
            else if (p_localcolliders != ModPrefs.GetBool("vrcextended", "localColliders") ||
                     p_multilocalcolliders != ModPrefs.GetBool("vrcextended", "multiLocalColliders") ||
                     p_selflocalcolliders != ModPrefs.GetBool("vrcextended", "selfLocalColliders") ||
                     p_fakeColliders != ModPrefs.GetBool("vrcextended", "fakeColliders") ||
                     p_fakeCollidersOthers != ModPrefs.GetBool("vrcextended", "fakeCollidersOthers") ||
                     p_smartColliders != ModPrefs.GetBool("vrcextended", "smartColliders") ||
                     p_targetHandColliders != ModPrefs.GetBool("vrcextended", "targetHandColliders") ||
                     p_ignoreInsideColliders != ModPrefs.GetBool("vrcextended", "ignoreInsideColliders"))
            {
                // Clear colliders
                foreach (ExtendedUser user in ExtendedServer.Users)
                {
                    if (user != null && user.Avatar != null)
                    {
                        user.RemoveLocalColliders();
                    }
                }
                // Add them back settings based
                foreach (ExtendedUser user in ExtendedServer.Users)
                {
                    if (user != null && user.Avatar != null)
                    {
                        user.OnAvatarCreated();
                    }
                }

                p_localcolliders        = ModPrefs.GetBool("vrcextended", "localColliders");
                p_multilocalcolliders   = ModPrefs.GetBool("vrcextended", "multiLocalColliders");
                p_selflocalcolliders    = ModPrefs.GetBool("vrcextended", "selfLocalColliders");
                p_fakeColliders         = ModPrefs.GetBool("vrcextended", "fakeColliders");
                p_fakeCollidersOthers   = ModPrefs.GetBool("vrcextended", "fakeCollidersOthers");
                p_smartColliders        = ModPrefs.GetBool("vrcextended", "smartColliders");
                p_targetHandColliders   = ModPrefs.GetBool("vrcextended", "targetHandColliders");
                p_ignoreInsideColliders = ModPrefs.GetBool("vrcextended", "ignoreInsideColliders");
                ExtendedLogger.Log("Reloaded local colliders!");
            }
            else if (p_unlimitedFPS != ModPrefs.GetBool("vrcextended", "unlimitedFPS"))
            {
                if (ModPrefs.GetBool("vrcextended", "unlimitedFPS"))
                {
                    Application.targetFrameRate = 0;
                }
                else
                {
                    Application.targetFrameRate = FrameRate;
                }
                p_unlimitedFPS = ModPrefs.GetBool("vrcextended", "unlimitedFPS");
            }
        }