private void Awake()
        {
            Logger = base.Logger;

            cardHeight   = Config.Bind(new ConfigDefinition("H Scene", "Height from card"), true, new ConfigDescription("Set players height according to the value in the card"));
            customHeight = Config.Bind(new ConfigDefinition("H Scene", "Custom height"), 75, new ConfigDescription("If 'Height from card' is off, use this value instead'", new AcceptableValueRange <int>(-100, 200)));

            cardHeight2nd   = Config.Bind(new ConfigDefinition("H Scene", "Height from card 2nd"), true, new ConfigDescription("Set players height according to the value in the card for 2nd male"));
            customHeight2nd = Config.Bind(new ConfigDefinition("H Scene", "Custom height 2nd"), 75, new ConfigDescription("If 'Height from card' is off, use this value instead for 2nd male", new AcceptableValueRange <int>(-100, 200)));

            var harmony = new HarmonyLib.Harmony("HS2_UnlockPlayerHeight");

            harmony.PatchAll(typeof(CoreHooks));

            if (Application.productName != "HoneySelect2")
            {
                return;
            }

            cardHeight.SettingChanged   += delegate { ApplySettings(false); };
            customHeight.SettingChanged += delegate { ApplySettings(false); };

            cardHeight2nd.SettingChanged   += delegate { ApplySettings(true); };
            customHeight2nd.SettingChanged += delegate { ApplySettings(true); };

            harmony.PatchAll(typeof(GameHooks));
        }
Exemple #2
0
        public override void OnEnabled()
        {
            try
            {
                Instance = this;

                NPCPlugin = (NPCS.Plugin)Exiled.Loader.Loader.Plugins.Where(p => p.Name == "CustomNPCs").FirstOrDefault();
                if (NPCPlugin == null)
                {
                    Log.Error("Failed to load Stalky106 compat module addon: CustomNPCs not found!");
                    return;
                }

                if (Exiled.Loader.Loader.Plugins.Where(p => p.Prefix == "ST106").FirstOrDefault() == null)
                {
                    Log.Error("Failed to load Stalky106 compat module addon: Stalky106 not found!");
                    return;
                }

                Harmony = new HarmonyLib.Harmony("gamehunt.compat.stalky106");
                Harmony.PatchAll();

                Log.Info($"Stalky106 compat module loaded. @gamehunt");
            }
            catch (Exception e)
            {
                //This try catch is redundant, as EXILED will throw an error before this block can, but is here as an example of how to handle exceptions/errors
                Log.Error($"There was an error loading the plugin: {e}");
            }
        }
        private void Awake()
        {
            instance = this;
            Logger   = base.Logger;

            alignCamera     = Config.Bind(new ConfigDefinition("Camera", "Align camera to player height"), true, new ConfigDescription("Aligns camera position according to player height"));
            lookAtOffset    = Config.Bind(new ConfigDefinition("Camera", "Camera y offset"), 0f, new ConfigDescription("Camera lookAt y offset", new AcceptableValueRange <float>(-10f, 10f)));
            lookAtPOVOffset = Config.Bind(new ConfigDefinition("Camera", "Camera POV y offset"), 0f, new ConfigDescription("Camera lookAtPOV y offset", new AcceptableValueRange <float>(-10f, 10f)));

            cardHeight   = Config.Bind(new ConfigDefinition("Free Roam & Events", "Height from card"), true, new ConfigDescription("Set players height according to the value in the card"));
            customHeight = Config.Bind(new ConfigDefinition("Free Roam & Events", "Custom height"), 75, new ConfigDescription("If 'Height from card' is off, use this value instead", new AcceptableValueRange <int>(-100, 200)));

            cardHeightDuringH   = Config.Bind(new ConfigDefinition("H Scene", "Height from card (H)"), false, new ConfigDescription("Set players height according to the value in the card"));
            customHeightDuringH = Config.Bind(new ConfigDefinition("H Scene", "Custom height (H)"), 75, new ConfigDescription("If 'Height from card' is off, use this value instead", new AcceptableValueRange <int>(-100, 200)));

            var harmony = new HarmonyLib.Harmony("HS2_UnlockPlayerHeight");

            harmony.PatchAll(typeof(CoreHooks));

            if (Application.productName != "AI-Syoujyo" && Application.productName != "AI-Shoujo")
            {
                return;
            }

            alignCamera.SettingChanged  += delegate { ApplySettings(actor); };
            lookAtOffset.SettingChanged += delegate { ApplySettings(actor); };

            cardHeight.SettingChanged   += delegate { ApplySettings(actor); };
            customHeight.SettingChanged += delegate { ApplySettings(actor); };

            cardHeightDuringH.SettingChanged   += delegate { ApplySettings(actor); };
            customHeightDuringH.SettingChanged += delegate { ApplySettings(actor); };

            harmony.PatchAll(typeof(GameHooks));
        }
