Exemplo n.º 1
0
        public override void OnApplicationStart()
        {
            ModPrefs.RegisterCategory(SettingsCategory, "Sparkle Be Gone");

            ModPrefs.RegisterPrefBool(SettingsCategory, StartSparkleSetting, false, "Show start sparkle");
            ModPrefs.RegisterPrefBool(SettingsCategory, EndSparksSetting, false, "Show end sparks");
            ModPrefs.RegisterPrefBool(SettingsCategory, EndFlareSetting, true, "Show end flare");

            ModPrefs.RegisterPrefBool(SettingsCategory, RecolorSparksSetting, false, "Recolor sparks");
            ModPrefs.RegisterPrefBool(SettingsCategory, RecolorBeamsSetting, true, "Recolor beams");

            ModPrefs.RegisterPrefString(SettingsCategory, BeamColorSetting, "25 50 255 255", "Beam color (r g b a)");

            var method = typeof(VRCSpaceUiPointer).GetMethod(nameof(VRCSpaceUiPointer.LateUpdate), BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

            {
                using var stream    = Assembly.GetExecutingAssembly().GetManifestResourceStream("SparkleBeGone.sparklebegone");
                using var memStream = new MemoryStream((int)stream.Length);
                stream.CopyTo(memStream);
                var bundle = AssetBundle.LoadFromMemory_Internal(memStream.ToArray(), 0);
                myWhiteLaserTexture            = bundle.LoadAsset_Internal("Assets/SparkleBeGone/sniper_beam_white.png", Il2CppType.Of <Texture2D>()).Cast <Texture2D>();
                myWhiteLaserTexture.hideFlags |= HideFlags.DontUnloadUnusedAsset;
            }

            unsafe
            {
                var originalPointer = *(IntPtr *)(IntPtr)UnhollowerUtils.GetIl2CppMethodInfoPointerFieldForGeneratedMethod(method).GetValue(null);
                CompatHook((IntPtr)(&originalPointer), typeof(SparkleBeGoneMod).GetMethod(nameof(CursorLateUpdatePatch), BindingFlags.Static | BindingFlags.NonPublic) !.MethodHandle.GetFunctionPointer());
                ourOriginalLateUpdate = Marshal.GetDelegateForFunctionPointer <VoidDelegate>(originalPointer);
            }

            MelonCoroutines.Start(InitThings());
        }
Exemplo n.º 2
0
        public static void RegisterSettings()
        {
            ModPrefs.RegisterCategory(SettingsCategory, "Join Notifier");

            ModPrefs.RegisterPrefBool(SettingsCategory, SettingShouldBlink, true, "Blink HUD icon on join");
            ModPrefs.RegisterPrefBool(SettingsCategory, SettingShouldPlaySound, true, "Play sound on join");
            ModPrefs.RegisterPrefBool(SettingsCategory, SettingJoinShowName, true, "Show joined names");

            ModPrefs.RegisterPrefBool(SettingsCategory, SettingLeaveBlink, false, "Blink HUD icon on leave");
            ModPrefs.RegisterPrefBool(SettingsCategory, SettingLeaveSound, false, "Play sound on leave");
            ModPrefs.RegisterPrefBool(SettingsCategory, SettingLeaveShowName, false, "Show left names");

            ModPrefs.RegisterPrefFloat(SettingsCategory, SettingSoundVolume, .3f, "Sound volume (0-1)");
            ModPrefs.RegisterPrefBool(SettingsCategory, SettingUseUiMixer, true, "Notifications are affected by UI volume slider");
            ModPrefs.RegisterPrefInt(SettingsCategory, SettingTextSize, 36, "Text size (pt)");

            ModPrefs.RegisterPrefBool(SettingsCategory, SettingNotifyPublic, false, "Notify in public instances");
            ModPrefs.RegisterPrefBool(SettingsCategory, SettingNotifyFriends, true, "Notify in friends[+] instances");
            ModPrefs.RegisterPrefBool(SettingsCategory, SettingNotifyPrivate, true, "Notify in private instances");

            ModPrefs.RegisterPrefBool(SettingsCategory, SettingShowFriendsOnly, false, "Show friend join/leave only");
            ModPrefs.RegisterPrefString(SettingsCategory, SettingJoinIconColor, "127 191 255", "Join icon color (r g b)");
            ModPrefs.RegisterPrefString(SettingsCategory, SettingLeaveIconColor, "153 82 51", "Leave icon color (r g b)");

            ModPrefs.RegisterPrefBool(SettingsCategory, SettingShowFriendsInDifferentColor, true, "Show friend names in different color");
            ModPrefs.RegisterPrefString(SettingsCategory, SettingFriendsJoinColor, "224 224 0", "Friend join name color (r g b)");
            ModPrefs.RegisterPrefString(SettingsCategory, SettingFriendsLeaveColor, "201 201 0", "Friend leave name color (r g b)");
        }
Exemplo n.º 3
0
        public override void OnApplicationStart()
        {
            ModPrefs.RegisterCategory("PortableMirror", "PortableMirror");
            ModPrefs.RegisterPrefFloat("PortableMirror", "MirrorScaleX", 5f, "Mirror Scale X");
            ModPrefs.RegisterPrefFloat("PortableMirror", "MirrorScaleY", 3f, "Mirror Scale Y");
            ModPrefs.RegisterPrefBool("PortableMirror", "OptimizedMirror", false, "Optimized Mirror");
            ModPrefs.RegisterPrefBool("PortableMirror", "CanPickupMirror", false, "Can Pickup Mirror");
            ModPrefs.RegisterPrefString("PortableMirror", "MirrorKeybind", "Alpha1", "Toggle Mirror Keybind");

            _mirrorScaleX    = ModPrefs.GetFloat("PortableMirror", "MirrorScaleX");
            _mirrorScaleY    = ModPrefs.GetFloat("PortableMirror", "MirrorScaleY");
            _optimizedMirror = ModPrefs.GetBool("PortableMirror", "OptimizedMirror");
            _canPickupMirror = ModPrefs.GetBool("PortableMirror", "CanPickupMirror");
            _mirrorKeybind   = Utils.GetMirrorKeybind();

            MelonModLogger.Log("Settings can be configured in UserData\\MelonPreferences.cfg");
            MelonModLogger.Log($"[{_mirrorKeybind}] -> Toggle portable mirror");

            MelonMod uiExpansionKit = MelonLoader.Main.Mods.Find(m => m.InfoAttribute.Name == "UI Expansion Kit");

            if (uiExpansionKit != null)
            {
                uiExpansionKit.InfoAttribute.SystemType.Assembly.GetTypes().First(t => t.FullName == "UIExpansionKit.API.ExpansionKitApi").GetMethod("RegisterWaitConditionBeforeDecorating", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static).Invoke(null, new object[]
                {
                    CreateQuickMenuButton()
                });
            }
        }
 void RegisterPrefs()   // settings
 {
     ModPrefs.RegisterCategory(BuildInfo.Name, "Grappling Gun");
     ModPrefs.RegisterPrefString(BuildInfo.Name, "gunname", "eder");
     ModPrefs.RegisterPrefFloat(BuildInfo.Name, "strength", 100);
     ModPrefs.RegisterPrefFloat(BuildInfo.Name, "damper", 10);
 }
Exemplo n.º 5
0
        public override void OnApplicationStart()
        {
            // Setup MonoBehaviors
            ClassInjector.RegisterTypeInIl2Cpp <ServerSyncedObject>();
            ClassInjector.RegisterTypeInIl2Cpp <IDHolder>();

            // Register Prefs
            ModPrefs.RegisterCategory("MPMod", "Multiplayer Settings");
            ModPrefs.RegisterPrefString("MPMod", "HostSteamID", "0");
            ModPrefs.RegisterPrefBool("MPMod", "ForceLargePlayspace", true);

            // Start Server Stuff
            SteamClient.Init(448280);

            // MelonModLogger.LogWarning("ALPHA TESTING BUILD");
            MelonModLogger.Log($"Multiplayer initialising with protocol version {PROTOCOL_VERSION}.");

            SteamNetworking.AllowP2PPacketRelay(true);

            client = new Client();
            server = new Server();
            PlayerRep.LoadPlayer();

            // Setup Discord Presence
            RichPresence.Initialise(736050983335100436);
            client.SetupRP();

            MelonModLogger.Log("MPMod Loaded");
        }
Exemplo n.º 6
0
        internal static void RegisterSettings()
        {
            ModPrefs.RegisterCategory(KitCategory, "UI Expansion Kit");

            ModPrefs.RegisterPrefString(KitCategory, PinnedPrefs, "", hideFromList: true);

            ModPrefs.RegisterPrefBool(KitCategory, QmExpandoStartsCollapsed, false, "Quick Menu extra panel starts hidden");
        }
Exemplo n.º 7
0
        public override void OnApplicationStart()
        {
            ModPrefs.RegisterCategory(ModCategory, "Camera Resolution");
            ModPrefs.RegisterPrefString(ModCategory, Resolution1NamePref, "1080p", "Resolution 1 Name:");
            ModPrefs.RegisterPrefString(ModCategory, Resolution2NamePref, "4K", "Resolution 2 Name:");
            ModPrefs.RegisterPrefString(ModCategory, Resolution3NamePref, "8K", "Resolution 3 Name:");
            ModPrefs.RegisterPrefInt(ModCategory, Resolution1Pref, 1080, "Resolution 1: (Photo height, unstable > 4320)");
            ModPrefs.RegisterPrefInt(ModCategory, Resolution2Pref, 2160, "Resolution 2: (Photo height, unstable > 4320)");
            ModPrefs.RegisterPrefInt(ModCategory, Resolution3Pref, 4320, "Resolution 3: (Photo height, unstable > 4320)");
            ModPrefs.RegisterPrefInt(ModCategory, ResolutionPref, 2, "Default resolution setting (1-3)");

            ExpansionKitApi.RegisterSimpleMenuButton(ExpandedMenu.CameraQuickMenu, ModPrefs.GetString(ModCategory, Resolution1NamePref), Resolution1);
            ExpansionKitApi.RegisterSimpleMenuButton(ExpandedMenu.CameraQuickMenu, ModPrefs.GetString(ModCategory, Resolution2NamePref), Resolution2);
            ExpansionKitApi.RegisterSimpleMenuButton(ExpandedMenu.CameraQuickMenu, ModPrefs.GetString(ModCategory, Resolution3NamePref), Resolution3);
        }
Exemplo n.º 8
0
        public override unsafe void OnApplicationStart()
        {
            try
            {
                var settingsCategory = "HWIDPatch";
                ModPrefs.RegisterCategory(settingsCategory, "HWID Patch");
                ModPrefs.RegisterPrefString(settingsCategory, "HWID", "", hideFromList: true);

                var newId = ModPrefs.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")));
                    ModPrefs.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)
                {
                    MelonModLogger.LogError("Can't resolve the icall, not patching");
                    return;
                }

                CompatHook((IntPtr)(&icallAddress),
                           typeof(HWIDPatchMod).GetMethod(nameof(GetDeviceIdPatch),
                                                          BindingFlags.Static | BindingFlags.NonPublic) !.MethodHandle.GetFunctionPointer());

                MelonModLogger.Log("Patched HWID; below two should match:");
                MelonModLogger.Log($"Current: {SystemInfo.deviceUniqueIdentifier}");
                MelonModLogger.Log($"Target:  {newId}");
            }
            catch (Exception ex)
            {
                MelonModLogger.LogError(ex.ToString());
            }
        }
Exemplo n.º 9
0
        internal static void RegisterSettings()
        {
            ModPrefs.RegisterCategory(KitCategory, "UI Expansion Kit");

            ModPrefs.RegisterPrefString(KitCategory, PinnedPrefs, "", hideFromList: true);
        }