Skip to content

Commit

Permalink
Add basic Intel custom presets menu
Browse files Browse the repository at this point in the history
Fix auto reapply for Ryzen APUs
  • Loading branch information
JamesCJ60 committed Jul 11, 2022
1 parent d6ad249 commit 9a57d0e
Show file tree
Hide file tree
Showing 12 changed files with 221 additions and 30 deletions.
8 changes: 7 additions & 1 deletion AATUV3.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Pages\Intel\IntelCustomPresets.xaml.cs">
<DependentUpon>IntelCustomPresets.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\ClockControl.xaml.cs">
<DependentUpon>ClockControl.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -207,6 +210,10 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="Pages\Intel\IntelCustomPresets.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Pages\ClockControl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down Expand Up @@ -336,7 +343,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Pages\AMDCPU\" />
<Folder Include="Pages\Intel\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
Expand Down
2 changes: 1 addition & 1 deletion MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
<RadioButton x:Name="rdHome" IsChecked="True" Content="Home" Style="{DynamicResource MenuRadioButtonStyle}" Tag="{DynamicResource home}" Click="rdHome_Click" Height="50"/>
<RadioButton x:Name="rdSnow" IsChecked="False" Content="Project Snowdrop" Style="{DynamicResource MenuRadioButtonStyle}" Tag="{DynamicResource plant}" Click="rdSnow_Click" Height="50"/>
<RadioButton x:Name="rdCustom" IsChecked="False" Content="Custom Presets" Style="{DynamicResource MenuRadioButtonStyle}" Tag="{DynamicResource custom}" Height="50" Click="rdCustom_Click"/>
<RadioButton x:Name="rdAC" IsChecked="False" Content="Armoury Crate" Style="{DynamicResource MenuRadioButtonStyle}" Tag="{DynamicResource ac}" Height="50" Click="rdAC_Click"/>
<RadioButton x:Name="rdAC" IsChecked="False" Content="Armoury Crate" Style="{DynamicResource MenuRadioButtonStyle}" Tag="{DynamicResource ac}" Height="50" Click="rdAC_Click" Visibility="Collapsed"/>
<RadioButton x:Name="rdAdaptive" IsChecked="False" Content="Adaptive Performance" Style="{DynamicResource FlashButton}" Tag="{DynamicResource flash}" Height="50" Click="rdAdaptive_Click"/>
<RadioButton x:Name="rdClock" IsChecked="False" Content="Clock Control" Style="{DynamicResource MenuRadioButtonStyle}" Tag="{DynamicResource speed}" Height="50" Click="rdClock_Click"/>
<RadioButton x:Name="rdInfo" IsChecked="False" Content="Info" Style="{DynamicResource MenuRadioButtonStyle}" Tag="{DynamicResource info}" Height="50" Click="rdInfo_Click"/>
Expand Down
2 changes: 1 addition & 1 deletion MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ private void rdCustom_Click(object sender, RoutedEventArgs e)
if (AppName.Contains("Intel CPU"))
{
//Load menu
PagesNavigation.Navigate(new System.Uri("Pages/ComingSoon.xaml", UriKind.RelativeOrAbsolute));
PagesNavigation.Navigate(new System.Uri("Pages/Intel/IntelCustomPresets.xaml", UriKind.RelativeOrAbsolute));
//Set menu lable to menu name
menu = (string)rdCustom.Content;
lblMenu.Content = menu.ToUpper();
Expand Down
2 changes: 1 addition & 1 deletion Pages/ClockControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<Grid>
<Border CornerRadius="5" Background="{DynamicResource PrimaryBackgroundColor}">
<DockPanel LastChildFill="True">
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,6,0,0">
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,6,4,0">
<TextBlock Width="425" TextWrapping="Wrap" Margin="0,0,60,0" FontSize="13" Foreground="{DynamicResource PrimaryBlueColor}" >Warning: We are not liable for any damages to hardware or resulting instabilities caused by adjustment of frequencies and voltages.</TextBlock>
<Button Style="{DynamicResource RoundedButtonStyle}" Margin="0,0,4,3" Background="{DynamicResource PrimaryBlueColor}" FontSize="16" Foreground="White" Content="Disable CPU OC" Height="45" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="170" Click="Disable_Click"/>
<Button Style="{DynamicResource RoundedButtonStyle}" Margin="0,0,3,3" Background="{DynamicResource PrimaryBlueColor}" FontSize="16" Foreground="White" Content="Apply Settings" Height="45" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="170" Click="Apply_Click"/>
Expand Down
6 changes: 3 additions & 3 deletions Pages/CustomPresets.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@
</UserControl.Resources>
<Grid>
<Label Content="Presets:" FontSize="20" Foreground="White" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="6,10,0,0" Width="80"/>
<Button Style="{DynamicResource RoundedButtonStyle}" Margin="0,0,3,3" Background="{DynamicResource PrimaryBlueColor}" FontSize="16" Foreground="White" Content="Apply Settings" Height="45" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="170" Click="Apply_Click"/>
<Button Style="{DynamicResource RoundedButtonStyle}" Margin="0,0,178,3" Background="{DynamicResource PrimaryBlueColor}" FontSize="16" Foreground="White" Content="Save Preset" Height="45" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="170" Click="btnSavePreset_Click"/>
<Button Style="{DynamicResource RoundedButtonStyle}" Margin="0,0,353,3" Background="{DynamicResource PrimaryBlueColor}" FontSize="16" Foreground="White" Content="Delete Preset" Height="45" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="170" Click="Delete_Click"/>
<Button Style="{DynamicResource RoundedButtonStyle}" Margin="0,0,7,3" Background="{DynamicResource PrimaryBlueColor}" FontSize="16" Foreground="White" Content="Apply Settings" Height="45" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="170" Click="Apply_Click"/>
<Button Style="{DynamicResource RoundedButtonStyle}" Margin="0,0,182,3" Background="{DynamicResource PrimaryBlueColor}" FontSize="16" Foreground="White" Content="Save Preset" Height="45" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="170" Click="btnSavePreset_Click"/>
<Button Style="{DynamicResource RoundedButtonStyle}" Margin="0,0,357,3" Background="{DynamicResource PrimaryBlueColor}" FontSize="16" Foreground="White" Content="Delete Preset" Height="45" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="170" Click="Delete_Click"/>

<ComboBox Name="cmbPresets" HorizontalAlignment="Left" Margin="91,18,0,0" VerticalAlignment="Top" Width="175" FontSize="14" Height="24" SelectionChanged="cmbPresets_SelectionChanged"></ComboBox>
<Label Content="New Preset Name:" FontSize="20" Foreground="White" VerticalAlignment="Top" Margin="0,10,192,0" HorizontalAlignment="Right" Width="172"/>
Expand Down
137 changes: 137 additions & 0 deletions Pages/Intel/IntelCustomPresets.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
<UserControl x:Class="AATUV3.Pages.Intel.IntelCustomPresets"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:AATUV3.Pages"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
d:DesignHeight="500" d:DesignWidth="850">
<UserControl.Resources>
<Style x:Key="FocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<SolidColorBrush x:Key="Button.Static.Background" Color="#FFDDDDDD"/>
<SolidColorBrush x:Key="Button.Static.Border" Color="#FF707070"/>
<SolidColorBrush x:Key="Button.MouseOver.Background" Color="#FFBEE6FD"/>
<SolidColorBrush x:Key="Button.MouseOver.Border" Color="#FF3C7FB1"/>
<SolidColorBrush x:Key="Button.Pressed.Background" Color="#FFC4E5F6"/>
<SolidColorBrush x:Key="Button.Pressed.Border" Color="#FF2C628B"/>
<SolidColorBrush x:Key="Button.Disabled.Background" Color="#FFF4F4F4"/>
<SolidColorBrush x:Key="Button.Disabled.Border" Color="#FFADB2B5"/>
<SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#FF838383"/>
<Style x:Key="RoundedButtonStyle" TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
<Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
<Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="border" Background="{TemplateBinding Background}" CornerRadius="4" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0" SnapsToDevicePixels="true">
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsDefaulted" Value="true">
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" TargetName="border" Value="{DynamicResource PrimaryBlueColorHover}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.MouseOver.Border}"/>
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" TargetName="border" Value="{DynamicResource PrimaryBlueColorDown}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Disabled.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Disabled.Border}"/>
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<Border CornerRadius="5" Background="{DynamicResource PrimaryBackgroundColor}">
<DockPanel LastChildFill="True">
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,6,4,0">
<Button Style="{DynamicResource RoundedButtonStyle}" Margin="0,0,3,3" Background="{DynamicResource PrimaryBlueColor}" FontSize="16" Foreground="White" Content="Apply Settings" Height="45" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="170" Click="Apply_Click"/>
</StackPanel>
<DockPanel LastChildFill="True" Margin="6,0,0,0">
<ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Auto" Margin="0,0,0,0" CanContentScroll="False" Name="rightView" >
<DockPanel LastChildFill="False">
<StackPanel CanVerticallyScroll="True" DockPanel.Dock="Left">
<StackPanel Margin="0,6,0,0">
<CheckBox Name="cbPower" Content="CPU Power Control:" FontSize="17.2" Foreground="White" BorderThickness="0,1,1,1" Padding="4,-4,0,0" Margin="6,0,0,0" />
<StackPanel Orientation="Horizontal" Margin="20,2,0,0">
<Label Content="Power Limit 1:" Foreground="White" BorderBrush="White" FontSize="16" Height="auto" Width="180" />
<xctk:IntegerUpDown Name="nudPL1" Watermark="Enter Integer" Width="95" Height="20" Minimum="0" Value="0" Increment="5"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="20,-5,0,0">
<Label Content="Power Limit 2:" Foreground="White" BorderBrush="White" FontSize="16" Height="auto" Width="180" />
<xctk:IntegerUpDown Name="nudPL2" Watermark="Enter Integer" Width="95" Height="20" Minimum="0" Value="0" Increment="5"/>
</StackPanel>
</StackPanel>

