Skip to content

Commit 9b03aeb

Browse files
authored
Merge pull request #7 from kdancybot/dev
Major update: built-in gosumemory and systray manager
2 parents 6e6d784 + 7a9bc70 commit 9b03aeb

33 files changed

+4706
-77
lines changed

README.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# NPClient for kdancybot
2+
3+
<img src="icon.ico" width="256">
4+
5+
## Usage
6+
7+
1. [Download the latest Release](https://github.com/kdancybot/np-client/releases/latest)
8+
* Unzip files anywhere
9+
10+
2. Get config.txt file with credentials
11+
3. Run NPClient & osu! and enjoy!
12+
* Hint: You can also add NPClient to autostart via systray icon!
13+
14+
## Special Thanks to:
15+
16+
* [l3lackShark](https://github.com/l3lackShark) for his [gosumemory](https://github.com/l3lackShark/gosumemory) for providing osu!'s state data
17+
* [Piotrekol](https://github.com/Piotrekol/) and his [ProcessMemoryDataFinder](https://github.com/Piotrekol/ProcessMemoryDataFinder) for most of the memory signatures

build-script.sh

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
#!/usr/bin/env bash
22

3-
target=kdancybot-np-client
4-
5-
platforms=("windows/amd64" "windows/386" "linux/amd64" "linux/386")
3+
target=np-manager
4+
5+
# # Since go doesn't support cross-compiling of C code (for obvious reasons)
6+
# # you can just comment out all unsupported platforms for yourself
7+
# # (I may or may not write better script later)
8+
# ^ With removal of Cgo parts of project this comment is obsolete
9+
platforms=(
10+
"linux/amd64" "linux/386"
11+
"windows/amd64" "windows/386"
12+
)
613

714
mkdir -p build
815

@@ -18,9 +25,9 @@ do
1825
flags+="-ldflags -H=windowsgui"
1926
fi
2027

21-
env GOOS=$GOOS GOARCH=$GOARCH go build $flags -o build/$output_name
28+
GOOS=$GOOS GOARCH=$GOARCH go build $flags -o build/$output_name
2229
if [ $? -ne 0 ]; then
2330
echo 'An error has occurred! Aborting the script execution...'
2431
exit 1
2532
fi
26-
done
33+
done

config/config.go

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
package config
2+
3+
import (
4+
"fmt"
5+
"io/ioutil"
6+
"log"
7+
"os"
8+
"path/filepath"
9+
10+
"github.com/l3lackShark/config"
11+
)
12+
13+
// Config file
14+
var Config map[string]string
15+
16+
// Init the config file
17+
func Init() {
18+
ex, err := os.Executable()
19+
if err != nil {
20+
panic(err)
21+
}
22+
exPath := filepath.Dir(ex)
23+
24+
cfg, err := config.SetFile(filepath.Join(exPath, "config.ini"))
25+
if err == config.ErrDoesNotExist {
26+
d := []byte(`[Main]
27+
update = 100
28+
path = auto
29+
cgodisable = false
30+
memdebug = false
31+
memcycletest = false
32+
wine = false
33+
34+
[Web]
35+
serverip = 127.0.0.1:24050
36+
cors = false
37+
38+
[GameOverlay] ; https://github.com/kdancybot/np-client/wiki/GameOverlay
39+
enabled = false
40+
gameWidth = 1920
41+
gameHeight = 1080
42+
overlayURL = http://localhost:24050/InGame2
43+
overlayWidth = 380
44+
overlayHeight = 110
45+
overlayOffsetX = 0
46+
overlayOffsetY = 0
47+
overlayScale = 10
48+
49+
`)
50+
if err := ioutil.WriteFile(filepath.Join(exPath, "config.ini"), d, 0644); err != nil {
51+
panic(err)
52+
}
53+
cfg, err = config.SetFile(filepath.Join(exPath, "config.ini"))
54+
if err != nil {
55+
panic(err)
56+
}
57+
} else if err != nil {
58+
log.Fatalln(err)
59+
}
60+
Config, err = cfg.Parse()
61+
if err != nil {
62+
panic(err)
63+
}
64+
if Config["overlayURL"] == "" { //Quck hack to append GameOverlay stuff to existing config, whole system needs revamp
65+
file, err := os.OpenFile(filepath.Join(exPath, "config.ini"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
66+
if err != nil {
67+
panic(err)
68+
}
69+
_, err = file.WriteString(fmt.Sprintf("\n[GameOverlay]; https://github.com/kdancybot/np-client/wiki/GameOverlay\nenabled = false\ngameWidth = 1920\ngameHeight = 1080\noverlayURL = http://localhost:24050/InGame2\noverlayWidth = 380\noverlayHeight = 110\noverlayOffsetX = 0\noverlayOffsetY = 0\noverlayScale = 10"))
70+
if err != nil {
71+
panic(err)
72+
}
73+
74+
Init()
75+
}
76+
}

0 commit comments

Comments
 (0)