Skip to content

Commit

Permalink
Resolve unknown values in score submission
Browse files Browse the repository at this point in the history
  • Loading branch information
Lekuruu committed Oct 13, 2024
1 parent 4857452 commit 8465a04
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
3 changes: 1 addition & 2 deletions hscore/objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ type ScoreData struct {
CountKatu int
CountGood int
CountMiss int
ClientBuildDate int
ClientVersion int
Unknown1 string // TODO
Unknown2 string // TODO
Mods *Mods
}

Expand Down
18 changes: 12 additions & 6 deletions hscore/parsing.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ func ParseScoreData(scoreDataBytes []byte) (*ScoreData, error) {
passed := scoreData[4] == "1"
perfect := scoreData[5] == "1"

unknown1 := scoreData[2]
unknown2 := scoreData[19]
clientVersion := scoreData[2]
clientVersionCheck := scoreData[19]

if clientVersion != clientVersionCheck {
return nil, fmt.Errorf("client version mismatch: %s != %s", clientVersion, clientVersionCheck)
}

collection := common.NewErrorCollection()

Expand Down Expand Up @@ -57,7 +61,10 @@ func ParseScoreData(scoreDataBytes []byte) (*ScoreData, error) {
countMiss, err := strconv.Atoi(scoreData[15])
collection.Add(err)

clientVersion, err := strconv.Atoi(scoreData[18])
clientBuildDate, err := strconv.Atoi(scoreData[18])
collection.Add(err)

clientVersionInt, err := strconv.Atoi(clientVersion)
collection.Add(err)

mods, err := ParseModsData(scoreData[17])
Expand All @@ -83,9 +90,8 @@ func ParseScoreData(scoreDataBytes []byte) (*ScoreData, error) {
CountKatu: countKatu,
CountGood: countGood,
CountMiss: countMiss,
ClientVersion: clientVersion,
Unknown1: unknown1,
Unknown2: unknown2,
ClientBuildDate: clientBuildDate,
ClientVersion: clientVersionInt,
Mods: mods,
}, nil
}
Expand Down

0 comments on commit 8465a04

Please sign in to comment.