Skip to content

Commit

Permalink
Add basic AMD custom presets menu
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesCJ60 committed Jul 11, 2022
1 parent 9a57d0e commit 2b40759
Show file tree
Hide file tree
Showing 7 changed files with 177 additions and 45 deletions.
11 changes: 8 additions & 3 deletions 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\AMDCPU\AMDCustomPresets.xaml.cs">
<DependentUpon>AMDCustomPresets.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\Intel\IntelCustomPresets.xaml.cs">
<DependentUpon>IntelCustomPresets.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -210,6 +213,10 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="Pages\AMDCPU\AMDCustomPresets.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Pages\Intel\IntelCustomPresets.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down Expand Up @@ -341,9 +348,7 @@
<ItemGroup>
<Resource Include="Assets\Icons\database-2-line.png" />
</ItemGroup>
<ItemGroup>
<Folder Include="Pages\AMDCPU\" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
Expand Down
17 changes: 3 additions & 14 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ private void rdCustom_Click(object sender, RoutedEventArgs e)
if (AppName.Contains("AMD CPU"))
{
//Load menu
PagesNavigation.Navigate(new System.Uri("Pages/ComingSoon.xaml", UriKind.RelativeOrAbsolute));
PagesNavigation.Navigate(new System.Uri("Pages/AMDCPU/AMDCustomPresets.xaml", UriKind.RelativeOrAbsolute));
//Set menu lable to menu name
menu = (string)rdCustom.Content;
lblMenu.Content = menu.ToUpper();
Expand Down Expand Up @@ -481,24 +481,13 @@ private void rdInfo_Click(object sender, RoutedEventArgs e)
}
}

if (AppName.Contains("AMD APU"))
if (File.Exists(Settings.Default["Path"].ToString() + $"\\bin\\pmtables\\0x00{string.Format("{0:x}", Addresses.PMTableVersion)}-sensors.txt"))
{
//Load menu
PagesNavigation.Navigate(new System.Uri("Pages/BasicSensor.xaml", UriKind.RelativeOrAbsolute));
//PagesNavigation.Navigate(new System.Uri("Pages/ComingSoon.xaml", UriKind.RelativeOrAbsolute));
//Set menu lable to menu name
menu = (string)rdInfo.Content;
lblMenu.Content = menu.ToUpper();
}


if (AppName.Contains("AMD CPU"))
else
{
//Load menu
PagesNavigation.Navigate(new System.Uri("Pages/ComingSoon.xaml", UriKind.RelativeOrAbsolute));
//Set menu lable to menu name
menu = (string)rdInfo.Content;
lblMenu.Content = menu.ToUpper();
}

if (AppName.Contains("Intel CPU"))
Expand Down
114 changes: 114 additions & 0 deletions Pages/AMDCPU/AMDCustomPresets.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<UserControl x:Class="AATUV3.Pages.AMDCPU.AMDCustomPresets"
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="PPT:" Foreground="White" BorderBrush="White" FontSize="16" Height="auto" Width="50" />
<xctk:IntegerUpDown Name="nudPPT" Watermark="Enter Integer" Width="95" Height="20" Minimum="0" Value="0" Increment="5"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="20,-5,0,0">
<Label Content="TDC:" Foreground="White" BorderBrush="White" FontSize="16" Height="auto" Width="50" />
<xctk:IntegerUpDown Name="nudTDC" Watermark="Enter Integer" Width="95" Height="20" Minimum="0" Value="0" Increment="5"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="20,-5,0,0">
<Label Content="EDC:" Foreground="White" BorderBrush="White" FontSize="16" Height="auto" Width="50" />
<xctk:IntegerUpDown Name="nudEDC" Watermark="Enter Integer" Width="95" Height="20" Minimum="0" Value="0" Increment="5"/>
</StackPanel>

