Skip to content

Commit

Permalink
remove Nvapi dependency when reading EDID, replace debug version of l…
Browse files Browse the repository at this point in the history
…cms2.dll with release version
  • Loading branch information
Maassoft committed Dec 29, 2023
1 parent 5611c1b commit c958e6c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ColorControl/ColorControl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<PublisherName>Maassoft</PublisherName>
<Company>Maassoft</Company>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>9.8.0.0</ApplicationVersion>
<Version>9.8.0.0</Version>
<ApplicationVersion>9.8.0.1</ApplicationVersion>
<Version>9.8.0.1</Version>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>false</BootstrapperEnabled>
Expand Down
20 changes: 18 additions & 2 deletions ColorControl/XForms/ColorProfileViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
using ColorControl.Shared.Forms;
using ColorControl.Shared.Native;
using ColorControl.Shared.XForms;
using EDIDParser;
using MHC2Gen;
using novideo_srgb;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.ComponentModel;
Expand Down Expand Up @@ -231,7 +232,7 @@ private void GetEDID()

var path = SelectedDisplay.DevicePath;

var edid = Novideo.GetEDID(path, null);
var edid = GetEDIDInternal(path);
var primaries = edid?.DisplayParameters?.ChromaticityCoordinates;

if (primaries == null)
Expand All @@ -257,4 +258,19 @@ internal RgbPrimaries GetDevicePrimaries()
new CIExy { x = BluePoint.X, y = BluePoint.Y },
new CIExy { x = WhitePoint.X, y = WhitePoint.Y });
}

private static EDID GetEDIDInternal(string path)
{
try
{
var registryPath = "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\DISPLAY\\";
registryPath += string.Join("\\", path.Split('#').Skip(1).Take(2));
return new EDID((byte[])Registry.GetValue(registryPath + "\\Device Parameters", "EDID", null));
}
catch
{
return null;
}
}

}
2 changes: 1 addition & 1 deletion ColorControl/XForms/ColorProfileWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static void CreateAndShow(bool show = true)
{
if (Application.Current == null)
{
new Application();
new Application { ShutdownMode = ShutdownMode.OnExplicitShutdown };
}

var window = Program.ServiceProvider.GetRequiredService<ColorProfileWindow>();
Expand Down
Binary file modified LittleCms/lcms2.dll
Binary file not shown.

0 comments on commit c958e6c

Please sign in to comment.