Skip to content

Commit

Permalink
Release 0.1.54.0
Browse files Browse the repository at this point in the history
Signed-off-by: paulober <44974737+paulober@users.noreply.github.com>
  • Loading branch information
paulober committed Mar 13, 2024
1 parent 0395ca3 commit bcfafbb
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 31 deletions.
2 changes: 1 addition & 1 deletion ArcticControl.Core/ArcticControl.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Platforms>x64;arm64;AnyCPU</Platforms>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>11.0</LangVersion>
<LangVersion>12.0</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
25 changes: 15 additions & 10 deletions ArcticControl.GPUInterop/ArcticControl.GPUInterop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ bool ArcticControlGPUInterop::GPUInterop::init_api()
}

h_devices_ = nullptr;
ctl_init_args_t ctl_init_args{};
ctl_init_args_t ctl_init_args;
h_api_handle_ = static_cast<ctl_api_handle_t*>(malloc(sizeof(ctl_api_handle_t)));

adapter_count_ = static_cast<uint32_t*>(malloc(sizeof*adapter_count_));
*adapter_count_ = 0;

_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);

ZeroMemory(&ctl_init_args, sizeof(ctl_init_args));
ctl_init_args.AppVersion = CTL_MAKE_VERSION(CTL_IMPL_MAJOR_VERSION, CTL_IMPL_MINOR_VERSION);
ctl_init_args.flags = CTL_INIT_FLAG_USE_LEVEL_ZERO;
ctl_init_args.Size = sizeof ctl_init_args;
Expand All @@ -52,7 +53,7 @@ bool ArcticControlGPUInterop::GPUInterop::init_api()
if (CTL_RESULT_SUCCESS == result)
{
// check for compatibility (only Arc A-Series dGPUs)
ctl_device_adapter_properties_t dev_adapter_props{0};
ctl_device_adapter_properties_t dev_adapter_props = {0};
dev_adapter_props.Size = sizeof(ctl_device_adapter_properties_t);
dev_adapter_props.pDeviceID = malloc(sizeof(LUID));
dev_adapter_props.device_id_size = sizeof(LUID);
Expand Down Expand Up @@ -131,16 +132,19 @@ bool ArcticControlGPUInterop::GPUInterop::init_api()
// TODO: maybe remove all h_devices_ handles which are not needed
// end check for compatibility

// TODO: enable fans in a future update
return true;

// TODO: maybe move this into separate method
// get fan handles for later
fans_count_ = static_cast<uint32_t*>(malloc(sizeof(*fans_count_)));
*fans_count_ = 0;
this->fans_count_ = 0;

result = ctlEnumFans(h_devices_[selected_device_], fans_count_, h_fans_);
result = ctlEnumFans(h_devices_[selected_device_], fans_count_, nullptr);

if (CTL_RESULT_SUCCESS == result)
{
h_fans_ = static_cast<ctl_fan_handle_t*>(malloc(sizeof(ctl_fan_handle_t) * (*fans_count_)));
h_fans_ = static_cast<ctl_fan_handle_t*>(malloc(sizeof(ctl_fan_handle_t) * (unsigned long long)(this->fans_count_)));

if (h_fans_ != nullptr)
{
Expand Down Expand Up @@ -538,7 +542,7 @@ System::Tuple<double, double>^ ArcticControlGPUInterop::GPUInterop::GetOverclock
return nullptr;
}

ctl_oc_vf_pair_t get_oc_vf_pair;
ctl_oc_vf_pair_t get_oc_vf_pair = {};
get_oc_vf_pair.Size = sizeof(ctl_oc_vf_pair_t);

if (const ctl_result_t result = ctlOverclockGpuLockGet(h_devices_[selected_device_], &get_oc_vf_pair);
Expand All @@ -557,7 +561,7 @@ bool ArcticControlGPUInterop::GPUInterop::SetOverclockGPULock(const double volta
return nullptr;
}

ctl_oc_vf_pair_t set_oc_vf_pair;
ctl_oc_vf_pair_t set_oc_vf_pair = {};
set_oc_vf_pair.Size = sizeof(ctl_oc_vf_pair_t);
set_oc_vf_pair.Voltage = voltage;
set_oc_vf_pair.Frequency = frequency;
Expand All @@ -580,7 +584,7 @@ bool ArcticControlGPUInterop::GPUInterop::InitPowerDomains()
}

pwr_count_ = static_cast<uint32_t*>(malloc(sizeof*pwr_count_));
*pwr_count_ = 0;
this->pwr_count_ = 0;

ctl_result_t result = ctlEnumPowerDomains(h_devices_[selected_device_], pwr_count_, nullptr);
if (result != CTL_RESULT_SUCCESS || pwr_count_ == nullptr)
Expand Down Expand Up @@ -671,7 +675,7 @@ ArcticControlGPUInterop::PowerLimitsCombination^ ArcticControlGPUInterop::GPUInt

bool ArcticControlGPUInterop::GPUInterop::InitFansHandles()
{
if (h_api_handle_ == nullptr || *adapter_count_ < 1 || selected_device_ < 0 || selected_device_ < 0)
if (h_api_handle_ == nullptr || *adapter_count_ < 1 || selected_device_ < 0)
{
return false;
}
Expand All @@ -683,7 +687,7 @@ bool ArcticControlGPUInterop::GPUInterop::InitFansHandles()
}

fans_count_ = static_cast<uint32_t*>(malloc(sizeof *fans_count_));
*fans_count_ = 0;
this->fans_count_ = 0;

if (ctl_result_t result = ctlEnumFans(h_devices_[selected_device_], fans_count_, h_fans_); CTL_RESULT_SUCCESS == result)
{
Expand Down Expand Up @@ -1219,6 +1223,7 @@ bool ArcticControlGPUInterop::GPUInterop::InitFrequencyDomains()
if (ctl_result_t result = ctlEnumFrequencyDomains(h_devices_[selected_device_], &freq_handle_count, nullptr);
result == CTL_RESULT_SUCCESS && freq_handle_count > 0)
{
// TODO: fix
h_freq_handle_ = new ctl_freq_handle_t[freq_handle_count];
ctlEnumFrequencyDomains(h_devices_[selected_device_], &freq_handle_count, h_freq_handle_);

Expand Down
2 changes: 1 addition & 1 deletion ArcticControl.IntelWebAPI/ArcticControl.IntelWebAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<RootNamespace>ArcticControl.IntelWebAPI</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>11.0</LangVersion>
<LangVersion>12.0</LangVersion>
<Platforms>x64;arm64;AnyCPU</Platforms>
</PropertyGroup>

Expand Down
10 changes: 7 additions & 3 deletions ArcticControl.IntelWebAPI/Models/WebArcDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ public string Size
get; set;
}

public string SHA1
/// <summary>
/// Either a SHA1 or SHA256 hash.
/// </summary>
public string SHA
{
get; set;
}
Expand All @@ -39,17 +42,18 @@ public string ReleaseDescription
get; set;
}

public WebArcDriver(string version, DateTime driverDate, Uri downloadUri, string size, string sha1, Uri releaseNotesUri, string releaseDescription = "")
public WebArcDriver(string version, DateTime driverDate, Uri downloadUri, string size, string sha, Uri releaseNotesUri, string releaseDescription = "")
{
DriverVersion = new ArcDriverVersion(version);
DriverDate = driverDate;
DownloadUri = downloadUri;
Size = size;
SHA1 = sha1;
SHA = sha;
ReleaseNotesUri = releaseNotesUri;
ReleaseDescription = releaseDescription;
}

public string FriendlyDate => $"{DriverDate.Date.ToString(CultureInfo.CurrentUICulture).Split(" ")[0]}";
public override string ToString() => $"Driver-Version: {DriverVersion}";
public bool IsSHA256 => SHA.Length > 41;
}
11 changes: 8 additions & 3 deletions ArcticControl.IntelWebAPI/Services/WebArcDriversService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,17 @@ public WebArcDriversService(IHttpClientFactory httpClientFactory, ILogger<WebArc
}
var driverSize = sizeMatches[downloadIndex].Groups["size"].Value;

var sha256Regex = SHA256Regex();
var sha1Regex = SHA1Regex();

var sha256Matches = sha256Regex.Matches(webPage);
var sha1Matches = sha1Regex.Matches(webPage);
if (sha1Matches == null || sha1Matches.Count < 1)
var isSha256 = sha256Matches != null && sha256Matches.Count >= 1;
if (!isSha256 && (sha1Matches == null || sha1Matches.Count < 1))
{
throw new Exception("PreloadWebDriver - could not load sha1 hashes");
throw new Exception("PreloadWebDriver - could not load sha1 or sha256 hashes");
}
var sha1Hash = sha1Matches[downloadIndex].Groups["sha1"].Value;
var sha1Hash = (isSha256 ? sha256Matches[downloadIndex] : sha1Matches[downloadIndex]).Groups[isSha256 ? "sha256" : "sha1"].Value;

var releaseNotesRegex = ReleaseNotesRegex();

Expand Down Expand Up @@ -267,6 +270,8 @@ public async Task<IEnumerable<WebArcDriver>> GetWebArcDriverDataAsync()
private static partial Regex SizeRegex();
[GeneratedRegex("SHA1: (?<sha1>[A-Z. 0-9]+)(?:\\s|\\n)*?")]
private static partial Regex SHA1Regex();
[GeneratedRegex("SHA256: (?<sha256>[A-Z. 0-9]+)(?:\\s|\\n)*?")]
private static partial Regex SHA256Regex();
[GeneratedRegex("dc-page-documentation-list__item--fixed.*? href=\"(?<url>.*?\\.pdf)\"")]
private static partial Regex ReleaseNotesRegex();
}
12 changes: 6 additions & 6 deletions ArcticControl/ArcticControl.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
Expand Down Expand Up @@ -63,15 +63,15 @@
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.4" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.2428" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.4.231219000" />
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.7" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.3233" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240311000" />
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Diagnostics.PerformanceCounter" Version="8.0.0" />
<PackageReference Include="System.Drawing.Common" Version="8.0.1" />
<PackageReference Include="System.Drawing.Common" Version="8.0.3" />
<PackageReference Include="System.Management" Version="8.0.0" />
<PackageReference Include="WinUIEx" Version="2.3.3" />
<PackageReference Include="WinUIEx" Version="2.3.4" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion ArcticControl/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<Identity
Name="paulober.ArcticControl"
Publisher="CN=paulober, C=DE"
Version="0.1.52.0" />
Version="0.1.54.0" />

<Properties>
<DisplayName>Arctic Control</DisplayName>
Expand Down
4 changes: 2 additions & 2 deletions ArcticControl/Views/DriversDetailControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@
<TextBlock
Grid.Row="0"
Margin="{StaticResource SmallTopMargin}"
Text="SHA1"
Text="SHA1 / SHA256"
Style="{StaticResource DetailSubTitleStyle}" />
<TextBlock
Grid.Row="1"
Text="{x:Bind ListDetailsMenuItem.SHA1, FallbackValue='N/A', Mode=OneWay}"
Text="{x:Bind ListDetailsMenuItem.SHA, FallbackValue='N/A', Mode=OneWay}"
Style="{StaticResource DetailBodyBaseMediumStyle}" />
</Grid>

Expand Down
4 changes: 0 additions & 4 deletions ArcticControl/Views/DriversDetailControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
using System.Diagnostics;
using System.IO.Compression;
using ArcticControl.Contracts.Services;
using ArcticControl.Helpers;
using ArcticControl.IntelWebAPI.Models;
using ArcticControl.Services;
using ArcticControl.ViewModels;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media;
using Windows.Storage;

namespace ArcticControl.Views;
Expand Down

0 comments on commit bcfafbb

Please sign in to comment.