First commit

This commit is contained in:
Watn3y 2022-08-18 11:19:02 +02:00
commit c4884162ae
6 changed files with 131 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.idea

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="amd64" name="DLSS_indicator_toggle" />
<dependency>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
</dependentAssembly>
</dependency>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True</dpiAware>
</windowsSettings>
</application>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

11
go.mod Normal file
View file

@ -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
)

9
go.sum Normal file
View file

@ -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=

51
main.go Normal file
View file

@ -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()
}

37
reg.go Normal file
View file

@ -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()
}