Skip to content

Commit

Permalink
actually show the errors and not just quit
Browse files Browse the repository at this point in the history
  • Loading branch information
nekoify committed Jun 27, 2024
1 parent c9a5434 commit a0b3582
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion discordRPC/update.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package discordRPC

import (
"fmt"
"time"

"github.com/hugolgst/rich-go/client"
Expand All @@ -18,6 +19,6 @@ func Update(mapName string, serverName string, startTime time.Time) {
})

if err != nil {
panic(err)
fmt.Println(err)
}
}
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@ func main() {

engineAddr, err := utils.GetModuleBaseAddress(pid, engineDll)
if err != nil {
panic(err)
fmt.Println(err)
}

clientAddr, err := utils.GetModuleBaseAddress(pid, clientDll)
if err != nil {
panic(err)
fmt.Println(err)
}

mapNameAddress := engineAddr + mapNameOffset
serverNameAddress := clientAddr + serverNameOffset

errr := client.Login("1253060133940891789")
if errr != nil {
panic(errr)
fmt.Println(errr)
}

for true {
Expand Down
7 changes: 5 additions & 2 deletions utils/getValueFromAddress.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package utils

import (
"fmt"

"golang.org/x/sys/windows"
)

Expand All @@ -12,11 +14,12 @@ func GetValueFromAddress(hProcess windows.Handle, baseAddress uintptr) string {
for i := 0; i < bufferSize; i++ {
err := windows.ReadProcessMemory(hProcess, baseAddress+uintptr(i), &buffer[i], 1, &bytesRead)
if err != nil {
panic(err)
fmt.Println(err)
}
if buffer[i] == 0 {
return string(buffer[:i])
}
}
panic("string too long to fit in buffer")
fmt.Println("string too long to fit in buffer")
return ""
}

0 comments on commit a0b3582

Please sign in to comment.