From 4f3e3c839fadde25a9b30625f8594e247fde6896 Mon Sep 17 00:00:00 2001 From: Terry MacDonald Date: Tue, 31 May 2022 08:50:53 +1200 Subject: [PATCH] Updated to latest WinLibrary version Also updated version to v1.7.5 --- AMDInfo/Program.cs | 4 ++-- AMDInfo/WinLibrary.cs | 30 ++++++++++++++++++++++++++---- README.md | 6 ++++-- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/AMDInfo/Program.cs b/AMDInfo/Program.cs index f9a52e3..afedb3a 100644 --- a/AMDInfo/Program.cs +++ b/AMDInfo/Program.cs @@ -52,10 +52,10 @@ static void Main(string[] args) NLog.LogManager.Configuration = config; // Start the Log file - SharedLogger.logger.Info($"AMDInfo/Main: Starting AMDInfo v1.7.3"); + SharedLogger.logger.Info($"AMDInfo/Main: Starting AMDInfo v1.7.5"); - Console.WriteLine($"\nAMDInfo v1.7.3"); + Console.WriteLine($"\nAMDInfo v1.7.5"); Console.WriteLine($"=============="); Console.WriteLine($"By Terry MacDonald 2022\n"); diff --git a/AMDInfo/WinLibrary.cs b/AMDInfo/WinLibrary.cs index 955b5a0..3c801d1 100644 --- a/AMDInfo/WinLibrary.cs +++ b/AMDInfo/WinLibrary.cs @@ -52,11 +52,15 @@ public struct DISPLAY_SOURCE : IEquatable public override bool Equals(object obj) => obj is DISPLAY_SOURCE other && this.Equals(other); public bool Equals(DISPLAY_SOURCE other) - => true; + => SourceId.Equals(other.SourceId) && + TargetId.Equals(other.TargetId) && + DevicePath.Equals(other.DevicePath) && + SourceDpiScalingRel.Equals(other.SourceDpiScalingRel); + //=> true; public override int GetHashCode() { //return 300; - return (AdapterId, SourceId, TargetId, DevicePath, SourceDpiScalingRel).GetHashCode(); + return (SourceId, TargetId, DevicePath, SourceDpiScalingRel).GetHashCode(); } public static bool operator ==(DISPLAY_SOURCE lhs, DISPLAY_SOURCE rhs) => lhs.Equals(rhs); @@ -83,7 +87,8 @@ public struct WINDOWS_DISPLAY_CONFIG : IEquatable public override bool Equals(object obj) => obj is WINDOWS_DISPLAY_CONFIG other && this.Equals(other); public bool Equals(WINDOWS_DISPLAY_CONFIG other) - => IsCloned == other.IsCloned && + { + if (!(IsCloned == other.IsCloned && DisplayConfigPaths.SequenceEqual(other.DisplayConfigPaths) && DisplayConfigModes.SequenceEqual(other.DisplayConfigModes) && DisplayHDRStates.SequenceEqual(other.DisplayHDRStates) && @@ -91,7 +96,24 @@ public bool Equals(WINDOWS_DISPLAY_CONFIG other) // Additionally, we had to disable the DEviceKey from the equality testing within the GDI library itself as that waould also change after changing back from NVIDIA surround // This still allows us to detect when refresh rates change, which will allow DisplayMagician to detect profile differences. GdiDisplaySettings.Values.SequenceEqual(other.GdiDisplaySettings.Values) && - DisplayIdentifiers.SequenceEqual(other.DisplayIdentifiers); + DisplayIdentifiers.SequenceEqual(other.DisplayIdentifiers))) + { + return false; + } + + // Now we need to go through the values to make sure they are the same, but ignore the keys (as they change after each reboot!) + for (int i = 0; i < DisplaySources.Count; i++) + { + if (!DisplaySources.ElementAt(i).Value.SequenceEqual(other.DisplaySources.ElementAt(i).Value)) + { + return false; + } + } + return true; + + + } + // NOTE: I have disabled the TaskBar specific matching for now due to errors I cannot fix // WinLibrary will still track the location of the taskbars, but won't actually set them as the setting of the taskbars doesnt work at the moment. /*&& diff --git a/README.md b/README.md index 4fdb901..0527071 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # AMDInfo -AMDInfo is a test programme designed to exercise the NVAPI library that I developed for DisplayMagician. This little programme helps me validate that the library is working properly, and that it will work when added to the main DisplayMagician code. +AMDInfo is a test programme designed to exercise the ADL library that I developed for DisplayMagician. This little programme helps me validate that the library is working properly, and that it will work when added to the main DisplayMagician code. AMDInfo records exactly how you setup your display settings, including AMD Eyefinity sccreens, display position, resolution, HDR settings, and even which screen is your main one, and then AMDInfo saves those settings to a file. It works using the AMD API and the Windows Display CCD interface to configure your display settings for you. You can set up your display settings exactly how you like them using AMD Setup and Windows Display Setup, and then use AMDInfo to save those settings to a file. NOTE: AMDInfo doesn't handle NVIDIA Surround/Mosaic. Please see [NVIDIAInfo](https://github.com/terrymacdonald/NVIDIAInfo) for that! -IMPORTANT: If you really want to control your NVIDIA or AMD screen, I'd recommend looking at [DisplayMagician](https://github.com/terrymacdonald/DisplayMagician) for that! +IMPORTANT: If you really want to control your NVIDIA or AMD screen, I'd recommend looking at [DisplayMagician](https://github.com/terrymacdonald/DisplayMagician) as it also provides the ability to change display layout when running a game! Command line examples: @@ -14,6 +14,8 @@ Command line examples: - Save the settings you currently are using to a file to use later: `AMDInfo save my-cool-settings.cfg` - Load the settings you saved earlier and use them now: `AMDInfo load my-cool-settings.cfg` - Show whether the display config file can be used: `AMDInfo possible my-cool-settings.cfg` +- Determine if a particular cfg is in use now used: `AMDInfo equal my-cool-settings.cfg` +- Determine if two cfg files are the same: `AMDInfo equal my-cool-settings.cfg other-cool-settings.cfg` ## To setup this software: