forked from Linus4/csgoverview
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_windows.go
39 lines (34 loc) · 1.17 KB
/
main_windows.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"flag"
"fmt"
"log"
"golang.org/x/sys/windows/registry"
)
const (
fontName string = "DejaVuSans"
)
func main() {
conf := DefaultConfig
flag.BoolVar(&conf.PrintVersion, "version", false, "Print version number")
flag.Float64Var(&conf.FrameRate, "framerate", conf.FrameRate, "Fallback GOTV Framerate")
flag.Float64Var(&conf.TickRate, "tickrate", conf.TickRate, "Fallback Gameserver Tickrate")
instDirKey, err := registry.OpenKey(registry.CURRENT_USER, `Software\csgoverview`, registry.QUERY_VALUE)
if err != nil {
log.Fatalln("trying to open csgoverview registry key:", err)
}
defer instDirKey.Close()
instDir, _, err := instDirKey.GetStringValue("InstallLocation")
if err != nil {
log.Fatalln("trying to get install directory from registry key:", err)
}
defaultFontPath := fmt.Sprintf("%v\\%v.ttf", instDir, fontName)
defaultOverviewDirectory := fmt.Sprintf("%v\\assets\\maps\\", instDir)
flag.StringVar(&conf.FontPath, "fontpath", defaultFontPath, "Path to font file (.ttf)")
flag.StringVar(&conf.OverviewDir, "overviewdir", defaultOverviewDirectory, "Path to overview directory")
flag.Parse()
err = run(&conf)
if err != nil {
log.Fatalln(err)
}
}