Skip to content

Commit

Permalink
Add warning when GGST is running as Administrator
Browse files Browse the repository at this point in the history
See #22 and a few scattered Reddit and Twitter messages.
  • Loading branch information
optix2000 committed Aug 6, 2021
1 parent dfbd27f commit a2bc023
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os/exec"
"runtime/debug"
"sync"
"syscall"
"time"

"github.com/optix2000/totsugeki/patcher"
Expand Down Expand Up @@ -44,7 +45,13 @@ Please report this to https://github.com/optix2000/totsugeki/issues
Error: %v
%v`
msg, e := windows.UTF16PtrFromString(fmt.Sprintf(header, v, string(debug.Stack())))
messageBox(fmt.Sprintf(header, v, string(debug.Stack())))

panic(v)
}

func messageBox(message string) {
msg, e := windows.UTF16PtrFromString(message)
if e != nil {
fmt.Println(e)
panic(e)
Expand All @@ -54,8 +61,6 @@ Error: %v
fmt.Println(e)
panic(e)
}

panic(v)
}

// Patch GGST as it starts
Expand Down Expand Up @@ -90,6 +95,9 @@ func watchGGST(noClose bool) {
if !noClose {
close = true
}
} else if errors.Unwrap(err) == syscall.Errno(windows.ERROR_ACCESS_DENIED) {
messageBox("Could not patch GGST. Steam/GGST may be running as Administrator. Try re-running Totsugeki as Administrator.")
os.Exit(1)
} else {
fmt.Printf("Error at offset 0x%x: %v", offset, err)
panic(err)
Expand Down

0 comments on commit a2bc023

Please sign in to comment.