Ejemplo n.º 1
0
 private void CreatePasteButton()
 {
     try {
         // Hey skids, if you're gonna take this and add to your mod, at least give me some credit. Much appreciated!
         _keybardPasteButton = Object.Instantiate(GameObject.Find("/UserInterface/MenuContent/Popups/InputPopup/ButtonLeft"),
                                                  VRCUiPopupManager.field_Public_VRCUiPopupInput_0.transform);
         _keybardPasteButton.GetComponent <RectTransform>().anchoredPosition = new Vector2(335f, -275f);
         _keybardPasteButton.GetComponentInChildren <Text>().text            = "Paste";
         _keybardPasteButton.name = "KeyboardPasteButton";
         _keybardPasteButton.GetComponent <Button>().onClick        = new Button.ButtonClickedEvent();
         _keybardPasteButton.GetComponent <Button>().m_Interactable = true;
         _keybardPasteButton.GetComponent <Button>().onClick.AddListener(new Action(() => {
             try {
                 if (GUIUtility.systemCopyBuffer.Length < 256)
                 {
                     GameObject.Find("UserInterface/MenuContent/Popups/InputPopup/InputField").GetComponent <InputField>().text = GUIUtility.systemCopyBuffer;
                 }
                 else
                 {
                     Logger.Warning("You cannot paste something more than 256 characters long in the keyboard.");
                 }
             }
             catch (Exception e) {
                 Logger.Error($"An error has occurred:\n{e}");
             }
         }));
         Log("Created the paste button.", _isDebug);
     }
     catch (Exception e) {
         Logger.Error($"Paste:\n{e}");
     }
 }
Ejemplo n.º 2
0
 private void OnValueChange(bool oldValue, bool newValue)
 {
     try
     {
         if (oldValue == newValue)
         {
             return;
         }
         if (newValue)
         {
             if (CurrentWorldChecked == false)
             {
                 MelonCoroutines.Start(RiskFunct.CheckWorld());
             }
             coroutine = MelonCoroutines.Start(AutoSet());
         }
         else
         {
             if (!coroutine?.Equals(null) ?? false)
             {
                 MelonCoroutines.Stop(coroutine);
             }
             Utils.SetImmobilize(false);
         }
     }
     catch (System.Exception ex) { Logger.Error("Error in starting/stopping coroutine:\n" + ex.ToString()); }
 }
Ejemplo n.º 3
0
        public override void Setup()
        {
            if (!PatchMonoExport())
            {
                Logger.Error("Failed to Bridge Il2Cpp Unity TLS! Web Connection based C# Methods may not work as intended.");
                return;
            }

            // Call InstallUnityTlsInterface Signature - Bootstrap - Il2Cpp::CallInstallUnityTLSInterface
        }