<StackPanel Margin="0,10,0,0">
<CheckBox Name="cbVoltage" Content="FIVR Voltage Offset Control:" FontSize="17.2" Foreground="White" BorderThickness="0,1,1,1" Padding="4,-4,0,0" Margin="6,0,0,0" />
<StackPanel Orientation="Horizontal" Margin="20,2,0,0">
<Label Content="Core Voltage:" Foreground="White" BorderBrush="White" FontSize="16" Height="auto" Width="180" />
<xctk:IntegerUpDown Name="nudCore" Watermark="Enter Integer" Width="95" Height="20" Minimum="-500" Value="0" Increment="5"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="20,-5,0,0">
<Label Content="Cache Voltage:" Foreground="White" BorderBrush="White" FontSize="16" Height="auto" Width="180" />
<xctk:IntegerUpDown Name="nudCache" Watermark="Enter Integer" Width="95" Height="20" Minimum="-500" Value="0" Increment="5"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="20,-5,0,0">
<Label Content="iGPU Compute Voltage:" Foreground="White" BorderBrush="White" FontSize="16" Height="auto" Width="180"/>
<xctk:IntegerUpDown Name="nudGPU" Watermark="Enter Integer" Width="95" Height="20" Minimum="-500" Value="0" Increment="5"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="20,-5,0,0">
<Label Content="iGPU Unslice Voltage:" Foreground="White" BorderBrush="White" FontSize="16" Height="auto" Width="180"/>
<xctk:IntegerUpDown Name="nudGPUSlice" Watermark="Enter Integer" Width="95" Height="20" Minimum="-500" Value="0" Increment="5"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="20,-5,0,0">
<Label Content="Agent Voltage:" Foreground="White" BorderBrush="White" FontSize="16" Height="auto" Width="180" />
<xctk:IntegerUpDown Name="nudAgent" Watermark="Enter Integer" Width="95" Height="20" Minimum="-500" Value="0" Increment="5"/>
</StackPanel>


