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); }
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()); }
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)"); }
public override void OnApplicationStart() { ModPrefs.RegisterCategory(ModCategory, "Mirror Resolution"); ModPrefs.RegisterPrefInt(ModCategory, MaxResPref, 4096, "Max eye texture size"); ModPrefs.RegisterPrefInt(ModCategory, MirrorMsaaPref, 0, "Mirror MSAA (0=default)"); ModPrefs.RegisterPrefBool(ModCategory, AllMirrorsAutoPref, false, "Force auto resolution"); unsafe { var methodInfo = Il2CppType.Of <VRC_MirrorReflection>().GetMethod(nameof(VRC_MirrorReflection.GetReflectionData), BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); var originalMethodPointer = *(IntPtr *)IL2CPP.il2cpp_method_get_from_reflection(methodInfo.Pointer); CompatHook((IntPtr)(&originalMethodPointer), typeof(MirrorResolutionUnlimiterMod).GetMethod(nameof(GetReflectionData), System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic) !.MethodHandle.GetFunctionPointer()); } OnModSettingsApplied(); if (AppDomain.CurrentDomain.GetAssemblies().Any(it => it.GetName().Name.StartsWith("UIExpansionKit"))) { MelonModLogger.Log("Adding UIExpansionKit buttons"); typeof(UiExtensionsAddon) .GetMethod(nameof(UiExtensionsAddon.Init), System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static) ! .Invoke(null, new object[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"); }
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() }); } }
public override void OnApplicationStart() { ModPrefs.RegisterCategory("NoPerformanceStats", "No Performance Stats"); ModPrefs.RegisterPrefBool("NoPerformanceStats", "DisablePerformanceStats", true, "Disable Performance Stats"); LoadModPrefs(); harmonyInstance = HarmonyInstance.Create("NoPerformanceStatsPatcher"); try { MethodInfo[] methods = typeof(AvatarPerformance).GetMethods(BindingFlags.Public | BindingFlags.Static); for (int i = 0; i < methods.Length; i++) { if (methods[i].Name == "Method_Public_Static_IEnumerator_String_GameObject_AvatarPerformanceStats_0" || methods[i].Name == "Method_Public_Static_IEnumerator_GameObject_AvatarPerformanceStats_EnumPublicSealedvaNoExGoMePoVe7vUnique_MulticastDelegateNPublicSealedVoUnique_0" || methods[i].Name == "Method_Public_Static_Void_String_GameObject_AvatarPerformanceStats_0") { harmonyInstance.Patch(methods[i], new HarmonyMethod(typeof(NoPerformanceStats).GetMethod("CalculatePerformance", BindingFlags.Static | BindingFlags.NonPublic)), null, null); } } } catch (Exception e) { MelonModLogger.Log(ConsoleColor.Red, "Failed to patch Performance Scanners: " + e); } }
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"); }
public override void OnApplicationStart() { MelonModLogger.Log("Mod loaded."); ModPrefs.RegisterCategory(ModCategory, "Desktop Camera"); ModPrefs.RegisterPrefInt(ModCategory, CameraSpeedPref, 5, "Basic camera speed"); ModPrefs.RegisterPrefInt(ModCategory, CameraSpeedAltPref, 20, "Alt camera speed (ALT pressed)"); OnModSettingsApplied(); }
public override void OnApplicationStart() { ModPrefs.RegisterCategory(CoreLimiterPrefCategory, "Core Limiter"); ModPrefs.RegisterPrefInt(CoreLimiterPrefCategory, MaxCoresPref, 4, "Maximum cores"); ModPrefs.RegisterPrefBool(CoreLimiterPrefCategory, SkipHyperThreadsPref, true, "Don't use both threads of a core"); MelonModLogger.Log($"[CoreLimiter] Have {Environment.ProcessorCount} processor cores"); ApplyAffinity(); }
public static void RegisterSettings() { ModPrefs.RegisterCategory(CategoryName, "Graphics settings"); ModPrefs.RegisterPrefInt(CategoryName, MsaaLevel, -1, "MSAA Level (1/2/4/8)"); ModPrefs.RegisterPrefBool(CategoryName, AllowMsaa, true, "Enable MSAA"); ModPrefs.RegisterPrefBool(CategoryName, AnisoFilter, true, "Enable anisotropic filtering"); ModPrefs.RegisterPrefBool(CategoryName, RealtimeShadows, true, "Realtime shadows"); ModPrefs.RegisterPrefBool(CategoryName, SoftShadows, true, "Soft shadows"); ModPrefs.RegisterPrefInt(CategoryName, PixelLights, -1, "Max pixel lights"); ModPrefs.RegisterPrefInt(CategoryName, TextureLimit, -1, "Texture decimation"); ModPrefs.RegisterPrefInt(CategoryName, GraphicsTier, -1, "Graphics tier (1/2/3)"); }
public override void OnApplicationStart() { TrustedUserColor = new Color(0.5058824f, 0.2627451f, 0.9019608f); VeteranUserColor = new Color(0.6705882352941176f, 0.803921568627451f, 0.937254901960784f); LegendaryUserColor = new Color(1f, 0.4117647058823529f, 0.7058823529411765f); ModPrefs.RegisterCategory("ogtrustranks", "OGTrustRanks"); ModPrefs.RegisterPrefBool("ogtrustranks", "enabled", true, "Enabled"); harmonyInstance = HarmonyInstance.Create("OGTrustRanks"); harmonyInstance.Patch(typeof(VRCPlayer).GetMethod("Method_Public_Static_String_APIUser_0", BindingFlags.Public | BindingFlags.Static), new HarmonyMethod(typeof(OGTrustRanks).GetMethod("GetFriendlyDetailedNameForSocialRank", BindingFlags.NonPublic | BindingFlags.Static))); harmonyInstance.Patch(typeof(VRCPlayer).GetMethod("Method_Public_Static_Color_APIUser_0", BindingFlags.Public | BindingFlags.Static), new HarmonyMethod(typeof(OGTrustRanks).GetMethod("GetColorForSocialRank", BindingFlags.NonPublic | BindingFlags.Static))); harmonyInstance.Patch(typeof(VRCPlayer).GetMethod("Method_Public_Static_Color_APIUser_1", BindingFlags.Public | BindingFlags.Static), new HarmonyMethod(typeof(OGTrustRanks).GetMethod("GetColorForSocialRank", BindingFlags.NonPublic | BindingFlags.Static))); harmonyInstance.Patch(typeof(VRCPlayer).GetMethod("Method_Public_Static_Color_APIUser_2", BindingFlags.Public | BindingFlags.Static), new HarmonyMethod(typeof(OGTrustRanks).GetMethod("GetColorForSocialRank", BindingFlags.NonPublic | BindingFlags.Static))); }
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); }
private static unsafe void RegisterModPrefs() { ModPrefs.RegisterCategory("NDB", "Multiplayer Dynamic Bones"); ModPrefs.RegisterPrefBool("NDB", "EnabledByDefault", true, "Enabled by default"); ModPrefs.RegisterPrefBool("NDB", "OnlyMe", false, "Only I can interact with other bones"); ModPrefs.RegisterPrefBool("NDB", "OnlyFriends", false, "Only me and friends can interact with my and friend's bones"); ModPrefs.RegisterPrefBool("NDB", "DisallowDesktoppers", false, "Desktoppers's colliders and bones won't be multiplayer'd"); ModPrefs.RegisterPrefBool("NDB", "DistanceDisable", true, "Disable bones if beyond a distance"); ModPrefs.RegisterPrefFloat("NDB", "DistanceToDisable", 4f, "Distance limit"); ModPrefs.RegisterPrefBool("NDB", "DisallowInsideColliders", true, "Disallow inside colliders"); ModPrefs.RegisterPrefFloat("NDB", "ColliderSizeLimit", 1f, "Collider size limit"); ModPrefs.RegisterPrefInt("NDB", "DynamicBoneUpdateRate", 60, "Dynamic bone update rate"); ModPrefs.RegisterPrefBool("NDB", "EnableJustIfVisible", true, "Enable dynamic bones just if they are on view"); ModPrefs.RegisterPrefFloat("NDB", "VisibilityUpdateRate", 1f, "Visibility update rate (seconds)"); ModPrefs.RegisterPrefBool("NDB", "OnlyHandColliders", false, "Only enable colliders in hands"); ModPrefs.RegisterPrefBool("NDB", "KeybindsEnabled", true, "Enable keyboard actuation(F1, F4 and F8)"); ModPrefs.RegisterPrefBool("NDB", "OptimizeOnly", false, "Just optimize the dynamic bones of the scene, don't enable interaction"); ModPrefs.RegisterPrefInt("NDB", "UpdateMode", 0, "A value of 2 will notify the user when a new version of the mod is avaiable, while 1 will not."); }
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()); } }
public unsafe override void OnApplicationStart() { SteamClient.Init(823500); Features.Guard.GetSteamFriends(); Features.Guard.GetLocalGuard(); #if DEBUG MelonModLogger.LogWarning("Debug build!"); #endif MelonModLogger.Log($"Multiplayer initialising with protocol version {PROTOCOL_VERSION}."); // Set up prefs ModPrefs.RegisterCategory("MPMod", "Multiplayer Settings"); ModPrefs.RegisterPrefBool("MPMod", "BaldFord", false, "90% effective hair removal solution"); // Initialise transport layer TransportLayer = new SteamTransportLayer(); // Create the UI and cache the PlayerRep's model ui = new MultiplayerUI(); client = new Client(ui, TransportLayer); server = new Server(ui, TransportLayer); PlayerRep.LoadFord(); // Configures if the PlayerRep's are showing or hiding certain parts PlayerRep.showBody = true; PlayerRep.showHair = ModPrefs.GetBool("MPMod", "BaldFord"); // Initialize Discord's RichPresence RichPresence.Initialise(701895326600265879); client.SetupRP(); #region Unused Code //PlayerHooks.OnPlayerGrabObject += PlayerHooks_OnPlayerGrabObject; //PlayerHooks.OnPlayerLetGoObject += PlayerHooks_OnPlayerLetGoObject; //BWUtil.InitialiseGunPrefabs(); #endregion }
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.RegisterPrefFloat(SettingsCategory, SettingSoundVolume, .3f, "Sound volume (0-1)"); 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, 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.RegisterPrefColor(SettingsCategory, SettingJoinIconColor, new Color(0.50F, 0.75F, 1F), hideFromList: true); // ModPrefs.RegisterPrefColor(SettingsCategory, SettingLeaveIconColor, new Color(0.6f, 0.32f, 0.2f), hideFromList: true); ModPrefs.RegisterPrefBool(SettingsCategory, SettingUseUiMixer, true, "Notifications are UI sounds", hideFromList: true); }
internal static void RegisterSettings() { ModPrefs.RegisterCategory(KitCategory, "UI Expansion Kit"); ModPrefs.RegisterPrefString(KitCategory, PinnedPrefs, "", hideFromList: true); }