GPCM: Handle new wwfc_report command

This commit is contained in:
mkwcat
2024-01-11 03:45:38 -05:00
parent 7b5c14ad45
commit 8ea725a6b3
3 changed files with 42 additions and 0 deletions

View File

@@ -199,6 +199,7 @@ func handleRequest(conn net.Conn) {
return
}
commands = session.handleCommand("wwfc_report", commands, session.handleWWFCReport)
commands = session.handleCommand("updatepro", commands, session.updateProfile)
commands = session.handleCommand("status", commands, session.setStatus)
commands = session.handleCommand("addbuddy", commands, session.addFriend)

37
gpcm/report.go Normal file
View File

@@ -0,0 +1,37 @@
package gpcm
import (
"wwfc/common"
"wwfc/logging"
"wwfc/qr2"
"github.com/logrusorgru/aurora/v3"
)
func (g *GameSpySession) handleWWFCReport(command common.GameSpyCommand) {
for key, value := range command.OtherValues {
logging.Info(g.ModuleName, "WWFC Report:", aurora.Yellow(key))
switch key {
case "mkw_user":
if g.GameName != "mariokartwii" {
logging.Warn(g.ModuleName, "Ignoring mkw_user packet from wrong game")
continue
}
packet, err := common.Base64DwcEncoding.DecodeString(value)
if err != nil {
logging.Error(g.ModuleName, "Error decoding mkw_user packet:", err.Error())
continue
}
if len(packet) != 0xC0 {
logging.Error(g.ModuleName, "Invalid mkw_user packet length:", len(packet))
continue
}
qr2.ProcessUSER(g.User.ProfileId, g.QR2IP, packet)
break
}
}
}

View File

@@ -252,6 +252,10 @@ func CheckGPReservationAllowed(senderIP uint64, senderPid uint32, destPid uint32
return checkReservationAllowed(moduleName, from, to, joinType)
}
func ProcessUSER(senderPid uint32, senderIP uint64, packet []byte) {
// TODO
}
// findNewServer attempts to find the new server/host in the group when the current server goes down.
// If no server is found, the group's server pointer is set to nil.
// Expects the mutex to be locked.