Exemple #4
0
        bool TryToEnableThrottling()
        {
            var mod = LoadedModManager.RunningMods.FirstOrDefault(m => m.PackageId == "brrainz.harmony");

            if (mod == null)
            {
                return(false);
            }

            void wrapperForSafety()
            {
                var harmony = new HarmonyLib.Harmony(Content.PackageId);
                {
                    var target  = HarmonyLib.AccessTools.Method(typeof(RealTime), nameof(RealTime.Update));
                    var postfix = HarmonyLib.AccessTools.Method(typeof(FrameRateControlMod), nameof(ThrottleEngine));

                    harmony.Patch(target, postfix: new HarmonyLib.HarmonyMethod(postfix));
                }
                {
                    var target  = HarmonyLib.AccessTools.Method(typeof(TickManager), nameof(TickManager.DoSingleTick));
                    var postfix = HarmonyLib.AccessTools.Method(typeof(FrameRateControlMod), nameof(SetWorstAllowedFPS));

                    harmony.Patch(target, postfix: new HarmonyLib.HarmonyMethod(postfix));
                }
            };

            try {
                wrapperForSafety();
            } catch (Exception e) {
                Log.Warning("FrameRateControl :: Despite HarmonyMod being loaded we can't patch, something went very wrong...\n" + e);
                return(false);
            }

            return(true);
        }
