Exemplo n.º 1
0
        //Main constructor
        public PwrMzrSettings(PwrMzrValue enabled, PwrMzrValue gov, PwrMzrValue batt_perf, PwrMzrValue ac_perf, bool OHSDOverride, PwrMzrValue OHSDEnabled, PwrMzrValue OHSDMemoryEnabled, PwrMzrValue OHSDCoreEnabled)
        {
            //Let's initialize the Entries with appropiate values

            if (enabled == PwrMzrValue.PM_DISABLED)
            {
                PowerMizerEnabled  = new Entry("PowerMizerEnable", PwrMzrValue.PM_DISABLED, RegistryValueKind.DWord);
                PowerMizerGovernor = new Entry("PerfLevelSrc", PwrMzrValue.BAT_FIXED_AC_FIXED, RegistryValueKind.DWord);
            }
            else
            {
                PowerMizerEnabled  = new Entry("PowerMizerEnable", PwrMzrValue.PM_ENABLED, RegistryValueKind.DWord);
                PowerMizerGovernor = new Entry("PerfLevelSrc", gov, RegistryValueKind.DWord);
            }


            PowerMizerBatteryFixedLevel = new Entry("PowerMizerLevel", batt_perf, RegistryValueKind.DWord);

            PowerMizerACFixedLevel = new Entry("PowerMizerLevelAC", ac_perf, RegistryValueKind.DWord);

            //Overheat Slowdown values
            OverheatSlowdownOverride = OHSDOverride;

            OverheatSlowdownEnabled = new Entry("EnableCoreSlowdown", OHSDEnabled, RegistryValueKind.DWord);
            OverheatSlowdownMemory  = new Entry("EnableMClkSlowdown", OHSDMemoryEnabled, RegistryValueKind.DWord);
            OverheatSlowdownCore    = new Entry("EnableNVClkSlowdown", OHSDCoreEnabled, RegistryValueKind.DWord);
        }