<TextBlock Foreground="White" FontSize="16" MaxWidth="295" TextWrapping="WrapWithOverflow">Only works on Intel CPUs with unlocked FIVR voltage control.</TextBlock>
<TextBlock Foreground="White" FontSize="16" MaxWidth="295" TextWrapping="WrapWithOverflow" Margin="0,10,0,0">Core and Cache must be synced with older Intel CPUs for voltage offsets to work.</TextBlock>
<TextBlock Foreground="White" FontSize="16" MaxWidth="295" TextWrapping="WrapWithOverflow" Margin="0,55,0,0">More options will be added over time.</TextBlock>

</StackPanel>

</StackPanel>
<StackPanel DockPanel.Dock="Right" Margin="0,6,0,0" Visibility="Collapsed">
<StackPanel Margin="0,6,0,0">
<Label Content="Radeon iGPU Settings:" FontSize="18" Foreground="White"/>
<StackPanel Orientation="Horizontal" Margin="20,6,0,0">
<CheckBox Name="cbiGPU" Content="iGPU Clock:" Foreground="White" BorderBrush="White" FontSize="16" Height="18" Width="150" BorderThickness="0,1,1,1" Padding="8,-4,0,0"/>
<xctk:IntegerUpDown Name="nudiGPU" Watermark="Enter Integer" Width="95" Height="20" Minimum="200" Value="1500" Increment="25"/>
</StackPanel>
</StackPanel>


</StackPanel>
</DockPanel>
</ScrollViewer>
</DockPanel>
</DockPanel>
</Border>
</Grid>
</UserControl>
41 changes: 41 additions & 0 deletions Pages/Intel/IntelCustomPresets.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
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.Intel;

namespace AATUV3.Pages.Intel
{
/// <summary>
/// Interaction logic for HomeMenu.xaml
/// </summary>
public partial class IntelCustomPresets : UserControl
{
public IntelCustomPresets()
{
InitializeComponent();
}

private async void Apply_Click(object sender, RoutedEventArgs e)
{
string voltageOffset = $"set --allow-overvolt --commit 0 {(int)nudCore.Value} 1 {(int)nudGPU.Value} 2 {(int)nudCache.Value} 3 {(int)nudAgent.Value} 4 {(int)nudGPUSlice.Value}";

if(cbPower.IsChecked == true) await Task.Run(() => ChangeTDP.changeTDP((int)nudPL1.Value, (int)nudPL2.Value));

if (cbVoltage.IsChecked == true) BasicExeBackend.ApplySettings("bin//intel//IntelVoltageControl.exe", voltageOffset, true);
}
}
}
Loading

0 comments on commit 9a57d0e

Please sign in to comment.