Common: Accept RESV_DENY without reason

This commit is contained in:
mkwcat 2024-04-27 01:43:50 -04:00
parent 76124b664a
commit ed18e03112
No known key found for this signature in database
GPG Key ID: 7A505679CE9E7AA9
2 changed files with 23 additions and 7 deletions

View File

@ -92,8 +92,9 @@ type MatchCommandDataResvOK struct {
}
type MatchCommandDataResvDeny struct {
Reason uint32
ReasonString string
Reason uint32
ReasonString string
ReasonSpecified bool
UserData []byte
}
@ -388,18 +389,23 @@ func DecodeMatchCommand(command byte, buffer []byte, version int) (MatchCommandD
}, true
case MatchResvDeny:
if len(buffer) != 0x04 {
break
var reason uint32
var userData []byte
if len(buffer) >= 0x04 {
reason = binary.LittleEndian.Uint32(buffer[0x00:0x04])
userData = buffer[0x04:]
} else {
reason = 0
userData = buffer
}
reason := binary.LittleEndian.Uint32(buffer[0x00:0x04])
return MatchCommandData{
Version: version,
Command: command,
ResvDeny: &MatchCommandDataResvDeny{
Reason: reason,
ReasonString: map[uint32]string{
0x00: "Unspecified reason.",
0x10: "Game server is fully occupied.",
0x11: "This Domain is already closed.",
0x12: "The condition was not satisfied.",
@ -410,7 +416,8 @@ func DecodeMatchCommand(command byte, buffer []byte, version int) (MatchCommandD
0x17: "The reservation came from a different other host.",
0x18: "Illegal mesh reservation.",
}[reason],
UserData: buffer[0x4:],
ReasonSpecified: len(buffer) > 0x04,
UserData: userData,
},
}, true
@ -418,6 +425,7 @@ func DecodeMatchCommand(command byte, buffer []byte, version int) (MatchCommandD
if len(buffer) != 0x00 {
break
}
return MatchCommandData{
Version: version,
Command: command,
@ -427,6 +435,7 @@ func DecodeMatchCommand(command byte, buffer []byte, version int) (MatchCommandD
if len(buffer) != 0x00 {
break
}
return MatchCommandData{
Version: version,
Command: command,
@ -480,6 +489,7 @@ func DecodeMatchCommand(command byte, buffer []byte, version int) (MatchCommandD
if len(buffer) != 0x00 {
break
}
return MatchCommandData{
Version: version,
Command: command,
@ -489,6 +499,7 @@ func DecodeMatchCommand(command byte, buffer []byte, version int) (MatchCommandD
if len(buffer) != 0x04 {
break
}
return MatchCommandData{
Version: version,
Command: command,
@ -642,6 +653,10 @@ func EncodeMatchCommand(command byte, data MatchCommandData) ([]byte, bool) {
return message, true
case MatchResvDeny:
if !data.ResvDeny.ReasonSpecified {
return data.ResvDeny.UserData, true
}
message := binary.LittleEndian.AppendUint32([]byte{}, data.ResvDeny.Reason)
message = append(message, data.ResvDeny.UserData...)

View File

@ -4321,6 +4321,7 @@ Ultima Online: Mondain's Legacy UltimaOnlineMondai
Ultima Online: Stygian Abyss ultimaonlinestygia
Ultimate Band (Wii) ultibandwii 2145 F8KfNf
Ultimate Brain Games (DS) ubraingamesds 2746 MzT7MD
Ultimate Card Games (DS) cardgamesds 2747 4rcSUc
Ultimate Card Games (DS) ucardgamesds 2747 PpmQVg
Ultimate Knight Windom XP ultimateknightwind
Ultimate Mortal Kombat (DS) ultimateMKds 1820 irQTn8

1 1001 Minigolf Challenge 1001MinigolfChalle
4321 Ultima Online: Stygian Abyss ultimaonlinestygia
4322 Ultimate Band (Wii) ultibandwii 2145 F8KfNf
4323 Ultimate Brain Games (DS) ubraingamesds 2746 MzT7MD
4324 Ultimate Card Games (DS) cardgamesds 2747 4rcSUc
4325 Ultimate Card Games (DS) ucardgamesds 2747 PpmQVg
4326 Ultimate Knight Windom XP ultimateknightwind
4327 Ultimate Mortal Kombat (DS) ultimateMKds 1820 irQTn8