Exemplo n.º 2
0
        //Create a powermizerSettings structure from the controls configuration
        private PwrMzrSettings collectDataFromControls()
        {
            PwrMzrValue    pm_enab, gov, battfix, acfix;
            PwrMzrValue    OHSDEnabled = PwrMzrValue.PM_DISABLED, OHSDMem = PwrMzrValue.PM_DISABLED, OHSDCore = PwrMzrValue.PM_DISABLED;
            bool           OHSDOverride = false;
            PwrMzrSettings pmset;

            log("Reading dialog...");
            //Checkbox ENABLE/DISABLE Powermizer
            if (!this.checkBoxEnablePM.Checked)
            {
                pm_enab = PwrMzrValue.PM_DISABLED;
                gov     = PwrMzrValue.BAT_FIXED_AC_FIXED;
                battfix = PwrMzrValue.PM_DISABLED;
                acfix   = PwrMzrValue.PM_DISABLED;
            }
            else
            {
                pm_enab = PwrMzrValue.PM_ENABLED;

                //Governor
                if (this.radioButtonATBAtt.Checked)
                {
                    if (this.radioButtonATAC.Checked)
                    {
                        //0x3333
                        gov     = PwrMzrValue.BAT_ON_AC_ON;
                        acfix   = PwrMzrValue.MAX_PERF;
                        battfix = PwrMzrValue.MAX_PERF;
                    }
                    else
                    {
                        //0x3322
                        gov     = PwrMzrValue.BAT_ON_AC_FIXED;
                        acfix   = ((KeyValuePair <PwrMzrValue, string>) this.comboBoxLevelAC.SelectedItem).Key;
                        battfix = PwrMzrValue.MAX_PERF;
                    }
                }
                else
                {
                    if (this.radioButtonATAC.Checked)
                    {
                        //0x2233
                        gov     = PwrMzrValue.BAT_FIXED_AC_ON;
                        battfix = ((KeyValuePair <PwrMzrValue, string>) this.comboBoxLevelBatt.SelectedItem).Key;
                        acfix   = PwrMzrValue.MAX_PERF;
                    }
                    else
                    {
                        //0x2222
                        gov     = PwrMzrValue.BAT_FIXED_AC_FIXED;
                        acfix   = ((KeyValuePair <PwrMzrValue, string>) this.comboBoxLevelAC.SelectedItem).Key;
                        battfix = ((KeyValuePair <PwrMzrValue, string>) this.comboBoxLevelBatt.SelectedItem).Key;
                    }
                }
            }

            //Overheat slowdown
            if (this.checkBoxEnableSlowDown.Checked)
            {
                OHSDOverride = true;
                int key = ((KeyValuePair <int, string>) this.comboBoxSlowDown.SelectedItem).Key;

                switch (key)
                {
                case 1:
                    OHSDEnabled = PwrMzrValue.PM_DISABLED;
                    OHSDMem     = PwrMzrValue.PM_DISABLED;
                    OHSDCore    = PwrMzrValue.PM_DISABLED;
                    break;

                case 2:
                    OHSDEnabled = PwrMzrValue.PM_ENABLED;
                    OHSDMem     = PwrMzrValue.PM_ENABLED;
                    OHSDCore    = PwrMzrValue.PM_DISABLED;
                    break;

                case 3:
                    OHSDEnabled = PwrMzrValue.PM_ENABLED;
                    OHSDMem     = PwrMzrValue.PM_DISABLED;
                    OHSDCore    = PwrMzrValue.PM_ENABLED;
                    break;

                case 4:
                    OHSDEnabled = PwrMzrValue.PM_ENABLED;
                    OHSDMem     = PwrMzrValue.PM_ENABLED;
                    OHSDCore    = PwrMzrValue.PM_ENABLED;
                    break;
                }
            }
            else //They're already initialized. This else can be deleted
            {
                OHSDOverride = false;
                OHSDEnabled  = PwrMzrValue.PM_DISABLED;
                OHSDMem      = PwrMzrValue.PM_DISABLED;
                OHSDCore     = PwrMzrValue.PM_DISABLED;
            }

            pmset = new PwrMzrSettings(pm_enab, gov, battfix, acfix, OHSDOverride, OHSDEnabled, OHSDMem, OHSDCore);

            if (pmset.PowerMizerEnabled.EntryValue == PwrMzrValue.PM_ENABLED)
            {
                log("Powermizer will be ENABLED");
            }
            else
            {
                log("Powermizer will be DISABLED");
            }
            logsub("Selected Governor: " + pmset.PowerMizerGovernor.EntryValue.ToString());
            logsub("Selected Fixed Batt Level: " + pmset.PowerMizerBatteryFixedLevel.EntryValue.ToString());
            logsub("Selected Fixed AC Level: " + pmset.PowerMizerACFixedLevel.EntryValue.ToString());

            if (pmset.OverheatSlowdownOverride)
            {
                logsub("Overheat Slowdown settings will be OVERRIDEN");
                if (pmset.OverheatSlowdownEnabled.EntryValue == PwrMzrValue.PM_ENABLED)
                {
                    logsub("Overheat Slowdown is ENABLED.");
                }
                else
                {
                    logsub("Overheat Slowdown is DISABLED.");
                }
                if (pmset.OverheatSlowdownMemory.EntryValue == PwrMzrValue.PM_ENABLED)
                {
                    logsub("Overheat MEMORY Slowdown is ENABLED.");
                }
                else
                {
                    logsub("Overheat MEMORY Slowdown is DISABLED.");
                }
                if (pmset.OverheatSlowdownCore.EntryValue == PwrMzrValue.PM_ENABLED)
                {
                    logsub("Overheat CORE Slowdown is ENABLED.");
                }
                else
                {
                    logsub("Overheat CORE Slowdown is DISABLED.");
                }
            }
            else
            {
                logsub("Will NOT override Overheat Slowdown settings");
            }

            return(pmset);
        }