<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>
42 changes: 42 additions & 0 deletions Pages/AMDCPU/AMDCustomPresets.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
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.AMDCPU
{
/// <summary>
/// Interaction logic for HomeMenu.xaml
/// </summary>
public partial class AMDCustomPresets : UserControl
{
public AMDCustomPresets()
{
InitializeComponent();
}

private void Apply_Click(object sender, RoutedEventArgs e)
{
if(cbPower.IsChecked == true)
{
SendCommand.set_ppt((uint)nudPPT.Value * 1000);
SendCommand.set_edc((uint)nudEDC.Value * 1000);
SendCommand.set_tdc((uint)nudTDC.Value * 1000);
}
}
}
}
4 changes: 2 additions & 2 deletions Pages/ClockControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@
<Label Content="Curve Optimiser Settings:" FontSize="18" Foreground="White"/>
<StackPanel Orientation="Horizontal" Margin="20,6,0,0">
<CheckBox Name="cbCOCPU" Content="CPU:" Foreground="White" BorderBrush="White" FontSize="16" Height="18" Width="150" BorderThickness="0,1,1,1" Padding="8,-4,0,0"/>
<xctk:IntegerUpDown Name="nudCOCPU" Watermark="Enter Integer" Width="95" Height="20" Minimum="-30" Value="0" Maximum="30" Increment="1"/>
<xctk:IntegerUpDown Name="nudCOCPU" Watermark="Enter Integer" Width="95" Height="20" Minimum="-50" Value="0" Maximum="30" Increment="1"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="20,3,0,0">
<CheckBox Name="cbCOIGPU" Content="iGPU:" Foreground="White" BorderBrush="White" FontSize="16" Height="18" Width="150" BorderThickness="0,1,1,1" Padding="8,-4,0,0"/>
<xctk:IntegerUpDown Name="nudCOIGPU" Watermark="Enter Integer" Width="95" Height="20" Minimum="-30" Value="0" Maximum="30" Increment="1"/>
<xctk:IntegerUpDown Name="nudCOIGPU" Watermark="Enter Integer" Width="95" Height="20" Minimum="-50" Value="0" Maximum="30" Increment="1"/>
</StackPanel>
</StackPanel>
</StackPanel>
Expand Down
8 changes: 4 additions & 4 deletions Windows/OverlayWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@
</StackPanel.Background>
<StackPanel Orientation="Horizontal" Height="38" HorizontalAlignment="Right" Margin="0,10,10,0">
<Image Source="..\Assets\Icons\time-line.png" Margin="10,0,5,0" />
<Label Name="lblTime" Content="18:30" Foreground="White" FontSize="20" FontWeight="Bold" />
<Label Name="lblTime" Content="18:30" Foreground="White" FontSize="20" FontWeight="Bold" MinWidth="60"/>

<Image Source="..\Assets\Icons\temp-hot-line.png" Margin="10,0,5,0" />
<Label Name="lblTemp" Content="0°C" Foreground="White" FontSize="20" FontWeight="Bold" />
<Label Name="lblTemp" Content="0°C" Foreground="White" FontSize="20" FontWeight="Bold" MinWidth="60"/>

<Image Source="..\Assets\Icons\flashlight-line.png" Margin="10,0,5,0" />
<Label Name="lblPower" Content="0w" Foreground="White" FontSize="20" FontWeight="Bold" />
<Label Name="lblPower" Content="0w" Foreground="White" FontSize="20" FontWeight="Bold" MinWidth="60"/>


<Image Name="imgBattery" Source="..\Assets\Icons\battery-fill.png" Margin="10,0,5,0"/>
<Label Name="lblBattery" Content="100%" Foreground="White" FontSize="20" FontWeight="Bold" Margin="0,0,0,0" />
<Label Name="lblBattery" Content="100%" Foreground="White" FontSize="20" FontWeight="Bold" MinWidth="60"/>
</StackPanel>

<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Margin="0,5,0,0" CanContentScroll="False" Name="rightView" Height="747" >
Expand Down
26 changes: 4 additions & 22 deletions Windows/OverlayWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,34 +279,16 @@ public void getCPUInfo()
{
if (sensor.SensorType == SensorType.Temperature && sensor.Name.Contains("Core"))
{
if ((int)sensor.Value.GetValueOrDefault() < 100)
{
lblTemp.Content = " " + (int)sensor.Value.GetValueOrDefault() + "°C";
}
if ((int)sensor.Value.GetValueOrDefault() < 10)
{
lblTemp.Content = " " + (int)sensor.Value.GetValueOrDefault() + "°C";
}
else
{

lblTemp.Content = (int)sensor.Value.GetValueOrDefault() + "°C";
}

}

if (sensor.SensorType == SensorType.Power && sensor.Name.Contains("Package"))
{
if ((int)sensor.Value.GetValueOrDefault() < 100)
{
lblPower.Content = " " + (int)sensor.Value.GetValueOrDefault() + "w";
}
if ((int)sensor.Value.GetValueOrDefault() < 10)
{
lblPower.Content = " " + (int)sensor.Value.GetValueOrDefault() + "w";
}
else
{

lblPower.Content = (int)sensor.Value.GetValueOrDefault() + "w";
}

}
}
}
Expand Down

0 comments on commit 2b40759

Please sign in to comment.