public void initButton(int btnXLocation, int btnYLocation, String btnText, String btnToolTip, Nullable <Color> btnBackgroundColor = null, Nullable <Color> btnTextColor = null, Nullable <Color> backbtnBackgroundColor = null, Nullable <Color> backbtnTextColor = null) { Transform menu = UnityEngine.Object.Instantiate(QuickMenuStuff.GetQuickMenuInstance().transform.Find("CameraMenu"), QuickMenuStuff.GetQuickMenuInstance().transform); menuName = "CustomMenu" + btnQMLoc + "_" + btnXLocation + "_" + btnYLocation; menu.name = menuName; mainButton = new QMSingleButton(btnQMLoc, btnXLocation, btnYLocation, btnText, new Action(() => { QuickMenuStuff.ShowQuickmenuPage(menuName); }), btnToolTip, btnBackgroundColor, btnTextColor); IEnumerator enumerator = menu.transform.GetEnumerator(); while (enumerator.MoveNext()) { Il2CppSystem.Object obj = enumerator.Current; Transform btnEnum = obj.Cast <Transform>(); if (btnEnum != null) { UnityEngine.Object.Destroy(btnEnum.gameObject); } } if (backbtnTextColor == null) { backbtnTextColor = Color.yellow; } backButton = new QMSingleButton(this, 4, 2, "Back", new Action(() => { QuickMenuStuff.ShowQuickmenuPage(btnQMLoc); }), "Go Back", backbtnBackgroundColor, backbtnTextColor); }
public void initButton(int btnXLocation, int btnYLocation, String btnText, String btnToolTip, Color?btnBackgroundColor = null, Color?btnTextColor = null, Color?backbtnBackgroundColor = null, Color?backbtnTextColor = null) { btnType = "NestedButton"; Transform menu = UnityEngine.Object.Instantiate <Transform>(QMStuff.NestedMenuTemplate(), QMStuff.GetQuickMenuInstance().transform); menuName = QMButtonAPI.identifier + btnQMLoc + "_" + btnXLocation + "_" + btnYLocation; menu.name = menuName; mainButton = new QMSingleButton(btnQMLoc, btnXLocation, btnYLocation, btnText, () => { QMStuff.ShowQuickmenuPage(menuName); }, btnToolTip, btnBackgroundColor, btnTextColor); Il2CppSystem.Collections.IEnumerator enumerator = menu.transform.GetEnumerator(); while (enumerator.MoveNext()) { Il2CppSystem.Object obj = enumerator.Current; Transform btnEnum = obj.Cast <Transform>(); if (btnEnum != null) { UnityEngine.Object.Destroy(btnEnum.gameObject); } } if (backbtnTextColor == null) { backbtnTextColor = Color.yellow; } QMButtonAPI.allNestedButtons.Add(this); backButton = new QMSingleButton(this, 5, 2, "Back", () => { QMStuff.ShowQuickmenuPage(btnQMLoc); }, "Go Back", backbtnBackgroundColor, backbtnTextColor); }
public Il2CppSystem.IAsyncResult BeginInvoke( T0 arg0, T1 arg1, Il2CppSystem.AsyncCallback callback, Il2CppSystem.Object @object) { return(null); }
private static bool OpRaiseEvent(byte __0, Il2CppSystem.Object __1, Photon.Realtime.RaiseEventOptions __2, SendOptions __3) // events sent by you { // event code == 4 if (__0 == 4) // 4 is sending cached events { return(DataOKToSend(__1)); } return(true); }
public static WindowBase InspectObject(object obj, out bool createdNew, bool forceReflection = false) { createdNew = false; //if (InputManager.GetKey(KeyCode.LeftShift)) //{ // forceReflection = true; //} #if CPP Il2CppSystem.Object iObj = null; if (obj is Il2CppSystem.Object isObj) { iObj = isObj; } #else var iObj = obj; #endif if (!forceReflection) { foreach (var window in Windows) { bool equals = ReferenceEquals(obj, window.Target); #if CPP if (!equals && iObj is Il2CppSystem.Object iCurrent && window.Target is Il2CppSystem.Object iTarget) { if (iCurrent.GetIl2CppType().FullName != iTarget.GetIl2CppType().FullName) { if (iCurrent is Transform transform) { iCurrent = transform.gameObject; } } equals = iCurrent.Pointer == iTarget.Pointer; } #endif if (equals) { FocusWindow(window); return(window); } } } createdNew = true; if (!forceReflection && (obj is GameObject || obj is Transform)) { return(InspectGameObject(obj as GameObject ?? (obj as Transform).gameObject)); } else { return(InspectReflection(obj)); } }
public static bool Prefix(Type t, int controlID, out Object __result) { if (!s_StateCache.TryGetValue(controlID, out __result) || __result.GetIl2CppType() != t) { s_StateCache[controlID] = __result = t.GetConstructor(new Il2CppReferenceArray <Type>(0)).Invoke(null, new Il2CppReferenceArray <Object>(0)); } return(false); }
public static Il2CppSystem.Object DynamicCast(this Il2CppSystem.Object obj, Il2CppSystem.Type type) { var mi = obj.GetIl2CppType().GetMethod("Cast"); var genericArg = new Il2CppReferenceArray <Il2CppSystem.Type>(1); genericArg[0] = type; var fooRef = mi.MakeGenericMethod(genericArg); return(fooRef.Invoke(obj, null)); }
private static bool UIListPatch(VRCUiContentButton __0, Il2CppSystem.Object __1) { if (__1.Cast <ApiAvatar>().releaseStatus == "public") { __0.transform.Find("TitleText").GetComponent <Text>().color = Color.green; } else { __0.transform.Find("TitleText").GetComponent <Text>().color = Color.red; } return(true); }
// this is greengrays code, we had this shit for ages to reverse il2cpp stuff, i already know 69 people are gonna paste this cuz it so good :) // https://github.com/GreengrayZ public static byte[] ToByteArray(Il2CppSystem.Object obj) { if (obj == null) { return(null); } var bf = new Il2CppSystem.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); var ms = new Il2CppSystem.IO.MemoryStream(); bf.Serialize(ms, obj); return(ms.ToArray()); }
private static bool OpRaiseEventPrefix(ref byte __0, ref Il2CppSystem.Object __1, ref ObjectPublicObByObInByObObUnique __2, ref SendOptions __3) { try { if (__0 == 7) { return(!GeneralUtils.CustomSerialization); } } catch { } return(true); }
public void ClearButtons() { Il2CppSystem.Collections.IEnumerator enumerator = CachedMenu.transform.GetEnumerator(); while (enumerator.MoveNext()) { Il2CppSystem.Object obj = enumerator.Current; Transform btnEnum = obj.Cast <Transform>(); if (btnEnum != null) { UnityEngine.Object.Destroy(btnEnum.gameObject); } } }
public static Object[] getRPCObjectEmf(int i, Vector3 pos, int type = 0) { Debug.Msg("getRPCObjectEmf", 3); Object[] obj = new Object[i]; if (i > 0) { Vector3 vector = default(Vector3); Int32 integer = default(Int32); vector = pos; integer.m_value = type; obj[0] = vector.BoxIl2CppObject(); obj[1] = integer.BoxIl2CppObject(); } return(obj); }
public static void ClearPage(string pagename) { QuickMenu quickmenu = GetQuickMenuInstance(); Transform pageTransform = quickmenu?.transform.Find(pagename); Il2CppSystem.Collections.IEnumerator enumerator = pageTransform.transform.GetEnumerator(); while (enumerator.MoveNext()) { Il2CppSystem.Object obj = enumerator.Current; Transform btnEnum = obj.Cast <Transform>(); if (btnEnum != null) { UnityEngine.Object.Destroy(btnEnum.gameObject); } } }
public UserInfoExtensionsAPIUser(Il2CppSystem.Object jsonObject) { if (jsonObject == null) { return; } Il2CppSystem.Collections.Generic.Dictionary <string, Il2CppSystem.Object> jsonDictionary = jsonObject.Cast <Il2CppSystem.Collections.Generic.Dictionary <string, Il2CppSystem.Object> >(); if (jsonDictionary.ContainsKey("id")) { Id = jsonDictionary.get_Item("id").ToString(); } if (jsonDictionary.ContainsKey("date_joined")) { DateJoined = jsonDictionary.get_Item("date_joined").ToString(); } }
private static bool ButtonPatch(VRCUiContentButton __0, Il2CppSystem.Object __1) { try { APIUser oof = __1.Cast <APIUser>(); if (oof.tags.Contains("admin_moderator")) { __0.field_Public_Text_0.color = UnityEngine.Color.red; } else if (oof.tags.Contains("system_legend")) { __0.field_Public_Text_0.color = new Color(1f, 1f, 1f); } else if (oof.tags.Contains("system_trust_legend")) { __0.field_Public_Text_0.color = new Color(1f, 1f, 0f); } else if (oof.tags.Contains("system_trust_veteran")) { __0.field_Public_Text_0.color = new Color(0.5f, 0.25f, 0.9f); } else if (oof.tags.Contains("system_trust_trusted")) { __0.field_Public_Text_0.color = new Color(1, 0.48f, 0); } else if (oof.tags.Contains("system_trust_known")) { __0.field_Public_Text_0.color = new Color(0.17f, 0.81f, 0.36f); } else if (oof.tags.Contains("system_trust_basic")) { __0.field_Public_Text_0.color = new Color(0.09f, 0.47f, 1f); } else { __0.field_Public_Text_0.color = UnityEngine.Color.grey; } } catch { //oof } return(true); }
public static Object[] getRPCObject(int i, bool isTrue = true, int rangeMin = 0, int rangeMax = 0, bool rangeFirst = false, bool isPosition = false, Vector3 pos = new Vector3()) { Debug.Msg("getRPCObject", 3); Object[] obj = new Object[i]; if (i > 0) { Boolean boolean = default(Boolean); if (!rangeFirst) { if (isTrue) { boolean.m_value = true; } else { boolean.m_value = false; } obj[0] = boolean.BoxIl2CppObject(); if (i == 2) { Int32 integer = default(Int32); integer.m_value = Random.Range(rangeMin, rangeMax); obj[1] = integer.BoxIl2CppObject(); } } else { Int32 integer = default(Int32); integer.m_value = Random.Range(rangeMin, rangeMax); obj[0] = integer.BoxIl2CppObject(); } } if (isPosition) { Vector3 vector = default(Vector3); vector = pos; obj[0] = vector.BoxIl2CppObject(); } return(obj); }
public override unsafe void OnApplicationStart() { try { var settingsCategory = "HWIDPatch"; MelonPrefs.RegisterCategory(settingsCategory, "HWID Patch"); MelonPrefs.RegisterString(settingsCategory, "HWID", "", hideFromList: true); var newId = MelonPrefs.GetString(settingsCategory, "HWID"); if (newId.Length != SystemInfo.deviceUniqueIdentifier.Length) { var random = new System.Random(Environment.TickCount); var bytes = new byte[SystemInfo.deviceUniqueIdentifier.Length / 2]; random.NextBytes(bytes); newId = string.Join("", bytes.Select(it => it.ToString("x2"))); MelonPrefs.SetString(settingsCategory, "HWID", newId); } ourGeneratedHwidString = new Il2CppSystem.Object(IL2CPP.ManagedStringToIl2Cpp(newId)); var icallName = "UnityEngine.SystemInfo::GetDeviceUniqueIdentifier"; var icallAddress = IL2CPP.il2cpp_resolve_icall(icallName); if (icallAddress == IntPtr.Zero) { MelonLogger.LogError("Can't resolve the icall, not patching"); return; } CompatHook((IntPtr)(&icallAddress), typeof(HWIDPatchMod).GetMethod(nameof(GetDeviceIdPatch), BindingFlags.Static | BindingFlags.NonPublic) !.MethodHandle.GetFunctionPointer()); MelonLogger.Log("Patched HWID; below two should match:"); MelonLogger.Log($"Current: {SystemInfo.deviceUniqueIdentifier}"); MelonLogger.Log($"Target: {newId}"); } catch (Exception ex) { MelonLogger.LogError(ex.ToString()); } }
public void initButton(int btnXLocation, int btnYLocation, bool btnHalf, string btnText, string btnToolTip, System.Action action = null, Color?btnBackgroundColor = null, Color?btnTextColor = null, Color?backbtnBackgroundColor = null, Color?backbtnTextColor = null) { btnType = "NestedButton"; Transform menu = Object.Instantiate <Transform>(QMStuff.NestedMenuTemplate(), QMStuff.GetQuickMenuInstance().transform); menuName = "PureMOD" + btnQMLoc + "_" + btnXLocation + "_" + btnYLocation; menu.name = menuName; mainButton = new ButtonAPI.SingleButton(btnQMLoc, btnXLocation, btnYLocation, btnHalf, btnText, btnToolTip, delegate() { if (action != null) { action.Invoke(); } QMStuff.ShowQuickmenuPage(menuName); }, btnBackgroundColor, btnTextColor); Il2CppSystem.Collections.IEnumerator enumerator = menu.transform.GetEnumerator(); while (enumerator.MoveNext()) { Il2CppSystem.Object obj = enumerator.Current; Transform btnEnum = obj.Cast <Transform>(); if (btnEnum != null) { Object.Destroy(btnEnum.gameObject); } } if (backbtnTextColor == null) { backbtnTextColor = Color.yellow; } backButton = new ButtonAPI.SingleButton(menuName, 5, 5, true, "Back", "Go Back", delegate() { QMStuff.ShowQuickmenuPage(btnQMLoc); }, backbtnTextColor, backbtnBackgroundColor); }
private static Object[] getRPCObject(int i, bool isTrue = true, int rangeMin = 0, int rangeMax = 0, bool rangeFirst = false) { Debug.Out("getRPCObject"); Object[] obj = new Object[i]; if (i > 0) { Boolean boolean = default(Boolean); if (!rangeFirst) { if (isTrue) { boolean.m_value = true; } else { boolean.m_value = false; } obj[0] = boolean.BoxIl2CppObject(); if (i == 2) { Int32 integer = default(Int32); integer.m_value = Random.Range(rangeMin, rangeMax); obj[1] = integer.BoxIl2CppObject(); } } else { Int32 integer = default(Int32); integer.m_value = Random.Range(rangeMin, rangeMax); obj[0] = integer.BoxIl2CppObject(); } } return(obj); }
private static bool DataOKToSend(Il2CppSystem.Object CPPObject) { object data = Serialization.FromIL2CPPToManaged <object>(CPPObject); int CachedEvents = 0; foreach (byte[] Array in (byte[][])data) { string ArrayToString = JsonConvert.SerializeObject(Array).Replace("\"", ""); byte[] Bytes = Convert.FromBase64String(ArrayToString); if (Bytes.Length > 200) // Normal events are around 60-120, doing 200 to be safe not to block normal events. { MelonLogger.Log($"Prevented self from sending/receiving Cached Events, bytes too high! (BYTES LENGTH: {Bytes.Length})"); return(false); } CachedEvents++; } if (CachedEvents > 30) { MelonLogger.Log($"Prevented self from sending/receiving Cached Events, too many to send/receive at once! (COUNT: {CachedEvents})"); return(false); } return(true); }
private IEnumerator InitButtonNew(string Name, string base64image, string ImageURL, byte[] imagebytes) { menuName = QMButtonAPI.identifier + "_Custom_Menu_" + Name; while (MonoBehaviourPublicObCoGaCoObCoObCoUnique.prop_MonoBehaviourPublicObCoGaCoObCoObCoUnique_0 == null || MonoBehaviourPublicObCoGaCoObCoObCoUnique.prop_MonoBehaviourPublicObCoGaCoObCoObCoUnique_0.field_Public_ArrayOf_GameObject_0 == null) { yield return(null); } byte[] imagedata = null; if (base64image != null && ImageURL == null && imagebytes == null) { imagedata = Convert.FromBase64String(base64image); } else if (ImageURL != null && base64image == null && imagebytes == null) { WebClient wc = new WebClient(); imagedata = wc.DownloadData(ImageURL); } else if (imagebytes != null && ImageURL == null && base64image == null) { imagedata = imagebytes; } else { MelonLoader.MelonLogger.Error("Well Shit someone is dumb"); yield break; } Texture2D icontexture = new Texture2D(2, 2, TextureFormat.ARGB32, false); ImageConversion.LoadImage(icontexture, imagedata); Transform menu = UnityEngine.Object.Instantiate <Transform>(QMStuff.NestedMenuTemplate(), QMStuff.GetQuickMenuInstance().transform); menu.name = menuName; var TabButton = GameObject.Instantiate(GameObject.Find("UserInterface/QuickMenu/QuickModeTabs/NotificationsTab"), GameObject.Find("UserInterface/QuickMenu/QuickModeTabs").transform); TabButton.name = QMButtonAPI.identifier + "_" + Name; GameObject.Destroy(TabButton.transform.Find("Badge")); TabButton.GetComponent <Button>().onClick = new Button.ButtonClickedEvent(); TabButton.GetComponent <Button>().onClick.AddListener((Action) delegate() { QMStuff.ShowQuickmenuPage(menuName); }); TabButton.transform.Find("Icon").GetComponent <Image>().sprite = new Sprite(); TabButton.transform.Find("Icon").GetComponent <Image>().material = new Material(TabButton.transform.Find("Icon").GetComponent <Image>().material) { mainTexture = icontexture }; Il2CppSystem.Collections.IEnumerator enumerator = menu.transform.GetEnumerator(); while (enumerator.MoveNext()) { Il2CppSystem.Object obj = enumerator.Current; Transform btnEnum = obj.Cast <Transform>(); if (btnEnum != null) { UnityEngine.Object.Destroy(btnEnum.gameObject); } } QMButtonAPI.allNestedButtons.Add(this); backButton = new QMSingleButton(this, 5, 2, "Back", () => { QMStuff.ShowQuickmenuPage("ShortcutMenu"); }, "Go Back", Color.cyan, Color.yellow); yield break; }
private static void OnSetPickerContentFromApiModel(UiUserList __instance, VRCUiContentButton __0, Il2CppSystem.Object __1) { if (!ShouldAdjustList(__instance)) { return; } APIUser user = __1.TryCast <APIUser>(); if (user == null) { return; } GameObject icon = __0.field_Public_VRCUiDynamicOverlayIcons_0.field_Public_ArrayOf_GameObject_0.First(gameObject => gameObject.name == "PrivateInstanceIcon"); if (UserInstanceSprite(user) is Sprite sprite) { icon.GetComponent <Image>().sprite = sprite; icon.SetActive(true); } else { icon.SetActive(false); } }
public UnityAction(Il2CppSystem.Object @object, System.IntPtr method) : this(IL2CPP.il2cpp_object_new((System.IntPtr)Il2CppClassPointerStore <UnityAction <T0, T1> > .NativeClassPtr)) { }
public void AddSystem(SystemTypes Type, Il2CppSystem.Object IType) { Systems.Add(Type, IType.Cast <ISystemType>()); }
/// <summary> /// (Cross-Game compatible) Is this Reference equal to another Object's Reference? /// </summary> /// <param name="instance"></param> /// <param name="to">Object to compare to</param> /// <returns></returns> public static bool ReferenceEquals(this Object instance, Object to) { return(ReferenceEquals(instance, (object)to)); }
static void Prefix(Il2CppSystem.Object message) { MelonLogger.Log(message.ToString()); }
static TestClass() { for (int i = 0; i < BigList.Capacity; i++) { BigList.Add(i.ToString()); } #if CPP IL2CPP_Dict = new Il2CppSystem.Collections.Generic.Dictionary <string, string>(); IL2CPP_Dict.Add("key1", "value1"); IL2CPP_Dict.Add("key2", "value2"); IL2CPP_Dict.Add("key3", "value3"); IL2CPP_HashTable = new Il2CppSystem.Collections.Hashtable(); IL2CPP_HashTable.Add("key1", "value1"); IL2CPP_HashTable.Add("key2", "value2"); IL2CPP_HashTable.Add("key3", "value3"); var dict2 = new Il2CppSystem.Collections.Generic.Dictionary <string, string>(); dict2.Add("key1", "value1"); IL2CPP_IDict = dict2.TryCast <Il2CppSystem.Collections.IDictionary>(); var list = new Il2CppSystem.Collections.Generic.List <Il2CppSystem.Object>(5); list.Add("one"); list.Add("two"); IL2CPP_IList = list.TryCast <Il2CppSystem.Collections.IList>(); IL2CPP_ListString = new Il2CppSystem.Collections.Generic.List <string>(); IL2CPP_ListString.Add("hello,"); IL2CPP_ListString.Add("world!"); IL2CPP_HashSet = new Il2CppSystem.Collections.Generic.HashSet <string>(); IL2CPP_HashSet.Add("one"); IL2CPP_HashSet.Add("two"); CppBoxedDict = new Dictionary <Il2CppSystem.String, Il2CppSystem.Object>(); CppBoxedDict.Add("1", new Il2CppSystem.Int32 { m_value = 1 }.BoxIl2CppObject()); CppBoxedDict.Add("2", new Il2CppSystem.Int32 { m_value = 2 }.BoxIl2CppObject()); CppBoxedDict.Add("3", new Il2CppSystem.Int32 { m_value = 3 }.BoxIl2CppObject()); CppBoxedDict.Add("4", new Il2CppSystem.Int32 { m_value = 4 }.BoxIl2CppObject()); cppDecimal = new Il2CppSystem.Decimal(1f); cppDecimalBoxed = new Il2CppSystem.Decimal(1f).BoxIl2CppObject(); cppVector3Boxed = Vector3.down.BoxIl2CppObject(); IL2CPP_listOfBoxedObjects = new List <Il2CppSystem.Object>(); IL2CPP_listOfBoxedObjects.Add((Il2CppSystem.String) "boxedString"); IL2CPP_listOfBoxedObjects.Add(new Il2CppSystem.Int32 { m_value = 5 }.BoxIl2CppObject()); IL2CPP_listOfBoxedObjects.Add(Color.red.BoxIl2CppObject()); try { var cppType = Il2CppType.Of <CameraClearFlags>(); if (cppType != null) { var boxedEnum = Il2CppSystem.Enum.Parse(cppType, "Color"); IL2CPP_listOfBoxedObjects.Add(boxedEnum); } var structBox = Vector3.one.BoxIl2CppObject(); IL2CPP_listOfBoxedObjects.Add(structBox); } catch (Exception ex) { ExplorerCore.LogWarning($"Test fail: {ex}"); } IL2CPP_structArray = new UnhollowerBaseLib.Il2CppStructArray <int>(5); IL2CPP_structArray[0] = 0; IL2CPP_structArray[1] = 1; IL2CPP_structArray[2] = 2; IL2CPP_structArray[3] = 3; IL2CPP_structArray[4] = 4; IL2CPP_stringArray = new UnhollowerBaseLib.Il2CppStringArray(2); IL2CPP_stringArray[0] = "hello, "; IL2CPP_stringArray[1] = "world!"; IL2CPP_ReferenceArray = new UnhollowerBaseLib.Il2CppReferenceArray <Il2CppSystem.Object>(3); IL2CPP_ReferenceArray[0] = new Il2CppSystem.Int32 { m_value = 5 }.BoxIl2CppObject(); IL2CPP_ReferenceArray[1] = null; IL2CPP_ReferenceArray[2] = (Il2CppSystem.String) "whats up"; cppBoxedInt = new Il2CppSystem.Int32() { m_value = 5 }.BoxIl2CppObject(); cppInt = new Il2CppSystem.Int32 { m_value = 420 }; cppHashset = new Il2CppSystem.Collections.Hashtable(); cppHashset.Add("key1", "itemOne"); cppHashset.Add("key2", "itemTwo"); cppHashset.Add("key3", "itemThree"); #endif }
/// <summary> /// (Cross-Game compatible) Check if object is the same type as T /// </summary> /// <param name="instance"></param> /// <param name="castObject">The casted object if this is of type T</param> /// <typeparam name="T">Type to check</typeparam> public static bool IsType <T>(this Object instance, out T castObject) where T : Object { castObject = instance.TryCast <T>(); return(castObject != null); }
/// <summary> /// (Cross-Game compatible) Check if object is the same type as T /// </summary> /// <typeparam name="T">Type to check</typeparam> public static bool IsType <T>(this Object instance) where T : Object { return(instance.TryCast <T>() != null); }
static void Prefix(Il2CppSystem.Object message, UnityEngine.Object context) { MelonLogger.LogError($"[{context}]: {message}"); }