Exemplo n.º 3
0
        //Read the prowermizer Settings
        public PwrMzrSettings readPowermizerSettings()
        {
            //Read the settings from the registry
            log("Extracting PowerMizer settings...");

            object enab, gov, batfix, acfix;
            object sdenab, sdmem, sdcore;
            bool   sdoverr = false;

            try
            {
                //Let's extract the name of the keys from a settings struct
                PwrMzrSettings auxstruct = new PwrMzrSettings(PwrMzrValue.DEFAULT);
                enab   = regmgr.getDataValue(this.nvidiaKey, auxstruct.PowerMizerEnabled.EntryName);
                gov    = regmgr.getDataValue(this.nvidiaKey, auxstruct.PowerMizerGovernor.EntryName);
                batfix = regmgr.getDataValue(this.nvidiaKey, auxstruct.PowerMizerBatteryFixedLevel.EntryName);
                acfix  = regmgr.getDataValue(this.nvidiaKey, auxstruct.PowerMizerACFixedLevel.EntryName);

                //This settings may not be there!
                sdenab = regmgr.getDataValue(this.nvidiaKey, auxstruct.OverheatSlowdownEnabled.EntryName);
                sdmem  = regmgr.getDataValue(this.nvidiaKey, auxstruct.OverheatSlowdownMemory.EntryName);
                sdcore = regmgr.getDataValue(this.nvidiaKey, auxstruct.OverheatSlowdownCore.EntryName);
            }
            catch
            {
                logsub("There were some major problems while reading the PowerMizer Settings.");
                throw;
            }

            //Patch in 0.95. Detect inconsistet registry keys caused by playing with different driver versions.
            //In some rare cases, the PerfLevelSrc entry is there, but the others are not, leading to strange situations. This provides a way out.
            if ((enab == null) || (gov == null) || (batfix == null) || (acfix == null))
            {
                logsub("Your Registry settings seem to be inconsistent. You have **SOME** of the required entries for PowerMizer Management, but strangely enough, not **ALL** of them.This can be caused by installing/uninstalling several different drivers versions.");
                logsub("Please click the [Delete Powermizer Settings] button, and then on [Create Powermizer Settings] button again. This should solve the trouble. In case it does not, please send debug info to devs through the [Problems?] button.");
                throw new Exception();
            }

            logsub("Success...");

            //Create the settings structure (convert from object to the enumtype)

            PwrMzrValue governor  = (PwrMzrValue)Enum.ToObject(typeof(PwrMzrValue), gov);
            PwrMzrValue levelbatt = (PwrMzrValue)Enum.ToObject(typeof(PwrMzrValue), batfix);
            PwrMzrValue levelac   = (PwrMzrValue)Enum.ToObject(typeof(PwrMzrValue), acfix);
            PwrMzrValue pm_enab;


            if (Convert.ToBoolean(enab))
            {
                pm_enab = PwrMzrValue.PM_ENABLED;
                logsub("Powermizer is ENABLED.");
            }
            else
            {
                pm_enab = PwrMzrValue.PM_DISABLED;
                logsub("Powermizer is DISABLED.");
            }


            logsub("Actual Governor: " + governor.ToString());
            logsub("Actual Fixed Batt Level: " + levelbatt.ToString());
            logsub("Actual Fixed AC Level: " + levelac.ToString());


            //This settings may not be there, so we may have a bunch if nulls. Careful!
            PwrMzrValue OHSDEnabled = PwrMzrValue.PM_DISABLED, OHSDMemory = PwrMzrValue.PM_DISABLED, OHSDCore = PwrMzrValue.PM_DISABLED;

            if (sdenab != null)
            {
                sdoverr = true;
                logsub("Overheat Slowdown settings are OVERRIDEN...");

                if (Convert.ToBoolean(sdenab))
                {
                    OHSDEnabled = PwrMzrValue.PM_ENABLED;
                    logsub("Overheat Slowdown is ENABLED.");
                }
                else
                {
                    OHSDEnabled = PwrMzrValue.PM_DISABLED;
                    logsub("Overheat Slowdown is DISABLED.");
                }

                if (Convert.ToBoolean(sdmem))
                {
                    OHSDMemory = PwrMzrValue.PM_ENABLED;
                    logsub("Overheat MEMORY Slowdown is ENABLED.");
                }
                else
                {
                    OHSDMemory = PwrMzrValue.PM_DISABLED;
                    logsub("Overheat MEMORY Slowdown is DISABLED.");
                }

                if (Convert.ToBoolean(sdcore))
                {
                    OHSDCore = PwrMzrValue.PM_ENABLED;
                    logsub("Overheat CORE Slowdown is ENABLED.");
                }
                else
                {
                    OHSDCore = PwrMzrValue.PM_DISABLED;
                    logsub("Overheat CORE Slowdown is DISABLED.");
                }
            }
            else
            {
                sdoverr = false;
                logsub("No Overheat Slowdown settings found...");
            }



            //Create the settings to return them
            PwrMzrSettings pmset;

            if (sdoverr) //IF we have detected overriden settings we need to take them into account
            {
                pmset = new PwrMzrSettings(pm_enab, governor, levelbatt, levelac, sdoverr, OHSDEnabled, OHSDMemory, OHSDCore);
            }
            else
            {
                pmset = new PwrMzrSettings(pm_enab, governor, levelbatt, levelac);
            }

            return(pmset);
        }
