Example #1
0
        private static void GetNewInstancePrefix(ref string tags)
        {
            MelonLogger.Msg("Mono Stacktrace:\n" + new StackTrace().ToString());
            MelonLogger.Msg("Il2Cpp Stacktrace:\n" + new Il2CppSystem.Diagnostics.StackTrace().ToString());
            ServerDef targetServer;

            if (new StackTrace().GetFrame(2).GetMethod().DeclaringType == typeof(PopupRoomInstance))
            {
                targetServer = serverList[serverDropdown.value];
            }
            else
            {
                targetServer = ss.AppSettings.UseNameServer ? ServerDef.CloudServer("", ss.AppSettings.FixedRegion, ss.AppSettings.AppIdRealtime, ss.AppSettings.AppVersion) : ServerDef.DedicatedServer("", ss.AppSettings.Server, ss.AppSettings.Port);
            }

            if (targetServer != defaultServer)
            {
                if (targetServer.cloud)
                {
                    tags += "~cloud(" + targetServer.region + "," + targetServer.appId + "," + targetServer.appVersion + ")";
                }
                else
                {
                    tags += "~server(" + targetServer.address + "," + targetServer.port + ")";
                }
            }

            MelonLogger.Msg("generated instance id: " + tags);
        }
        private static void GetNewInstancePrefix(ref string tags)
        {
            ServerDef targetServer;

            if (new StackTrace().GetFrame(2).GetMethod().DeclaringType == typeof(PopupRoomInstance))
            {
                targetServer = serverList[serverDropdown.value];
            }
            else
            {
                targetServer = ss.AppSettings.UseNameServer ? ServerDef.CloudServer("", ss.AppSettings.FixedRegion, ss.AppSettings.AppIdRealtime, ss.AppSettings.AppVersion) : ServerDef.DedicatedServer("", ss.AppSettings.Server, ss.AppSettings.Port);
            }

            if (targetServer != defaultServer)
            {
                if (targetServer.cloud)
                {
                    tags += "~cloud(" + targetServer.region + "," + targetServer.appId + "," + targetServer.appVersion + ")";
                }
                else
                {
                    tags += "~server(" + targetServer.address + "," + targetServer.port + ")";
                }
            }
        }
Example #3
0
        public override bool Equals(object obj)
        {
            if (obj == null || obj.GetType() != typeof(ServerDef))
            {
                return(false);
            }

            ServerDef s = (ServerDef)obj;

            return(s.cloud == cloud && s.cloud ? (s.region == region && s.appId == appId && s.appVersion == appVersion) : (s.address == address && s.port == port));
        }
Example #4
0
        private IEnumerator InitAfterFrame()
        {
            yield return(null);

            //ss = PhotonNetwork.field_Public_Static_ServerSettings_0;
            ss = PhotonNetwork.PhotonServerSettings;
            MelonLogger.Msg("ss: " + ss?.ToString() ?? "null");
            MelonLogger.Msg("AppSettings: " + ss?.AppSettings?.ToString() ?? "null");

            defaultServer = ServerDef.CloudServer("VRChat Cloud Server USW", ss.AppSettings.FixedRegion, ss.AppSettings.AppIdRealtime, ss.AppSettings.AppVersion);

            foreach (string text in Environment.GetCommandLineArgs())
            {
                if (text.StartsWith("--photonUseNS="))
                {
                    string value = text.Substring("--photonUseNS=".Length);
                    if (value == "false" || value == "0")
                    {
                        Log("setting UserNameServer to false. Old value was " + ss.AppSettings.UseNameServer);
                        ss.AppSettings.UseNameServer = false;
                    }
                    else if (value == "true" || value == "1")
                    {
                        Log("setting UserNameServer to true. Old value was " + ss.AppSettings.UseNameServer);
                        ss.AppSettings.UseNameServer = true;
                    }
                    else
                    {
                        Log("--photonUseNS was passed with an invalid value");
                    }
                }
                else if (text.StartsWith("--photonFixedRegion="))
                {
                    Log("setting FixedRegion to " + text.Substring("--photonFixedRegion=".Length) + ". Old value was " + ss.AppSettings.FixedRegion);
                    ss.AppSettings.FixedRegion = text.Substring("--photonFixedRegion=".Length);
                }
                else if (text.StartsWith("--photonServer="))
                {
                    Log("setting Server to " + text.Substring("--photonServer=".Length) + ". Old value was " + ss.AppSettings.Server);
                    ss.AppSettings.Server = text.Substring("--photonServer=".Length);
                }
                else if (text.StartsWith("--photonPort="))
                {
                    if (int.TryParse(text.Substring("--photonPort=".Length), out int valueInt))
                    {
                        Log("setting Port to " + valueInt + ". Old value was " + ss.AppSettings.Port);
                        ss.AppSettings.Port = valueInt;
                        Log("Port set to " + ss.AppSettings.Port);
                    }
                    else
                    {
                        Log("--photonPort was passed with an invalid value");
                    }
                }
                else if (text.StartsWith("--photonId"))
                {
                    //Log("setting Id to " + text.Substring("--photonId=".Length) + ". Old value was " + VRCApplicationSetup.field_Private_Static_VRCApplicationSetup_0.gameServerVersionOverride);
                    //VRCApplicationSetup.field_Private_Static_VRCApplicationSetup_0.gameServerVersionOverride = text.Substring("--photonId=".Length);
                    //Log("Id set to " + VRCApplicationSetup.field_Private_Static_VRCApplicationSetup_0.gameServerVersionOverride);
                    Log("setting Id to " + text.Substring("--photonId=".Length) + ". Old value was " + VRCApplicationSetup.Instance.gameServerVersionOverride);
                    VRCApplicationSetup.Instance.gameServerVersionOverride = text.Substring("--photonId=".Length);
                    Log("Id set to " + VRCApplicationSetup.Instance.gameServerVersionOverride);
                }
            }

            MelonLogger.Msg("Waiting for InitUI");

            yield return(null);// InitUI();

            MelonLogger.Msg("Done InitUI");
        }
Example #5
0
        private IEnumerator InitUI()
        {
            PopupRoomInstance[] pris;
            while ((pris = Resources.FindObjectsOfTypeAll <PopupRoomInstance>()).Length == 0)
            {
                yield return(null);
            }

            PopupRoomInstance pri = pris[0];

            RectTransform nameTextRT = pri.transform.Find("Popup/NameText").GetComponent <RectTransform>();

            nameTextRT.GetComponent <Text>().alignment = TextAnchor.MiddleLeft;



            byte[] data = Properties.Resources.dropdown;
            AssetBundleCreateRequest request = AssetBundle.LoadFromMemoryAsync(data);

            while (!request.isDone)
            {
                yield return(null);
            }
            if (request.assetBundle == null)
            {
                MelonLogger.Error("Unable to load dropdown Assetbundle");
                yield break;
            }

            //Load main prefab
            AssetBundleRequest abrMain = request.assetBundle.LoadAssetWithSubAssetsAsync("Assets/Prefabs/Dropdown.prefab");

            while (!abrMain.isDone)
            {
                yield return(null);
            }
            if (abrMain.asset == null)
            {
                MelonLogger.Error("Unable to load Dropdown prefab from Assetbundle (prefab is null)");
                yield break;
            }
            Dropdown prefab = abrMain.asset.Cast <GameObject>().GetComponent <Dropdown>();

            if (prefab == null)
            {
                MelonLogger.Error("Invalid Dropdown prefab: Missing Dropdown script");
                yield break;
            }

            Log("Dropdown prefab is valid");

            serverDropdown = GameObject.Instantiate(prefab, pri.GetComponent <RectTransform>());
            RectTransform ddRT = serverDropdown.GetComponent <RectTransform>();

            ddRT.localPosition += new Vector3(250, 150);
            ddRT.sizeDelta     += new Vector2(200, 0);

            //defaultServer.appVersion = GameObject.FindObjectOfType<VRCApplicationSetup>().Method_Public_String_2();
            defaultServer.appVersion = GameObject.FindObjectOfType <VRCApplicationSetup>().appVersion;

            serverList = new List <ServerDef> {
                defaultServer, ServerDef.DedicatedServer("Slaynash EUW Server", "31.204.91.102", 5055)                               /*, ServerDef.DedicatedServer("Local Server", "127.0.0.1", 5055)*/
            };
            serverDropdown.ClearOptions();
            Il2CppSystem.Collections.Generic.List <string> options = new Il2CppSystem.Collections.Generic.List <string>(serverList.Count);
            foreach (ServerDef serverdef in serverList)
            {
                options.Add(serverdef.name);
            }
            serverDropdown.AddOptions(options);
        }