Skip to content

Commit 4f3e65b

Browse files
committed
"Finalize" GUI
1 parent 8315a80 commit 4f3e65b

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

gameutil/build.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
go build -v -tags walk_use_cgo -ldflags="-w -s" -gcflags "-dwarf=false" .
1+
go build -v -ldflags="-w -s" -gcflags "-dwarf=false" .
22
pause

gameutil/main.go

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818

1919
type MyMainWindow struct {
2020
*walk.MainWindow
21-
*walk.NumberEdit // NumberEdit1
21+
*walk.NumberEdit
2222
}
2323

2424
var (
@@ -121,7 +121,6 @@ func main() {
121121
PushButton{
122122
Text: "Start",
123123
OnClicked: func() {
124-
label.SetText("Starting...")
125124
start()
126125
},
127126
},
@@ -156,21 +155,16 @@ func start() {
156155
NtSetTimerRes(TIMERRES)
157156
}
158157
if DISABLE_IDLE {
159-
err := exec.Command("powercfg", "-setacvalueindex", "scheme_current", "sub_processor", "5d76a2ca-e8c0-402f-a133-2158492d58ad", "1").Start()
160-
if err != nil {
161-
fmt.Printf("Could not disable idle: %v\n", err)
162-
}
158+
exec.Command("powercfg", "-setacvalueindex", "scheme_current", "sub_processor", "5d76a2ca-e8c0-402f-a133-2158492d58ad", "1").Start()
159+
exec.Command("powercfg", "-setactive", "scheme_current").Start()
163160
}
164161
if KILL_DWM {
165162
// Kill explorer and other processes
166-
fmt.Println("Killing DWM..")
167163
p2k := []string{"explorer.exe", "searchapp.exe", "shellexperiencehost.exe", "searchui.exe", "runtimebroker.exe", "textinputhost.exe", "dllhost.exe", "wmiprvse.exe"}
168164
pids := wp.findProcessIDByNames(p2k)
169165
fmt.Println("p2k", pids)
170166
killProcesses(pids)
171-
172167
// Suspend winlogon
173-
fmt.Println("Suspending winlogon..")
174168
pids = wp.findProcessIDByNames([]string{"winlogon.exe"})
175169
fmt.Println("winlogon", pids)
176170
pidUint, _ := strconv.ParseUint(pids[0], 10, 32)
@@ -191,14 +185,11 @@ func restore() {
191185
// restore explorer, resume winlogon, dwm etc.
192186
// timer resolution will be returned back to previous value after process is closed
193187
if DISABLE_IDLE {
194-
err := exec.Command("powercfg", "-setacvalueindex", "scheme_current", "sub_processor", "5d76a2ca-e8c0-402f-a133-2158492d58ad", "0").Start()
195-
if err != nil {
196-
fmt.Printf("Could not enable idle: %v\n", err)
197-
}
188+
exec.Command("powercfg", "-setacvalueindex", "scheme_current", "sub_processor", "5d76a2ca-e8c0-402f-a133-2158492d58ad", "0").Start()
189+
exec.Command("powercfg", "-setactive", "scheme_current").Start()
198190
}
199191
if KILL_DWM {
200192
// Resume winlogon
201-
fmt.Println("Resuming winlogon..")
202193
pids := wp.findProcessIDByNames([]string{"winlogon.exe"})
203194
for _, pid := range pids {
204195
pidUint, err := strconv.ParseUint(pid, 10, 32)
@@ -222,7 +213,6 @@ func restore() {
222213
}()
223214
}
224215
if KILL_EXPLORER {
225-
fmt.Println("Starting explorer..")
226216
pids := wp.findProcessIDByNames([]string{"explorer.exe"})
227217
killProcesses(pids)
228218
ch := make(chan os.Signal)

0 commit comments

Comments
 (0)