Exemplo n.º 4
0
 public Entry(string name, PwrMzrValue value, RegistryValueKind type)
 {
     this.EntryName = name;
     this.EntryValue = value;
     this.EntryType = type;
 }
Exemplo n.º 5
0
 public PwrMzrSettings(PwrMzrValue value)
     : this(PwrMzrValue.PM_DISABLED, PwrMzrValue.BAT_FIXED_AC_FIXED, PwrMzrValue.PM_DISABLED, PwrMzrValue.PM_DISABLED)
 {
 }
Exemplo n.º 6
0
 //Ok, i'm tired of creating structs just to obtain the entry names or something , so this  are a couple of default contructors.
 //Not the cleanest thing ever, but it'll do the work:D
 public PwrMzrSettings(PwrMzrValue enabled, PwrMzrValue gov, PwrMzrValue batt_perf, PwrMzrValue ac_perf)
     : this(enabled, gov, batt_perf, ac_perf, false, PwrMzrValue.PM_DISABLED, PwrMzrValue.PM_DISABLED, PwrMzrValue.PM_DISABLED)
 {
 }
Exemplo n.º 7
0
        //Main constructor
        public PwrMzrSettings(PwrMzrValue enabled, PwrMzrValue gov, PwrMzrValue batt_perf, PwrMzrValue ac_perf, bool OHSDOverride, PwrMzrValue OHSDEnabled, PwrMzrValue OHSDMemoryEnabled, PwrMzrValue OHSDCoreEnabled)
        {
            //Let's initialize the Entries with appropiate values

            if (enabled == PwrMzrValue.PM_DISABLED)
            {
                PowerMizerEnabled = new Entry("PowerMizerEnable", PwrMzrValue.PM_DISABLED, RegistryValueKind.DWord);
                PowerMizerGovernor = new Entry("PerfLevelSrc", PwrMzrValue.BAT_FIXED_AC_FIXED, RegistryValueKind.DWord);
            }
            else
            {
                PowerMizerEnabled = new Entry("PowerMizerEnable", PwrMzrValue.PM_ENABLED, RegistryValueKind.DWord);
                PowerMizerGovernor = new Entry("PerfLevelSrc", gov, RegistryValueKind.DWord);
            }

            PowerMizerBatteryFixedLevel = new Entry("PowerMizerLevel", batt_perf, RegistryValueKind.DWord);

            PowerMizerACFixedLevel = new Entry("PowerMizerLevelAC", ac_perf, RegistryValueKind.DWord);

            //Overheat Slowdown values
            OverheatSlowdownOverride = OHSDOverride;

            OverheatSlowdownEnabled = new Entry("EnableCoreSlowdown", OHSDEnabled, RegistryValueKind.DWord);
            OverheatSlowdownMemory = new Entry("EnableMClkSlowdown", OHSDMemoryEnabled, RegistryValueKind.DWord);
            OverheatSlowdownCore = new Entry("EnableNVClkSlowdown", OHSDCoreEnabled, RegistryValueKind.DWord);
        }
Exemplo n.º 8
0
 public Entry(string name, PwrMzrValue value, RegistryValueKind type)
 {
     this.EntryName  = name;
     this.EntryValue = value;
     this.EntryType  = type;
 }
Exemplo n.º 9
0
 public PwrMzrSettings(PwrMzrValue value) : this(PwrMzrValue.PM_DISABLED, PwrMzrValue.BAT_FIXED_AC_FIXED, PwrMzrValue.PM_DISABLED, PwrMzrValue.PM_DISABLED)
 {
 }
Exemplo n.º 10
0
 //Ok, i'm tired of creating structs just to obtain the entry names or something , so this  are a couple of default contructors.
 //Not the cleanest thing ever, but it'll do the work:D
 public PwrMzrSettings(PwrMzrValue enabled, PwrMzrValue gov, PwrMzrValue batt_perf, PwrMzrValue ac_perf) : this(enabled, gov, batt_perf, ac_perf, false, PwrMzrValue.PM_DISABLED, PwrMzrValue.PM_DISABLED, PwrMzrValue.PM_DISABLED)
 {
 }