Skip to content

Commit

Permalink
Updated to latest WinLibrary version
Browse files Browse the repository at this point in the history
Also updated version to v1.7.5
  • Loading branch information
terrymacdonald committed May 30, 2022
1 parent bf046d2 commit 4f3e3c8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
4 changes: 2 additions & 2 deletions AMDInfo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
30 changes: 26 additions & 4 deletions AMDInfo/WinLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,15 @@ public struct DISPLAY_SOURCE : IEquatable<DISPLAY_SOURCE>

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);
Expand All @@ -83,15 +87,33 @@ public struct WINDOWS_DISPLAY_CONFIG : IEquatable<WINDOWS_DISPLAY_CONFIG>

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) &&
// The dictionary keys sometimes change after returning from NVIDIA Surround, so we need to only focus on comparing the values of the GDISettings.
// 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.
/*&&
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
# 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:

- Show what settings you currently are using: `AMDInfo print`
- 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:
Expand Down

0 comments on commit 4f3e3c8

Please # to comment.