mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-13 22:47:26 +01:00
Compare commits
11 Commits
37ed48db86
...
466f0c000c
Author | SHA1 | Date | |
---|---|---|---|
|
466f0c000c | ||
|
c47aa9ee7f | ||
|
7a4a2a4994 | ||
|
5fd91e2750 | ||
|
dc77c655af | ||
|
013e235628 | ||
|
59521d715b | ||
|
11398f3bb5 | ||
|
5c0c084b6e | ||
|
25a814d561 | ||
|
0ab4538fa1 |
@ -54,11 +54,6 @@ func goEnv(name string) string {
|
|||||||
return strings.TrimSpace(string(val))
|
return strings.TrimSpace(string(val))
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
|
||||||
// Copied from gomobile.
|
|
||||||
minAndroidAPI = 15
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
buildA bool // -a
|
buildA bool // -a
|
||||||
buildI bool // -i
|
buildI bool // -i
|
||||||
@ -99,6 +94,11 @@ func main() {
|
|||||||
flag.Usage()
|
flag.Usage()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// minAndroidAPI specifies the minimum API version for Android.
|
||||||
|
// Now Google Player v23.30.99+ drops API levels that are older than 21.
|
||||||
|
// See https://apilevels.com/.
|
||||||
|
const minAndroidAPI = 21
|
||||||
|
|
||||||
var flagset flag.FlagSet
|
var flagset flag.FlagSet
|
||||||
flagset.StringVar(&buildO, "o", "", "")
|
flagset.StringVar(&buildO, "o", "", "")
|
||||||
flagset.StringVar(&buildGcflags, "gcflags", "", "")
|
flagset.StringVar(&buildGcflags, "gcflags", "", "")
|
||||||
@ -150,6 +150,20 @@ func main() {
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If args doesn't include '-androidapi', set it to args explicitly.
|
||||||
|
// It's because ebitenmobile's default API level is different from gomobile's one.
|
||||||
|
if buildTarget == "android" && buildAndroidAPI == minAndroidAPI {
|
||||||
|
var found bool
|
||||||
|
flag.Visit(func(f *flag.Flag) {
|
||||||
|
if f.Name == "androidapi" {
|
||||||
|
found = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if !found {
|
||||||
|
args = append([]string{args[0], "-androidapi", fmt.Sprintf("%d", minAndroidAPI)}, args[1:]...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err := doBind(args, &flagset, buildTarget); err != nil {
|
if err := doBind(args, &flagset, buildTarget); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -251,7 +265,7 @@ func doBind(args []string, flagset *flag.FlagSet, buildOS string) error {
|
|||||||
// TODO: strings.Title is used here for the consistency with gomobile (see cmd/gomobile/bind_iosapp.go).
|
// TODO: strings.Title is used here for the consistency with gomobile (see cmd/gomobile/bind_iosapp.go).
|
||||||
// As strings.Title is deprecated, golang.org/x/text/cases should be used.
|
// As strings.Title is deprecated, golang.org/x/text/cases should be used.
|
||||||
frameworkNameBase = strings.Title(frameworkNameBase)
|
frameworkNameBase = strings.Title(frameworkNameBase)
|
||||||
dir := filepath.Join(buildO, name, frameworkNameBase+".framework", "Versions", "A")
|
dir := filepath.Join(buildO, name, frameworkNameBase+".framework")
|
||||||
|
|
||||||
if err := os.WriteFile(filepath.Join(dir, "Headers", prefixUpper+"EbitenViewController.h"), []byte(replacePrefixes(objcH)), 0644); err != nil {
|
if err := os.WriteFile(filepath.Join(dir, "Headers", prefixUpper+"EbitenViewController.h"), []byte(replacePrefixes(objcH)), 0644); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -47,7 +47,7 @@ type State struct {
|
|||||||
// Start starts text inputting.
|
// Start starts text inputting.
|
||||||
// Start returns a channel to send the state repeatedly, and a function to end the text inputting.
|
// Start returns a channel to send the state repeatedly, and a function to end the text inputting.
|
||||||
//
|
//
|
||||||
// Start is the low-leve API. For most use cases, Field is easier to use.
|
// Start is the low-level API. For most use cases, Field is easier to use.
|
||||||
//
|
//
|
||||||
// Start returns nil and nil if the current environment doesn't support this package.
|
// Start returns nil and nil if the current environment doesn't support this package.
|
||||||
func Start(x, y int) (states chan State, close func()) {
|
func Start(x, y int) (states chan State, close func()) {
|
||||||
|
22
genkeys.go
22
genkeys.go
@ -576,7 +576,7 @@ const uiGLFWKeysTmpl = `{{.License}}
|
|||||||
|
|
||||||
{{.DoNotEdit}}
|
{{.DoNotEdit}}
|
||||||
|
|
||||||
{{.BuildTag}}
|
{{.BuildConstraints}}
|
||||||
|
|
||||||
package ui
|
package ui
|
||||||
|
|
||||||
@ -594,7 +594,7 @@ const uiJSKeysTmpl = `{{.License}}
|
|||||||
|
|
||||||
{{.DoNotEdit}}
|
{{.DoNotEdit}}
|
||||||
|
|
||||||
{{.BuildTag}}
|
{{.BuildConstraints}}
|
||||||
|
|
||||||
package ui
|
package ui
|
||||||
|
|
||||||
@ -612,7 +612,7 @@ const glfwKeysTmpl = `{{.License}}
|
|||||||
|
|
||||||
{{.DoNotEdit}}
|
{{.DoNotEdit}}
|
||||||
|
|
||||||
{{.BuildTag}}
|
{{.BuildConstraints}}
|
||||||
|
|
||||||
package glfw
|
package glfw
|
||||||
|
|
||||||
@ -626,7 +626,7 @@ const mobileAndroidKeysTmpl = `{{.License}}
|
|||||||
|
|
||||||
{{.DoNotEdit}}
|
{{.DoNotEdit}}
|
||||||
|
|
||||||
{{.BuildTag}}
|
{{.BuildConstraints}}
|
||||||
|
|
||||||
package ebitenmobileview
|
package ebitenmobileview
|
||||||
|
|
||||||
@ -644,7 +644,7 @@ const mobileIOSKeysTmpl = `{{.License}}
|
|||||||
|
|
||||||
{{.DoNotEdit}}
|
{{.DoNotEdit}}
|
||||||
|
|
||||||
{{.BuildTag}}
|
{{.BuildConstraints}}
|
||||||
|
|
||||||
package ebitenmobileview
|
package ebitenmobileview
|
||||||
|
|
||||||
@ -799,20 +799,20 @@ func main() {
|
|||||||
|
|
||||||
// The build tag can't be included in the templates because of `go vet`.
|
// The build tag can't be included in the templates because of `go vet`.
|
||||||
// Pass the build tag and extract this in the template to make `go vet` happy.
|
// Pass the build tag and extract this in the template to make `go vet` happy.
|
||||||
buildTag := ""
|
buildConstraints := ""
|
||||||
switch path {
|
switch path {
|
||||||
case filepath.Join("internal", "glfw", "keys.go"):
|
case filepath.Join("internal", "glfw", "keys.go"):
|
||||||
buildTag = "//go:build darwin || freebsd || linux || netbsd || openbsd || windows"
|
buildConstraints = "//go:build darwin || freebsd || linux || netbsd || openbsd || windows"
|
||||||
case filepath.Join("internal", "ui", "keys_mobile.go"):
|
case filepath.Join("internal", "ui", "keys_mobile.go"):
|
||||||
buildTag = "//go:build android || ios"
|
buildConstraints = "//go:build android || ios"
|
||||||
case filepath.Join("internal", "ui", "keys_glfw.go"):
|
case filepath.Join("internal", "ui", "keys_glfw.go"):
|
||||||
buildTag = "//go:build !android && !ios && !js && !nintendosdk && !playstation5"
|
buildConstraints = "//go:build !android && !ios && !js && !nintendosdk && !playstation5"
|
||||||
}
|
}
|
||||||
// NOTE: According to godoc, maps are automatically sorted by key.
|
// NOTE: According to godoc, maps are automatically sorted by key.
|
||||||
if err := tmpl.Execute(f, struct {
|
if err := tmpl.Execute(f, struct {
|
||||||
License string
|
License string
|
||||||
DoNotEdit string
|
DoNotEdit string
|
||||||
BuildTag string
|
BuildConstraints string
|
||||||
UIKeyNameToJSCode map[string]string
|
UIKeyNameToJSCode map[string]string
|
||||||
EbitengineKeyNames []string
|
EbitengineKeyNames []string
|
||||||
EbitengineKeyNamesWithoutOld []string
|
EbitengineKeyNamesWithoutOld []string
|
||||||
@ -826,7 +826,7 @@ func main() {
|
|||||||
}{
|
}{
|
||||||
License: license,
|
License: license,
|
||||||
DoNotEdit: doNotEdit,
|
DoNotEdit: doNotEdit,
|
||||||
BuildTag: buildTag,
|
BuildConstraints: buildConstraints,
|
||||||
UIKeyNameToJSCode: uiKeyNameToJSCode,
|
UIKeyNameToJSCode: uiKeyNameToJSCode,
|
||||||
EbitengineKeyNames: ebitengineKeyNames,
|
EbitengineKeyNames: ebitengineKeyNames,
|
||||||
EbitengineKeyNamesWithoutOld: ebitengineKeyNamesWithoutOld,
|
EbitengineKeyNamesWithoutOld: ebitengineKeyNamesWithoutOld,
|
||||||
|
8
go.mod
8
go.mod
@ -3,11 +3,11 @@ module github.com/hajimehoshi/ebiten/v2
|
|||||||
go 1.18
|
go 1.18
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/ebitengine/gomobile v0.0.0-20240320163605-0b2c67584a2b
|
github.com/ebitengine/gomobile v0.0.0-20240327025426-b04d93b1a983
|
||||||
github.com/ebitengine/hideconsole v1.0.0
|
github.com/ebitengine/hideconsole v1.0.0
|
||||||
github.com/ebitengine/oto/v3 v3.2.0-alpha.4
|
github.com/ebitengine/oto/v3 v3.3.0-alpha
|
||||||
github.com/ebitengine/purego v0.7.0-alpha.3
|
github.com/ebitengine/purego v0.8.0-alpha
|
||||||
github.com/go-text/typesetting v0.1.1-0.20240319115800-09fd9aa0cd1b
|
github.com/go-text/typesetting v0.1.1-0.20240325125605-c7936fe59984
|
||||||
github.com/hajimehoshi/bitmapfont/v3 v3.0.0
|
github.com/hajimehoshi/bitmapfont/v3 v3.0.0
|
||||||
github.com/hajimehoshi/go-mp3 v0.3.4
|
github.com/hajimehoshi/go-mp3 v0.3.4
|
||||||
github.com/jakecoffman/cp v1.2.1
|
github.com/jakecoffman/cp v1.2.1
|
||||||
|
16
go.sum
16
go.sum
@ -1,13 +1,13 @@
|
|||||||
github.com/ebitengine/gomobile v0.0.0-20240320163605-0b2c67584a2b h1:ccykWd0kO+TooxL9yKfKsI3RB/yK+k/a4vdlA4Q9th8=
|
github.com/ebitengine/gomobile v0.0.0-20240327025426-b04d93b1a983 h1:hHib1v7Z+pXVENSB5x3EF8eQJThPhRfj35RymJFVgm0=
|
||||||
github.com/ebitengine/gomobile v0.0.0-20240320163605-0b2c67584a2b/go.mod h1:tWboRRNagZwwwis4QIgEFG1ZNFwBJ3LAhSLAXAAxobQ=
|
github.com/ebitengine/gomobile v0.0.0-20240327025426-b04d93b1a983/go.mod h1:tWboRRNagZwwwis4QIgEFG1ZNFwBJ3LAhSLAXAAxobQ=
|
||||||
github.com/ebitengine/hideconsole v1.0.0 h1:5J4U0kXF+pv/DhiXt5/lTz0eO5ogJ1iXb8Yj1yReDqE=
|
github.com/ebitengine/hideconsole v1.0.0 h1:5J4U0kXF+pv/DhiXt5/lTz0eO5ogJ1iXb8Yj1yReDqE=
|
||||||
github.com/ebitengine/hideconsole v1.0.0/go.mod h1:hTTBTvVYWKBuxPr7peweneWdkUwEuHuB3C1R/ielR1A=
|
github.com/ebitengine/hideconsole v1.0.0/go.mod h1:hTTBTvVYWKBuxPr7peweneWdkUwEuHuB3C1R/ielR1A=
|
||||||
github.com/ebitengine/oto/v3 v3.2.0-alpha.4 h1:aaUdcbEDUV1oErHDv/Cd0IAjQaQPChZuvO8Cn/kQHE8=
|
github.com/ebitengine/oto/v3 v3.3.0-alpha h1:XxKkEhWl1w5zK9TjPwod+vZeTU91pXYYSooAGk9ya8o=
|
||||||
github.com/ebitengine/oto/v3 v3.2.0-alpha.4/go.mod h1:JtMbxJHZBDXfS8BmVYwzWk9Z6r7jsjwsHzOuZrEkfs4=
|
github.com/ebitengine/oto/v3 v3.3.0-alpha/go.mod h1:T2/VV0UWG97GEEf4kORMU2nCneYT/YmwSTxPutSVaUg=
|
||||||
github.com/ebitengine/purego v0.7.0-alpha.3 h1:9hH1aneqLaM3sM+PMUgRJVsMe2SqfVjZtV3DEzxBDJU=
|
github.com/ebitengine/purego v0.8.0-alpha h1:xWsUo8xQZLH8f9TzXXSvs/qjc2s6rhNGYxEo5Qd10so=
|
||||||
github.com/ebitengine/purego v0.7.0-alpha.3/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ=
|
github.com/ebitengine/purego v0.8.0-alpha/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ=
|
||||||
github.com/go-text/typesetting v0.1.1-0.20240319115800-09fd9aa0cd1b h1:CPNyzp2f5+D9FDN7yT6pXWTDAmpnpjnWi5jt3bKPJyA=
|
github.com/go-text/typesetting v0.1.1-0.20240325125605-c7936fe59984 h1:NwCC36eQsDf1xVZG9jD7ngXNNjsvk8KXky15ogA1Vo0=
|
||||||
github.com/go-text/typesetting v0.1.1-0.20240319115800-09fd9aa0cd1b/go.mod h1:2+owI/sxa73XA581LAzVuEBZ3WEEV2pXeDswCH/3i1I=
|
github.com/go-text/typesetting v0.1.1-0.20240325125605-c7936fe59984/go.mod h1:2+owI/sxa73XA581LAzVuEBZ3WEEV2pXeDswCH/3i1I=
|
||||||
github.com/go-text/typesetting-utils v0.0.0-20240317173224-1986cbe96c66 h1:GUrm65PQPlhFSKjLPGOZNPNxLCybjzjYBzjfoBGaDUY=
|
github.com/go-text/typesetting-utils v0.0.0-20240317173224-1986cbe96c66 h1:GUrm65PQPlhFSKjLPGOZNPNxLCybjzjYBzjfoBGaDUY=
|
||||||
github.com/hajimehoshi/bitmapfont/v3 v3.0.0 h1:r2+6gYK38nfztS/et50gHAswb9hXgxXECYgE8Nczmi4=
|
github.com/hajimehoshi/bitmapfont/v3 v3.0.0 h1:r2+6gYK38nfztS/et50gHAswb9hXgxXECYgE8Nczmi4=
|
||||||
github.com/hajimehoshi/bitmapfont/v3 v3.0.0/go.mod h1:+CxxG+uMmgU4mI2poq944i3uZ6UYFfAkj9V6WqmuvZA=
|
github.com/hajimehoshi/bitmapfont/v3 v3.0.0/go.mod h1:+CxxG+uMmgU4mI2poq944i3uZ6UYFfAkj9V6WqmuvZA=
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
// Copyright 2024 The Ebitengine Authors
|
// Copyright 2024 The Ebitengine Authors
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -13,20 +12,28 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
// Code generated by gen.go using 'go generate'. DO NOT EDIT.
|
// Code generated by gen.go using 'go generate'. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build android
|
//go:build android
|
||||||
|
|
||||||
package gamepaddb
|
package gamepaddb
|
||||||
|
|
||||||
import _ "embed"
|
import (
|
||||||
|
_ "embed"
|
||||||
|
)
|
||||||
|
|
||||||
//go:embed gamecontrollerdb_android.txt
|
//go:embed gamecontrollerdb_android.txt
|
||||||
var controllerBytes []byte
|
var controllerBytes []byte
|
||||||
|
|
||||||
|
//go:embed gamecontrollerdb_glfw.txt
|
||||||
|
var glfwControllerBytes []byte
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
if err := Update(controllerBytes); err != nil {
|
if err := Update(controllerBytes); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if err := Update(glfwControllerBytes); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
// Copyright 2024 The Ebitengine Authors
|
// Copyright 2024 The Ebitengine Authors
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -13,20 +12,28 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
// Code generated by gen.go using 'go generate'. DO NOT EDIT.
|
// Code generated by gen.go using 'go generate'. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build ios
|
//go:build ios
|
||||||
|
|
||||||
package gamepaddb
|
package gamepaddb
|
||||||
|
|
||||||
import _ "embed"
|
import (
|
||||||
|
_ "embed"
|
||||||
|
)
|
||||||
|
|
||||||
//go:embed gamecontrollerdb_ios.txt
|
//go:embed gamecontrollerdb_ios.txt
|
||||||
var controllerBytes []byte
|
var controllerBytes []byte
|
||||||
|
|
||||||
|
//go:embed gamecontrollerdb_glfw.txt
|
||||||
|
var glfwControllerBytes []byte
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
if err := Update(controllerBytes); err != nil {
|
if err := Update(controllerBytes); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if err := Update(glfwControllerBytes); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
// Copyright 2024 The Ebitengine Authors
|
// Copyright 2024 The Ebitengine Authors
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -13,20 +12,28 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
// Code generated by gen.go using 'go generate'. DO NOT EDIT.
|
// Code generated by gen.go using 'go generate'. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build (freebsd || (linux && !android) || netbsd || openbsd) && !nintendosdk && !playstation5
|
//go:build (freebsd || (linux && !android) || netbsd || openbsd) && !nintendosdk && !playstation5
|
||||||
|
|
||||||
package gamepaddb
|
package gamepaddb
|
||||||
|
|
||||||
import _ "embed"
|
import (
|
||||||
|
_ "embed"
|
||||||
|
)
|
||||||
|
|
||||||
//go:embed gamecontrollerdb_linbsd.txt
|
//go:embed gamecontrollerdb_linbsd.txt
|
||||||
var controllerBytes []byte
|
var controllerBytes []byte
|
||||||
|
|
||||||
|
//go:embed gamecontrollerdb_glfw.txt
|
||||||
|
var glfwControllerBytes []byte
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
if err := Update(controllerBytes); err != nil {
|
if err := Update(controllerBytes); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if err := Update(glfwControllerBytes); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
// Copyright 2024 The Ebitengine Authors
|
// Copyright 2024 The Ebitengine Authors
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -13,20 +12,28 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
// Code generated by gen.go using 'go generate'. DO NOT EDIT.
|
// Code generated by gen.go using 'go generate'. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build darwin && !ios
|
//go:build darwin && !ios
|
||||||
|
|
||||||
package gamepaddb
|
package gamepaddb
|
||||||
|
|
||||||
import _ "embed"
|
import (
|
||||||
|
_ "embed"
|
||||||
|
)
|
||||||
|
|
||||||
//go:embed gamecontrollerdb_macos_darwin.txt
|
//go:embed gamecontrollerdb_macos_darwin.txt
|
||||||
var controllerBytes []byte
|
var controllerBytes []byte
|
||||||
|
|
||||||
|
//go:embed gamecontrollerdb_glfw.txt
|
||||||
|
var glfwControllerBytes []byte
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
if err := Update(controllerBytes); err != nil {
|
if err := Update(controllerBytes); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if err := Update(glfwControllerBytes); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
// Copyright 2024 The Ebitengine Authors
|
// Copyright 2024 The Ebitengine Authors
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -13,18 +12,19 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
// Code generated by gen.go using 'go generate'. DO NOT EDIT.
|
// Code generated by gen.go using 'go generate'. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build windows && !microsoftgdk
|
//go:build windows && !microsoftgdk
|
||||||
|
|
||||||
package gamepaddb
|
package gamepaddb
|
||||||
|
|
||||||
import _ "embed"
|
import (
|
||||||
|
_ "embed"
|
||||||
|
)
|
||||||
|
|
||||||
//go:embed gamecontrollerdb_windows.txt
|
//go:embed gamecontrollerdb_windows.txt
|
||||||
var controllerBytes []byte
|
var controllerBytes []byte
|
||||||
|
|
||||||
//go:embed gamecontrollerdb_glfw.txt
|
//go:embed gamecontrollerdb_glfw.txt
|
||||||
var glfwControllerBytes []byte
|
var glfwControllerBytes []byte
|
||||||
|
|
||||||
@ -32,8 +32,8 @@ func init() {
|
|||||||
if err := Update(controllerBytes); err != nil {
|
if err := Update(controllerBytes); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := Update(glfwControllerBytes); err != nil {
|
if err := Update(glfwControllerBytes); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,4 +287,3 @@
|
|||||||
050000005e040000130b0000ffff3f00,Xbox Series Controller,a:b0,b:b1,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Android,
|
050000005e040000130b0000ffff3f00,Xbox Series Controller,a:b0,b:b1,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Android,
|
||||||
65633038363832353634653836396239,Xbox Series Controller,a:b0,b:b1,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Android,
|
65633038363832353634653836396239,Xbox Series Controller,a:b0,b:b1,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Android,
|
||||||
050000001727000044310000ffff3f00,XiaoMi Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a7,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a6,rightx:a2,righty:a5,start:b6,x:b2,y:b3,platform:Android,
|
050000001727000044310000ffff3f00,XiaoMi Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a7,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a6,rightx:a2,righty:a5,start:b6,x:b2,y:b3,platform:Android,
|
||||||
|
|
||||||
|
@ -610,4 +610,3 @@
|
|||||||
xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
|
xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
|
||||||
03000000120c0000100e000011010000,Zeroplus P4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
|
03000000120c0000100e000011010000,Zeroplus P4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
|
||||||
03000000120c0000101e000011010000,Zeroplus P4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
|
03000000120c0000101e000011010000,Zeroplus P4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
|
||||||
|
|
||||||
|
@ -284,4 +284,3 @@
|
|||||||
03000000172700004431000029010000,XiaoMi Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,platform:Mac OS X,
|
03000000172700004431000029010000,XiaoMi Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,platform:Mac OS X,
|
||||||
03000000120c0000100e000000010000,Zeroplus P4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
|
03000000120c0000100e000000010000,Zeroplus P4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
|
||||||
03000000120c0000101e000000010000,Zeroplus P4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
|
03000000120c0000101e000000010000,Zeroplus P4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
|
||||||
|
|
||||||
|
@ -798,4 +798,3 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
|
|||||||
03000000790000004f18000000000000,ZDT Android Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,
|
03000000790000004f18000000000000,ZDT Android Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,
|
||||||
03000000120c00000500000000000000,Zeroplus Adapter,a:b2,b:b1,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b0,righttrigger:b5,rightx:a3,righty:a2,start:b8,x:b3,y:b0,platform:Windows,
|
03000000120c00000500000000000000,Zeroplus Adapter,a:b2,b:b1,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b0,righttrigger:b5,rightx:a3,righty:a2,start:b8,x:b3,y:b0,platform:Windows,
|
||||||
03000000120c0000101e000000000000,Zeroplus P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
|
03000000120c0000101e000000000000,Zeroplus P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
|
||||||
|
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//go:generate go run gen.go
|
//go:generate go run gen.go
|
||||||
|
//go:generate gofmt -s -w .
|
||||||
|
|
||||||
package gamepaddb
|
package gamepaddb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -14,11 +14,10 @@
|
|||||||
|
|
||||||
//go:build ignore
|
//go:build ignore
|
||||||
|
|
||||||
// This program generates platform-specific controller dbs. It can be invoked by running
|
|
||||||
// go generate
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
_ "embed"
|
_ "embed"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -50,134 +49,170 @@ const license = `// Copyright 2024 The Ebitengine Authors
|
|||||||
// curl --location --remote-name https://raw.githubusercontent.com/mdqinc/SDL_GameControllerDB/master/gamecontrollerdb.txt
|
// curl --location --remote-name https://raw.githubusercontent.com/mdqinc/SDL_GameControllerDB/master/gamecontrollerdb.txt
|
||||||
|
|
||||||
//go:embed gamecontrollerdb.txt
|
//go:embed gamecontrollerdb.txt
|
||||||
var gamecontrollerdb_txt []byte
|
var gameControllerDB []byte
|
||||||
|
|
||||||
const db_template string = `
|
const dbTemplate string = `{{.License}}
|
||||||
{{.License}}
|
|
||||||
|
|
||||||
{{.DoNotEdit}}
|
{{.DoNotEdit}}
|
||||||
|
|
||||||
{{.BuildTag}}
|
{{.BuildConstraints}}
|
||||||
|
|
||||||
package gamepaddb
|
package gamepaddb
|
||||||
|
|
||||||
import _ "embed"
|
import (
|
||||||
|
_ "embed"
|
||||||
|
)
|
||||||
|
|
||||||
//go:embed gamecontrollerdb_{{.Platform}}.txt
|
//go:embed gamecontrollerdb_{{.FileNameSuffix}}.txt
|
||||||
var controllerBytes []byte
|
var controllerBytes []byte
|
||||||
{{if eq .Platform "windows" }}
|
|
||||||
//go:embed gamecontrollerdb_glfw.txt
|
//go:embed gamecontrollerdb_glfw.txt
|
||||||
var glfwControllerBytes []byte
|
var glfwControllerBytes []byte
|
||||||
{{end}}
|
|
||||||
func init() {
|
func init() {
|
||||||
if err := Update(controllerBytes); err != nil {
|
if err := Update(controllerBytes); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
{{if eq .Platform "windows" }}
|
|
||||||
if err := Update(glfwControllerBytes); err != nil {
|
if err := Update(glfwControllerBytes); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
{{end}}}`
|
}`
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
if err := run(); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func run() error {
|
||||||
// Follow the standard comment rule (https://pkg.go.dev/cmd/go#hdr-Generate_Go_files_by_processing_source).
|
// Follow the standard comment rule (https://pkg.go.dev/cmd/go#hdr-Generate_Go_files_by_processing_source).
|
||||||
doNotEdit := "// Code generated by gen.go using 'go generate'. DO NOT EDIT."
|
doNotEdit := "// Code generated by gen.go using 'go generate'. DO NOT EDIT."
|
||||||
|
|
||||||
type gamePadPlatform struct {
|
type gamePadPlatform struct {
|
||||||
name string
|
filenameSuffix string
|
||||||
buildTag string
|
buildConstraints string
|
||||||
}
|
}
|
||||||
|
|
||||||
supported := map[string]gamePadPlatform{
|
supported := map[string]gamePadPlatform{
|
||||||
"Windows": {
|
"Windows": {
|
||||||
name: "windows",
|
filenameSuffix: "windows",
|
||||||
buildTag: "//go:build windows && !microsoftgdk",
|
buildConstraints: "//go:build windows && !microsoftgdk",
|
||||||
},
|
},
|
||||||
"Mac OS X": {
|
"Mac OS X": {
|
||||||
name: "macos_darwin",
|
filenameSuffix: "macos_darwin",
|
||||||
buildTag: "//go:build darwin && !ios",
|
buildConstraints: "//go:build darwin && !ios",
|
||||||
},
|
},
|
||||||
"Linux": {
|
"Linux": {
|
||||||
name: "linbsd",
|
filenameSuffix: "linbsd",
|
||||||
buildTag: "//go:build (freebsd || (linux && !android) || netbsd || openbsd) && !nintendosdk && !playstation5",
|
buildConstraints: "//go:build (freebsd || (linux && !android) || netbsd || openbsd) && !nintendosdk && !playstation5",
|
||||||
},
|
},
|
||||||
"iOS": {
|
"iOS": {
|
||||||
name: "ios",
|
filenameSuffix: "ios",
|
||||||
buildTag: "//go:build ios",
|
buildConstraints: "//go:build ios",
|
||||||
},
|
},
|
||||||
"Android": {
|
"Android": {
|
||||||
name: "android",
|
filenameSuffix: "android",
|
||||||
buildTag: "//go:build android",
|
buildConstraints: "//go:build android",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// divide controller dbs into chunks by platform
|
controllerDBs, err := splitControllersByPlatform(gameControllerDB)
|
||||||
controllerDbs := splitControllerDb(gamecontrollerdb_txt)
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
for sdlName, platform := range supported {
|
for sdlName, platform := range supported {
|
||||||
controllerDb, ok := controllerDbs[sdlName]
|
controllerDB, ok := controllerDBs[sdlName]
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Fatalf("failed to find controller db for platform %s in gamecontrollerdb_txt", sdlName)
|
return fmt.Errorf("failed to find controller db for platform %s in gamecontrollerdb_txt", sdlName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// write each chunk into separate text file for embedding into respective generated files
|
// write each chunk into separate text file for embedding into respective generated files
|
||||||
txtFile, err := os.Create(fmt.Sprintf("gamecontrollerdb_%s.txt", platform.name))
|
txtFile, err := os.Create(fmt.Sprintf("gamecontrollerdb_%s.txt", platform.filenameSuffix))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("failed to open file: %v", err)
|
return fmt.Errorf("failed to open file: %v", err)
|
||||||
}
|
}
|
||||||
defer txtFile.Close()
|
defer txtFile.Close()
|
||||||
written, err := txtFile.Write(controllerDb)
|
written, err := txtFile.Write(controllerDB)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("failed to write controller db for %s, expected to write %d bytes, wrote %d: %v", sdlName, len(controllerDb), written, err)
|
return fmt.Errorf("failed to write controller db for %s, expected to write %d bytes, wrote %d: %v", sdlName, len(controllerDB), written, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
path := fmt.Sprintf("db_%s.go", platform.name)
|
path := fmt.Sprintf("db_%s.go", platform.filenameSuffix)
|
||||||
tmpl, err := template.New(path).Parse(db_template)
|
tmpl, err := template.New(path).Parse(dbTemplate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("failed to parse template: %v", err)
|
return fmt.Errorf("failed to parse template: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
f, err := os.Create(path)
|
f, err := os.Create(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
return err
|
||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
err = tmpl.Execute(f, struct {
|
err = tmpl.Execute(f, struct {
|
||||||
License string
|
License string
|
||||||
DoNotEdit string
|
DoNotEdit string
|
||||||
BuildTag string
|
BuildConstraints string
|
||||||
Platform string
|
FileNameSuffix string
|
||||||
}{
|
}{
|
||||||
License: license,
|
License: license,
|
||||||
DoNotEdit: doNotEdit,
|
DoNotEdit: doNotEdit,
|
||||||
BuildTag: platform.buildTag,
|
BuildConstraints: platform.buildConstraints,
|
||||||
Platform: platform.name,
|
FileNameSuffix: platform.filenameSuffix,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// splitControllerDb maps the game controller db into respective controller definition byte slices for
|
func splitControllersByPlatform(controllerDB []byte) (map[string][]byte, error) {
|
||||||
// each platform
|
s := bufio.NewScanner(bytes.NewReader(controllerDB))
|
||||||
func splitControllerDb(controllerDb []byte) map[string][]byte {
|
|
||||||
dbs := map[string][]byte{}
|
dbs := map[string][]byte{}
|
||||||
// split at #, skip first 3 header chunks
|
|
||||||
chunks := bytes.Split(controllerDb, []byte{'#'})[3:]
|
|
||||||
|
|
||||||
for _, chunk := range chunks {
|
var currentPlatform string
|
||||||
// find each platform string
|
buf := bytes.Buffer{}
|
||||||
lines := bytes.Split(chunk, []byte{'\n'})
|
for s.Scan() {
|
||||||
if len(lines) == 0 {
|
chunk := s.Bytes()
|
||||||
|
if len(chunk) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
platform := strings.TrimSpace(string(lines[0]))
|
if chunk[0] == '#' {
|
||||||
// count platform string len + space + newline
|
if currentPlatform != "" && buf.Len() > 0 {
|
||||||
bytesRead := len(lines[0]) + 1
|
dbs[currentPlatform] = bytes.Clone(buf.Bytes())
|
||||||
dbs[platform] = chunk[bytesRead:]
|
buf.Reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
platform := strings.Replace(string(chunk), "# ", "", 1)
|
||||||
|
switch platform {
|
||||||
|
case "Windows":
|
||||||
|
currentPlatform = "Windows"
|
||||||
|
case "Mac OS X":
|
||||||
|
currentPlatform = "Mac OS X"
|
||||||
|
case "iOS":
|
||||||
|
currentPlatform = "iOS"
|
||||||
|
case "Android":
|
||||||
|
currentPlatform = "Android"
|
||||||
|
case "Linux":
|
||||||
|
currentPlatform = "Linux"
|
||||||
|
default:
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
buf.Write(chunk)
|
||||||
|
buf.WriteByte('\n')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return dbs
|
if currentPlatform != "" && buf.Len() > 0 {
|
||||||
|
dbs[currentPlatform] = bytes.Clone(buf.Bytes())
|
||||||
|
}
|
||||||
|
if err := s.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return dbs, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user