Skip to content

Commit

Permalink
feat: improve build script, fix: null bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
gpedro committed Jul 7, 2019
1 parent d2a75c6 commit e22b79c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ build:
GOOS=windows GOARCH=amd64 go build -o client-editor-x64.exe main.go
GOOS=linux GOARCH=386 go build -o client-editor-x86 main.go
GOOS=linux GOARCH=amd64 go build -o client-editor-x64 main.go
zip client-editor-windows.zip *.exe *.key
zip client-editor-linux.zip client-editor-x64 client-editor-x86 *.key

clean:
rm -f *.zip client-editor
9 changes: 8 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,14 @@ func main() {
os.Exit(1)
}

tibiaBinary = bytes.Replace(tibiaBinary, append([]byte(propertyLoginWebService+tibiaLoginWebService)), append([]byte(propertyLoginWebService+customLoginWebService)), 1)
originalWebService := []byte(propertyLoginWebService + tibiaLoginWebService)
customWebService := []byte(propertyLoginWebService + customLoginWebService)

if len(customWebService) < len(originalWebService) {
customWebService = append(customWebService, bytes.Repeat([]byte{0x20}, len(originalWebService)-len(customWebService))...)
}

tibiaBinary = bytes.Replace(tibiaBinary, originalWebService, customWebService, 1)
fmt.Printf("[INFO] Tibia Login WebService found! %s\n", tibiaLoginWebService)
fmt.Printf("[PATCH] Tibia Login WebService replaced to %s!\n", customLoginWebService)
replaced = true
Expand Down

0 comments on commit e22b79c

Please # to comment.