Exemple #5
0
        static Boot()
        {
            if (Initialized)
            {
                return;
            }
            try
            {
                LoadAll();
                Initialized = true;

                HarmonyLib.Harmony harmony = new HarmonyLib.Harmony("QTRHacker.Patches");
                harmony.PatchAll();

                List <GameInterfaceLayer> layers =
                    typeof(Main).GetField("_gameInterfaceLayers", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(Main.instance) as List <GameInterfaceLayer>;
                int index = layers.FindIndex(t => t.Name == "Vanilla: Mouse Text");
                layers.Insert(index, new LegacyGameInterfaceLayer("QTRHacker: Game", delegate
                {
                    try
                    {
                        OnGameDraw?.Invoke(Main.spriteBatch);
                    }
                    catch (Exception e)
                    {
                        File.AppendAllText("./QTRHacker.Patches.Exceptions.log", $"{e.GetType()}:{e.Message}\n{e.StackTrace}\n");
                    }
                    return(true);
                }, InterfaceScaleType.Game));
            }
            catch (Exception e)
            {
                File.WriteAllText("./QTRHacker.Patches.boot.log", $"{e.GetType()}:{e.Message}\n{e.StackTrace}\n");
            }
        }
        public async void OnApplicationStart()
        {
            // Harmony
            Harmony = new HarmonyLib.Harmony(HarmonyId);
            Harmony.PatchAll(Assembly.GetExecutingAssembly());

            // Assets
            Sprites.Initialize();

            // HTTP client
            HttpClient = new HttpClient();
            HttpClient.DefaultRequestHeaders.Add("User-Agent", Plugin.UserAgent);
            HttpClient.DefaultRequestHeaders.Add("X-BSSB", "✔");

            // BS Events
            BSEvents.lateMenuSceneLoadedFresh += OnLateMenuSceneLoadedFresh;

            // Start update timer
            UpdateTimer.Start();

            // Detect platform
            // Note - currently (will be fixed in BS utils soon!): if the health warning is skipped (like in fpfc mode),
            //  this await will hang until a song is played, so the platform will be stuck on "unknown" til then
            await DetectPlatform();
        }
Exemple #7
0
        private static int Initialize()
        {
            AppDomain curDomain = AppDomain.CurrentDomain;

            Fixes.UnhandledException.Install(curDomain);
            MelonUtils.Setup(curDomain);
            Assertions.LemonAssertMapping.Setup();

            if (!MonoLibrary.Setup() ||
                !MonoResolveManager.Setup())
            {
                return(1);
            }

            HarmonyInstance = new HarmonyLib.Harmony(BuildInfo.Name);

            Fixes.ForcedCultureInfo.Install();
            Fixes.InstancePatchFix.Install();
            Fixes.ProcessFix.Install();
            PatchShield.Install();

            MelonPreferences.Load();
            MelonLaunchOptions.Load();
            bHaptics.Load();

            MelonCompatibilityLayer.Setup();
            MelonCompatibilityLayer.SetupModules(MelonCompatibilityLayer.SetupType.OnPreInitialization);

            MelonHandler.LoadPlugins();
            MelonHandler.OnPreInitialization();

            return(0);
        }
Exemple #8
0
        public void OnApplicationStart()
        {
            SongCore.Collections.RegisterCapability("GameSaber");
            var harmony = new HarmonyLib.Harmony("GameSaber");

            harmony.PatchAll();
        }
        HarmonyInstance(string id)
        {
            instance = new HarmonyLib.Harmony(id);
            if (DEBUG)
            {
                HarmonyLib.Harmony.DEBUG = true;
                var assembly = typeof(HarmonyInstance).Assembly;
                var version  = assembly.GetName().Version;
                var location = assembly.Location;
                if (location == null || location == "")
                {
                    location = new Uri(assembly.CodeBase).LocalPath;
                }
                FileLog.Log("### Harmony id=" + id + ", version=" + version + ", location=" + location);
                var callingMethod   = GetOutsideCaller();
                var callingAssembly = callingMethod.DeclaringType.Assembly;
                location = callingAssembly.Location;
                if (location == null || location == "")
                {
                    location = new Uri(callingAssembly.CodeBase).LocalPath;
                }
                FileLog.Log("### Started from " + callingMethod.FullDescription() + ", location " + location);
                FileLog.Log("### At " + DateTime.Now.ToString("yyyy-MM-dd hh.mm.ss"));
            }

            this.id = id;
        }
Exemple #10
0
        public Mod(ModContentPack content) : base(content)
        {
#if HARMONY_1_2
            var harmony = Harmony.HarmonyInstance.Create("likeafox.rimworld.haulexplicitly");
#elif HARMONY_2_0
            var harmony = new HarmonyLib.Harmony("likeafox.rimworld.haulexplicitly");
#endif
            harmony.PatchAll(Assembly.GetExecutingAssembly());
        }
Exemple #11
0
 public void Init(IPA.Logging.Logger log, Config conf, Zenjector zenjector)
 {
     Instance      = this;
     Logger.logger = log;
     Configuration.PluginConfig.Instance = conf.Generated <Configuration.PluginConfig>();
     Logger.logger.Debug("Config loaded");
     Harmony = new HarmonyLib.Harmony(HarmonyID);
     zenjector.Install <CMMMenuInstaller>(Location.Menu);
 }
Exemple #12
0
        public void OnApplicationStart()
        {
            var harmony = new HarmonyLib.Harmony("com.kyle1413.beatsaber.diffreducer");

            harmony.PatchAll(System.Reflection.Assembly.GetExecutingAssembly());
            BeatSaberMarkupLanguage.GameplaySetup.GameplaySetup.instance.AddTab("DiffReducer", "DiffReducer.UI.modifierUI.bsml", UI.ModifierUI.instance, BeatSaberMarkupLanguage.GameplaySetup.MenuType.Solo);
            BS_Utils.Utilities.BSEvents.lateMenuSceneLoadedFresh += BSEvents_lateMenuSceneLoadedFresh;
            Config.Read();
        }
Exemple #13
0
        public Mod(ModContentPack content) : base(content)
        {
            Settings = GetSettings <Settings>();
            ModName  = content.Name;

            var harmony = new HarmonyLib.Harmony("FrontierDevelopments.Shields");

            harmony.PatchAll(Assembly.GetExecutingAssembly());
        }
Exemple #14
0
        protected BasePlugin()
        {
            var metadata = MetadataHelper.GetMetadata(this);

            HarmonyInstance = new HarmonyLib.Harmony("BepInEx.Plugin." + metadata.GUID);

            Log = Logger.CreateLogSource(metadata.Name);

            Config = new ConfigFile(Utility.CombinePaths(Paths.ConfigPath, metadata.GUID + ".cfg"), false, metadata);
        }
Exemple #15
0
        //////////////////////
        //  VRChat Methods  //
        //////////////////////

        public override void OnApplicationStart()
        {
            ExpansionKitApi.OnUiManagerInit += OnUiManagerInit;
            videoList = new List <ModVideo>();
            MelonCoroutines.Start(InitializeLibrary());
            MelonCoroutines.Start(LoadMenu());

            hInstance = new HarmonyLib.Harmony("com.StonedCode.VRCVideoLibrary");
            hInstance.PatchAll();
        }
Exemple #16
0
        static bool Load(UnityModManager.ModEntry modEntry)
        {
            //modEntry.OnToggle = OnToggle;

            harmony = new HarmonyLib.Harmony(modEntry.Info.Id);

            harmony.PatchAll(Assembly.GetExecutingAssembly());

            return(true);
        }
Exemple #17
0
        public override void Setup()
        {
            HarmonyLib.Harmony harmony = new HarmonyLib.Harmony("DemeoIntegration");
            harmony.Patch(typeof(ModdingAPI).GetMethod("GetInstalledMods", BindingFlags.Public | BindingFlags.Instance),
                          typeof(Demeo_Module).GetMethod("GetInstalledMods", BindingFlags.NonPublic | BindingFlags.Static).ToNewHarmonyMethod());

            MelonCompatibilityLayer.AddRefreshPluginsEvent(Refresh);
            MelonCompatibilityLayer.AddRefreshModsEvent(Refresh);
            Refresh();
        }
Exemple #18
0
        static PatchLoader()
        {
            var instance = new HarmonyLib.Harmony("pawn.education");

            instance.PatchAll(Assembly.GetExecutingAssembly());
            var message = "pawn.education : patched DoListingItems";

            ModSettings.ReadModSettings(ref message);
            Log.Message(message);
        }
Exemple #19
0
        public Module(ModContentPack content) : base(content)
        {
            var harmony = new HarmonyLib.Harmony("FrontierDevelopments.Shields1.2");

            harmony.PatchAll(Assembly.GetExecutingAssembly());

            Harmony_Verb.BlacklistType(typeof(Verb_Bombardment));

            // support for Cargo Pod transport
            Harmony_Skyfaller.WhitelistDef("HelicopterIncoming");
            Harmony_Skyfaller.WhitelistDef("HelicopterLeaving");
        }
Exemple #20
0
        public void HarmonyPatchOnce(Action <HarmonyLib.Harmony> action)
        {
            if (_harmonyId != null)             // this is faster than calling HarmonyLib.Harmony.HasAnyPatches(_harmonyId) for every Update
            {
                return;
            }

            _harmonyId = GetType().FullName;
            var harmony = new HarmonyLib.Harmony(_harmonyId);

            action(harmony);
        }
 public override void OnEnabled()
 {
     if (Config.IsEnabled)
     {
         instance = new HarmonyLib.Harmony($"abastien.seedmaker.{++counter}");
         instance.PatchAll();
     }
     else
     {
         Data.isRandom.Reset();
         Data.currentSeed.Reset();
     }
 }
Exemple #22
0
Fichier : Base.cs Projet : Ecu/MVCF
        public Base(ModContentPack content) : base(content)
        {
            var harm = new HarmonyLib.Harmony("legodude17.mvcf");

            harm.PatchAll(Assembly.GetExecutingAssembly());
            SearchLabel = harm.Id + Rand.Value;
            Prepatcher  = ModLister.HasActiveModWithName("Prepatcher");
            if (Prepatcher)
            {
                Log.Message("[MVCF] Prepatcher installed, switching");
            }
            Compat.ApplyCompat(harm);
        }
Exemple #23
0
        internal static int Initialize(ConfigFile configFile)
        {
            AppDomain curDomain = AppDomain.CurrentDomain;

            HarmonyInstance = new HarmonyLib.Harmony(BuildInfo.Name);

            if (MelonLaunchOptions.Core.EnableFixes)
            {
                Fixes.UnhandledException.Run(curDomain);
                Fixes.InvariantCurrentCulture.Install();
            }

            try { MelonUtils.Setup(); } catch (Exception ex) { MelonLogger.Error($"MelonUtils.Setup Exception: {ex}"); throw; }

            if (MelonLaunchOptions.Core.EnableFixes)
            {
                Fixes.ApplicationBase.Run(curDomain);
                Fixes.ExtraCleanup.Run();
            }

            MelonPreferences.Load();
            MelonLaunchOptions.Load(configFile);

            if (MelonLaunchOptions.Core.EnableCompatibilityLayers)
            {
                MelonCompatibilityLayer.Setup();
            }

            if (MelonLaunchOptions.Core.EnablePatchShield)
            {
                PatchShield.Install();
            }

            if (MelonLaunchOptions.Core.EnableBHapticsIntegration)
            {
                bHaptics.Load();
            }

            if (MelonLaunchOptions.Core.EnableCompatibilityLayers)
            {
                MelonCompatibilityLayer.SetupModules(MelonCompatibilityLayer.SetupType.OnPreInitialization);
            }

            MelonHandler.LoadPlugins();
            MelonHandler.OnPreInitialization();

            return(0);
        }
        protected override void OnGameStart(Game game, IGameStarter gameStarter)
        {
            if (game.GameType is Campaign)
            {
                workshopsSaved = new List <Workshop>();
                var harmony     = new HarmonyLib.Harmony("MBWorkshopSaver");
                var original    = typeof(ChangeOwnerOfWorkshopAction).GetMethod("ApplyByWarDeclaration");
                var newfunc     = typeof(SaveMyWorkshops).GetMethod("ApplyByWarDeclaration");
                var returnFalse = typeof(SaveMyWorkshops).GetMethod("returnFalse");
                harmony.Patch(original, new HarmonyLib.HarmonyMethod(returnFalse), new HarmonyLib.HarmonyMethod(newfunc));

                CampaignGameStarter campaignStarter = (CampaignGameStarter)gameStarter;
                campaignStarter.AddBehavior(new workshopworker());
            }
            base.BeginGameStart(game);
        }
Exemple #25
0
        public Plugin(IPALogger logger,
                      [Config.Name("CountersPlus")] Config conf,
                      Zenjector zenjector)
        {
            Instance   = this;
            Logger     = logger;
            MainConfig = conf.Generated <MainConfigModel>();
            harmony    = new HarmonyObj(HARMONY_ID);

            zenjector.OnApp <CoreInstaller>();
            zenjector.OnGame <CountersInstaller>()
            .Expose <CoreGameHUDController>()
            .ShortCircuitForTutorial()
            .ShortCircuitForMultiplayer();     // still dont have the time for this
            zenjector.OnMenu <MenuUIInstaller>();
        }
Exemple #26
0
        static bool Load(UnityModManager.ModEntry modEntry)
        {
            try
            {
                logger = modEntry.Logger;

                harmony = new HarmonyLib.Harmony(modEntry.Info.Id);
                harmony.PatchAll(Assembly.GetExecutingAssembly());
            }
            catch (Exception ex)
            {
                DebugError(ex);
                throw ex;
            }
            return(true);
        }
Exemple #27
0
        public Plugin(IPALogger logger,
                      [Config.Name("CountersPlus")] Config conf,
                      Zenjector zenjector)
        {
            Instance   = this;
            Logger     = logger;
            MainConfig = conf.Generated <MainConfigModel>();
            harmony    = new HarmonyObj(HARMONY_ID);

            zenjector.OnApp <CoreInstaller>();
            zenjector.OnGame <CountersInstaller>()
            .Expose <CoreGameHUDController>()
            .ShortCircuitForTutorial()
            .ShortCircuitForMultiplayer();     // This is until I can safely confirm that C+ works with Multiplayer.
            zenjector.OnMenu <MenuUIInstaller>();
        }
        internal void Awake()
        {
            try
            {
                var harmony = new HarmonyLib.Harmony(ID);
                harmony.PatchAll();

                CustomKeybindings.AddAction("QuickSave", KeybindingsCategory.CustomKeybindings, ControlType.Keyboard);
                //CustomKeybindings.AddAction("QuickLoad", KeybindingsCategory.Actions, ControlType.Both, 5);

                MyLogger.LogDebug("Awaken");
            }
            catch (Exception ex)
            {
                MyLogger.LogError(ex.Message);
            }
        }
Exemple #29
0
        public Plugin(IPALogger logger,
                      [Config.Name("CountersPlus")] Config conf,
                      Zenjector zenjector)
        {
            Instance   = this;
            Logger     = logger;
            MainConfig = conf.Generated <MainConfigModel>();
            harmony    = new HarmonyObj(HARMONY_ID);

            zenjector.Expose <CoreGameHUDController>("Environment");

            zenjector.Install <CoreInstaller>(Location.App);
            zenjector.Install <MenuUIInstaller>(Location.Menu);

            zenjector.Install <CountersInstaller>(Location.StandardPlayer | Location.CampaignPlayer);
            zenjector.Install <MultiplayerCountersInstaller, MultiplayerLocalActivePlayerInstaller>();
        }
Exemple #30
0
        public override void OnApplicationStart()
        {
            Logger    = LoggerInstance;
            HInstance = HarmonyInstance;

            ClassInjector.RegisterTypeInIl2Cpp <PortalPtr>();
            ClassInjector.RegisterTypeInIl2Cpp <EnableDisableListener>();
            MelonPreferences.CreateCategory("BetterPortalPlacement", "BetterPortalPlacement Settings");
            IsModOn = MelonPreferences.CreateEntry("BetterPortalPlacement", nameof(IsModOn), true, "Enable BetterPortalPlacement");
            UseConfirmationPopup = MelonPreferences.CreateEntry("BetterPortalPlacement", nameof(UseConfirmationPopup), false, "Use confirmation popup when dropping portal?");
            IsOnlyOnError        = MelonPreferences.CreateEntry("BetterPortalPlacement", nameof(IsOnlyOnError), false, "Use only on error?");
            Patches.ApplyPatches();

            WaitForUiInit();

            Logger.Msg("Successfully loaded!");
        }