From 494f815870639850f9ec340fe1f62d69abea799a Mon Sep 17 00:00:00 2001 From: Shingo INADA Date: Sat, 12 Dec 2020 15:11:04 +0900 Subject: [PATCH] flycast version check --- gdxsv/lbs_handler.go | 9 +++++++++ gdxsv/main.go | 3 +++ gdxsv/mcs_room.go | 2 +- go.mod | 1 + go.sum | 1 + 5 files changed, 15 insertions(+), 1 deletion(-) diff --git a/gdxsv/lbs_handler.go b/gdxsv/lbs_handler.go index 8c60739..d4e613c 100644 --- a/gdxsv/lbs_handler.go +++ b/gdxsv/lbs_handler.go @@ -15,6 +15,7 @@ import ( "go.uber.org/zap" + "golang.org/x/mod/semver" "golang.org/x/text/encoding/japanese" "golang.org/x/text/transform" "golang.org/x/text/width" @@ -261,6 +262,14 @@ var _ = register(lbsLoginType, func(p *LbsPeer, m *LbsMessage) { switch loginType { case 2: + if p.PlatformInfo["flycast"] != "" { + if semver.Compare(p.PlatformInfo["flycast"], requiredFlycastVersion) < 0 { + p.SendMessage(NewServerNotice(lbsShutDown).Writer(). + WriteString("
PLEASE UPDATE Flycast").Msg()) + return + } + } + // Go to account registration flow. p.SendMessage(NewServerQuestion(lbsUserInfo1)) case 3: diff --git a/gdxsv/main.go b/gdxsv/main.go index 758d679..4b9f47b 100644 --- a/gdxsv/main.go +++ b/gdxsv/main.go @@ -27,6 +27,9 @@ var ( // This will be overwritten via ldflags. gdxsvVersion string gdxsvRevision string + + // Minimum required flycast version. + requiredFlycastVersion = "v0.6.0" ) var ( diff --git a/gdxsv/mcs_room.go b/gdxsv/mcs_room.go index ec43cff..1521f20 100644 --- a/gdxsv/mcs_room.go +++ b/gdxsv/mcs_room.go @@ -27,7 +27,7 @@ func newMcsRoom(mcs *Mcs, gameInfo *McsGame) *McsRoom { mcs: mcs, game: gameInfo, battleLog: &proto.BattleLogFile{ - LogFileVersion: 20201117, + LogFileVersion: 20201212, GameDisk: gameInfo.GameDisk, GdxsvVersion: gdxsvVersion, BattleCode: gameInfo.BattleCode, diff --git a/go.mod b/go.mod index 02ac845..01deb47 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( github.com/stretchr/testify v1.5.1 // indirect github.com/tommy351/zap-stackdriver v0.1.3 go.uber.org/zap v1.15.0 + golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e golang.org/x/net v0.0.0-20190923162816-aa69164e4478 golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 golang.org/x/sync v0.0.0-20190423024810-112230192c58 diff --git a/go.sum b/go.sum index c9f83c7..3dcdf73 100644 --- a/go.sum +++ b/go.sum @@ -93,6 +93,7 @@ golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTk golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e h1:JgcxKXxCjrA2tyDP/aNU9K0Ck5Czfk6C7e2tMw7+bSI= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=