mirror of
https://github.com/WiiLink24/wfc-server.git
synced 2026-08-11 03:15:42 -05:00
GPCM: Kick players who drop too many frames
This commit is contained in:
@@ -351,6 +351,19 @@ var (
|
||||
"Error Code: %[1]d",
|
||||
},
|
||||
}
|
||||
|
||||
WWFCMsgTooManyFramesDropped = WWFCErrorMessage{
|
||||
ErrorCode: 22010,
|
||||
MessageRMC: map[byte]string{
|
||||
LangEnglish: "" +
|
||||
"Your game is dropping too many frames.\n" +
|
||||
"Please remove any modifications that may\n" +
|
||||
"be causing frame rate problems to avoid\n" +
|
||||
"being banned from WiiLink Wi-Fi Connection.\n" +
|
||||
"\n" +
|
||||
"Error Code: %[1]d",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
func (err GPError) GetMessage() string {
|
||||
|
||||
@@ -25,6 +25,9 @@ func kickPlayer(profileID uint32, reason string) {
|
||||
case "invalid_elo":
|
||||
errorMessage = WWFCMsgInvalidELO
|
||||
|
||||
case "too_many_frames_dropped":
|
||||
errorMessage = WWFCMsgTooManyFramesDropped
|
||||
|
||||
case "network_error":
|
||||
// No error message
|
||||
common.CloseConnection(ServerName, session.ConnIndex)
|
||||
@@ -37,7 +40,6 @@ func kickPlayer(profileID uint32, reason string) {
|
||||
Fatal: true,
|
||||
WWFCMessage: errorMessage,
|
||||
})
|
||||
common.CloseConnection(ServerName, session.ConnIndex)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -269,7 +269,6 @@ func (g *GameSpySession) login(command common.GameSpyCommand) {
|
||||
otherSession, exists := sessions[g.User.ProfileId]
|
||||
if exists {
|
||||
otherSession.replyError(ErrForcedDisconnect)
|
||||
common.CloseConnection(ServerName, otherSession.ConnIndex)
|
||||
|
||||
for i := 0; ; i++ {
|
||||
mutex.Unlock()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package gpcm
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"wwfc/common"
|
||||
"wwfc/logging"
|
||||
@@ -60,6 +61,22 @@ func (g *GameSpySession) handleWWFCReport(command common.GameSpyCommand) {
|
||||
}
|
||||
|
||||
logging.Warn(g.ModuleName, "Room stall caused by", aurora.BrightCyan(strconv.FormatUint(profileId, 10)))
|
||||
|
||||
case "mkw_too_many_frames_dropped":
|
||||
if g.GameName != "mariokartwii" {
|
||||
logging.Warn(g.ModuleName, "Ignoring mkw_too_many_frames_dropped from wrong game")
|
||||
continue
|
||||
}
|
||||
|
||||
framesDropped, err := strconv.ParseUint(value, 10, 32)
|
||||
if err != nil {
|
||||
logging.Error(g.ModuleName, "Error decoding mkw_too_many_frames_dropped:", err.Error())
|
||||
continue
|
||||
}
|
||||
|
||||
profileId := g.User.ProfileId
|
||||
logging.Warn(g.ModuleName, "Kicking", aurora.BrightCyan(strconv.FormatUint(uint64(profileId), 10)), fmt.Sprintf("for dropping too many frames (%d)", framesDropped))
|
||||
kickPlayer(profileId, "too_many_frames_dropped")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user