-
-
Notifications
You must be signed in to change notification settings - Fork 64
/
main.go
65 lines (58 loc) · 2.14 KB
/
main.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package main
import (
"flag"
"log"
"os"
"runtime"
"github.com/spf13/cast"
"github.com/l3lackShark/gosumemory/config"
"github.com/l3lackShark/gosumemory/mem"
"github.com/l3lackShark/gosumemory/memory"
"github.com/l3lackShark/gosumemory/pp"
"github.com/l3lackShark/gosumemory/updater"
"github.com/l3lackShark/gosumemory/web"
)
func main() {
config.Init()
updateTimeFlag := flag.Int("update", cast.ToInt(config.Config["update"]), "How fast should we update the values? (in milliseconds)")
shouldWeUpdate := flag.Bool("autoupdate", true, "Should we auto update the application?")
isRunningInWINE := flag.Bool("wine", cast.ToBool(config.Config["wine"]), "Running under WINE?")
songsFolderFlag := flag.String("path", config.Config["path"], `Path to osu! Songs directory ex: /mnt/ps3drive/osu\!/Songs`)
memDebugFlag := flag.Bool("memdebug", cast.ToBool(config.Config["memdebug"]), `Enable verbose memory debugging?`)
memCycleTestFlag := flag.Bool("memcycletest", cast.ToBool(config.Config["memcycletest"]), `Enable memory cycle time measure?`)
disablecgo := flag.Bool("cgodisable", cast.ToBool(config.Config["cgodisable"]), `Disable everything non memory-reader related? (pp counters)`)
flag.Parse()
cgo := *disablecgo
mem.Debug = *memDebugFlag
memory.MemCycle = *memCycleTestFlag
memory.UpdateTime = *updateTimeFlag
memory.SongsFolderPath = *songsFolderFlag
memory.UnderWine = *isRunningInWINE
if runtime.GOOS != "windows" && memory.SongsFolderPath == "auto" {
log.Fatalln("Please specify path to osu!Songs (see --help)")
}
if memory.SongsFolderPath != "auto" {
if _, err := os.Stat(memory.SongsFolderPath); os.IsNotExist(err) {
log.Fatalln(`Specified Songs directory does not exist on the system! (try setting to "auto" if you are on Windows or make sure that the path is correct)`)
}
}
if *shouldWeUpdate == true {
updater.DoSelfUpdate()
}
go memory.Init()
// err := db.InitDB()
// if err != nil {
// log.Println(err)
// time.Sleep(5 * time.Second)
// os.Exit(1)
// }
go web.SetupStructure()
go web.SetupRoutes()
if !cgo {
go pp.GetData()
go pp.GetFCData()
go pp.GetMaxData()
go pp.GetEditorData()
}
web.HTTPServer()
}