Handle no DLSS support error
This commit is contained in:
parent
ffccbaf8d4
commit
6a68ad64b1
2 changed files with 11 additions and 17 deletions
4
main.go
4
main.go
|
@ -38,9 +38,9 @@ func main() {
|
|||
|
||||
OnClicked: func() {
|
||||
if indicatorStatus == 1024 {
|
||||
setKeyOff()
|
||||
setKey(0)
|
||||
} else {
|
||||
setKeyOn()
|
||||
setKey(1)
|
||||
}
|
||||
getKey()
|
||||
indicatorTextLabel.SetText(indicatorStatusString)
|
||||
|
|
24
reg.go
24
reg.go
|
@ -5,8 +5,11 @@ import (
|
|||
)
|
||||
|
||||
func getKey() {
|
||||
key, _ := 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 {
|
||||
indicatorStatusString = "Error: DLSS not supported!"
|
||||
return
|
||||
}
|
||||
value, _, _ := key.GetIntegerValue("ShowDlssIndicator")
|
||||
defer key.Close()
|
||||
|
||||
|
@ -20,18 +23,9 @@ func getKey() {
|
|||
indicatorStatusString = "NOT SET"
|
||||
}
|
||||
}
|
||||
func setKeyOn() {
|
||||
|
||||
func setKey(value int) {
|
||||
key, _ := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\NVIDIA Corporation\Global\NGXCore`, registry.SET_VALUE)
|
||||
|
||||
key.SetDWordValue("ShowDlssIndicator", uint32(1024))
|
||||
key.SetDWordValue("ShowDlssIndicator", uint32(value * 1024))
|
||||
defer key.Close()
|
||||
|
||||
}
|
||||
|
||||
func setKeyOff() {
|
||||
key, _ := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\NVIDIA Corporation\Global\NGXCore`, registry.SET_VALUE)
|
||||
|
||||
key.SetDWordValue("ShowDlssIndicator", uint32(0))
|
||||
defer key.Close()
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue