-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
71 lines (63 loc) · 1.8 KB
/
main.go
File metadata and controls
71 lines (63 loc) · 1.8 KB
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
66
67
68
69
70
71
package main
import (
"flag"
"os"
"slices"
)
var resolutions = []string{"1152x648", "1280x720", "1366x768", "1600x900", "1920x1080", "2560x1440", "3840x2160"}
var IsCLIMode bool
func main() {
cliRevert := flag.Bool("revert", false, "revert to original DaybreakDX.exe from ./backup/")
cliShadow := flag.Bool("shadow", true, "by using this, turns off shadows")
cliOutline := flag.Bool("outline", true, "by using this, turns off character outline")
cliHiTexture := flag.Bool("htexture", true, "by using this, turns off high texture")
cliName := flag.String("name", "", "Set network name (max 8 characters)")
cliResolution := flag.String("resolution", "", "Set resolution (ex: 1920x1080)")
flag.Parse()
if flag.NFlag() > 0 || flag.NArg() > 0 {
IsCLIMode = true
}
verifyRequiredFiles()
if !IsCLIMode {
startWindow()
} else {
if *cliRevert {
revertToOriginalEXE()
return
}
if *cliResolution != "" {
resOk := slices.Contains(resolutions, *cliResolution)
if !resOk {
throwErrorMessageWindow("Invalid resolution")
listAvaliableResolutions()
os.Exit(1)
}
patchAndSave(*cliResolution)
}
if *cliName != "" {
if len(*cliName) > 8 || !isAlphanumeric(*cliName) {
throwErrorMessageWindow("Invalid name: must be max 8 characters and alphanumeric")
} else {
setNetworkName(*cliName)
}
}
if *cliShadow {
err := setBoolConfig(shadows, true)
if err != nil {
throwErrorMessageWindow("Error while setting shadows" + err.Error())
}
}
if *cliOutline {
err := setBoolConfig(outline, true)
if err != nil {
throwErrorMessageWindow("Error while setting outline" + err.Error())
}
}
if *cliHiTexture {
err := setBoolConfig(higerResTex, true)
if err != nil {
throwErrorMessageWindow("Error while setting high texture" + err.Error())
}
}
}
}