From ed18e03112b21fe1b565dadc6c145cef24a581a5 Mon Sep 17 00:00:00 2001 From: mkwcat Date: Sat, 27 Apr 2024 01:43:50 -0400 Subject: [PATCH] Common: Accept RESV_DENY without reason --- common/match_command.go | 29 ++++++++++++++++++++++------- game_list.tsv | 1 + 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/common/match_command.go b/common/match_command.go index 92d7c10..94c6e07 100644 --- a/common/match_command.go +++ b/common/match_command.go @@ -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...) diff --git a/game_list.tsv b/game_list.tsv index 98af24e..293911e 100644 --- a/game_list.tsv +++ b/game_list.tsv @@ -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