示例#1
0
        public override void DoSettingsWindowContents(Rect inRect)
        {
            if (Settings.modsText.Length == 0)
            {
                Settings.modsText  = "Potential RimThreaded mod conflicts :\n";
                Settings.modsText += getPotentialModConflicts();

                //Settings.modsText2 = "For future use... \n";
                //Settings.modsText2 += getAllStaticFields();

                //string path = "hmodText.txt";
                //StreamWriter writer = new StreamWriter(path, true);
                //writer.WriteLine(Settings.modsText);
                //writer.Close();
            }
            Settings.DoWindowContents(inRect);
            if (Settings.maxThreads != RimThreaded.maxThreads)
            {
                RimThreaded.maxThreads = Settings.disablelimits ? Math.Max(Settings.maxThreads, 1) : Math.Min(Math.Max(Settings.maxThreads, 1), 255);
                RimThreaded.RestartAllWorkerThreads();
            }
            RimThreaded.timeoutMS          = Settings.disablelimits ? Math.Max(Settings.timeoutMS, 1) : Math.Min(Math.Max(Settings.timeoutMS, 10000), 1000000);
            RimThreaded.timeSpeedNormal    = Settings.timeSpeedNormal;
            RimThreaded.timeSpeedFast      = Settings.timeSpeedFast;
            RimThreaded.timeSpeedSuperfast = Settings.timeSpeedSuperfast;
            RimThreaded.timeSpeedUltrafast = Settings.timeSpeedUltrafast;
        }
        public static bool DoSingleTick(TickManager __instance)
        {
            //RimThreaded.currentInstance = __instance;

            if (!DebugSettings.fastEcology)
            {
                __instance.ticksGameInt++;
            }
            else
            {
                __instance.ticksGameInt += 2000;
            }
            Shader.SetGlobalFloat(ShaderPropertyIDs.GameSeconds, __instance.TicksGame.TicksToSeconds());

            RimThreaded.MainThreadWaitLoop(__instance);

            if (DebugViewSettings.logHourlyScreenshot && Find.TickManager.TicksGame >= __instance.lastAutoScreenshot + 2500)
            {
                ScreenshotTaker.QueueSilentScreenshot();
                __instance.lastAutoScreenshot = Find.TickManager.TicksGame / 2500 * 2500;
            }

            Debug.developerConsoleVisible = false;
            return(false);
        }
 public static bool RunEventFromAnotherThread(Action action)
 {
     RimThreaded.InitializeAllThreadStatics();
     return(true);
 }
示例#4
0
        public override void DoSettingsWindowContents(Rect inRect)
        {
            if (Settings.modsText.Length == 0)
            {
                Settings.modsText = "Potential RimThreaded mod conflicts :\n";

                IEnumerable <MethodBase> originalMethods = Harmony.GetAllPatchedMethods();
                foreach (MethodBase originalMethod in originalMethods)
                {
                    Patches patches = Harmony.GetPatchInfo(originalMethod);
                    if (patches is null)
                    {
                    }
                    else
                    {
                        bool isRimThreadedPrefixed = false;
                        foreach (Patch patch in patches.Prefixes)
                        {
                            if (patch.owner.Equals("majorhoff.rimthreaded") && (patches.Prefixes.Count > 1 || patches.Postfixes.Count > 0 || patches.Transpilers.Count > 0))
                            {
                                isRimThreadedPrefixed = true;
                                Settings.modsText    += "\n---Patch method: " + patch.PatchMethod.DeclaringType.FullName + " " + patch.PatchMethod + "-- -\n";
                                Settings.modsText    += "RimThreaded priority: " + patch.priority + "\n";
                                break;
                            }
                        }
                        if (isRimThreadedPrefixed)
                        {
                            foreach (Patch patch in patches.Prefixes)
                            {
                                if (!patch.owner.Equals("majorhoff.rimthreaded"))
                                {
                                    //Settings.modsText += "method: " + patch.PatchMethod + " - ";
                                    Settings.modsText += "owner: " + patch.owner + " - ";
                                    Settings.modsText += "priority: " + patch.priority + "\n";
                                }
                            }
                            foreach (Patch patch in patches.Postfixes)
                            {
                                //Settings.modsText += "method: " + patch.PatchMethod + " - ";
                                Settings.modsText += "owner: " + patch.owner + " - ";
                                Settings.modsText += "priority: " + patch.priority + "\n";
                            }
                            foreach (Patch patch in patches.Transpilers)
                            {
                                //Settings.modsText += "method: " + patch.PatchMethod + " - ";
                                Settings.modsText += "owner: " + patch.owner + " - ";
                                Settings.modsText += "priority: " + patch.priority + "\n";
                            }
                        }
                    }
                }
                //string path = "hmodText.txt";
                //StreamWriter writer = new StreamWriter(path, true);
                //writer.WriteLine(Settings.modsText);
                //writer.Close();
            }
            Settings.DoWindowContents(inRect);
            if (Settings.maxThreads != RimThreaded.maxThreads)
            {
                RimThreaded.maxThreads = Math.Max(Settings.maxThreads, 1);
                RimThreaded.RestartAllWorkerThreads();
            }
            RimThreaded.timeoutMS          = Math.Max(Settings.timeoutMS, 1);
            RimThreaded.timeSpeedNormal    = Settings.timeSpeedNormal;
            RimThreaded.timeSpeedFast      = Settings.timeSpeedFast;
            RimThreaded.timeSpeedSuperfast = Settings.timeSpeedSuperfast;
            RimThreaded.timeSpeedUltrafast = Settings.timeSpeedUltrafast;
        }