diff --git a/AATUV3.csproj b/AATUV3.csproj
index f87d73a..eb4f6dd 100644
--- a/AATUV3.csproj
+++ b/AATUV3.csproj
@@ -114,6 +114,9 @@
AMDCustomPresets.xaml
+
+ APM.xaml
+
FSR.xaml
@@ -132,7 +135,9 @@
ASUSAC.xaml
+
+
@@ -167,6 +172,10 @@
Designer
MSBuild:Compile
+
+ MSBuild:Compile
+ Designer
+
MSBuild:Compile
Designer
diff --git a/App.config b/App.config
index bf8af73..081f12a 100644
--- a/App.config
+++ b/App.config
@@ -123,7 +123,13 @@
0,0,0,0,0,0,0,0
- 1
+ 2
+
+
+ 0,0,0,0,0,0,0,0
+
+
+ False
diff --git a/App.xaml.cs b/App.xaml.cs
index 32d9ce7..99dd20f 100644
--- a/App.xaml.cs
+++ b/App.xaml.cs
@@ -5,22 +5,44 @@
using System.Data;
using System.Diagnostics;
using System.Linq;
+using System.Security.Principal;
+using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Interop;
using UXTU.Scripts;
+using Windows.Foundation.Metadata;
namespace AATUV3
{
public partial class App : Application
{
+ //check if program has admin rights
+ public static bool IsAdministrator()
+ {
+ WindowsIdentity identity = WindowsIdentity.GetCurrent();
+ WindowsPrincipal principal = new WindowsPrincipal(identity);
+ return principal.IsInRole(WindowsBuiltInRole.Administrator);
+ }
+
private void Application_Startup(object sender, StartupEventArgs e)
{
_ = Tablet.TabletDevices;
new HwndSource(new HwndSourceParameters());
+
+ if (!App.IsAdministrator())
+ {
+ // Restart and run as admin
+ var exeName = Process.GetCurrentProcess().MainModule.FileName;
+ ProcessStartInfo startInfo = new ProcessStartInfo(exeName);
+ startInfo.Verb = "runas";
+ startInfo.Arguments = "restart";
+ Process.Start(startInfo);
+ System.Windows.Application.Current.Shutdown();
+ }
}
}
}
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index 22b2a06..af20909 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -29,23 +29,19 @@
using Forms = System.Windows.Forms;
using UXTU.Scripts;
using Microsoft.Win32;
+using System.Windows.Forms;
+using MessageBox = System.Windows.MessageBox;
+using Application = System.Windows.Application;
namespace AATUV3
{
public partial class MainWindow : Window
{
- //check if program has admin rights
- public static bool IsAdministrator()
- {
- WindowsIdentity identity = WindowsIdentity.GetCurrent();
- WindowsPrincipal principal = new WindowsPrincipal(identity);
- return principal.IsInRole(WindowsBuiltInRole.Administrator);
- }
public static string menu = "";
public static string AppName = "";
public static string mbo = "";
- public static Timer reApply;
+ public static System.Threading.Timer reApply;
[DllImport("inpoutx64.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
@@ -61,17 +57,6 @@ public static bool IsAdministrator()
public MainWindow()
{
- if (!MainWindow.IsAdministrator())
- {
- // Restart and run as admin
- var exeName = Process.GetCurrentProcess().MainModule.FileName;
- ProcessStartInfo startInfo = new ProcessStartInfo(exeName);
- startInfo.Verb = "runas";
- startInfo.Arguments = "restart";
- Process.Start(startInfo);
- this.Close();
- }
-
InitializeComponent();
//load main menu on load
PagesNavigation.Navigate(new System.Uri("Pages/HomeMenu.xaml", UriKind.RelativeOrAbsolute));
@@ -274,6 +259,7 @@ public MainWindow()
private void OnPowerChange(object s, PowerModeChangedEventArgs e)
{
+ int i = 0;
switch (e.Mode)
{
case PowerModes.Resume:
@@ -290,6 +276,124 @@ private void OnPowerChange(object s, PowerModeChangedEventArgs e)
case PowerModes.Suspend:
break;
}
+
+ if (e.Mode == Microsoft.Win32.PowerModes.StatusChange)
+ {
+ if ((bool)Settings.Default.isCPUCO == true)
+ {
+ if ((int)Settings.Default.COCPU >= 0)
+ {
+ SendCommand.set_coall((uint)Settings.Default.COCPU);
+ }
+ else
+ {
+ SendCommand.set_coall(Convert.ToUInt32(0x100000 - (uint)(-1 * (int)Settings.Default.COCPU)));
+ }
+ i++;
+ }
+
+ if ((bool)Settings.Default.isGPUCO == true)
+ {
+ if ((int)Settings.Default.COiGPU >= 0)
+ {
+ SendCommand.set_cogfx((uint)Settings.Default.COiGPU);
+ }
+ else
+ {
+ SendCommand.set_cogfx(Convert.ToUInt32(0x100000 - (uint)(-1 * (int)Settings.Default.COiGPU)));
+ }
+ i++;
+ }
+
+ //if (cbiGPU.IsChecked == true)
+ //{
+ // SendCommand.set_gfx_clk((uint)nudiGPU.Value);
+ // i++;
+ //}
+
+ string CCD1output = Settings.Default.PerCOCCD1;
+ string[] CCD1 = CCD1output.Split(',');
+
+ string CCD2output = Settings.Default.PerCOCCD2;
+ string[] CCD2 = CCD2output.Split(',');
+
+ if (Settings.Default.isPerCO == true)
+ {
+ int x = 0;
+ do
+ {
+ int CCD, CCX, CORE, magnitude, magnitude2;
+
+ CCD = 0;
+ CCX = 0;
+ CORE = x;
+
+ magnitude = Convert.ToInt32(CCD1[x]);
+ magnitude2 = Convert.ToInt32(CCD2[x]);
+
+ if (Families.FAMID == 3 || Families.FAMID == 7 || Families.FAMID == 8)
+ {
+ int value = (CORE << 20) | (magnitude & 0xFFFF);
+ SendCommand.set_coper(Convert.ToUInt32(value));
+ }
+ else if (magnitude >= 0)
+ {
+ uint CO = Convert.ToUInt32(((CCD << 4 | CCX % 1 & 15) << 4 | CORE % 8 & 15) << 20 | magnitude & 0xFFFFF);
+ SendCommand.set_coper(CO);
+
+ CCX = 1;
+ CO = Convert.ToUInt32(((CCD << 4 | CCX % 1 & 15) << 4 | CORE % 8 & 15) << 20 | magnitude & 0xFFFFF);
+ SendCommand.set_coper(CO);
+ }
+ else
+ {
+ magnitude = magnitude * -1;
+ uint CO = Convert.ToUInt32(((CCD << 4 | CCX % 1 & 15) << 4 | CORE % 8 & 15) << 20 | (0x100000 - magnitude) & 0xFFFFF);
+ SendCommand.set_coper(CO);
+
+ CCX = 1;
+ CO = Convert.ToUInt32(((CCD << 4 | CCX % 1 & 15) << 4 | CORE % 8 & 15) << 20 | (0x100000 - magnitude) & 0xFFFFF);
+ SendCommand.set_coper(CO);
+ }
+
+ if (magnitude2 >= 0)
+ {
+ uint CO;
+ if (Families.FAMID == 6 || Families.FAMID == 10)
+ {
+ CCD = 1;
+ CCX = 0;
+ CO = Convert.ToUInt32(((CCD << 4 | CCX % 1 & 15) << 4 | CORE % 8 & 15) << 20 | magnitude & 0xFFFFF);
+ SendCommand.set_coper(CO);
+
+ CCX = 1;
+ CO = Convert.ToUInt32(((CCD << 4 | CCX % 1 & 15) << 4 | CORE % 8 & 15) << 20 | magnitude & 0xFFFFF);
+ SendCommand.set_coper(CO);
+ }
+ }
+ else
+ {
+ magnitude2 = magnitude2 * -1;
+ uint CO;
+ if (Families.FAMID == 6 || Families.FAMID == 10)
+ {
+ CCX = 0;
+ CCD = 1;
+ CO = Convert.ToUInt32(((CCD << 4 | CCX % 1 & 15) << 4 | CORE % 8 & 15) << 20 | (0x100000 - magnitude2) & 0xFFFFF);
+ SendCommand.set_coper(CO);
+
+ CCX = 1;
+ CO = Convert.ToUInt32(((CCD << 4 | CCX % 1 & 15) << 4 | CORE % 8 & 15) << 20 | (0x100000 - magnitude2) & 0xFFFFF);
+ SendCommand.set_coper(CO);
+ }
+ }
+
+ x++;
+ }
+ while (x < 8);
+ i++;
+ }
+ }
}
private void btnClose_Click(object sender, RoutedEventArgs e)
@@ -459,6 +563,7 @@ private void rdAdaptive_Click(object sender, RoutedEventArgs e)
if (AppName.Contains("AMD APU"))
{
//Load menu
+ //PagesNavigation.Navigate(new System.Uri("Pages/APM.xaml", UriKind.RelativeOrAbsolute));
PagesNavigation.Navigate(new System.Uri("Pages/ComingSoon.xaml", UriKind.RelativeOrAbsolute));
//Set menu lable to menu name
menu = (string)rdAdaptive.Content;
diff --git a/NumericSpinner.xaml b/NumericSpinner.xaml
index 9b2e084..97750b5 100644
--- a/NumericSpinner.xaml
+++ b/NumericSpinner.xaml
@@ -58,7 +58,7 @@
-
+
diff --git a/Pages/APM.xaml b/Pages/APM.xaml
new file mode 100644
index 0000000..0822abc
--- /dev/null
+++ b/Pages/APM.xaml
@@ -0,0 +1,137 @@
+
+
+
+
+
+ Warning: We are not liable for any damages to hardware or resulting instabilities caused by adjustment of frequencies and voltages.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Power Savings
+ Balanced
+ Max Performance
+
+
+
+
+
+
+
+ TBO CPU offsets only work on unlocked Ryzen systems with max performance.
+
+
+
+
+
+
+ Power Savings
+ Max Performance
+
+
+
+
+
+
+
+
+
+ TBO iGPU only works with unlocked Radeon iGPUs.
+
+
+
+ This option only works with Radeon iGPU/dGPUs.
+
+
+
+
+
+
+
+
+
+
+
+ This option only works with Radeon iGPU/dGPUs.
+
+
+
+
+
+
+
+
+
+
+
+
+ This option only works with Radeon iGPU/dGPUs.
+
+
+
+
+
+ Power Savings
+ Max Performance
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ TBO GPU only works with unlocked Radeon/NVIDIA dGPUs.
+
+
+
+
+
+
+
+
+
diff --git a/Pages/APM.xaml.cs b/Pages/APM.xaml.cs
new file mode 100644
index 0000000..2414f08
--- /dev/null
+++ b/Pages/APM.xaml.cs
@@ -0,0 +1,104 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using RyzenSMUBackend;
+using AATUV3.Scripts.SMU_Backend_Scripts;
+using AATUV3.Scripts;
+using UXTU.Scripts;
+using UXTU.Properties;
+using System.IO;
+using System.Diagnostics;
+using UXTU.Scripts.Adpative_Modes.Performance;
+using UXTU.Scripts.ADLX;
+using System.Windows.Threading;
+
+namespace AATUV3.Pages
+{
+ ///
+ /// Interaction logic for HomeMenu.xaml
+ ///
+ ///
+
+ public partial class APM : UserControl
+ {
+ public DispatcherTimer reapplyAPM = new DispatcherTimer();
+
+ public APM()
+ {
+ InitializeComponent();
+ }
+
+ private async void Apply_Click(object sender, RoutedEventArgs e)
+ {
+ if (btnStart.Content.ToString() == "Start Mode")
+ {
+ btnStart.Content = "Stop Mode";
+
+ GlobalVariables.AdaptivePerf = true;
+ if (cbCPU.IsChecked == true)
+ {
+ int powermode = 0;
+
+ if (rbPower.IsChecked == true) powermode = 0;
+ if (rbBal.IsChecked == true) powermode = 1;
+ if (rbMax.IsChecked == true) powermode = 2;
+
+ if (cbTDP.IsChecked == true)
+ {
+ OverlayWindow.tdpOverride = (bool)cbTDP.IsChecked;
+ OverlayWindow.maxPowerOverride = (int)nudTDP.Value;
+ }
+
+ if (cbTemp.IsChecked == true)
+ {
+ OverlayWindow.tempOverride = (bool)cbTemp.IsChecked;
+ OverlayWindow.maxTempOverride = (int)nudTemp.Value;
+ }
+
+ if (cbTDP.IsChecked == true)
+ {
+ OverlayWindow.uvOverride = (bool)cbCO.IsChecked;
+ OverlayWindow.maxCOOverride = (int)nudCO.Value;
+ }
+
+ OverlayWindow.tboCPU = (bool)cbCPU.IsChecked;
+ OverlayWindow.tboiGPU = (bool)cbiGPU.IsChecked;
+
+ if (cbiGPUTemp.IsChecked == true) { OverlayWindow.tboiGPUTempOverride = true; OverlayWindow.tboiGPUMaxTemp = (int)nudiGPUTemp.Value; }
+ else OverlayWindow.tboiGPUTempOverride = false;
+
+ if (cbiGPUClockOffset.IsChecked == true) { OverlayWindow.tboiGPUOffset = (int)nudiGPUClockOffset.Value; }
+ else OverlayWindow.tboiGPUOffset = 0;
+
+ bool isEnabled = false;
+ if (cbsFPS.IsChecked == true) isEnabled = true;
+ int fpsLimit = (int)nudsFPS.Value;
+
+ ADLXBackend.SetFPSLimit(0, isEnabled, fpsLimit);
+
+ OverlayWindow.powermode = powermode;
+ }
+ else
+ {
+ btnStart.Content = "Start Mode";
+ GlobalVariables.AdaptivePerf = false;
+ if (cbCPU.IsChecked == true)
+ {
+ CpuPowerLimiter.updateBattery(1, 1, 1);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Pages/BasicSensor.xaml b/Pages/BasicSensor.xaml
index 6813f92..0d609c6 100644
--- a/Pages/BasicSensor.xaml
+++ b/Pages/BasicSensor.xaml
@@ -358,6 +358,51 @@
+
+
+
+ CCD1 Curve Optimiser Offsets:
+
+ Sensor
+ Value
+
+
+ Core 1 Offset:
+ 80w/105w
+
+
+ Core 2 Offset:
+ 80w/105w
+
+
+ Core 3 Offset:
+ 80w/105w
+
+
+ Core 4 Offset:
+ 105w/105w
+
+
+ Core 5 Offset:
+ 105w/105w
+
+
+
+ Core 6 Offset:
+ 105w/105w
+
+
+
+ Core 7 Offset:
+ 105w/105w
+
+
+
+ Core 8 Offset:
+ 105w/105w
+
+
+
diff --git a/Pages/BasicSensor.xaml.cs b/Pages/BasicSensor.xaml.cs
index 76ff1e5..aef4d1c 100644
--- a/Pages/BasicSensor.xaml.cs
+++ b/Pages/BasicSensor.xaml.cs
@@ -1,8 +1,10 @@
using AATUV3.Scripts.SMU_Backend_Scripts;
+using RyzenSmu;
using RyzenSMUBackend;
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@@ -35,6 +37,9 @@ public partial class BasicSensor : UserControl
//REMBRANDT - 8
//PHEONIX - 9
//RAPHAEL/DRAGON RANGE - 10
+ private static Smu RyzenAccess;
+ private static bool EnableDebug;
+ private static uint[] Args;
public BasicSensor()
{
@@ -49,6 +54,9 @@ public BasicSensor()
sensor.Interval = TimeSpan.FromSeconds(1);
sensor.Tick += SensorUpdate_Tick;
sensor.Start();
+
+ RyzenAccess = new Smu(EnableDebug);
+ RyzenAccess.Initialize();
}
void SensorUpdate_Tick(object sender, EventArgs e)
@@ -108,6 +116,7 @@ private void updateSensor()
lblSTAPM.Text = lblSTAPM.Text = $"{(int)GetSensor.getSensorValve("PPT_VALUE")}W/{(int)GetSensor.getSensorValve("PPT_LIMIT")}W";
}
+
lblCPUpw.Text = $"{GetSensor.getSensorValve("VDDCR_CPU_POWER").ToString("0.00")}W";
lblL3pw.Text = $"{(GetSensor.getSensorValve("L3_LOGIC_POWER") + GetSensor.getSensorValve("L3_VDDM_POWER")).ToString("0.00")}W";
@@ -183,8 +192,31 @@ private void updateSensor()
lblCore8ClkCCD2.Text = $"{(GetSensor.getSensorValve("CORE_FREQ_15")).ToString("0.00")}GHz";
}
}
+
+ if (Families.FAMID == 7 || Families.FAMID == 3)
+ {
+
+ TextBlock[] coCCD1 = {lblCore1CO, lblCore2CO, lblCore3CO, lblCore4CO, lblCore5CO, lblCore6CO, lblCore7CO, lblCore8CO };
+ int i = 0;
+ do
+ {
+ RyzenAccess = new Smu(EnableDebug);
+ RyzenAccess.Initialize();
+ Args = new uint[6];
+ Args[0] = Convert.ToUInt32(i & 0xFFFF);
+ RyzenAccess.SendMp1(0x62, ref Args);
+ coCCD1[i].Text = $"{(int)Args[0]}";
+ RyzenAccess.Deinitialize();
+ i++;
+ }
+ while (i < coCCD1.Length);
+
+ CCD1CO.Visibility = Visibility.Visible;
+
+
+ }
}
- catch { }
+ catch (Exception ex) { MessageBox.Show(ex.Message); }
}
}
}
diff --git a/Pages/ClockControl.xaml b/Pages/ClockControl.xaml
index f0de508..a05e54e 100644
--- a/Pages/ClockControl.xaml
+++ b/Pages/ClockControl.xaml
@@ -70,7 +70,7 @@
Warning: We are not liable for any damages to hardware or resulting instabilities caused by adjustment of frequencies and voltages.
-
+
@@ -80,13 +80,54 @@
-
+
+
+
+
+
+
+
+ CCD1:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Pages/ClockControl.xaml.cs b/Pages/ClockControl.xaml.cs
index 6757ca6..051f6d7 100644
--- a/Pages/ClockControl.xaml.cs
+++ b/Pages/ClockControl.xaml.cs
@@ -24,6 +24,7 @@
using System.Security.Cryptography;
using Stopbyte.Controls;
using System.Runtime.InteropServices;
+using RyzenSmu;
namespace AATUV3.Pages
{
@@ -52,6 +53,7 @@ public ClockControl()
cbdGPUCore.IsChecked = Settings.Default.isNV;
cbiGPU.IsChecked = Settings.Default.isiGPUClk;
cbCOPerCPU.IsChecked = Settings.Default.isPerCO;
+ cbOCPerCPU.IsChecked = Settings.Default.isPerOC;
cbRaddGPUCore.IsChecked = Settings.Default.isRadOC;
@@ -64,9 +66,14 @@ public ClockControl()
string CCD1 = Settings.Default.PerCOCCD1;
string[] CCD1Array = CCD1.Split(',');
+ string CCD1OC = Settings.Default.PerOCCCD1;
+ string[] CCD1OCArray = CCD1OC.Split(',');
+
string CCD2 = Settings.Default.PerCOCCD2;
string[] CCD2Array = CCD2.Split(',');
+ NumericSpinner[] ocCCD1 = { nudCCD1C1OC, nudCCD1C2OC, nudCCD1C3OC, nudCCD1C4OC, nudCCD1C5OC, nudCCD1C6OC, nudCCD1C7OC, nudCCD1C8OC };
+
NumericSpinner[] nudCCD1 = { nudCCD1C1, nudCCD1C2, nudCCD1C3, nudCCD1C4, nudCCD1C5, nudCCD1C6, nudCCD1C7, nudCCD1C8 };
NumericSpinner[] nudCCD2 = { nudCCD2C1, nudCCD2C2, nudCCD2C3, nudCCD2C4, nudCCD2C5, nudCCD2C6, nudCCD2C7, nudCCD2C8 };
@@ -78,13 +85,22 @@ public ClockControl()
x++;
} while (x < 8);
- if(Families.FAMID == 3 || Families.FAMID == 7 || Families.FAMID == 8)
+ x = 0;
+ do
+ {
+ ocCCD1[x].Value = Convert.ToInt32(CCD1OCArray[x]);
+ x++;
+ } while (x < 8);
+
+ if (Families.FAMID == 3 || Families.FAMID == 7 || Families.FAMID == 8)
{
cbCOPerCPU.Visibility= Visibility.Visible;
+ cbOCPerCPU.Visibility = Visibility.Visible;
}
else
{
cbCOPerCPU.Visibility = Visibility.Collapsed;
+ cbOCPerCPU.Visibility = Visibility.Collapsed;
}
if(cbCOPerCPU.IsChecked == true)
@@ -105,6 +121,15 @@ public ClockControl()
COCCD1.Visibility = Visibility.Collapsed;
}
+ if (cbOCPerCPU.IsChecked == true)
+ {
+ OCCCD1.Visibility = Visibility.Visible;
+ }
+ else
+ {
+ COCCD1.Visibility = Visibility.Collapsed;
+ }
+
//GetPowerInfo();
//getGPURange();
//getVRAMInfo();
@@ -114,6 +139,7 @@ public ClockControl()
private void Disable_Click(object sender, RoutedEventArgs e)
{
SendCommand.set_disable_oc();
+ BasicExeBackend.ApplySettings("\\bin\\Notification.exe", "1 Overclock-Reverted! Your-settings-have-been-reverted-successfully.", false);
}
public static int power, minClock, maxClock, Volt, VRAMClock, VRAMMode;
@@ -173,14 +199,32 @@ private async void Apply_Click(object sender, RoutedEventArgs e)
if (nudCOCPU.Value >= 0)
{
SendCommand.set_coall((uint)nudCOCPU.Value);
+ SendCommand.set_coall((uint)nudCOCPU.Value);
}
else
{
SendCommand.set_coall(Convert.ToUInt32(0x100000 - (uint)(-1 * (int)nudCOCPU.Value)));
+ SendCommand.set_coall(Convert.ToUInt32(0x100000 - (uint)(-1 * (int)nudCOCPU.Value)));
}
i++;
}
+ NumericSpinner[] ocCCD1 = { nudCCD1C1OC, nudCCD1C2OC, nudCCD1C3OC, nudCCD1C4OC, nudCCD1C5OC, nudCCD1C6OC, nudCCD1C7OC, nudCCD1C8OC };
+
+ if (cbOCPerCPU.IsChecked == true)
+ {
+ int o = 0;
+ do
+ {
+ SendCommand.set_per_core_oc_clk(Convert.ToUInt32((o << 20) | ((int)ocCCD1[o].Value & 1048575)));
+ SendCommand.set_enable_oc();
+ o++;
+ }
+ while (o < ocCCD1.Length);
+
+ i++;
+ }
+
NumericSpinner[] CCD1 = { nudCCD1C1, nudCCD1C2, nudCCD1C3, nudCCD1C4, nudCCD1C5, nudCCD1C6, nudCCD1C7, nudCCD1C8 };
NumericSpinner[] CCD2 = { nudCCD2C1, nudCCD2C2, nudCCD2C3, nudCCD2C4, nudCCD2C5, nudCCD2C6, nudCCD2C7, nudCCD2C8 };
@@ -202,6 +246,7 @@ private async void Apply_Click(object sender, RoutedEventArgs e)
{
int value = (CORE << 20) | (magnitude & 0xFFFF);
SendCommand.set_coper(Convert.ToUInt32(value));
+ SendCommand.set_coper(Convert.ToUInt32(value));
}
else if (magnitude >= 0)
{
@@ -348,6 +393,8 @@ private async void Apply_Click(object sender, RoutedEventArgs e)
string CCD1output = $"{CCD1[0].Value},{CCD1[1].Value},{CCD1[2].Value},{CCD1[3].Value},{CCD1[4].Value},{CCD1[5].Value},{CCD1[6].Value},{CCD1[7].Value}";
string CCD2output = $"{CCD2[0].Value},{CCD2[1].Value},{CCD2[2].Value},{CCD2[3].Value},{CCD2[4].Value},{CCD2[5].Value},{CCD2[6].Value},{CCD2[7].Value}";
+ string CCD1OCoutput = $"{ocCCD1[0].Value},{ocCCD1[1].Value},{ocCCD1[2].Value},{ocCCD1[3].Value},{ocCCD1[4].Value},{ocCCD1[5].Value},{ocCCD1[6].Value},{ocCCD1[7].Value}";
+
Settings.Default.isAllCoreCLK = (bool)cbCoreClock.IsChecked;
Settings.Default.isVID = (bool)cbCoreVolt.IsChecked;
Settings.Default.isBUS = (bool)cbBus.IsChecked;
@@ -357,9 +404,11 @@ private async void Apply_Click(object sender, RoutedEventArgs e)
Settings.Default.isNV = (bool)cbdGPUCore.IsChecked;
Settings.Default.isiGPUClk = (bool)cbiGPU.IsChecked;
Settings.Default.isRadOC = (bool)cbRaddGPUCore.IsChecked;
+ Settings.Default.isPerOC = (bool)cbOCPerCPU.IsChecked;
Settings.Default.PerCOCCD1 = CCD1output;
Settings.Default.PerCOCCD2 = CCD2output;
+ Settings.Default.PerOCCCD1 = CCD1OCoutput;
if (rbFactory.IsChecked == true) Settings.Default.RadOption = 0;
else if (rbUVGPU.IsChecked == true) Settings.Default.RadOption = 1;
@@ -404,6 +453,34 @@ private void cbCOPer_Click(object sender, RoutedEventArgs e)
}
}
+ private void cbOCPer_Click(object sender, RoutedEventArgs e)
+ {
+ if (cbOCPerCPU.IsChecked == true) cbCoreClock.IsChecked = false;
+
+ if (cbOCPerCPU.IsChecked == true)
+ {
+ OCCCD1.Visibility = Visibility.Visible;
+ }
+ else
+ {
+ OCCCD1.Visibility = Visibility.Collapsed;
+ }
+ }
+
+ private void cbOCCPU_Click(object sender, RoutedEventArgs e)
+ {
+ if (cbCoreClock.IsChecked == true) cbOCPerCPU.IsChecked = false;
+
+ if (cbCoreClock.IsChecked == true)
+ {
+ OCCCD1.Visibility = Visibility.Collapsed;
+ }
+ else
+ {
+ OCCCD1.Visibility = Visibility.Visible;
+ }
+ }
+
private void rbMan_Checked(object sender, RoutedEventArgs e)
{
spManual.Visibility = Visibility.Visible;
diff --git a/Pages/CustomPresets.xaml.cs b/Pages/CustomPresets.xaml.cs
index 482f981..fa6accd 100644
--- a/Pages/CustomPresets.xaml.cs
+++ b/Pages/CustomPresets.xaml.cs
@@ -397,6 +397,7 @@ private void UpdateRyzenAdjOutput(bool apply)
{
ryzenadj = ryzenadj + $"--tctl-temp={nudTempLimit.Value} ";
if(apply == true) SendCommand.set_tctl_temp((uint)nudTempLimit.Value);
+ if (apply == true) SendCommand.set_cHTC_temp((uint)nudTempLimit.Value);
}
if (cbSkinTempLimit.IsChecked == true)
@@ -409,6 +410,7 @@ private void UpdateRyzenAdjOutput(bool apply)
{
ryzenadj = ryzenadj + $"--stapm-limit={nudSTAPMLimit.Value * 1000} ";
if (apply == true) SendCommand.set_stapm_limit((uint)nudSTAPMLimit.Value * 1000);
+ if (apply == true) SendCommand.set_stapm2_limit((uint)nudSTAPMLimit.Value * 1000);
}
if (cbPL1.IsChecked == true)
diff --git a/Pages/HomeMenu.xaml b/Pages/HomeMenu.xaml
index e01402b..9ce76d3 100644
--- a/Pages/HomeMenu.xaml
+++ b/Pages/HomeMenu.xaml
@@ -76,7 +76,7 @@
-
+
diff --git a/Pages/HomeMenu.xaml.cs b/Pages/HomeMenu.xaml.cs
index 96cf23c..8dec19e 100644
--- a/Pages/HomeMenu.xaml.cs
+++ b/Pages/HomeMenu.xaml.cs
@@ -1,4 +1,6 @@
-using System;
+using AATUV3.Scripts.SMU_Backend_Scripts;
+using RyzenSMUBackend;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -25,6 +27,9 @@ public HomeMenu()
InitializeComponent();
lblAppName.Content = MainWindow.AppName;
+
+ //SendCommand.set_per_core_oc_clk(Convert.ToUInt32((7 << 20) | (4700 & 1048575)));
+
}
private void Discord_Click(object sender, RoutedEventArgs e)
diff --git a/Pages/ProjectSnowdrop.xaml b/Pages/ProjectSnowdrop.xaml
index 93ec434..6e0f8f3 100644
--- a/Pages/ProjectSnowdrop.xaml
+++ b/Pages/ProjectSnowdrop.xaml
@@ -81,7 +81,7 @@
-
+
Intended System Specification:
CPU: Ryzen 7 5825U 8C/16T @ 4.5GHz
GPU: Radeon RX Vega 8 @ 2GHz
diff --git a/Pages/ProjectSnowdrop.xaml.cs b/Pages/ProjectSnowdrop.xaml.cs
index 3101a43..ab6637e 100644
--- a/Pages/ProjectSnowdrop.xaml.cs
+++ b/Pages/ProjectSnowdrop.xaml.cs
@@ -40,10 +40,6 @@ public ProjectSnowdrop()
string apuPreset = path + "\\project-snowdrop\\APU";
string devicePath = path + "\\project-snowdrop\\Device";
- if (Settings.Default.SnowPreset == 1) btnPreset1.IsChecked = true;
- else if (Settings.Default.SnowPreset == 2) btnPreset2.IsChecked = true;
- else if (Settings.Default.SnowPreset == 3) btnPreset3.IsChecked = true;
-
if (File.Exists(devicePath + "\\config.txt"))
{
imgDevice.Source = new BitmapImage(new Uri(devicePath + "\\config.png"));
@@ -242,6 +238,11 @@ public ProjectSnowdrop()
lblPresetsHeader.Text = "APU Specific Power Presets:";
}
+
+ if (Settings.Default.SnowPreset == 1) { btnPreset1.IsChecked = true; applyPreset1(); }
+ else if (Settings.Default.SnowPreset == 2) { btnPreset2.IsChecked = true; applyPreset2(); }
+ else if (Settings.Default.SnowPreset == 3) { btnPreset3.IsChecked = true; applyPreset3(); }
+
} catch (Exception ex)
{
MessageBox.Show("An error occured loading presets. Error: " + ex.Message);
@@ -249,6 +250,11 @@ public ProjectSnowdrop()
}
private void btnPreset1_Click(object sender, RoutedEventArgs e)
+ {
+ applyPreset1();
+ }
+
+ public void applyPreset1()
{
if (preset1 == null || preset1 == "")
{
@@ -259,8 +265,8 @@ private void btnPreset1_Click(object sender, RoutedEventArgs e)
{
//Get RyzenAdj path
string pathRyzenAdj = "\\bin\\ryzenadj\\ryzenadj.exe";
- //Pass settings on to be applied
- BasicExeBackend.ApplySettings(pathRyzenAdj, preset1, true);
+ //Pass settings on to be applied
+ BasicExeBackend.ApplySettings(pathRyzenAdj, preset1, true);
BasicExeBackend.ApplySettings("\\bin\\Notification.exe", "1 Settings-Applied! Your-settings-have-been-applied-successfully.", false);
Settings.Default["RyzenAdjArguments"] = preset1;
Settings.Default.SnowPreset = 1;
@@ -270,6 +276,11 @@ private void btnPreset1_Click(object sender, RoutedEventArgs e)
}
private void btnPreset2_Click(object sender, RoutedEventArgs e)
+ {
+ applyPreset2();
+ }
+
+ public void applyPreset2()
{
if (preset2 == null || preset2 == "")
{
@@ -291,6 +302,11 @@ private void btnPreset2_Click(object sender, RoutedEventArgs e)
}
private void btnPreset3_Click(object sender, RoutedEventArgs e)
+ {
+ applyPreset3();
+ }
+
+ public void applyPreset3()
{
if (preset3 == null || preset3 == "")
{
diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
index 3e0f4fb..cdffb7c 100644
--- a/Properties/AssemblyInfo.cs
+++ b/Properties/AssemblyInfo.cs
@@ -51,5 +51,6 @@
// Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión
// utilizando el carácter "*", como se muestra a continuación:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.3")]
-[assembly: AssemblyFileVersion("1.0.0.3")]
+[assembly: AssemblyVersion("1.0.0.5")]
+[assembly: AssemblyFileVersion("1.0.0.5")]
+[assembly: NeutralResourcesLanguage("en-GB")]
diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs
index 8e5376f..eed833a 100644
--- a/Properties/Settings.Designer.cs
+++ b/Properties/Settings.Designer.cs
@@ -469,7 +469,7 @@ public string PerCOCCD2 {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("1")]
+ [global::System.Configuration.DefaultSettingValueAttribute("2")]
public int SnowPreset {
get {
return ((int)(this["SnowPreset"]));
@@ -478,5 +478,29 @@ public int SnowPreset {
this["SnowPreset"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("0,0,0,0,0,0,0,0")]
+ public string PerOCCCD1 {
+ get {
+ return ((string)(this["PerOCCCD1"]));
+ }
+ set {
+ this["PerOCCCD1"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("False")]
+ public bool isPerOC {
+ get {
+ return ((bool)(this["isPerOC"]));
+ }
+ set {
+ this["isPerOC"] = value;
+ }
+ }
}
}
diff --git a/Properties/Settings.settings b/Properties/Settings.settings
index cb4b933..a310f9f 100644
--- a/Properties/Settings.settings
+++ b/Properties/Settings.settings
@@ -114,7 +114,13 @@
0,0,0,0,0,0,0,0
- 1
+ 2
+
+
+ 0,0,0,0,0,0,0,0
+
+
+ False
\ No newline at end of file
diff --git a/Scripts/ADLX/ADLXBackend.cs b/Scripts/ADLX/ADLXBackend.cs
new file mode 100644
index 0000000..864c9f9
--- /dev/null
+++ b/Scripts/ADLX/ADLXBackend.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace UXTU.Scripts.ADLX
+{
+ internal class ADLXBackend
+ {
+ public const string CppFunctionsDLL = @"PerformanceMetrics.dll";
+ public const string CppFunctionsDLL1 = @"GraphSettings.dll";
+ [DllImport(CppFunctionsDLL, CallingConvention = CallingConvention.Cdecl)] public static extern int GetFPSData();
+ [DllImport(CppFunctionsDLL, CallingConvention = CallingConvention.Cdecl)] public static extern int GetGPUMetrics(int GPU, int Sensor);
+ [DllImport(CppFunctionsDLL1, CallingConvention = CallingConvention.Cdecl)] public static extern int SetFPSLimit(int GPU, bool isEnabled, int FPS);
+ }
+}
diff --git a/Scripts/Adpative Modes/Performance/CpuPowerLimiter.cs b/Scripts/Adpative Modes/Performance/CpuPowerLimiter.cs
index 7e415b1..46ca021 100644
--- a/Scripts/Adpative Modes/Performance/CpuPowerLimiter.cs
+++ b/Scripts/Adpative Modes/Performance/CpuPowerLimiter.cs
@@ -1,14 +1,17 @@
using AATUV3.Scripts.SMU_Backend_Scripts;
+using LibreHardwareMonitor.Hardware;
using RyzenSmu;
using RyzenSMUBackend;
using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Linq;
+using System.Management;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using UXTU.Properties;
+using UXTU.Scripts.ADLX;
namespace UXTU.Scripts.Adpative_Modes.Performance
{
@@ -19,7 +22,7 @@ public class CpuPowerLimiter
private const int CurveOptimiserIncrement = 1; // CO
private static int _newPowerLimit; // watts
- private static int _currentPowerLimit; // watts
+ public static int _currentPowerLimit; // watts
private static int _newCO; // CO
private static int _lastPowerLimit = 1000; // watts
private static int _lastCO = 0; // CO
@@ -55,6 +58,14 @@ public static void GetCurrentPowerLimit(int MaxPowerLimit, int MinPowerLimit, in
_currentPowerLimit = (int)GetSensor.getSensorValve("PPT_LIMIT");
MinPowerLimit = 30;
}
+ else
+ {
+ decimal STAPM = GetSensor.getSensorValueRAdj("STAPM LIMIT");
+ decimal Slow = GetSensor.getSensorValueRAdj("PPT LIMIT FAST");
+ decimal Fast = GetSensor.getSensorValueRAdj("PPT LIMIT SLOW");
+
+ _currentPowerLimit = Convert.ToInt32((Fast + Slow + STAPM) / 3);
+ }
if (_newPowerLimit == 0) _newPowerLimit = _currentPowerLimit;
}
@@ -73,25 +84,28 @@ public static void UpdatePowerLimit(int temperature, int cpuLoad, int MaxPowerLi
}
// Apply new power limit if power limit has changed
- if (_newPowerLimit != _lastPowerLimit || _currentPowerLimit != _newPowerLimit)
+ if (_newPowerLimit <= _lastPowerLimit - 1 && _newPowerLimit >= _lastPowerLimit + 1 || _currentPowerLimit != _newPowerLimit)
{
// Turn power limit into mW
uint _TDP = Convert.ToUInt32(_newPowerLimit * 1000);
// Detect if AMD CPU or APU
- if (Families.FAMID == 3 || Families.FAMID == 7)
+ if (Families.FAMID == 3 || Families.FAMID == 7 || Families.FAMID == 8)
{
- // Apply new power and temp limit
- SendCommand.set_tctl_temp((uint)MaxTemperature);
- SendCommand.set_apu_skin_temp_limit((uint)MaxTemperature);
- SendCommand.set_fast_limit(_TDP);
- SendCommand.set_slow_limit(_TDP);
- SendCommand.set_stapm_limit(_TDP);
- SendCommand.set_slow_time(64);
- SendCommand.set_stapm_time(1024);
- SendCommand.set_vrm_current((uint)(_TDP * 1.33));
- SendCommand.set_vrmmax_current((uint)(_TDP * 1.33));
+ if(_TDP >= 5000)
+ {
+ // Apply new power and temp limit
+ SendCommand.set_tctl_temp((uint)MaxTemperature);
+ SendCommand.set_apu_skin_temp_limit((uint)MaxTemperature);
+ SendCommand.set_fast_limit(_TDP);
+ SendCommand.set_slow_limit(_TDP);
+ SendCommand.set_stapm_limit(_TDP);
+ SendCommand.set_slow_time(64);
+ SendCommand.set_stapm_time(1024);
+ SendCommand.set_vrm_current((uint)(_TDP * 1.33));
+ SendCommand.set_vrmmax_current((uint)(_TDP * 1.33));
+ }
}
else if (Families.FAMID == 4 || Families.FAMID == 6)
{
@@ -112,7 +126,6 @@ public static void CurveOptimiserLimit(int cpuLoad, int MaxCurveOptimiser)
{
int newMaxCO = MaxCurveOptimiser;
-
// Change max CO limit based on CPU usage
if(cpuLoad < 10) newMaxCO = MaxCurveOptimiser;
else if (cpuLoad >= 10 && cpuLoad < 80) newMaxCO = MaxCurveOptimiser - CurveOptimiserIncrement * 2;
@@ -157,5 +170,382 @@ private static void UpdateCO(int _newCO)
// Save new CO to avoid unnecessary reapplies
_lastCO = _newCO;
}
+
+ private static int time = 200;
+ public static async void updateBattery(int _powerMode, int _cpuLoad, int _coresInUse)
+ {
+ await Task.Run(() =>
+ {
+ try
+ {
+ System.Diagnostics.Process process = new System.Diagnostics.Process();
+ System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
+ startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
+ startInfo.CreateNoWindow = true;
+
+ int i = 0;
+ if (_powerMode == 0)
+ {
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive 961CC777-2547-4F9D-8174-7D86181b8A7A";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setacvalueindex scheme_current sub_processor PERFBOOSTMODE 3";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setdcvalueindex scheme_current sub_processor PERFBOOSTMODE 3";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setacvalueindex scheme_current sub_processor CPMINCORES 25";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setdcvalueindex scheme_current sub_processor CPMINCORES 25";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setacvalueindex scheme_current sub_processor DISTRIBUTEUTIL 1";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setdcvalueindex scheme_current sub_processor DISTRIBUTEUTIL 1";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive scheme_current";
+ process.StartInfo = startInfo;
+ process.Start();
+ i++;
+ }
+ else if (_powerMode == 1)
+ {
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive 381B4222-F694-41F0-9685-FF5BB260DF2E";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive scheme_current";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setacvalueindex scheme_current sub_processor PERFBOOSTMODE 1";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive scheme_current";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setdcvalueindex scheme_current sub_processor PERFBOOSTMODE 1";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive scheme_current";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setacvalueindex scheme_current sub_processor CPMINCORES 75";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive scheme_current";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setdcvalueindex scheme_current sub_processor CPMINCORES 75";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive scheme_current";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive scheme_current";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setacvalueindex scheme_current sub_processor DISTRIBUTEUTIL 1";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive scheme_current";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setdcvalueindex scheme_current sub_processor DISTRIBUTEUTIL 1";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive scheme_current";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive scheme_current";
+ process.StartInfo = startInfo;
+ process.Start();
+ i++;
+ }
+ else if (_powerMode == 3)
+ {
+ SendCommand.set_max_performance(0);
+
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive DED574B5-45A0-4F42-8737-46345C09C238";
+ process.StartInfo = startInfo;
+ process.Start();
+
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive scheme_current";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setacvalueindex scheme_current sub_processor PERFBOOSTMODE 4";
+ process.StartInfo = startInfo;
+ process.Start();
+
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive scheme_current";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setdcvalueindex scheme_current sub_processor PERFBOOSTMODE 4";
+ process.StartInfo = startInfo;
+ process.Start();
+
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive scheme_current";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setacvalueindex scheme_current sub_processor CPMINCORES 100";
+ process.StartInfo = startInfo;
+ process.Start();
+
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive scheme_current";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "-setdcvalueindex scheme_current sub_processor CPMINCORES 100";
+ process.StartInfo = startInfo;
+ process.Start();
+
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive scheme_current";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "-setacvalueindex scheme_current sub_processor DISTRIBUTEUTIL 0";
+ process.StartInfo = startInfo;
+ process.Start();
+
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive scheme_current";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "-setdcvalueindex scheme_current sub_processor DISTRIBUTEUTIL 0";
+ process.StartInfo = startInfo;
+ process.Start();
+
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive scheme_current";
+ process.StartInfo = startInfo;
+ process.Start();
+ i++;
+
+ updateClock(_powerMode, _cpuLoad, _coresInUse);
+ }
+ } catch(Exception ex) { MessageBox.Show(ex.Message); }
+ });
+ }
+ public static int lastClock = 100;
+ public static async void updateClock(int _powerMode, int _cpuLoad, int _coresInUse)
+ {
+ await Task.Run(() =>
+ {
+ try
+ {
+ System.Diagnostics.Process process = new System.Diagnostics.Process();
+ System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
+ startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
+ startInfo.CreateNoWindow = true;
+ int gpuLoad = (int)ADLXBackend.GetGPUMetrics(0, 7);
+ int gpuFPS = (int)ADLXBackend.GetFPSData();
+ int gpuClock =(int)ADLXBackend.GetGPUMetrics(0, 0);
+ int maxBaseClock = 0;
+ int maxClock = 100;
+ int minClock = 20;
+ int minState = 0;
+ int newClock = 100;
+ int cpuIncrement = 1;
+
+ try
+ {
+ ManagementObjectSearcher searcher =
+ new ManagementObjectSearcher("root\\CIMV2",
+ "SELECT * FROM Win32_Processor");
+
+ foreach (ManagementObject queryObj in searcher.Get())
+ {
+ maxBaseClock = Convert.ToInt32(queryObj["MaxClockSpeed"]);
+ }
+ }
+ catch (ManagementException e)
+ {
+
+ }
+
+
+ if (_powerMode == 0)
+ {
+ maxClock = 99;
+ minState = 0;
+
+ if (_coresInUse == 1 && _cpuLoad < 65 || _coresInUse == 2 && _cpuLoad < 65)
+ {
+ newClock = 99;
+ }
+ else if (_coresInUse > 2 | _coresInUse < 1)
+ {
+ if (gpuFPS > 0 && gpuLoad > 95 && gpuClock < 1000 && _cpuLoad < 90)
+ {
+ newClock = lastClock - cpuIncrement;
+ }
+ else if (gpuFPS > 0 && gpuLoad > 95 && _cpuLoad < 90)
+ {
+ newClock = lastClock - cpuIncrement;
+ }
+ else if (_cpuLoad < 90)
+ {
+ newClock = lastClock - cpuIncrement;
+ }
+
+ if (gpuFPS > 0 && gpuLoad < 90 && _cpuLoad >= 95)
+ {
+ newClock = lastClock + cpuIncrement;
+ }
+ else if (_cpuLoad > 95)
+ {
+ newClock = lastClock + cpuIncrement;
+ }
+
+ if (newClock > maxClock) newClock = maxClock;
+ if (newClock < minClock) newClock = minClock;
+
+ lastClock = newClock;
+ }
+ }
+ else if (_powerMode == 1)
+ {
+ newClock = 100;
+ minState = 0;
+ }
+ else if (_powerMode == 2)
+ {
+ newClock = 100;
+ minState = 100;
+ }
+
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "-setacvalueindex scheme_current sub_processor PROCTHROTTLEMAX " + newClock;
+ process.StartInfo = startInfo;
+ process.Start();
+
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive scheme_current";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+
+
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "-setacvalueindex scheme_current sub_processor PROCTHROTTLEMIN " + minState;
+ process.StartInfo = startInfo;
+ process.Start();
+
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive scheme_current";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+
+
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "-setdcvalueindex scheme_current sub_processor PROCTHROTTLEMAX " + newClock;
+ process.StartInfo = startInfo;
+ process.Start();
+
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive scheme_current";
+ process.StartInfo = startInfo;
+ process.Start();
+ System.Threading.Thread.Sleep(time);
+
+
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "-setdcvalueindex scheme_current sub_processor PROCTHROTTLEMIN " + minState;
+ process.StartInfo = startInfo;
+ process.Start();
+
+ System.Threading.Thread.Sleep(time);
+ startInfo.FileName = "powercfg";
+ startInfo.Arguments = "/setactive scheme_current";
+ process.StartInfo = startInfo;
+ process.Start();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ });
+ }
}
}
diff --git a/Scripts/Adpative Modes/Performance/iGPUClockAdjust.cs b/Scripts/Adpative Modes/Performance/iGPUClockAdjust.cs
new file mode 100644
index 0000000..0651f1c
--- /dev/null
+++ b/Scripts/Adpative Modes/Performance/iGPUClockAdjust.cs
@@ -0,0 +1,101 @@
+using AATUV3.Scripts.SMU_Backend_Scripts;
+using Microsoft.Win32;
+using RyzenSMUBackend;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Management;
+using System.Text;
+using System.Threading.Tasks;
+using UXTU.Scripts.ADLX;
+
+namespace UXTU.Scripts.Adpative_Modes.Performance
+{
+ internal class iGPUClockAdjust
+ {
+ private const int ClockIncrement = 50; // mhz
+
+ private static int _newClock = 0; // mhz
+ private static int _currentClock = 0; // mhz
+ private static int _lastClock = 1000; // mhz
+ private static int _lastGpuUsage = 0; // %
+ private static int _gpuFPS = 0;
+ private static int _currentPowerUsage = 0; // watt
+ private static int _gpuLoad = 100; // %
+ private static int _temperature = 0; // °C
+
+ private static async void GetGPULoad()
+ {
+ await Task.Run(() =>
+ {
+ try
+ {
+ _gpuLoad = (int)ADLXBackend.GetGPUMetrics(0, 7);
+ _gpuFPS = (int)ADLXBackend.GetFPSData();
+ _currentClock = (int)ADLXBackend.GetGPUMetrics(0, 0);
+ _temperature = (int)ADLXBackend.GetGPUMetrics(0, 3);
+ }
+ catch (Exception ex)
+ {
+
+ }
+ });
+ }
+
+ private static void GetPower()
+ {
+ if (Families.FAMID == 3 || Families.FAMID == 7)
+ {
+ _currentPowerUsage = (int)GetSensor.getSensorValve("SOCKET_POWER");
+ }
+ else
+ {
+ decimal STAPM = GetSensor.getSensorValueRAdj("STAPM VALUE");
+ decimal Slow = GetSensor.getSensorValueRAdj("PPT VALUE SLOW");
+ decimal Fast = GetSensor.getSensorValueRAdj("PPT VALUE FAST");
+
+ _currentPowerUsage = Convert.ToInt32(Math.Max(Math.Max(STAPM, Slow), Fast));
+ }
+ }
+
+ public static void UpdateiGPUClock(int maxClock, int minClock, int MaxTemperature)
+ {
+ GetGPULoad();
+ GetPower();
+
+ if (maxClock < 2000 && _gpuLoad > (_lastGpuUsage + 35) && _currentClock < (maxClock / 1.35)) _newClock = (int)(maxClock / 1.35);
+ if (maxClock >= 2000 && _gpuLoad > (_lastGpuUsage + 35) && _currentClock < (maxClock / 1.55)) _newClock = (int)(maxClock / 1.55);
+
+ if (_temperature >= MaxTemperature - 2 || _gpuLoad < 85 || _currentPowerUsage > (CpuPowerLimiter._currentPowerLimit - 2))
+ {
+ // Reduce clock if temperature is too high or usage is too low or power is too high
+ _newClock = Math.Max(minClock, _newClock - ClockIncrement);
+ }
+ else if (_gpuLoad > 90 && _temperature <= (MaxTemperature - 5))
+ {
+ // Increase clock if temperature allows and GPU load is high
+ _newClock = Math.Min(maxClock, minClock + ClockIncrement);
+ }
+
+ // Apply new clock if clock has changed
+ if (_newClock != _lastClock + 50 || _newClock != _lastClock - 50)
+ {
+ // Detect if AMD CPU or APU
+ if (Families.FAMID == 3 || Families.FAMID == 7 || Families.FAMID == 8)
+ {
+ //Apply new clock
+ SendCommand.set_gfx_clk((uint)_newClock);
+ }
+ else if (Families.FAMID == 0 || Families.FAMID == 1)
+ {
+ //Apply new clock limits
+ SendCommand.set_max_gfxclk_freq((uint)_newClock);
+ SendCommand.set_min_gfxclk_freq((uint)_newClock - 200);
+ }
+
+ _lastClock = _newClock;
+ _lastGpuUsage = _gpuLoad;
+ }
+ }
+ }
+}
diff --git a/Scripts/SMU Backend Scripts/Addresses.cs b/Scripts/SMU Backend Scripts/Addresses.cs
index 780621b..a3ffb86 100644
--- a/Scripts/SMU Backend Scripts/Addresses.cs
+++ b/Scripts/SMU Backend Scripts/Addresses.cs
@@ -363,6 +363,22 @@ private static void ApplyOC()
string CCD2output = Settings.Default.PerCOCCD2;
string[] CCD2 = CCD2output.Split(',');
+ string CCD1OC = Settings.Default.PerOCCCD1;
+ string[] CCD1OCArray = CCD1OC.Split(',');
+
+ if ((bool)Settings.Default.isPerOC == true)
+ {
+ int o = 0;
+ do
+ {
+ SendCommand.set_per_core_oc_clk(Convert.ToUInt32((o << 20) | (Convert.ToUInt32( CCD1OCArray[o]) & 1048575)));
+ SendCommand.set_enable_oc();
+ o++;
+ i++;
+ }
+ while (o < CCD1OCArray.Length);
+ }
+
if (Settings.Default.isPerCO == true)
{
int x = 0;
diff --git a/Scripts/SMU Backend Scripts/GetSensor.cs b/Scripts/SMU Backend Scripts/GetSensor.cs
index c1ae36b..59d7eb1 100644
--- a/Scripts/SMU Backend Scripts/GetSensor.cs
+++ b/Scripts/SMU Backend Scripts/GetSensor.cs
@@ -9,6 +9,7 @@
using System.Windows.Forms;
using System.IO;
using UXTU.Properties;
+using System.Diagnostics;
namespace AATUV3.Scripts.SMU_Backend_Scripts
{
@@ -45,5 +46,50 @@ public static float getSensorValve(string SensorName)
catch (Exception ex) { }
return 0;
}
+
+ public static decimal getSensorValueRAdj(string SensorName)
+ {
+ using (Process process = new Process())
+ {
+ int i = 0;
+
+ string path = Settings.Default.Path + "\\bin\\ryzenadj\\ryzenadj.exe";
+ process.StartInfo.FileName = path;
+ process.StartInfo.Arguments = "-i";
+ process.StartInfo.UseShellExecute = false;
+ process.StartInfo.RedirectStandardOutput = true;
+ process.StartInfo.CreateNoWindow = true;
+ process.Start();
+
+
+ // Synchronously read the standard output of the spawned process.
+ StreamReader reader = process.StandardOutput;
+ string output = reader.ReadToEnd();
+
+ string[] lines = output.Split(new string[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
+
+ if (lines != null || lines.Length != 0)
+ {
+ do { i++; } while (!lines[i].Contains(SensorName));
+
+ if (lines[i].Contains(SensorName))
+ {
+ lines[i] = lines[i].Substring(25);
+ lines[i] = lines[i].Remove(lines[i].Length - 21);
+ lines[i] = lines[i].Replace("|", null);
+ lines[i] = lines[i].Replace(" ", null);
+
+ return Convert.ToDecimal(lines[i].ToString());
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ process.WaitForExit();
+ }
+
+ return 0;
+ }
}
}
diff --git a/Scripts/SMU Backend Scripts/SendCommand.cs b/Scripts/SMU Backend Scripts/SendCommand.cs
index 7257c90..6128bbe 100644
--- a/Scripts/SMU Backend Scripts/SendCommand.cs
+++ b/Scripts/SMU Backend Scripts/SendCommand.cs
@@ -54,6 +54,27 @@ public static void set_stapm_limit(uint value)
RyzenAccess.Deinitialize();
}
+ //STAMP2 Limit
+ public static void set_stapm2_limit(uint value)
+ {
+ RyzenAccess.Initialize();
+ uint[] Args = new uint[6];
+ Args[0] = value;
+
+ switch (FAMID)
+ {
+ case 3:
+ case 5:
+ case 7:
+ case 8:
+ RyzenAccess.SendPsmu(0x31, ref Args);
+ break;
+ default:
+ break;
+ }
+ RyzenAccess.Deinitialize();
+ }
+
//Fast Limit
public static void set_fast_limit(uint value)
{
@@ -194,6 +215,32 @@ public static void set_tctl_temp(uint value)
RyzenAccess.Deinitialize();
}
+ //cHTC Temp Limit
+ public static void set_cHTC_temp(uint value)
+ {
+ RyzenAccess.Initialize();
+ uint[] Args = new uint[6];
+ Args[0] = value;
+
+ switch (FAMID)
+ {
+ case 0:
+ case 1:
+ case 2:
+ RyzenAccess.SendPsmu(0x56, ref Args);
+ break;
+ case 3:
+ case 5:
+ case 7:
+ case 8:
+ RyzenAccess.SendPsmu(0x37, ref Args);
+ break;
+ default:
+ break;
+ }
+ RyzenAccess.Deinitialize();
+ }
+
//Skin Temp limit
public static void set_apu_skin_temp_limit(uint value)
{
@@ -615,11 +662,12 @@ public static void set_gfx_clk(uint value)
switch (FAMID)
{
case 3:
- case 5:
- case 7:
case 8:
RyzenAccess.SendPsmu(0x89, ref Args);
break;
+ case 7:
+ RyzenAccess.SendPsmu(0x1C, ref Args);
+ break;
default:
break;
}
diff --git a/Windows/OverlayWindow.xaml.cs b/Windows/OverlayWindow.xaml.cs
index 09ef5c3..e425a00 100644
--- a/Windows/OverlayWindow.xaml.cs
+++ b/Windows/OverlayWindow.xaml.cs
@@ -28,6 +28,8 @@
using AATUV3.Scripts.SMU_Backend_Scripts;
using MessageBox = System.Windows.MessageBox;
using Microsoft.Win32;
+using RyzenSmu;
+using System.Windows.Interop;
namespace AATUV3
{
@@ -38,6 +40,9 @@ public partial class OverlayWindow : Window
{
public int NVGPU = 0;
public DispatcherTimer autoReapply = new DispatcherTimer();
+ private static Smu RyzenAccess;
+ private static bool EnableDebug;
+ private static uint[] Args;
public OverlayWindow()
{
InitializeComponent();
@@ -46,7 +51,7 @@ public OverlayWindow()
//set up timer for sensor update
DispatcherTimer Adaptive = new DispatcherTimer();
- Adaptive.Interval = TimeSpan.FromSeconds(1);
+ Adaptive.Interval = TimeSpan.FromSeconds(1.125);
Adaptive.Tick += Adaptive_Tick;
Adaptive.Start();
@@ -69,6 +74,9 @@ public OverlayWindow()
};
thisPC.Open();
thisPC.Accept(new UpdateVisitor());
+
+ RyzenAccess = new Smu(EnableDebug);
+ RyzenAccess.Initialize();
}
public static Computer thisPC;
@@ -84,20 +92,21 @@ void Sensor_Tick(object sender, EventArgs e)
}
}
+ public static int maxPower, minPower, maxTemp, maxCO, powermode, coresInUse, tboiGPUOffset = 0, tboiGPUMaxTemp;
+ public static int maxPowerOverride, maxTempOverride, maxCOOverride;
+ public static bool tboCPU,tboiGPU, tdpOverride, tempOverride, uvOverride, tboiGPUTempOverride;
void Adaptive_Tick(object sender, EventArgs e)
{
try
{
if (GlobalVariables.AdaptivePerf == true)
{
- int maxPower, minPower, maxTemp, maxCO;
-
maxCO = 10;
maxPower = 65;
minPower = 5;
maxTemp = 95;
- if (Families.FAMID == 3 || Families.FAMID == 7)
+ if (Families.FAMID == 3 || Families.FAMID == 7 || Families.FAMID == 8)
{
maxTemp = 100;
@@ -111,9 +120,52 @@ void Adaptive_Tick(object sender, EventArgs e)
int cpuTemp = (int)GetSensor.getSensorValve("THM_VALUE_CORE");
+ if (tdpOverride) maxPower = maxPowerOverride;
+ if (tempOverride) maxTemp = maxTempOverride;
+ if (uvOverride) maxCO = maxCOOverride;
+
CpuPowerLimiter.GetCurrentPowerLimit(maxPower, minPower, maxTemp);
CpuPowerLimiter.UpdatePowerLimit(cpuTemp, cpuLoad, maxPower, minPower, maxTemp);
CpuPowerLimiter.CurveOptimiserLimit(cpuLoad, maxCO);
+
+ if (tboiGPUTempOverride != true) tboiGPUMaxTemp = maxTemp;
+
+ if(tboCPU == true)
+ {
+ if (System.Windows.Forms.SystemInformation.PowerStatus.PowerLineStatus != System.Windows.Forms.PowerLineStatus.Offline) CpuPowerLimiter.updateBattery(powermode, cpuLoad, coresInUse);
+ }
+
+ if (tboiGPU == true)
+ {
+ if (Families.FAMID == 3 || Families.FAMID == 7 )
+ {
+ Args = new uint[6];
+ int minClock, maxClock;
+ minClock = 400;
+ RyzenAccess.SendPsmu(0xE, ref Args);
+ maxClock = (int)Args[0];
+
+ maxClock = maxClock + tboiGPUOffset;
+
+ iGPUClockAdjust.UpdateiGPUClock(maxClock, minClock, tboiGPUMaxTemp);
+ }
+ else if (Settings.Default.APUName.Contains("6800U"))
+ {
+ int minClock, maxClock;
+ minClock = 400;
+ maxClock = 2200;
+ maxClock = maxClock + tboiGPUOffset;
+ iGPUClockAdjust.UpdateiGPUClock(maxClock, minClock, tboiGPUMaxTemp);
+ }
+ else if (Settings.Default.APUName.Contains("6600U"))
+ {
+ int minClock, maxClock;
+ minClock = 400;
+ maxClock = 1900;
+ maxClock = maxClock + tboiGPUOffset;
+ iGPUClockAdjust.UpdateiGPUClock(maxClock, minClock, tboiGPUMaxTemp);
+ }
+ }
}
else if (Families.FAMID == 4 || Families.FAMID == 6)
{
@@ -142,6 +194,7 @@ void Adaptive_Tick(object sender, EventArgs e)
}
public int cpuLoad = 0;
+ public int gpuLoad = 0;
void AutoReapply_Tick(object sender, EventArgs e)
{
@@ -193,13 +246,27 @@ public void getCPUInfo()
hardware.Update();
if (hardware.HardwareType == HardwareType.Cpu)
{
+ int i = 0;
foreach (var sensor in hardware.Sensors)
{
+ int o = 0;
+
if (sensor.SensorType == SensorType.Load && sensor.Name.Contains("Total"))
{
cpuLoad = (int)sensor.Value.GetValueOrDefault();
}
+
+ do
+ {
+ if (sensor.SensorType == SensorType.Load && sensor.Name.Contains(o.ToString()))
+ {
+ if ((int)sensor.Value.GetValueOrDefault() > 70) i++;
+ }
+ o++;
+ }
+ while (o < 32);
}
+ coresInUse = i;
}
}
}