private IEnumerator LoadShaderBlacklist() { using (UnityWebRequest request = UnityWebRequest.Get("https://raw.githubusercontent.com/AtiLion/VRCExtended/master/ShaderBlacklist.txt")) { yield return(request.SendWebRequest()); if (!request.isNetworkError) { List <string> blockedShaders = new List <string>(); blockedShaders.AddRange(AntiCrasherConfig.Instance.BlacklistedShaders); foreach (string shader in request.downloadHandler.text.Split('\n')) { if (!string.IsNullOrEmpty(shader) && !blockedShaders.Contains(shader)) { blockedShaders.Add(shader); } } AntiCrasherConfig.Instance.BlacklistedShaders = blockedShaders.ToArray(); ExtendedLogger.Log("Downloaded shader blacklist!"); } else { ExtendedLogger.LogError("Failed to get shader blacklist! " + request.error); } } }
public static void Setup() { if (!File.Exists("volumes.json")) { return; } try { _volumes = JObject.Parse(File.ReadAllText("volumes.json")); foreach (JProperty property in _volumes.Properties()) { float[] volumes = new float[2] { 1f, 1f }; // 0 = User, 1 = Avatar JArray jaVol = property.Value as JArray; Volumes.Add(property.Name, volumes); volumes[0] = (float)jaVol[0]; volumes[1] = (float)jaVol[1]; } ExtendedLogger.Log("Successfully parsed volumes.json!"); } catch (Exception ex) { ExtendedLogger.LogError("Failed to parse JSON volumes.json!", ex); return; } }
void OnApplicationQuit() { if (ModManager.Mods.Count(a => a.Name == "QuitFix" && a.Author == "Herp Derpinstine") > 1) { return; } if (!File.Exists("antiCrash.json")) { File.WriteAllText("antiCrash.json", JsonConvert.SerializeObject(AntiCrasherConfig.Instance, Formatting.Indented)); ExtendedLogger.Log("Saved AntiCrasher config!"); } }
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(); }
private void AddSocialRefresh() { if (VRCEUi.SocialScreen == null) { return; } Transform currentStatus = VRCEUi.SocialScreen.transform.Find("Current Status"); Transform btnStatus = currentStatus.Find("StatusButton"); RectTransform rt_btnStatus = btnStatus.GetComponent <RectTransform>(); Transform icnStatus = currentStatus.Find("StatusIcon"); RectTransform rt_icnStatus = icnStatus.GetComponent <RectTransform>(); Transform txtStatus = currentStatus.Find("StatusText"); RectTransform rt_txtStatus = txtStatus.GetComponent <RectTransform>(); VRCEUiButton btnRefresh = new VRCEUiButton("Refresh", new Vector2(rt_btnStatus.localPosition.x - 20f, rt_btnStatus.localPosition.y), "Refresh", currentStatus); RectTransform rt_btnRefresh = btnRefresh.Control.GetComponent <RectTransform>(); rt_btnStatus.localPosition += new Vector3(210f, 0f, 0f); rt_icnStatus.localPosition += new Vector3(210f, 0f, 0f); rt_txtStatus.localPosition += new Vector3(210f, 0f, 0f); rt_btnRefresh.sizeDelta -= new Vector2(5f, 10f); btnRefresh.Button.onClick.AddListener(() => { UiUserList[] userLists = VRCEUi.SocialScreen.GetComponentsInChildren <UiUserList>(true); foreach (UiUserList userList in userLists) { userList.ClearAll(); userList.Refresh(); userList.FetchAndRenderElementsForCurrentPage(); userList.RefreshData(); } ExtendedLogger.Log("Refreshed social lists!"); }); }
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!"); }
private void AddUserInfoButtons() { if (VRCEUi.UserInfoScreen == null) { ExtendedLogger.LogError("Failed to find UserInfo screen!"); return; } Transform btnPlaylists = VRCEUi.InternalUserInfoScreen.PlaylistsButton; Transform btnFavorite = VRCEUi.InternalUserInfoScreen.FavoriteButton; Transform btnReport = VRCEUi.InternalUserInfoScreen.ReportButton; if (btnPlaylists == null || btnFavorite == null || btnReport == null) { ExtendedLogger.LogError("Failed to get required button!"); return; } Vector3 pos = btnPlaylists.GetComponent <RectTransform>().localPosition; UserInfoLastLogin = new VRCEUiText("LastLoginText", new Vector2(-470f, -130f), "", VRCEUi.UserInfoScreen.transform); UserInfoLastLogin.Text.fontSize -= 20; UserInfoMore = new VRCEUiButton("More", new Vector2(pos.x, pos.y + 75f), "More", VRCEUi.InternalUserInfoScreen.UserPanel); UserInfoMore.Button.onClick.AddListener(() => { if (Patch_PageUserInfo.SelectedAPI == null) { return; } ToggleUserInfoMore(UserInfoMore.Text.text == "More"); }); UserInfoColliderControl = new VRCEUiButton("ColliderControl", new Vector2(pos.x, pos.y - 75f), "Not in world!", VRCEUi.InternalUserInfoScreen.UserPanel); UserInfoColliderControl.Control.gameObject.SetActive(false); UserInfoColliderControl.Button.onClick.AddListener(() => { if (Patch_PageUserInfo.SelectedAPI == null) { return; } ExtendedUser user = ExtendedServer.Users.FirstOrDefault(a => a.APIUser.id == Patch_PageUserInfo.SelectedAPI.id); if (user == null) { return; } user.HasColliders = !user.HasColliders; UserInfoColliderControl.Text.text = (user.HasColliders ? "Disable colliders" : "Enable colliders"); }); UserInfoRefresh = new VRCEUiButton("Refresh", new Vector2(pos.x, pos.y), "Refresh", VRCEUi.InternalUserInfoScreen.UserPanel); UserInfoRefresh.Control.gameObject.SetActive(false); UserInfoRefresh.Button.onClick.AddListener(() => { if (Patch_PageUserInfo.SelectedAPI == null) { return; } ApiCache.Invalidate <APIUser>(Patch_PageUserInfo.SelectedAPI.id); APIUser.FetchUser(Patch_PageUserInfo.SelectedAPI.id, (APIUser user) => { PageUserInfo pageUserInfo = VRCEUi.UserInfoScreen.GetComponent <PageUserInfo>(); if (pageUserInfo != null) { pageUserInfo.SetupUserInfo(user); } }, (string error) => { ExtendedLogger.LogError(error); }); }); ExtendedLogger.Log("Setup PageUserInfo!"); }
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"); } }