Default to fullscreen mode on Steam Deck

This commit is contained in:
Trevor Slocum 2024-09-09 14:33:20 -07:00
parent d4e378d7e0
commit 4b80831ccd
5 changed files with 30 additions and 0 deletions

View file

@ -86,6 +86,10 @@ func parseFlags() *game.Game {
flag.IntVar(&debug, "debug", 0, "Debug level")
flag.Parse()
if game.DefaultFullscreen() {
fullscreen = true
}
var forceLanguage *language.Tag
if locale == "" {
var err error

View file

@ -29,3 +29,7 @@ func GetLocale() (string, error) {
}
return string(out), nil
}
func DefaultFullscreen() bool {
return false
}

View file

@ -3,9 +3,20 @@
package game
import (
"bytes"
"os"
)
func GetLocale() (string, error) {
return os.Getenv("LANG"), nil
}
func DefaultFullscreen() bool {
buf, err := os.ReadFile("/sys/devices/virtual/dmi/id/board_vendor")
if err != nil {
return false
}
steamDevice := bytes.Equal(bytes.ToLower(bytes.TrimSpace(buf)), []byte("valve"))
return steamDevice // Default to fullscreen mode on Steam Deck.
}

View file

@ -7,3 +7,7 @@ import "syscall/js"
func GetLocale() (string, error) {
return js.Global().Get("navigator").Get("language").String(), nil
}
func DefaultFullscreen() bool {
return false
}

7
game/platform_windows.go Normal file
View file

@ -0,0 +1,7 @@
//go:build windows
package game
func DefaultFullscreen() bool {
return false
}