Skip to content

Commit

Permalink
Workaround hang on ChromeOS.
Browse files Browse the repository at this point in the history
Ebitengine-side bug: hajimehoshi/ebiten#3091

Workaround is simply enabling --runnable_when_unfocused when on
ChromeOS.

Fixes issue #394.
  • Loading branch information
divVerent committed Sep 10, 2024
1 parent c9aaaf5 commit 0c572fe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion internal/aaaaxy/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ var (
runnableWhenUnfocused = flag.Bool("runnable_when_unfocused", flag.SystemDefault(map[string]bool{
// Focus didn't quite work well on JS. TODO: try testing again later.
"js/*": true,
"*/*": false,
// Focus doesn't work well with ChromeOS's sommelier either.
"chromeos/*": true,
// Otherwise default to pausing when focus is gone.
"*/*": false,
}), "keep running the game even when not focused")
dumpLoadingFractions = flag.String("dump_loading_fractions", "", "file name to dump actual loading fractions to")
debugJustInit = flag.Bool("debug_just_init", false, "just init everything, then quit right away")
Expand Down
10 changes: 8 additions & 2 deletions internal/flag/flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,17 @@ var (
// SystemDefault performs a GOOS/GOARCH dependent value lookup to be used in flag defaults.
// Map keys shall be */*, GOOS/*, */GOARCH or GOOS/GOARCH.
func SystemDefault[T any](m map[string]T) T {
k := fmt.Sprintf("%v/%v", runtime.GOOS, runtime.GOARCH)
goos := runtime.GOOS
if goos == "linux" {
if os.Getenv("SOMMELIER_VERSION") != "" {
goos = "chromeos"
}
}
k := fmt.Sprintf("%v/%v", goos, runtime.GOARCH)
if val, found := m[k]; found {
return val
}
k = fmt.Sprintf("%v/*", runtime.GOOS)
k = fmt.Sprintf("%v/*", goos)
if val, found := m[k]; found {
return val
}
Expand Down

0 comments on commit 0c572fe

Please sign in to comment.