Ejemplo n.º 4
0
        private static void Integrations()
        {
            if (_amapiIntegration.Value)
            {
                if (MelonHandler.Mods.Any(x => x.Info.Name.Equals("ActionMenuApi")))
                {
                    Assets.OnApplicationStart();
                    _isUsingAmapi = true;
                }
                else
                {
                    Logger.Warning("For a better experience, please consider installing ActionMenuApi.");
                }
            }
            else
            {
                Logger.Warning("Integration with ActionMenuApi has been deactivated on Settings.");
            }

            if (_uixIntegration.Value)
            {
                if (MelonHandler.Mods.Any(x => x.Info.Name.Equals("UI Expansion Kit")))
                {
                    typeof(UIXManager).GetMethod("OnApplicationStart") !.Invoke(null, null);
                    _isUsingUix = true;
                }
                else
                {
                    Logger.Warning("For a better experience, please consider installing UIExpansionKit.");
                }
            }
            else
            {
                Logger.Warning("Integration with UIExpansionKit has been deactivated on Settings.");
            }

            if (!_amapiIntegration.Value && !_uixIntegration.Value)
            {
                Logger.Warning("Both integrations (Action Menu and UiExpansionKit) have been deactivated. " +
                               "The mod cannot run without those, therefore, expect it to fail. If this was not intended, " +
                               "please consider activating at least one of the integrations on Settings.");
            }

            if (!_isUsingAmapi && !_isUsingUix)
            {
                Logger.Error("Failed to load both integrations with UIExpansionKit and ActionMenuApi! The mod will not be loaded.");
            }
            else if (!_isUsingUix)
            {
                Logger.Warning("Using coroutine to wait for UiInit.");
Ejemplo n.º 5
0
 private void GetBlackList()
 {
     try
     {
         blackList = new Dictionary <string, System.Tuple <bool, string> >();
         string    url    = "https://raw.githubusercontent.com/Nirv-git/VRMods/main/NearClippingPlaneAdjuster/blacklist";
         WebClient client = new WebClient();
         var       temp   = client.DownloadString(url);
         using (System.IO.StringReader reader = new System.IO.StringReader(temp))
         {
             string line;
             while ((line = reader.ReadLine()) != null)
             {
                 var sub = line.Split(',');
                 if (sub.Length == 3)
                 {
                     blackList.Add(sub[0], new System.Tuple <bool, string>(bool.Parse(sub[1]), sub[2]));
                 }
             }
         }
     }
     catch (Exception ex) { Logger.Error($"GetBlackList error\n" + ex.ToString()); }
 }
Ejemplo n.º 6
0
        public static void ToggleObject()
        {
            if (!fluxObj?.Equals(null) ?? false)
            {
                try { UnityEngine.Object.Destroy(fluxObj); } catch (System.Exception ex) { Logger.Error(ex.ToString()); }
                fluxObj   = null;
                isEnabled = false;
            }
            else
            {
                GameObject obj = GameObject.Instantiate(fluxPrefab);
                GameObject cam = Camera.main.gameObject;
                obj.transform.SetParent(cam.transform);
                obj.transform.localPosition = new Vector3(0f, 0f, 0f);
                obj.layer = 5;

                fluxObj = obj;
                OnValueChange(0f, 0f);
                isEnabled = true;
            }
        }
Ejemplo n.º 7
0
        public unsafe override void Setup()
        {
            if (!PatchMonoExport())
            {
                Logger.Error("Web Connection based C# Methods may not work as intended.");
                return;
            }

            if (!PatchIl2CppExport())
            {
                Logger.Error("Web Connection based C# Methods may not work as intended.");
                return;
            }

            IntPtr unityplayer = GetUnityPlayerModule(out int unityplayer_size);

            if (unityplayer == IntPtr.Zero)
            {
                return;
            }

            IntPtr[] ptrs = null;
            if (MelonUtils.IsGame32Bit())
            {
                ptrs = CppUtils.SigscanAll(unityplayer, unityplayer_size, "A1 ?? ?? ?? ?? 85 C0 0F 85 68 01 00 00 A1 ?? ?? ?? ?? A3 ?? ?? ?? ?? A1 ?? ?? ?? ?? A3 ?? ?? ?? ?? A1 ?? ?? ?? ?? A3 ?? ?? ?? ?? A1 ?? ?? ?? ?? A3 ?? ?? ?? ?? B8 ?? ?? ?? ?? C7 05");
            }
            else
            {
                ptrs = CppUtils.SigscanAll(unityplayer, unityplayer_size, "48 8B 0D ?? ?? ?? ?? 48 85 C9 0F 85 DC 01 00 00 48 8B 05 ?? ?? ?? ?? 48 8D 0D ?? ?? ?? ?? 48 89 05 ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 89 05");
            }

            if (ptrs.Length <= 0)
            {
                if (MelonUtils.IsGame32Bit())
                {
                    ptrs = CppUtils.SigscanAll(unityplayer, unityplayer_size, "A1 ?? ?? ?? ?? 8B 0D ?? ?? ?? ?? 85 C0 0F 85 68 01 00 00 A1 ?? ?? ?? ?? A3 ?? ?? ?? ?? A1 ?? ?? ?? ?? A3 ?? ?? ?? ?? A1 ?? ?? ?? ?? A3 ?? ?? ?? ?? A1 ?? ?? ?? ?? A3 ?? ?? ?? ?? B8 ?? ?? ?? ?? C7 05");
                }
                else
                {
                    ptrs = CppUtils.SigscanAll(unityplayer, unityplayer_size, "48 8B 0D ?? ?? ?? ?? 48 8B 15 ?? ?? ?? ?? 48 85 C9 0F 85 DC 01 00 00 48 8B 05 ?? ?? ?? ?? 48 8D 0D ?? ?? ?? ?? 48 89 05 ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 89 05");
                }
            }

            if (ptrs.Length <= 0)
            {
                Logger.Error("InstallUnityTlsInterface was not found!");
                Logger.Error("Web Connection based C# Methods may not work as intended.");
                return;
            }

            foreach (IntPtr ptr in ptrs)
            {
                byte *i = (byte *)ptr.ToPointer();
                if (*i == 0 || (*i & 0xF) == 0xF)
                {
                    continue;
                }
                Logger.Msg("Calling InstallUnityTlsInterface...");
                dInstallUnityTlsInterface installUnityTlsInterface = (dInstallUnityTlsInterface)Marshal.GetDelegateForFunctionPointer(ptr, typeof(dInstallUnityTlsInterface));
                installUnityTlsInterface();
                break;
            }
        }