Small readability changes

This commit is contained in:
Watn3y 2022-08-18 14:43:02 +02:00
parent 6a68ad64b1
commit 85b7d1be11
2 changed files with 5 additions and 4 deletions

View file

@ -37,10 +37,11 @@ func main() {
Text: "Toggle Indicator", Text: "Toggle Indicator",
OnClicked: func() { OnClicked: func() {
// a value of 1024 activates the overlay, a value of 0 deactivates it. Other values seem to deactivate it as well but you never know
if indicatorStatus == 1024 { if indicatorStatus == 1024 {
setKey(0) setKey(0)
} else { } else {
setKey(1) setKey(1024)
} }
getKey() getKey()
indicatorTextLabel.SetText(indicatorStatusString) indicatorTextLabel.SetText(indicatorStatusString)

4
reg.go
View file

@ -7,7 +7,7 @@ import (
func getKey() { func getKey() {
key, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\NVIDIA Corporation\Global\NGXCore`, registry.QUERY_VALUE) key, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\NVIDIA Corporation\Global\NGXCore`, registry.QUERY_VALUE)
if err != nil { if err != nil {
indicatorStatusString = "Error: DLSS not supported!" indicatorStatusString = "Error: DLSS not supported or registry path not accessible"
return return
} }
value, _, _ := key.GetIntegerValue("ShowDlssIndicator") value, _, _ := key.GetIntegerValue("ShowDlssIndicator")
@ -26,6 +26,6 @@ func getKey() {
func setKey(value int) { func setKey(value int) {
key, _ := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\NVIDIA Corporation\Global\NGXCore`, registry.SET_VALUE) key, _ := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\NVIDIA Corporation\Global\NGXCore`, registry.SET_VALUE)
key.SetDWordValue("ShowDlssIndicator", uint32(value * 1024)) key.SetDWordValue("ShowDlssIndicator", uint32(value))
defer key.Close() defer key.Close()
} }