Skip to content

Commit

Permalink
fix: Y9S1 kill feed & site detection
Browse files Browse the repository at this point in the history
  • Loading branch information
redraskal committed May 7, 2024
1 parent 85da0b5 commit 6c3efa1
Show file tree
Hide file tree
Showing 7 changed files with 445 additions and 106 deletions.
22 changes: 15 additions & 7 deletions dissect/feedback.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package dissect
import (
"bytes"
"encoding/json"
"errors"
"strings"

"github.com/rs/zerolog/log"
Expand Down Expand Up @@ -56,24 +57,31 @@ var activity2 = []byte{0x00, 0x00, 0x00, 0x22, 0xe3, 0x09, 0x00, 0x79}
var killIndicator = []byte{0x22, 0xd9, 0x13, 0x3c, 0xba}

func readMatchFeedback(r *Reader) error {
if r.Header.CodeVersion < Y9S1 {
if err := r.Skip(1); err != nil {
return err
}
if err := r.Seek(activity2); err != nil {
if r.Header.CodeVersion >= Y9S1Update3 {
if err := r.Skip(38); err != nil {
return err
}
} else {
} else if r.Header.CodeVersion >= Y9S1 {
if err := r.Skip(9); err != nil {
return err
}
valid, err := r.Int()
if err != nil || valid != 4 {
if err != nil {
return err
}
if valid != 4 {
return errors.New("match feedback failed valid check")
}
if err := r.Skip(24); err != nil {
return err
}
} else {
if err := r.Skip(1); err != nil {
return err
}
if err := r.Seek(activity2); err != nil {
return err
}
}
size, err := r.Int()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion dissect/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func readSpawn(r *Reader) error {
Int("flag", flag).
Str("site", location).
Msg("site")
if r.Header.Site == "" && flag == 1 {
if r.Header.Site == "" && flag == 1 || flag == 164 {
formatted := strings.Replace(location, "<br/>", ", ", 1)
log.Debug().Str("site", formatted).Msg("defense site")
for i, p := range r.Header.Players {
Expand Down
Binary file added dissect/test/data/replays/valid/Y9S1/custom_1.rec
Binary file not shown.
Loading

0 comments on commit 6c3efa1

Please sign in to comment.