commit c4884162aedbf5b601d1bba22ed7c2d65723a4f1 Author: Watn3y Date: Thu Aug 18 11:19:02 2022 +0200 First commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..723ef36 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea \ No newline at end of file diff --git a/DLSS_indicator_toggle.manifest b/DLSS_indicator_toggle.manifest new file mode 100644 index 0000000..0398357 --- /dev/null +++ b/DLSS_indicator_toggle.manifest @@ -0,0 +1,22 @@ + + + + + + + + + + + PerMonitorV2, PerMonitor + True + + + + + + + + + + \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..18bc90a --- /dev/null +++ b/go.mod @@ -0,0 +1,11 @@ +module DLSS_indicator_toggle + +go 1.19 + +require github.com/lxn/walk v0.0.0-20210112085537-c389da54e794 + +require ( + github.com/lxn/win v0.0.0-20210218163916-a377121e959e // indirect + golang.org/x/sys v0.0.0-20220817070843-5a390386f1f2 // indirect + gopkg.in/Knetic/govaluate.v3 v3.0.0 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..1e236e8 --- /dev/null +++ b/go.sum @@ -0,0 +1,9 @@ +github.com/lxn/walk v0.0.0-20210112085537-c389da54e794 h1:NVRJ0Uy0SOFcXSKLsS65OmI1sgCCfiDUPj+cwnH7GZw= +github.com/lxn/walk v0.0.0-20210112085537-c389da54e794/go.mod h1:E23UucZGqpuUANJooIbHWCufXvOcT6E7Stq81gU+CSQ= +github.com/lxn/win v0.0.0-20210218163916-a377121e959e h1:H+t6A/QJMbhCSEH5rAuRxh+CtW96g0Or0Fxa9IKr4uc= +github.com/lxn/win v0.0.0-20210218163916-a377121e959e/go.mod h1:KxxjdtRkfNoYDCUP5ryK7XJJNTnpC8atvtmTheChOtk= +golang.org/x/sys v0.0.0-20201018230417-eeed37f84f13/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220817070843-5a390386f1f2 h1:fqTvyMIIj+HRzMmnzr9NtpHP6uVpvB5fkHcgPDC4nu8= +golang.org/x/sys v0.0.0-20220817070843-5a390386f1f2/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +gopkg.in/Knetic/govaluate.v3 v3.0.0 h1:18mUyIt4ZlRlFZAAfVetz4/rzlJs9yhN+U02F4u1AOc= +gopkg.in/Knetic/govaluate.v3 v3.0.0/go.mod h1:csKLBORsPbafmSCGTEh3U7Ozmsuq8ZSIlKk1bcqph0E= diff --git a/main.go b/main.go new file mode 100644 index 0000000..a5dc440 --- /dev/null +++ b/main.go @@ -0,0 +1,51 @@ +package main + +import ( + "github.com/lxn/walk" + . "github.com/lxn/walk/declarative" +) + +var indicatorStatusString string +var indicatorStatus int + +func main() { + + getKey() + var indicatorTextLabel *walk.TextLabel + var windowMain *walk.MainWindow + + MainWindow{ + Title: "DLSS Indicator Toggle", + AssignTo: &windowMain, + Size: Size{ + Width: 300, + Height: 200, + }, + Layout: VBox{}, + Children: []Widget{ + TextLabel{ + Text: "The DLSS Indicator is currently", + TextAlignment: AlignHCenterVCenter, + }, + TextLabel{ + Text: indicatorStatusString, + AssignTo: &indicatorTextLabel, + TextAlignment: AlignHCenterVCenter, + }, + + PushButton{ + Text: "Toggle Indicator", + + OnClicked: func() { + if indicatorStatus == 1024 { + setKeyOff() + } else { + setKeyOn() + } + getKey() + indicatorTextLabel.SetText(indicatorStatusString) + }, + }, + }, + }.Run() +} diff --git a/reg.go b/reg.go new file mode 100644 index 0000000..4a78f00 --- /dev/null +++ b/reg.go @@ -0,0 +1,37 @@ +package main + +import ( + "golang.org/x/sys/windows/registry" +) + +func getKey() { + key, _ := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\NVIDIA Corporation\Global\NGXCore`, registry.QUERY_VALUE) + + value, _, _ := key.GetIntegerValue("ShowDlssIndicator") + defer key.Close() + + indicatorStatus = int(value) + + if indicatorStatus == 1024 { + indicatorStatusString = "ON" + } else if indicatorStatus == 0 { + indicatorStatusString = "OFF" + } else { + indicatorStatusString = "NOT SET" + } +} +func setKeyOn() { + key, _ := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\NVIDIA Corporation\Global\NGXCore`, registry.SET_VALUE) + + key.SetDWordValue("ShowDlssIndicator", uint32(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() + +}