Commit Graph

52 Commits

Author SHA1 Message Date
Terry MacDonald
eefa361773 Fixed error when returning from Mosaic layouts in WIndows 10
There was an error that occurred in NvAPI_SetDisplayConfig when attempting to go from an NVIDIA Surround to a non-NVIDIA Surround setup on a machine that has multiple video cards installed in it. This is due to the fact that the NVIDIA driver only sees the displays connected to NVIDIA video adapters.

The previous DM logic tried to set the DisplayConfig after switching to or from a Surround display profile, but this would fail when returning from a a Surround display profile on Win 10 devices. It appears that the NVIDIA driver AUTOMATICALLY disables all additional displays in windows when it returns from a Surround profile. This simple fact means that the DisplayConfig won't be applied properly, and it errors with an NVAPI_INVALID_ARGUMENT error. This doesn't actually matter though, as the WinLibrary comes to the rescue.

WinLibrary can see all the video adapters available, and so will turn the required displays back on and set them up just right! We *may* lose are some specific DisplayConfig parameters abeing set as part of this process, but I'm not totally sure about that as WinLibrary is basically feature parity with the DisplayConfig settings as far as I can tell.

The fix is to look specifically for the NVAPI_INVALID_ARGUMENT error when attempting to set the NvAPI_DisplayConfig, and if this happens we check if we were going from a surround profile to a non-surround profile. If that is true, then we simply ignore that error. WinLibrary then clears up that problem and everything proceeds as normal.

This should (fingers crossed) fix #119!

This change also makes it far faster to grab and set the tabaskbar settings from registry, though this logic may not detect some Windows 10 formats which appear to be LOCALDISPLAY(\d,\d,\d\d) settings which I've never seen before. It should be generally much faster and more reliable.
2022-07-14 22:41:59 +12:00
Terry MacDonald
20c390d6f9 Fixed ProcessPriority error in StartProgramControl
This is now working properly.
2022-06-29 20:37:20 +12:00
Terry MacDonald
076f9524cd Remove unneeded NvAPI_Mosaic_GetSupportedTopoInfo function
This function isn't needed, but seems to be unreliable when it's used. So diabling it within NVIDIALibrary to reduce the chances of there being memory errors thrown.
2022-06-17 10:34:31 +12:00
Terry MacDonald
7d17b5ae10 Fixed second CTD when changing from Surround to non-surround.
The NVIDIA Driver seems to not like any other SetTopoFlags except NONE. There is a CTD if anything is selected :(. So as a workaround I will leave send a NONE SetTopoFlag so DisplayMagician can work.

Also have updated the Display Profiles Window logic so that it repositions DisplayMagician in the center of the screen on the primary display. This has to be done when changing Display Profiles using the Apply Button, as the display coordinates change, and sometimes this results in the current position being off screen. This was causing confusion amongst users. But now just always moving to the middle of the primary screen I can always be sure that the UI is visible.
2022-06-09 22:56:07 +12:00
Terry MacDonald
97d9caf2af Fixed CTD in patchAdapterids
Error with PatchAdapterIds that caused a crash to desktop. Has now been fixed. Should fix #117 and #118
2022-06-09 22:25:37 +12:00
Terry MacDonald
aede23a83d Updated NVIDIALibrary and WinLibrary to handle win display reordering
NVIDIALibrary and WinLibrary were too rigid in their equality testing, which meant that there was a problem when Windows reordered the displays in the path. This happens randomly when changing to cloned displays, and after a reboot. This would muck up the equality testing, which would prevent users selecting the display profiles. This has now been corrected (as far as we can tell so far).

There is a slight chance that further testing may find other parts of the Windows Display Config that randomly change and need to be updated. Thanks Microsoft.
2022-06-03 21:47:33 +12:00
Terry MacDonald
340387dcc4 Updated WinLibrary, NVIDIALibrary and AMDLIbrary to latest versions
Updated video libraries to v1.7.5
2022-05-31 09:02:18 +12:00
Terry MacDonald
f40640ccbd Updated UpdateActiveConfig 2022-05-29 21:16:55 +12:00
Terry MacDonald
567c9b7af2 Reduced the displayid calls for profile comparison 2022-05-29 21:01:08 +12:00
Terry MacDonald
f8a9ca8e1e Added in partial DRS Setting support
This DRS Support is just reserving a space for the future addition of DRS Settings pulled from the driver. This will allow the recording of settings listed in the 3D Settings within the NVIDIA Control panel.
2022-04-20 20:35:51 +12:00
Terry MacDonald
11792ec1a3 Fixed incorrect log function name 2022-04-13 09:30:27 +12:00
Terry MacDonald
e4aab07b03 Tweaked error messages to better represent errorlevel
Changed a few ERROR level log messages to WARN as that better represents their classification.
2022-04-10 09:40:28 +12:00
Terry MacDonald
2d554d217a Updated NVIDIALIbrary to latest version 2022-03-30 18:37:24 +13:00
Terry MacDonald
168fab9fc2 Merge from feature branch 2022-03-30 10:49:10 +13:00
Terry MacDonald
b4f9f32e1d Fully working DisplayConfig
NVIDIALibrary updated to properly support DisplayConfig functionality. Even works with Cloned mode now!
2022-03-30 10:43:47 +13:00
Terry MacDonald
842854e957 Merged from feature-update-libraries 2022-03-24 22:41:16 +13:00
Terry MacDonald
67c1015730 Updated the NVIDIALibrary and WinLibrary to v1.7.0
This is the version used within NVIDIAInfo v1.7.0
2022-03-24 22:36:42 +13:00
Terry MacDonald
87f62aa322 Made display changes reliable 2022-02-12 09:18:03 +13:00
Terry MacDonald
963b267158 Move SkippedConnectionTypes earlier to stop error 2022-02-10 09:02:17 +13:00
Terry MacDonald
488ea803fc First attempt at skipping the HDR and colour settings on unsupported connection types
Let's see if this works. It will skip grabbing the color data and the HDR data on monitors that don't support it. That includes the following connections types: VGA, COMPONENT, SVIDEO, DVI, COMPOSITE. Any other connection types will attempt to get HDR and Colour settings, so that we'll automatically support whatever new technology arrives in the future.  Should help fix the last part of #76.
2022-02-04 21:53:17 +13:00
Terry MacDonald
7d0c8e1ca4 Updated NVIDIALibrary and WinLibrary to latest version 2022-01-28 17:04:42 +13:00
Terry MacDonald
b50b49af74 Updated some error levels 2022-01-19 22:35:50 +13:00
Terry MacDonald
b148d7484a Updated HDR colour setting logic
The NVIDIA HDR colour logic was flawed, and wouldn't always apply properly. These logic changes now set the NVIDIA HDR colour back to windows controlled each time  so the settings are at a known inital logical state. Then winlibray can set the windows HDR mode, and NVIDIA can set the NVIDIA HDR mode.
2022-01-18 20:43:45 +13:00
Terry MacDonald
77ab0f20f1 Updated NVIDIA Library and WinLibrary based on testing
Did a HUGE amount of testing with the amazing help of @domenic as part of #41, and we finally got the right configuration sorted out! This update is a reflection of the changes required.
2021-11-19 22:20:43 +13:00
Terry MacDonald
21d173b6ca Fixed mistake 2021-11-13 21:30:21 +13:00
Terry MacDonald
d4494aa699 Updated NVIDIA, AMD and Windows Video libraries
Updated with enhancements to make application of colour more robust, and to avoid a Windows CCD display validation issue.
2021-11-13 15:06:54 +13:00
Terry MacDonald
8cf85c5227 Added empty DisplayConfig and CustomDisplays to Display Profiles
Added empty DisplayConfig dictionary and CustomDisplays list to the Display Profiles JSON format, as I'm going to need it in a while when I add the integer scaling.
2021-11-07 20:49:21 +13:00
Terry MacDonald
b44bc3f269 Updated incorrect error message 2021-10-29 22:36:12 +13:00
Terry MacDonald
e321893876 Updated WinLibrary, AMDLibrary and NVIDIALibrary to v1.2.1
This integrates all the library enhancements that I've been working on for the last 2 weeks into DisplayMagician. This fixes $47, #46 and possibly others.
2021-10-24 21:06:59 +13:00
Terry MacDonald
81f2d08fe0 Fixed profile matching for cloned displays
Weird error where having a clone causes an extra 'zeroed out' entry in the Windows Display Modes sequence. This change modifies the Windows mode info checks to allow for this situation.
2021-10-17 10:44:03 +13:00
Terry MacDonald
7661f1dc73 Made changes to stop Cloned displays causing CTD
Currently still can't get the cloned displays to get applied properly though. Looks like the cloned displays are not being recorded in the settings.
2021-10-16 21:41:34 +13:00
Terry MacDonald
6032be043a Updated NVIDIALibrary to the one used in NVIDIAInfo v1.1.1 2021-10-16 21:24:59 +13:00
Terry MacDonald
3f3518f536 Update NVIDIALibrary from recent HDR/colour settings updates. 2021-10-10 17:17:22 +13:00
Terry MacDonald
e41279d706 Improved NVIDIALIbrary SetActiveOverride function
It now only applies configuration changes if they are needed to be applied. If the colour settings are the same then they aren't applied.
2021-10-09 19:58:22 +13:00
Terry MacDonald
a824f06b33 Updated DM will latest video libraries
Brought over all the latest working code from NVIDIAInfo, AMDInfo and CCDInfo. This includes the new split between the NVIDIA and AMD specific layout, and the NVIDIA and AMD specific color application, so that the video application logic goes like this:
1. Apply NVIDIA Surround or AMD Eyefinity and any 'pre' windows settings
2. Apply the Windows Display Layout
3. Apply the NVIDIA or AMD 'post' windows settings e.g. driver specific color overrides

This new process works.
2021-10-07 21:08:10 +13:00
Terry MacDonald
b6de9aa85f Partial fix for OriginLibrary v3.x
Note - doesn't work with Origin v2.1 files yet... still troubleshooting those!
2021-10-04 22:40:32 +13:00
Terry MacDonald
cd71725617 [WIP] Fixed error loading JSON after save
There was a problem with the unused display config containing null values on save, which meant that the JSON would be invalid when loaded in the next time. The fix was to ensure that both NVIDIA and AMD both were filled with a default config when a new profiles was created. This means that the real config would overwrite whichever config was needed, and the JSON file would work as all objects were populated correctly!
2021-09-19 20:56:58 +12:00
Terry MacDonald
6bd9898ea8 Fixed inconsistent NVIDIA HDR display setting
THere was an unneeded check that prevented the NVIDIA HDR settings being applied when it should have been. This in turn meant that the display profile equality matching wasn't working as the applied display profile was sufficiently different to the one selected and applied that it wouldn't match, and would instead display the brand new profile interface. This has been corrected now.
2021-09-09 09:21:53 +12:00
Terry MacDonald
28a8f131b3 Workaround Windows changing display source order
Windows changes the display source order which mucks up the equality matching in DM. This change attempts to mitigate that fact.

There were also errors in the HDR settings captured, which indicate that the HDR changes weren't finishing before they were being recorded. This change attempts to take care of that too.

All tests so far seem to work, so lets see how things go!
2021-09-08 20:04:37 +12:00
Terry MacDonald
1966412162 Mostly working Equality part 3
Equality works until we return from a surround profile to a non-surround profile. At this point the displays are reordered by windows, and the windows display configus don't match any more. Addtionally, it looks as though we need a 0.5 second pause between applying the configuration, and reading the new config. There appears to be a difference between HDR before we changed to the surround proile and after we've returned, and that's not a good thing!
2021-09-08 11:00:00 +12:00
Terry MacDonald
7c21c19056 Fixed Profile Matching
Found an underlying problem of using the OutputID for displayIdentifier matching as the outputID changes after each reboot. CHanged the DisplayIdentifier to record the type of the connection to the display, which stays the same even if the OututID changes. Also made the ProfileItem.Equals look for DisplayIdentifier ids and match them even if they are in a different order. This seems to happen some times, and I'm not sure why the NVIDIA driver does it!
2021-09-05 21:00:36 +12:00
Terry MacDonald
a07e4ad3f5 Corrected an incorrect logging message clarification
It was set to Error instead of Trace! Corrected now.

Also corrected some incorrect log message descriptions that will mean I look at the right code when I see the errors. There were all the same (as I copied a lot of the code).
2021-09-04 21:27:40 +12:00
Terry MacDonald
ee1d2e4717 Fixed screen drawing for icons and forms
Fixed the NVIDIA screen drawing so that it works fine now.
2021-09-01 22:13:22 +12:00
Terry MacDonald
b6bd89bed2 Updated NVIDIALibrary and WinLibrary based on NVIDIAInfo testing
Added in the ability to map the Windows CCD Display name to NVAPI DisplayId, which will make it possible to use that information within DisplayMagician.
2021-09-01 20:44:00 +12:00
Terry MacDonald
bc6242a8bb Updated NVIDIALibrary and WinLibrary with latest versions.
Latest versions based on tests from NVIDIAInfo
2021-08-31 21:06:08 +12:00
Terry MacDonald
293ca14730 Moved RunProfile to ProfileRepository
It makes WAY more sense here.
2021-08-27 17:53:32 +12:00
Terry MacDonald
5eea1f0a95 Fixed NVIDIA profile matching! 2021-08-25 22:00:14 +12:00
Terry MacDonald
ad732d388f Added missing NVAPI Equals tests 2021-08-25 21:45:40 +12:00
Terry MacDonald
01ffda8428 [WIP] Graphic library integration part 1 2021-08-22 12:54:39 +12:00
Terry MacDonald
4d1f074f42 Initial NVIDIA, AMD and CCD Integration
Putting the current libraries into DisplaayMagician so I can work on the logic.
2021-08-21 21:46:36 +12:00