Commit Graph

89 Commits

Author SHA1 Message Date
Terry MacDonald
6add0822fb NVIDIALibrary Equality testing fix
This tweak fixes the equality testing so that it works reliably with rotated displays. It turns out that the NVIDIA driver doesn't set the TVFormat option reliably whenever it rotates a display. During testing I've had the TvFormat option set to 557 and 320 for the exact same nonitor, and it really seems to depend on what the driver decided it wanted to set (the landscape mode is always 555).

I expect that it is due to the portrait sizes not being 'standard' TV sizes, so it is trying to find the best match, but in any case the variation in this setting doesn't appear to affect us using the profile... it only affects the equality tests uses to check if a particular profile is in use.

For this reason I've excluded the TvFormat from the equality testing so that the variation caused by the driver doesn't break the Equals check.
2023-01-03 11:23:18 +13:00
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
3cadb9a0fe Fixed SetDisplayConfig memory management 2022-03-30 12:05:53 +13:00
Terry MacDonald
53375df302 Fix memory deallocation
There were some issues with memory deallocation where AllocateHGlobal memory was being freed incorrectly with FreeCoTaskMem. This was causing issues with subsequent memory allocations.
2022-03-30 11:50:43 +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
e12cd19d14 [WIP] Error with Timing
The Advanced Target Info object returned by the NVIDIA driver points to memory outside the allocated memory. I need to figure out how the NVIDIA code allocates the memory, so I can account for it on return.
2022-03-30 09:01:15 +13:00
Terry MacDonald
490a5f135f [WIP] Partially fixed GetDisplayConfig
The returned structure doesn't match the structure put in
2022-03-29 10:09:29 +13:00
Terry MacDonald
cd9765e765 [WIP] Partially working GetDisplayConfig third pass
Need to get the timing stuff working as it isn't populated properly.
2022-03-26 21:29:53 +13:00
Terry MacDonald
3b4a5ac29d [WIP] Trying a different memeory structure for GetDisplayConfig 2022-03-26 20:11:52 +13:00
Terry MacDonald
faaa61586c [WIP] Understanding memory leak in GetDisplayConfig 2022-03-25 22:57:32 +13:00
Terry MacDonald
37b9a79ff2 [WIP] Partial integration of new libraries.
Still some bits broken.
2022-03-25 21:51:38 +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
1591fd534e Upgraded AMDLibrary to v1.0.0
This is the first actual working version of the AMDLibrary from AMDInfo v1.0.0. This is the first time that all 3 different video libraries are in DisplayMagician and working (mostly). The AMD Screens structu creation logic in ProfileItem still needs to be updated to cope with the AMD Eyefinity configuration, but it at least defaults to the windows one at the moment so it doesn't crash (whew).

Also managed to bugfix the recent libraryfolder.vdf parsing change that a recent Steam Library change oforced on us. The logic wasn't working, and so the parsing didn't work, which in turn caused an exception when it came time to look up the game shortcut validity.
2021-09-18 21:55:43 +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