Skip to content

Commit

Permalink
flycast version check
Browse files Browse the repository at this point in the history
  • Loading branch information
inada-s committed Dec 12, 2020
1 parent 4eb39c7 commit 494f815
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
9 changes: 9 additions & 0 deletions gdxsv/lbs_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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("<LF=5><BODY><CENTER>PLEASE UPDATE Flycast<END>").Msg())
return
}
}

// Go to account registration flow.
p.SendMessage(NewServerQuestion(lbsUserInfo1))
case 3:
Expand Down
3 changes: 3 additions & 0 deletions gdxsv/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ var (
// This will be overwritten via ldflags.
gdxsvVersion string
gdxsvRevision string

// Minimum required flycast version.
requiredFlycastVersion = "v0.6.0"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion gdxsv/mcs_room.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit 494f815

Please sign in to comment.