Exemple #1
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            try
            {
                // Send restore command
                NotificationIcon.Execute(DataInterface.NOTIFY_SAVE, false);

                buttonSave.Enabled = !NotificationIcon.SettingsSaved;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #2
0
        void ButtonApplyClick(object sender, EventArgs e)
        {
            // Apply new settings
            try
            {
                if (radioManualControl.Checked)
                {
                    UInt64 ocFid = Convert.ToUInt64(((CustomListItem)PstateOcFid.SelectedItem).value);
                    UInt64 ocDid = Convert.ToUInt64(((CustomListItem)PstateOcDid.SelectedItem).value);
                    UInt64 ocVid = Convert.ToUInt64(((CustomListItem)PstateOcVid.SelectedItem).value);
                    UInt64 ocPs  = NotificationIcon.di.MemRead(DataInterface.REG_PSTATE_OC);

                    ocPs &= 0xFFFFFFFFFFC00000;
                    ocPs |= (ocVid & 0xFF) << 14 | (ocDid & 0xFF) << 8 | ocFid & 0xFF;

                    NotificationIcon.di.MemWrite(DataInterface.REG_PSTATE_OC, ocPs);
                    if (!isZen2)
                    {
                        for (int i = 0; i < PSTATES - 1; i++)
                        {
                            UInt64 en = Convert.ToUInt64(PstateEn[i].Checked);
                            ocPs |= (en & 1) << 63;
                            NotificationIcon.di.MemWrite(DataInterface.REG_P0 + i, ocPs);
                            PstateFid[i].SelectedItem = PstateOcFid.SelectedItem;
                            PstateDid[i].SelectedItem = PstateOcDid.SelectedItem;
                            PstateVid[i].SelectedItem = PstateOcVid.SelectedItem;
                        }
                    }
                }
                else
                {
                    if (isZen2)
                    {
                        // Pstate2
                        UInt64 fid = Convert.ToUInt64(((CustomListItem)BoostFreqFid[2].SelectedItem).value);
                        UInt64 did = Convert.ToUInt64(((CustomListItem)BoostFreqDid[2].SelectedItem).value);

                        UInt64 ps = NotificationIcon.di.MemRead(DataInterface.REG_P2);

                        ps &= 0xFFFFFFFFFFFF0000;
                        ps |= (did & 0xFF) << 8 | fid & 0xFF;

                        NotificationIcon.di.MemWrite(DataInterface.REG_P2, ps);

                        // Max boost frequencies
                        for (int i = 0; i < 2; i++)
                        {
                            fid = Convert.ToUInt64(((CustomListItem)BoostFreqFid[i].SelectedItem).value);
                            did = Convert.ToUInt64(((CustomListItem)BoostFreqDid[i].SelectedItem).value);
                            // double freq = (25 * boostFid / (boostDid * 12.5)) * 100;
                            ps = NotificationIcon.di.MemRead(DataInterface.REG_BOOST_FREQ_0 + i);

                            ps &= 0xFFFFFFFFFFFF0000;
                            ps |= (did & 0xFF) << 8 | fid & 0xFF;

                            NotificationIcon.di.MemWrite(DataInterface.REG_BOOST_FREQ_0 + i, ps);
                        }
                    }
                    else
                    {
                        for (int i = 0; i < PSTATES; i++)
                        {
                            UInt64 en = Convert.ToUInt64(PstateEn[i].Checked);

                            UInt64 fid = Convert.ToUInt64(((CustomListItem)PstateFid[i].SelectedItem).value);
                            UInt64 did = Convert.ToUInt64(((CustomListItem)PstateDid[i].SelectedItem).value);
                            UInt64 vid = Convert.ToUInt64(((CustomListItem)PstateVid[i].SelectedItem).value);

                            UInt64 ps = NotificationIcon.di.MemRead(DataInterface.REG_P0 + i);

                            ps &= 0x7FFFFFFFFFC00000;
                            ps |= (en & 1) << 63 | (vid & 0xFF) << 14 | (did & 0xFF) << 8 | fid & 0xFF;

                            NotificationIcon.di.MemWrite(DataInterface.REG_P0 + i, ps);
                        }

                        NotificationIcon.di.MemWrite(DataInterface.REG_PSTATE_OC, NotificationIcon.di.MemRead(DataInterface.REG_P0));
                        PstateOcFid.SelectedItem = PstateFid[0].SelectedItem;
                        PstateOcDid.SelectedItem = PstateDid[0].SelectedItem;
                        PstateOcVid.SelectedItem = PstateVid[0].SelectedItem;
                    }
                }

                UInt64 flags = 0;
                if (checkBoxApplyOnStart.Checked)
                {
                    flags |= DataInterface.FLAG_APPLY_AT_START;
                }
                if (checkBoxGuiOnStart.Checked)
                {
                    flags |= DataInterface.FLAG_TRAY_ICON_AT_START;
                }
                if (checkBoxP80temp.Checked)
                {
                    flags |= DataInterface.FLAG_P80_TEMP_EN;
                }
                if (checkBoxC6Core.Checked)
                {
                    flags |= DataInterface.FLAG_C6CORE;
                }
                if (checkBoxC6Package.Checked)
                {
                    flags |= DataInterface.FLAG_C6PACKAGE;
                }
                if (checkBoxCpb.Checked)
                {
                    flags |= DataInterface.FLAG_CPB;
                }
                if (radioManualControl.Checked)
                {
                    flags |= DataInterface.FLAG_OC;
                }

                if (!int.TryParse(textBoxPPT.Text, out int ppt))
                {
                    MessageBox.Show("Bad PPT value.");
                    return;
                }
                if (!int.TryParse(textBoxTDC.Text, out int tdc))
                {
                    MessageBox.Show("Bad TDC value.");
                    return;
                }
                if (!int.TryParse(textBoxEDC.Text, out int edc))
                {
                    MessageBox.Show("Bad EDC value.");
                    return;
                }
                if (!int.TryParse(textBoxScalar.Text, out int scalar) || scalar < 1 || scalar > 10)
                {
                    MessageBox.Show("Bad Scalar value.");
                    return;
                }

                NotificationIcon.di.MemWrite(DataInterface.REG_PPT, (UInt64)ppt);
                NotificationIcon.di.MemWrite(DataInterface.REG_TDC, (UInt64)tdc);
                NotificationIcon.di.MemWrite(DataInterface.REG_EDC, (UInt64)edc);
                NotificationIcon.di.MemWrite(DataInterface.REG_SCALAR, (UInt64)scalar);
                NotificationIcon.di.MemWrite(DataInterface.REG_PERF_BIAS, (UInt64)comboBoxPerfbias.SelectedIndex);
                NotificationIcon.di.MemWrite(DataInterface.REG_CLIENT_FLAGS, flags);

                // Send update flag command
                NotificationIcon.Execute(DataInterface.NOTIFY_CLIENT_FLAGS, true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }