entrance server response improvements

This commit is contained in:
wishu
2022-07-08 13:18:35 +10:00
parent b1fb80ea3f
commit 5161690e5b
2 changed files with 10 additions and 3 deletions

View File

@@ -81,7 +81,7 @@ type EntranceServerInfo struct {
Season uint8 // Server activity. 0 = green, 1 = orange, 2 = blue
Recommended uint8 // Something to do with server recommendation on 0, 3, and 5.
Name string // Server name, 66 byte null terminated Shift-JIS(JP) or Big5(TW).
Description string // Server description
// 4096(PC, PS3/PS4)?, 8258(PC, PS3/PS4)?, 8192 == nothing?
// THIS ONLY EXISTS IF Binary8Header.type == "SV2", NOT "SVR"!
AllowedClientFlags uint32

View File

@@ -50,11 +50,18 @@ func encodeServerInfo(serverInfos []config.EntranceServerInfo, s *Server) []byte
bf.WriteUint8(si.Type)
bf.WriteUint8(season)
bf.WriteUint8(si.Recommended)
shiftjisName, err := stringsupport.ConvertUTF8ToShiftJIS(si.Name)
sjisName, err := stringsupport.ConvertUTF8ToShiftJIS(si.Name)
if err != nil {
panic(err)
}
bf.WriteBytes(paddedString(string(shiftjisName), 66))
sjisDesc, err := stringsupport.ConvertUTF8ToShiftJIS(si.Description)
if err != nil {
panic(err)
}
combined := append([]byte{0x00}, sjisName...)
combined = append(combined, []byte{0x00}...)
combined = append(combined, sjisDesc...)
bf.WriteBytes(paddedString(string(combined), 66))
bf.WriteUint32(si.AllowedClientFlags)
for channelIdx, ci := range si.Channels {