Skip to content

Commit

Permalink
Use hw VID in ocmode
Browse files Browse the repository at this point in the history
  • Loading branch information
irusanov committed Dec 3, 2024
1 parent 0e1d155 commit 066e2ae
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 21 deletions.
17 changes: 11 additions & 6 deletions MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,23 @@ private double GetCurrentMulti(bool ocmode = false)
return Core.Utils.BitSlice(eax, 11, 0) * 5;
}

private byte GetCurrentVid(bool ocmode = false)
private uint GetCurrentVid(bool ocmode = false)
{
uint msr = ocmode ? MSR_PSTATE_BOOST : MSR_PStateDef0;
uint eax = default, edx = default;
//uint msr = ocmode ? MSR_PSTATE_BOOST : MSR_PStateDef0;
if (ocmode)
{
int vid = cpu.GetCurrentHwVid();
return vid > -1 ? (uint)vid : 0;
}

if (!cpu.ReadMsr(msr, ref eax, ref edx))
uint eax = default, edx = default;
if (!cpu.ReadMsr(MSR_PStateDef0, ref eax, ref edx))
{
HandleError("Error getting current VID!");
return 0;
}

return (byte)(eax >> 14 & 0xFF);
return eax >> 14 & 0x1FF;
}

private bool GetCPB()
Expand Down Expand Up @@ -464,7 +469,7 @@ private void InitPowerTab()
{
numericUpDownPPT.Value = Convert.ToDecimal(cpu.powerTable.Table[2]);
numericUpDownTDC.Value = Convert.ToDecimal(cpu.powerTable.Table[8]);
numericUpDownEDC.Value = Convert.ToDecimal(cpu.powerTable.Table[cpu.info.family >= Cpu.Family.FAMILY_19H ? 63 : 61]);
numericUpDownEDC.Value = Convert.ToDecimal(cpu.powerTable.Table[cpu.info.family >= Cpu.Family.FAMILY_1AH ? 63 : 61]);

/*
GetPhysLong(dramPtr + 0x010, out data);
Expand Down
18 changes: 11 additions & 7 deletions ZenStatesControlLib/ManualOverclockItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,8 @@ public Cpu.Family Family
set
{
family = value;
checkBoxSlowMode.Enabled = ocmode && Family < Cpu.Family.FAMILY_19H;
bool vidInput = Family >= Cpu.Family.FAMILY_1AH;
comboBoxMulti.Visible = !vidInput;
numericUpDown.Visible = vidInput;
//checkBoxSlowMode.Enabled = ocmode && Family < Cpu.Family.FAMILY_19H;

Reset();
}
}
Expand All @@ -288,8 +286,10 @@ public void Reset()
Frequency = frequency;
Multi = multi;
OCmode = ocmode;
comboBoxCore.SelectedIndex = selectedCoreIndex;

if (selectedCoreIndex < comboBoxCore.Items.Count - 1)
{
comboBoxCore.SelectedIndex = selectedCoreIndex;
}
comboBoxCore.Enabled = OCmode;
comboBoxMulti.Enabled = OCmode;
comboBoxVid.Enabled = OCmode;
Expand All @@ -298,7 +298,11 @@ public void Reset()
comboBoxControlMode.Enabled = OCmode;
comboBoxControlMode.SelectedIndex = 0;
checkBoxProchot.Enabled = OCmode;
checkBoxSlowMode.Enabled = OCmode;
checkBoxSlowMode.Enabled = OCmode && Family < Cpu.Family.FAMILY_19H;

bool vidInput = Family >= Cpu.Family.FAMILY_1AH;
comboBoxMulti.Visible = !vidInput;
numericUpDown.Visible = vidInput;

checkBoxProchot.Checked = ProchotEnabled;
}
Expand Down
8 changes: 4 additions & 4 deletions ZenStatesControlLib/PstateItem.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions ZenStatesControlLib/PstateItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,15 @@ private void NotifyValueChanged()
ValueChanged?.Invoke(new object(), new EventArgs());
}

private void checkBoxPstateEnabled_CheckedChanged(object sender, EventArgs e)
private void CheckBoxPstateEnabled_CheckedChanged(object sender, EventArgs e)
{
Checked = checkBoxPstateEnabled.Checked;
comboBoxFID.Enabled = Checked;
comboBoxDID.Enabled = Checked;
comboBoxVID.Enabled = Checked;
}

private void comboBoxDID_SelectedIndexChanged(object sender, EventArgs e)
private void ComboBoxDID_SelectedIndexChanged(object sender, EventArgs e)
{
double targetMulti = CalculateMulti(InitialCpuFid, InitialCpuDid);
CpuDid = GetSelectedItemValue(comboBoxDID);
Expand All @@ -179,12 +179,12 @@ private void comboBoxDID_SelectedIndexChanged(object sender, EventArgs e)
PopulateFidItems();
}

private void comboBoxFID_SelectedIndexChanged(object sender, EventArgs e)
private void ComboBoxFID_SelectedIndexChanged(object sender, EventArgs e)
{
CpuFid = GetSelectedItemValue(comboBoxFID);
}

private void comboBoxVID_SelectedIndexChanged(object sender, EventArgs e)
private void ComboBoxVID_SelectedIndexChanged(object sender, EventArgs e)
{
CpuVid = GetSelectedItemValue(comboBoxVID);
}
Expand Down

0 comments on commit 066e2ae

Please sign in to comment.