feat: add realtime vis

This commit is contained in:
Louis Dalibard 2025-02-18 14:21:43 +01:00
parent 5dbea7f196
commit 389177e03d
57 changed files with 1000 additions and 303 deletions

View File

@ -8,6 +8,7 @@ import (
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
) )
// Rest of config
type ConfigS struct { type ConfigS struct {
OnlyWarnings bool OnlyWarnings bool
Latitude float64 Latitude float64
@ -19,6 +20,12 @@ type ConfigS struct {
IssueNotification bool IssueNotification bool
OpenWebPages bool OpenWebPages bool
TestWarning bool TestWarning bool
RenderRealtimeVis bool
RealtimeVisFPS int
RealtimeVisFontSize float64
RealtimeVisTextPadding float64
RealtimeVisCircleResolution int
RealtimeVisRenderSize int
RetryConnectionEveryXS float64 RetryConnectionEveryXS float64
} }
@ -35,6 +42,12 @@ var DefaultConfig = ConfigS{
IssueNotification: true, IssueNotification: true,
OpenWebPages: false, OpenWebPages: false,
TestWarning: false, TestWarning: false,
RenderRealtimeVis: true,
RealtimeVisFPS: 165,
RealtimeVisFontSize: 32,
RealtimeVisTextPadding: 32,
RealtimeVisCircleResolution: 60,
RealtimeVisRenderSize: 1280,
RetryConnectionEveryXS: 30, RetryConnectionEveryXS: 30,
} }

25
go.mod
View File

@ -3,28 +3,45 @@ module hayai
go 1.23.0 go 1.23.0
require ( require (
github.com/disintegration/imaging v1.6.2
github.com/faiface/beep v1.1.0 github.com/faiface/beep v1.1.0
github.com/fogleman/gg v1.3.0
github.com/gen2brain/beeep v0.0.0-20240516210008-9c006672e7f4 github.com/gen2brain/beeep v0.0.0-20240516210008-9c006672e7f4
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
github.com/gorilla/websocket v1.5.3 github.com/gorilla/websocket v1.5.3
github.com/hajimehoshi/ebiten/v2 v2.8.6
github.com/jftuga/geodist v1.0.0 github.com/jftuga/geodist v1.0.0
github.com/kirsle/configdir v0.0.0-20170128060238-e45d2f54772f github.com/kirsle/configdir v0.0.0-20170128060238-e45d2f54772f
github.com/mmcloughlin/globe v0.0.0-20240209192953-d41128bd4632
github.com/pymaxion/geographiclib-go v1.1.0
github.com/sqweek/dialog v0.0.0-20240226140203-065105509627 github.com/sqweek/dialog v0.0.0-20240226140203-065105509627
golang.org/x/image v0.20.0
gonum.org/v1/gonum v0.15.1
gopkg.in/yaml.v3 v3.0.1 gopkg.in/yaml.v3 v3.0.1
) )
require ( require (
github.com/TheTitanrain/w32 v0.0.0-20180517000239-4f5cfb03fabf // indirect github.com/TheTitanrain/w32 v0.0.0-20180517000239-4f5cfb03fabf // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/ebitengine/gomobile v0.0.0-20240911145611-4856209ac325 // indirect
github.com/ebitengine/hideconsole v1.0.0 // indirect
github.com/ebitengine/purego v0.8.0 // indirect
github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4 // indirect github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/hajimehoshi/oto v0.7.1 // indirect github.com/hajimehoshi/oto v0.7.1 // indirect
github.com/icza/bitio v1.0.0 // indirect github.com/icza/bitio v1.0.0 // indirect
github.com/jezek/xgb v1.1.1 // indirect
github.com/mewkiz/flac v1.0.7 // indirect github.com/mewkiz/flac v1.0.7 // indirect
github.com/mewkiz/pkg v0.0.0-20190919212034-518ade7978e2 // indirect github.com/mewkiz/pkg v0.0.0-20190919212034-518ade7978e2 // indirect
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect
github.com/pkg/errors v0.9.1 // indirect github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af // indirect github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af // indirect
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8 // indirect github.com/tidwall/pinhole v0.0.0-20210130162507-d8644a7c3d19 // indirect
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067 // indirect golang.org/x/exp/shiny v0.0.0-20250215185904-eff6e970281f // indirect
golang.org/x/mobile v0.0.0-20190415191353-3e0bab5405d6 // indirect golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a // indirect
golang.org/x/sys v0.18.0 // indirect golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.25.0 // indirect
) )

85
go.sum
View File

@ -2,8 +2,21 @@ github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q
github.com/TheTitanrain/w32 v0.0.0-20180517000239-4f5cfb03fabf h1:FPsprx82rdrX2jiKyS17BH6IrTmUBYqZa/CXT4uvb+I= github.com/TheTitanrain/w32 v0.0.0-20180517000239-4f5cfb03fabf h1:FPsprx82rdrX2jiKyS17BH6IrTmUBYqZa/CXT4uvb+I=
github.com/TheTitanrain/w32 v0.0.0-20180517000239-4f5cfb03fabf/go.mod h1:peYoMncQljjNS6tZwI9WVyQB3qZS6u79/N3mBOcnd3I= github.com/TheTitanrain/w32 v0.0.0-20180517000239-4f5cfb03fabf/go.mod h1:peYoMncQljjNS6tZwI9WVyQB3qZS6u79/N3mBOcnd3I=
github.com/d4l3k/messagediff v1.2.2-0.20190829033028-7e0a312ae40b/go.mod h1:Oozbb1TVXFac9FtSIxHBMnBCq2qeH/2KkEQxENCrlLo= github.com/d4l3k/messagediff v1.2.2-0.20190829033028-7e0a312ae40b/go.mod h1:Oozbb1TVXFac9FtSIxHBMnBCq2qeH/2KkEQxENCrlLo=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c=
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
github.com/ebitengine/gomobile v0.0.0-20240911145611-4856209ac325 h1:Gk1XUEttOk0/hb6Tq3WkmutWa0ZLhNn/6fc6XZpM7tM=
github.com/ebitengine/gomobile v0.0.0-20240911145611-4856209ac325/go.mod h1:ulhSQcbPioQrallSuIzF8l1NKQoD7xmMZc5NxzibUMY=
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/purego v0.8.0 h1:JbqvnEzRvPpxhCJzJJ2y0RbiZ8nyjccVUrSM3q+GvvE=
github.com/ebitengine/purego v0.8.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
github.com/faiface/beep v1.1.0 h1:A2gWP6xf5Rh7RG/p9/VAW2jRSDEGQm5sbOb38sf5d4c= github.com/faiface/beep v1.1.0 h1:A2gWP6xf5Rh7RG/p9/VAW2jRSDEGQm5sbOb38sf5d4c=
github.com/faiface/beep v1.1.0/go.mod h1:6I8p6kK2q4opL/eWb+kAkk38ehnTunWeToJB+s51sT4= github.com/faiface/beep v1.1.0/go.mod h1:6I8p6kK2q4opL/eWb+kAkk38ehnTunWeToJB+s51sT4=
github.com/fogleman/gg v1.3.0 h1:/7zJX8F6AaYQc57WQCyN9cAIz+4bCJGO9B+dyW29am8=
github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
github.com/gdamore/tcell v1.3.0/go.mod h1:Hjvr+Ofd+gLglo7RYKxxnzCBmev3BzsS67MebKS4zMM= github.com/gdamore/tcell v1.3.0/go.mod h1:Hjvr+Ofd+gLglo7RYKxxnzCBmev3BzsS67MebKS4zMM=
github.com/gen2brain/beeep v0.0.0-20240516210008-9c006672e7f4 h1:ygs9POGDQpQGLJPlq4+0LBUmMBNox1N4JSpw+OETcvI= github.com/gen2brain/beeep v0.0.0-20240516210008-9c006672e7f4 h1:ygs9POGDQpQGLJPlq4+0LBUmMBNox1N4JSpw+OETcvI=
@ -15,8 +28,14 @@ github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4 h1:qZNfIGkIANxGv/Oq
github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4/go.mod h1:kW3HQ4UdaAyrUCSSDR4xUzBKW6O2iA4uHhk7AtyYp10= github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4/go.mod h1:kW3HQ4UdaAyrUCSSDR4xUzBKW6O2iA4uHhk7AtyYp10=
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU=
github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4=
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/hajimehoshi/ebiten/v2 v2.8.6 h1:Dkd/sYI0TYyZRCE7GVxV59XC+WCi2BbGAbIBjXeVC1U=
github.com/hajimehoshi/ebiten/v2 v2.8.6/go.mod h1:cCQ3np7rdmaJa1ZnvslraVlpxNb3wCjEnAP1LHNyXNA=
github.com/hajimehoshi/go-mp3 v0.3.0/go.mod h1:qMJj/CSDxx6CGHiZeCgbiq2DSUkbK0UbtXShQcnfyMM= github.com/hajimehoshi/go-mp3 v0.3.0/go.mod h1:qMJj/CSDxx6CGHiZeCgbiq2DSUkbK0UbtXShQcnfyMM=
github.com/hajimehoshi/oto v0.6.1/go.mod h1:0QXGEkbuJRohbJaxr7ZQSxnju7hEhseiPx2hrh6raOI= github.com/hajimehoshi/oto v0.6.1/go.mod h1:0QXGEkbuJRohbJaxr7ZQSxnju7hEhseiPx2hrh6raOI=
github.com/hajimehoshi/oto v0.7.1 h1:I7maFPz5MBCwiutOrz++DLdbr4rTzBsbBuV2VpgU9kk= github.com/hajimehoshi/oto v0.7.1 h1:I7maFPz5MBCwiutOrz++DLdbr4rTzBsbBuV2VpgU9kk=
@ -25,6 +44,8 @@ github.com/icza/bitio v1.0.0 h1:squ/m1SHyFeCA6+6Gyol1AxV9nmPPlJFT8c2vKdj3U8=
github.com/icza/bitio v1.0.0/go.mod h1:0jGnlLAx8MKMr9VGnn/4YrvZiprkvBelsVIbA9Jjr9A= github.com/icza/bitio v1.0.0/go.mod h1:0jGnlLAx8MKMr9VGnn/4YrvZiprkvBelsVIbA9Jjr9A=
github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6 h1:8UsGZ2rr2ksmEru6lToqnXgA8Mz1DP11X4zSJ159C3k= github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6 h1:8UsGZ2rr2ksmEru6lToqnXgA8Mz1DP11X4zSJ159C3k=
github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6/go.mod h1:xQig96I1VNBDIWGCdTt54nHt6EeI639SmHycLYL7FkA= github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6/go.mod h1:xQig96I1VNBDIWGCdTt54nHt6EeI639SmHycLYL7FkA=
github.com/jezek/xgb v1.1.1 h1:bE/r8ZZtSv7l9gk6nU0mYx51aXrvnyb44892TwSaqS4=
github.com/jezek/xgb v1.1.1/go.mod h1:nrhwO0FX/enq75I7Y7G8iN1ubpSGZEiA3v9e9GyRFlk=
github.com/jfreymuth/oggvorbis v1.0.1/go.mod h1:NqS+K+UXKje0FUYUPosyQ+XTVvjmVjps1aEZH1sumIk= github.com/jfreymuth/oggvorbis v1.0.1/go.mod h1:NqS+K+UXKje0FUYUPosyQ+XTVvjmVjps1aEZH1sumIk=
github.com/jfreymuth/vorbis v1.0.0/go.mod h1:8zy3lUAm9K/rJJk223RKy6vjCZTWC61NA2QD06bfOE0= github.com/jfreymuth/vorbis v1.0.0/go.mod h1:8zy3lUAm9K/rJJk223RKy6vjCZTWC61NA2QD06bfOE0=
github.com/jftuga/geodist v1.0.0 h1:PFPQlZtj10u8ETAYTyxE0DWMl1bwA+Xzrqb4+oLkkC0= github.com/jftuga/geodist v1.0.0 h1:PFPQlZtj10u8ETAYTyxE0DWMl1bwA+Xzrqb4+oLkkC0=
@ -37,31 +58,85 @@ github.com/mewkiz/flac v1.0.7 h1:uIXEjnuXqdRaZttmSFM5v5Ukp4U6orrZsnYGGR3yow8=
github.com/mewkiz/flac v1.0.7/go.mod h1:yU74UH277dBUpqxPouHSQIar3G1X/QIclVbFahSd1pU= github.com/mewkiz/flac v1.0.7/go.mod h1:yU74UH277dBUpqxPouHSQIar3G1X/QIclVbFahSd1pU=
github.com/mewkiz/pkg v0.0.0-20190919212034-518ade7978e2 h1:EyTNMdePWaoWsRSGQnXiSoQu0r6RS1eA557AwJhlzHU= github.com/mewkiz/pkg v0.0.0-20190919212034-518ade7978e2 h1:EyTNMdePWaoWsRSGQnXiSoQu0r6RS1eA557AwJhlzHU=
github.com/mewkiz/pkg v0.0.0-20190919212034-518ade7978e2/go.mod h1:3E2FUC/qYUfM8+r9zAwpeHJzqRVVMIYnpzD/clwWxyA= github.com/mewkiz/pkg v0.0.0-20190919212034-518ade7978e2/go.mod h1:3E2FUC/qYUfM8+r9zAwpeHJzqRVVMIYnpzD/clwWxyA=
github.com/mmcloughlin/globe v0.0.0-20240209192953-d41128bd4632 h1:Fwxwzkdjl6JC8/b4E3mkqvSIycR5yZ86M24ZDnon/ek=
github.com/mmcloughlin/globe v0.0.0-20240209192953-d41128bd4632/go.mod h1:KO2C9UXlC8EA6ScZmeX+bi4Ashw0Nn3DZS2LPoIcO90=
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ=
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pymaxion/geographiclib-go v1.1.0 h1:fEVKhoLHLsUDomaq3fZq6pQ+BZYM9tb3oK9DP+rv0PY=
github.com/pymaxion/geographiclib-go v1.1.0/go.mod h1:TjKyEChLyv0keLuuXVoZxnFZLDp1JVA9Pz+FdQs4e3U=
github.com/sqweek/dialog v0.0.0-20240226140203-065105509627 h1:2JL2wmHXWIAxDofCK+AdkFi1KEg3dgkefCsm7isADzQ= github.com/sqweek/dialog v0.0.0-20240226140203-065105509627 h1:2JL2wmHXWIAxDofCK+AdkFi1KEg3dgkefCsm7isADzQ=
github.com/sqweek/dialog v0.0.0-20240226140203-065105509627/go.mod h1:/qNPSY91qTz/8TgHEMioAUc6q7+3SOybeKczHMXFcXw= github.com/sqweek/dialog v0.0.0-20240226140203-065105509627/go.mod h1:/qNPSY91qTz/8TgHEMioAUc6q7+3SOybeKczHMXFcXw=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af h1:6yITBqGTE2lEeTPG04SN9W+iWHCRyHqlVYILiSXziwk= github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af h1:6yITBqGTE2lEeTPG04SN9W+iWHCRyHqlVYILiSXziwk=
github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af/go.mod h1:4F09kP5F+am0jAwlQLddpoMDM+iewkxxt6nxUQ5nq5o= github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af/go.mod h1:4F09kP5F+am0jAwlQLddpoMDM+iewkxxt6nxUQ5nq5o=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8 h1:idBdZTd9UioThJp8KpM/rTSinK/ChZFBE43/WtIy8zg= github.com/tidwall/pinhole v0.0.0-20210130162507-d8644a7c3d19 h1:PH18rfaiwA/34DAtuREBTrrByvZeLHqhfYh4SG7jYg4=
github.com/tidwall/pinhole v0.0.0-20210130162507-d8644a7c3d19/go.mod h1:5VfbOBfzaI6Y0XiGSkz7hiXgKtwYaDBI3plwKGsLonM=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ=
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE=
golang.org/x/exp/shiny v0.0.0-20250215185904-eff6e970281f h1:QYRA5Bxxd8Yu+4vNdN+WWXDyH4ihtmA6UrL0QcvVoeI=
golang.org/x/exp/shiny v0.0.0-20250215185904-eff6e970281f/go.mod h1:ygj7T6vSGhhm/9yTpOQQNvuAUFziTH7RUiH74EoE2C8=
golang.org/x/image v0.0.0-20190220214146-31aff87c08e9/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190220214146-31aff87c08e9/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067 h1:KYGJGHOQy8oSi1fDlSpcZF0+juKwk/hEMv5SiwHogR0=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/mobile v0.0.0-20190415191353-3e0bab5405d6 h1:vyLBGJPIl9ZYbcQFM2USFmJBK6KI+t+z6jL0lbwjrnc= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.6.0/go.mod h1:MXLdDR43H7cDJq5GEGXEVeeNhPgi+YYEQ2pC1byI1x0=
golang.org/x/image v0.20.0 h1:7cVCUjQwfL18gyBJOmYvptfSHS8Fb3YUDtfLIZ7Nbpw=
golang.org/x/image v0.20.0/go.mod h1:0a88To4CYVBAHp5FXJm8o7QbUl37Vd85ply1vyD8auM=
golang.org/x/mobile v0.0.0-20190415191353-3e0bab5405d6/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mobile v0.0.0-20190415191353-3e0bab5405d6/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a h1:sYbmY3FwUWCBTodZL1S3JUuOvaW6kM2o+clDzzDNBWg=
golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a/go.mod h1:Ede7gF0KGoHlj822RtphAHK1jLdrcuRBZg0sF1Q+SPc=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190429190828-d89cdac9e872/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190429190828-d89cdac9e872/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gonum.org/v1/gonum v0.15.1 h1:FNy7N6OUZVUaWG9pTiD+jlhdQ3lMP+/LcTpJ6+a8sQ0=
gonum.org/v1/gonum v0.15.1/go.mod h1:eZTZuRFrzu5pcyjN5wJhcIhnUdNijYxX1T2IcrOGY0o=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@ -2,10 +2,15 @@ package main
import ( import (
"hayai/config" "hayai/config"
"hayai/render"
"hayai/waves"
"hayai/wolfx" "hayai/wolfx"
) )
func main() { func main() {
config.Init() config.Init()
waves.Init()
render.Init()
wolfx.Listen() wolfx.Listen()
} }

3
vendor/golang.org/x/exp/AUTHORS generated vendored
View File

@ -1,3 +0,0 @@
# This source code refers to The Go Authors for copyright purposes.
# The master list of authors is in the main Go distribution,
# visible at http://tip.golang.org/AUTHORS.

View File

@ -1,3 +0,0 @@
# This source code was written by the Go contributors.
# The master list of contributors is in the main Go distribution,
# visible at http://tip.golang.org/CONTRIBUTORS.

27
vendor/golang.org/x/exp/LICENSE generated vendored
View File

@ -1,27 +0,0 @@
Copyright (c) 2009 The Go Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

22
vendor/golang.org/x/exp/PATENTS generated vendored
View File

@ -1,22 +0,0 @@
Additional IP Rights Grant (Patents)
"This implementation" means the copyrightable works distributed by
Google as part of the Go project.
Google hereby grants to You a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable (except as stated in this section)
patent license to make, have made, use, offer to sell, sell, import,
transfer and otherwise run, modify and propagate the contents of this
implementation of Go, where such license applies only to those patent
claims, both currently owned or controlled by Google and acquired in
the future, licensable by Google that are necessarily infringed by this
implementation of Go. This grant does not include claims that would be
infringed only as a consequence of further modification of this
implementation. If you or your agent or exclusive licensee institute or
order or agree to the institution of patent litigation against any
entity (including a cross-claim or counterclaim in a lawsuit) alleging
that this implementation of Go or any code incorporated within this
implementation of Go constitutes direct or contributory patent
infringement, or inducement of patent infringement, then any patent
rights granted to you under this License for this implementation of Go
shall terminate as of the date such litigation is filed.

View File

@ -2,14 +2,12 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build darwin //go:build darwin && !ios
// +build 386 amd64
// +build !ios
package gldriver package gldriver
/* /*
#cgo CFLAGS: -x objective-c #cgo CFLAGS: -x objective-c -DGL_SILENCE_DEPRECATION
#cgo LDFLAGS: -framework Cocoa -framework OpenGL #cgo LDFLAGS: -framework Cocoa -framework OpenGL
#include <OpenGL/gl3.h> #include <OpenGL/gl3.h>
#import <Carbon/Carbon.h> // for HIToolbox/Events.h #import <Carbon/Carbon.h> // for HIToolbox/Events.h
@ -231,11 +229,11 @@ var mods = [...]struct {
{1<<17 | 0x102, C.kVK_Shift, key.ModShift}, {1<<17 | 0x102, C.kVK_Shift, key.ModShift},
{1<<17 | 0x104, C.kVK_RightShift, key.ModShift}, {1<<17 | 0x104, C.kVK_RightShift, key.ModShift},
{1<<18 | 0x101, C.kVK_Control, key.ModControl}, {1<<18 | 0x101, C.kVK_Control, key.ModControl},
// TODO key.ControlRight {33<<13 | 0x100, C.kVK_RightControl, key.ModControl},
{1<<19 | 0x120, C.kVK_Option, key.ModAlt}, {1<<19 | 0x120, C.kVK_Option, key.ModAlt},
{1<<19 | 0x140, C.kVK_RightOption, key.ModAlt}, {1<<19 | 0x140, C.kVK_RightOption, key.ModAlt},
{1<<20 | 0x108, C.kVK_Command, key.ModMeta}, {1<<20 | 0x108, C.kVK_Command, key.ModMeta},
{1<<20 | 0x110, C.kVK_Command, key.ModMeta}, // TODO: missing kVK_RightCommand {1<<20 | 0x110, 0x36 /* kVK_RightCommand */, key.ModMeta},
} }
func cocoaMods(flags uint32) (m key.Modifiers) { func cocoaMods(flags uint32) (m key.Modifiers) {
@ -290,7 +288,7 @@ func mouseEvent(id uintptr, x, y, dx, dy float32, ty, button int32, flags uint32
// can produce wheel events in opposite directions, but the // can produce wheel events in opposite directions, but the
// direction matches what other programs on the OS do. // direction matches what other programs on the OS do.
// //
// If we wanted to expose the phsyical device motion in the // If we wanted to expose the physical device motion in the
// event we could use [NSEvent isDirectionInvertedFromDevice] // event we could use [NSEvent isDirectionInvertedFromDevice]
// to know if "natural scrolling" is enabled. // to know if "natural scrolling" is enabled.
// //
@ -412,6 +410,7 @@ func cocoaRune(r rune) rune {
// into the standard keycodes used by the key package. // into the standard keycodes used by the key package.
// //
// To get a sense of the key map, see the diagram on // To get a sense of the key map, see the diagram on
//
// http://boredzo.org/blog/archives/2007-05-22/virtual-key-codes // http://boredzo.org/blog/archives/2007-05-22/virtual-key-codes
func cocoaKeyCode(vkcode uint16) key.Code { func cocoaKeyCode(vkcode uint16) key.Code {
switch vkcode { switch vkcode {

View File

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build darwin // +build darwin
// +build 386 amd64
// +build !ios // +build !ios
#include "_cgo_export.h" #include "_cgo_export.h"
@ -34,7 +33,6 @@ enum
void makeCurrentContext(uintptr_t context) { void makeCurrentContext(uintptr_t context) {
NSOpenGLContext* ctx = (NSOpenGLContext*)context; NSOpenGLContext* ctx = (NSOpenGLContext*)context;
[ctx makeCurrentContext]; [ctx makeCurrentContext];
[ctx update];
} }
void flushContext(uintptr_t context) { void flushContext(uintptr_t context) {
@ -57,10 +55,16 @@ uint64 threadID() {
@implementation ScreenGLView @implementation ScreenGLView
- (void)prepareOpenGL { - (void)prepareOpenGL {
[super prepareOpenGL];
[self setWantsBestResolutionOpenGLSurface:YES]; [self setWantsBestResolutionOpenGLSurface:YES];
GLint swapInt = 1; GLint swapInt = 1;
NSOpenGLContext *ctx = [self openGLContext]; NSOpenGLContext *ctx = [self openGLContext];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[ctx setValues:&swapInt forParameter:NSOpenGLCPSwapInterval]; [ctx setValues:&swapInt forParameter:NSOpenGLCPSwapInterval];
#pragma clang diagnostic pop
// Using attribute arrays in OpenGL 3.3 requires the use of a VBA. // Using attribute arrays in OpenGL 3.3 requires the use of a VBA.
// But VBAs don't exist in ES 2. So we bind a default one. // But VBAs don't exist in ES 2. So we bind a default one.
@ -229,7 +233,7 @@ uint64 threadID() {
@implementation AppDelegate @implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
driverStarted(); driverStarted();
[[NSRunningApplication currentApplication] activateWithOptions:(NSApplicationActivateAllWindows | NSApplicationActivateIgnoringOtherApps)]; [[NSRunningApplication currentApplication] activateWithOptions:NSApplicationActivateAllWindows];
} }
- (void)applicationWillTerminate:(NSNotification *)aNotification { - (void)applicationWillTerminate:(NSNotification *)aNotification {

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !android //go:build !android
package gldriver package gldriver

View File

@ -2,10 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !darwin !386,!amd64 ios //go:build (!darwin || ios || !cgo) && (!linux || android || !cgo) && (!openbsd || !cgo) && !windows
// +build !linux android
// +build !windows
// +build !openbsd
package gldriver package gldriver
@ -19,13 +16,14 @@ import (
const useLifecycler = true const useLifecycler = true
const handleSizeEventsAtChannelReceive = true const handleSizeEventsAtChannelReceive = true
func newWindow(opts *screen.NewWindowOptions) (uintptr, error) { return 0, nil } var errUnsupported = fmt.Errorf("gldriver: unsupported GOOS/GOARCH %s/%s or cgo not enabled", runtime.GOOS, runtime.GOARCH)
func newWindow(opts *screen.NewWindowOptions) (uintptr, error) { return 0, errUnsupported }
func initWindow(id *windowImpl) {} func initWindow(id *windowImpl) {}
func showWindow(id *windowImpl) {} func showWindow(id *windowImpl) {}
func closeWindow(id uintptr) {} func closeWindow(id uintptr) {}
func drawLoop(w *windowImpl) {} func drawLoop(w *windowImpl) {}
func main(f func(screen.Screen)) error { func surfaceCreate() error { return errUnsupported }
return fmt.Errorf("gldriver: unsupported GOOS/GOARCH %s/%s", runtime.GOOS, runtime.GOARCH) func main(f func(screen.Screen)) error { return errUnsupported }
}

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build windows //go:build windows
package gldriver package gldriver

View File

@ -6,6 +6,8 @@
#include "_cgo_export.h" #include "_cgo_export.h"
#include <EGL/egl.h> #include <EGL/egl.h>
#include <X11/Xlib.h> // for Atom, Colormap, Display, Window
#include <X11/Xutil.h> // for XVisualInfo
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -151,6 +153,7 @@ startDriver() {
keysyms[(k-key_lo)*keysyms_per_keycode + 0], keysyms[(k-key_lo)*keysyms_per_keycode + 0],
keysyms[(k-key_lo)*keysyms_per_keycode + 1]); keysyms[(k-key_lo)*keysyms_per_keycode + 1]);
} }
//TODO: use GetModifierMapping to figure out which modifier is the numlock modifier.
} }
void void

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build linux,!android openbsd //go:build (linux && !android) || openbsd
package gldriver package gldriver
@ -194,8 +194,8 @@ func onExpose(id uintptr) {
//export onKeysym //export onKeysym
func onKeysym(k, unshifted, shifted uint32) { func onKeysym(k, unshifted, shifted uint32) {
theKeysyms[k][0] = unshifted theKeysyms.Table[k][0] = unshifted
theKeysyms[k][1] = shifted theKeysyms.Table[k][1] = shifted
} }
//export onKey //export onKey

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build windows //go:build windows
package win32 package win32
@ -332,14 +332,14 @@ func sendKeyEvent(hwnd syscall.Handle, uMsg uint32, wParam, lParam uintptr) (lRe
Modifiers: keyModifiers(), Modifiers: keyModifiers(),
} }
switch uMsg { switch uMsg {
case _WM_KEYDOWN: case _WM_KEYDOWN, _WM_SYSKEYDOWN:
const prevMask = 1 << 30 const prevMask = 1 << 30
if repeat := lParam&prevMask == prevMask; repeat { if repeat := lParam&prevMask == prevMask; repeat {
e.Direction = key.DirNone e.Direction = key.DirNone
} else { } else {
e.Direction = key.DirPress e.Direction = key.DirPress
} }
case _WM_KEYUP: case _WM_KEYUP, _WM_SYSKEYUP:
e.Direction = key.DirRelease e.Direction = key.DirRelease
default: default:
panic(fmt.Sprintf("win32: unexpected key message: %d", uMsg)) panic(fmt.Sprintf("win32: unexpected key message: %d", uMsg))

View File

@ -183,3 +183,4 @@ func _HIWORD(l uintptr) uint16 {
//sys _ScreenToClient(hwnd syscall.Handle, lpPoint *_POINT) (ok bool) = user32.ScreenToClient //sys _ScreenToClient(hwnd syscall.Handle, lpPoint *_POINT) (ok bool) = user32.ScreenToClient
//sys _ToUnicodeEx(wVirtKey uint32, wScanCode uint32, lpKeyState *byte, pwszBuff *uint16, cchBuff int32, wFlags uint32, dwhkl syscall.Handle) (ret int32) = user32.ToUnicodeEx //sys _ToUnicodeEx(wVirtKey uint32, wScanCode uint32, lpKeyState *byte, pwszBuff *uint16, cchBuff int32, wFlags uint32, dwhkl syscall.Handle) (ret int32) = user32.ToUnicodeEx
//sys _TranslateMessage(msg *_MSG) (done bool) = user32.TranslateMessage //sys _TranslateMessage(msg *_MSG) (done bool) = user32.TranslateMessage
//sys _UnregisterClass(lpClassName *uint16, hInstance syscall.Handle) (done bool) = user32.UnregisterClassW

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build windows //go:build windows
// Package win32 implements a partial shiny screen driver using the Win32 API. // Package win32 implements a partial shiny screen driver using the Win32 API.
// It provides window, lifecycle, key, and mouse management, but no drawing. // It provides window, lifecycle, key, and mouse management, but no drawing.
@ -331,9 +331,10 @@ var windowMsgs = map[uint32]func(hwnd syscall.Handle, uMsg uint32, wParam, lPara
_WM_MOUSEMOVE: sendMouseEvent, _WM_MOUSEMOVE: sendMouseEvent,
_WM_MOUSEWHEEL: sendMouseEvent, _WM_MOUSEWHEEL: sendMouseEvent,
_WM_KEYDOWN: sendKeyEvent, _WM_KEYDOWN: sendKeyEvent,
_WM_KEYUP: sendKeyEvent, _WM_KEYUP: sendKeyEvent,
// TODO case _WM_SYSKEYDOWN, _WM_SYSKEYUP: _WM_SYSKEYDOWN: sendKeyEvent,
_WM_SYSKEYUP: sendKeyEvent,
} }
func AddWindowMsg(fn func(hwnd syscall.Handle, uMsg uint32, wParam, lParam uintptr)) uint32 { func AddWindowMsg(fn func(hwnd syscall.Handle, uMsg uint32, wParam, lParam uintptr)) uint32 {
@ -367,6 +368,7 @@ func NewWindow(opts *screen.NewWindowOptions) (syscall.Handle, error) {
} }
const windowClass = "shiny_Window" const windowClass = "shiny_Window"
const screenWindowClass = "shiny_ScreenWindow"
func initWindowClass() (err error) { func initWindowClass() (err error) {
wcname, err := syscall.UTF16PtrFromString(windowClass) wcname, err := syscall.UTF16PtrFromString(windowClass)
@ -385,8 +387,17 @@ func initWindowClass() (err error) {
return err return err
} }
func closeWindowClass() (err error) {
wcname, err := syscall.UTF16PtrFromString(windowClass)
if err != nil {
return err
}
_UnregisterClass(wcname, hThisInstance)
return nil
}
func initScreenWindow() (err error) { func initScreenWindow() (err error) {
const screenWindowClass = "shiny_ScreenWindow"
swc, err := syscall.UTF16PtrFromString(screenWindowClass) swc, err := syscall.UTF16PtrFromString(screenWindowClass)
if err != nil { if err != nil {
return err return err
@ -419,6 +430,20 @@ func initScreenWindow() (err error) {
return nil return nil
} }
func closeScreenWindow() (err error) {
// first destroy window
_DestroyWindow(screenHWND)
// then unregister class
swc, err := syscall.UTF16PtrFromString(screenWindowClass)
if err != nil {
return err
}
_UnregisterClass(swc, hThisInstance)
return nil
}
var ( var (
hDefaultIcon syscall.Handle hDefaultIcon syscall.Handle
hDefaultCursor syscall.Handle hDefaultCursor syscall.Handle
@ -461,13 +486,16 @@ func Main(f func()) (retErr error) {
} }
defer func() { defer func() {
// TODO(andlabs): log an error if this fails? // TODO(andlabs): log an error if this fails?
_DestroyWindow(screenHWND) closeScreenWindow()
// TODO(andlabs): unregister window class
}() }()
if err := initWindowClass(); err != nil { if err := initWindowClass(); err != nil {
return err return err
} }
defer func() {
// TODO(andlabs): log an error if this fails?
closeWindowClass()
}()
// Prime the pump. // Prime the pump.
mainCallback = f mainCallback = f

View File

@ -62,6 +62,7 @@ var (
procScreenToClient = moduser32.NewProc("ScreenToClient") procScreenToClient = moduser32.NewProc("ScreenToClient")
procToUnicodeEx = moduser32.NewProc("ToUnicodeEx") procToUnicodeEx = moduser32.NewProc("ToUnicodeEx")
procTranslateMessage = moduser32.NewProc("TranslateMessage") procTranslateMessage = moduser32.NewProc("TranslateMessage")
procUnregisterClassW = moduser32.NewProc("UnregisterClassW")
) )
func GetDC(hwnd syscall.Handle) (dc syscall.Handle, err error) { func GetDC(hwnd syscall.Handle) (dc syscall.Handle, err error) {
@ -284,3 +285,9 @@ func _TranslateMessage(msg *_MSG) (done bool) {
done = r0 != 0 done = r0 != 0
return return
} }
func _UnregisterClass(lpClassName *uint16, hInstance syscall.Handle) (done bool) {
r0, _, _ := syscall.Syscall(procUnregisterClassW.Addr(), 2, uintptr(unsafe.Pointer(lpClassName)), uintptr(hInstance), 0)
done = r0 != 0
return
}

View File

@ -2,10 +2,14 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:generate go run gen.go
// x11key contains X11 numeric codes for the keyboard and mouse. // x11key contains X11 numeric codes for the keyboard and mouse.
package x11key // import "golang.org/x/exp/shiny/driver/internal/x11key" package x11key // import "golang.org/x/exp/shiny/driver/internal/x11key"
import ( import (
"unicode"
"golang.org/x/mobile/event/key" "golang.org/x/mobile/event/key"
) )
@ -26,14 +30,30 @@ const (
Button5Mask = 1 << 12 Button5Mask = 1 << 12
) )
type KeysymTable [256][2]uint32 type KeysymTable struct {
Table [256][6]uint32
NumLockMod, ModeSwitchMod, ISOLevel3ShiftMod uint16
}
func (t *KeysymTable) Lookup(detail uint8, state uint16) (rune, key.Code) { func (t *KeysymTable) Lookup(detail uint8, state uint16) (rune, key.Code) {
te := t.Table[detail][0:2]
if state&t.ModeSwitchMod != 0 {
te = t.Table[detail][2:4]
}
if state&t.ISOLevel3ShiftMod != 0 {
te = t.Table[detail][4:6]
}
// The key event's rune depends on whether the shift key is down. // The key event's rune depends on whether the shift key is down.
unshifted := rune(t[detail][0]) unshifted := rune(te[0])
r := unshifted r := unshifted
if state&ShiftMask != 0 { if state&t.NumLockMod != 0 && isKeypad(te[1]) {
r = rune(t[detail][1]) if state&ShiftMask == 0 {
r = rune(te[1])
}
} else if state&ShiftMask != 0 {
r = rune(te[1])
// In X11, a zero keysym when shift is down means to use what the // In X11, a zero keysym when shift is down means to use what the
// keysym is when shift is up. // keysym is when shift is up.
if r == 0 { if r == 0 {
@ -44,17 +64,28 @@ func (t *KeysymTable) Lookup(detail uint8, state uint16) (rune, key.Code) {
// The key event's code is independent of whether the shift key is down. // The key event's code is independent of whether the shift key is down.
var c key.Code var c key.Code
if 0 <= unshifted && unshifted < 0x80 { if 0 <= unshifted && unshifted < 0x80 {
// TODO: distinguish the regular '2' key and number-pad '2' key (with
// Num-Lock).
c = asciiKeycodes[unshifted] c = asciiKeycodes[unshifted]
if state&LockMask != 0 {
r = unicode.ToUpper(r)
}
} else if kk, isKeypad := keypadKeysyms[r]; isKeypad {
r, c = kk.rune, kk.code
} else if nuk := nonUnicodeKeycodes[unshifted]; nuk != key.CodeUnknown {
r, c = -1, nuk
} else { } else {
r, c = -1, nonUnicodeKeycodes[unshifted] r = keysymCodePoints[r]
if state&LockMask != 0 {
r = unicode.ToUpper(r)
}
} }
// TODO: Unicode-but-not-ASCII keysyms like the Swiss keyboard's 'ö'.
return r, c return r, c
} }
func isKeypad(keysym uint32) bool {
return keysym >= 0xff80 && keysym <= 0xffbd
}
func KeyModifiers(state uint16) (m key.Modifiers) { func KeyModifiers(state uint16) (m key.Modifiers) {
if state&ShiftMask != 0 { if state&ShiftMask != 0 {
m |= key.ModShift m |= key.ModShift
@ -89,27 +120,59 @@ const (
xkEnd = 0xff57 xkEnd = 0xff57
xkInsert = 0xff63 xkInsert = 0xff63
xkMenu = 0xff67 xkMenu = 0xff67
xkF1 = 0xffbe xkHelp = 0xff6a
xkF2 = 0xffbf
xkF3 = 0xffc0 xkNumLock = 0xff7f
xkF4 = 0xffc1 xkKeypadEnter = 0xff8d
xkF5 = 0xffc2 xkKeypadHome = 0xff95
xkF6 = 0xffc3 xkKeypadLeft = 0xff96
xkF7 = 0xffc4 xkKeypadUp = 0xff97
xkF8 = 0xffc5 xkKeypadRight = 0xff98
xkF9 = 0xffc6 xkKeypadDown = 0xff99
xkF10 = 0xffc7 xkKeypadPageUp = 0xff9a
xkF11 = 0xffc8 xkKeypadPageDown = 0xff9b
xkF12 = 0xffc9 xkKeypadEnd = 0xff9c
xkShiftL = 0xffe1 xkKeypadInsert = 0xff9e
xkShiftR = 0xffe2 xkKeypadDelete = 0xff9f
xkControlL = 0xffe3 xkKeypadEqual = 0xffbd
xkControlR = 0xffe4 xkKeypadMultiply = 0xffaa
xkAltL = 0xffe9 xkKeypadAdd = 0xffab
xkAltR = 0xffea xkKeypadSubtract = 0xffad
xkSuperL = 0xffeb xkKeypadDecimal = 0xffae
xkSuperR = 0xffec xkKeypadDivide = 0xffaf
xkDelete = 0xffff xkKeypad0 = 0xffb0
xkKeypad1 = 0xffb1
xkKeypad2 = 0xffb2
xkKeypad3 = 0xffb3
xkKeypad4 = 0xffb4
xkKeypad5 = 0xffb5
xkKeypad6 = 0xffb6
xkKeypad7 = 0xffb7
xkKeypad8 = 0xffb8
xkKeypad9 = 0xffb9
xkF1 = 0xffbe
xkF2 = 0xffbf
xkF3 = 0xffc0
xkF4 = 0xffc1
xkF5 = 0xffc2
xkF6 = 0xffc3
xkF7 = 0xffc4
xkF8 = 0xffc5
xkF9 = 0xffc6
xkF10 = 0xffc7
xkF11 = 0xffc8
xkF12 = 0xffc9
xkShiftL = 0xffe1
xkShiftR = 0xffe2
xkControlL = 0xffe3
xkControlR = 0xffe4
xkCapsLock = 0xffe5
xkAltL = 0xffe9
xkAltR = 0xffea
xkSuperL = 0xffeb
xkSuperR = 0xffec
xkDelete = 0xffff
xf86xkAudioLowerVolume = 0x1008ff11 xf86xkAudioLowerVolume = 0x1008ff11
xf86xkAudioMute = 0x1008ff12 xf86xkAudioMute = 0x1008ff12
@ -135,8 +198,22 @@ var nonUnicodeKeycodes = map[rune]key.Code{
xkEnd: key.CodeEnd, xkEnd: key.CodeEnd,
xkInsert: key.CodeInsert, xkInsert: key.CodeInsert,
xkMenu: key.CodeRightGUI, // TODO: CodeRightGUI or CodeMenu?? xkMenu: key.CodeRightGUI, // TODO: CodeRightGUI or CodeMenu??
xkHelp: key.CodeHelp,
xkNumLock: key.CodeKeypadNumLock,
xkMultiKey: key.CodeCompose, xkMultiKey: key.CodeCompose,
xkKeypadEnter: key.CodeKeypadEnter,
xkKeypadHome: key.CodeHome,
xkKeypadLeft: key.CodeLeftArrow,
xkKeypadUp: key.CodeUpArrow,
xkKeypadRight: key.CodeRightArrow,
xkKeypadDown: key.CodeDownArrow,
xkKeypadPageUp: key.CodePageUp,
xkKeypadPageDown: key.CodePageDown,
xkKeypadEnd: key.CodeEnd,
xkKeypadInsert: key.CodeInsert,
xkKeypadDelete: key.CodeDeleteForward,
xkF1: key.CodeF1, xkF1: key.CodeF1,
xkF2: key.CodeF2, xkF2: key.CodeF2,
xkF3: key.CodeF3, xkF3: key.CodeF3,
@ -154,6 +231,7 @@ var nonUnicodeKeycodes = map[rune]key.Code{
xkShiftR: key.CodeRightShift, xkShiftR: key.CodeRightShift,
xkControlL: key.CodeLeftControl, xkControlL: key.CodeLeftControl,
xkControlR: key.CodeRightControl, xkControlR: key.CodeRightControl,
xkCapsLock: key.CodeCapsLock,
xkAltL: key.CodeLeftAlt, xkAltL: key.CodeLeftAlt,
xkAltR: key.CodeRightAlt, xkAltR: key.CodeRightAlt,
xkSuperL: key.CodeLeftGUI, xkSuperL: key.CodeLeftGUI,
@ -218,7 +296,28 @@ var asciiKeycodes = [0x80]key.Code{
',': key.CodeComma, ',': key.CodeComma,
'.': key.CodeFullStop, '.': key.CodeFullStop,
'/': key.CodeSlash, '/': key.CodeSlash,
}
// TODO: distinguish CodeKeypadSlash vs CodeSlash, and similarly for other
// keypad codes. type keypadKeysym struct {
rune rune
code key.Code
}
var keypadKeysyms = map[rune]keypadKeysym{
xkKeypadEqual: {'=', key.CodeKeypadEqualSign},
xkKeypadMultiply: {'*', key.CodeKeypadAsterisk},
xkKeypadAdd: {'+', key.CodeKeypadPlusSign},
xkKeypadSubtract: {'-', key.CodeKeypadHyphenMinus},
xkKeypadDecimal: {'.', key.CodeKeypadFullStop},
xkKeypadDivide: {'/', key.CodeKeypadSlash},
xkKeypad0: {'0', key.CodeKeypad0},
xkKeypad1: {'1', key.CodeKeypad1},
xkKeypad2: {'2', key.CodeKeypad2},
xkKeypad3: {'3', key.CodeKeypad3},
xkKeypad4: {'4', key.CodeKeypad4},
xkKeypad5: {'5', key.CodeKeypad5},
xkKeypad6: {'6', key.CodeKeypad6},
xkKeypad7: {'7', key.CodeKeypad7},
xkKeypad8: {'8', key.CodeKeypad8},
xkKeypad9: {'9', key.CodeKeypad9},
} }

3
vendor/golang.org/x/image/AUTHORS generated vendored
View File

@ -1,3 +0,0 @@
# This source code refers to The Go Authors for copyright purposes.
# The master list of authors is in the main Go distribution,
# visible at http://tip.golang.org/AUTHORS.

View File

@ -1,3 +0,0 @@
# This source code was written by the Go contributors.
# The master list of contributors is in the main Go distribution,
# visible at http://tip.golang.org/CONTRIBUTORS.

4
vendor/golang.org/x/image/LICENSE generated vendored
View File

@ -1,4 +1,4 @@
Copyright (c) 2009 The Go Authors. All rights reserved. Copyright 2009 The Go Authors.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are modification, are permitted provided that the following conditions are
@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer.
copyright notice, this list of conditions and the following disclaimer copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the in the documentation and/or other materials provided with the
distribution. distribution.
* Neither the name of Google Inc. nor the names of its * Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived from contributors may be used to endorse or promote products derived from
this software without specific prior written permission. this software without specific prior written permission.

3
vendor/golang.org/x/mobile/AUTHORS generated vendored
View File

@ -1,3 +0,0 @@
# This source code refers to The Go Authors for copyright purposes.
# The master list of authors is in the main Go distribution,
# visible at http://tip.golang.org/AUTHORS.

View File

@ -1,3 +0,0 @@
# This source code was written by the Go contributors.
# The master list of contributors is in the main Go distribution,
# visible at http://tip.golang.org/CONTRIBUTORS.

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build android
// +build android // +build android
#include <android/log.h> #include <android/log.h>

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build android //go:build android
/* /*
Android Apps are built with -buildmode=c-shared. They are loaded by a Android Apps are built with -buildmode=c-shared. They are loaded by a
@ -35,8 +35,9 @@ package app
#include <pthread.h> #include <pthread.h>
#include <stdlib.h> #include <stdlib.h>
EGLDisplay display; extern EGLDisplay display;
EGLSurface surface; extern EGLSurface surface;
char* createEGLSurface(ANativeWindow* window); char* createEGLSurface(ANativeWindow* window);
char* destroyEGLSurface(); char* destroyEGLSurface();
@ -285,8 +286,12 @@ func mainUI(vm, jniEnv, ctx uintptr) error {
donec := make(chan struct{}) donec := make(chan struct{})
go func() { go func() {
// close the donec channel in a defer statement
// so that we could still be able to return even
// if mainUserFn panics.
defer close(donec)
mainUserFn(theApp) mainUserFn(theApp)
close(donec)
}() }()
var pixelsPerPt float32 var pixelsPerPt float32
@ -436,9 +441,9 @@ func processKey(env *C.JNIEnv, e *C.AInputEvent) {
Code: convAndroidKeyCode(int32(C.AKeyEvent_getKeyCode(e))), Code: convAndroidKeyCode(int32(C.AKeyEvent_getKeyCode(e))),
} }
switch C.AKeyEvent_getAction(e) { switch C.AKeyEvent_getAction(e) {
case C.AKEY_STATE_DOWN: case C.AKEY_EVENT_ACTION_DOWN:
k.Direction = key.DirPress k.Direction = key.DirPress
case C.AKEY_STATE_UP: case C.AKEY_EVENT_ACTION_UP:
k.Direction = key.DirRelease k.Direction = key.DirRelease
default: default:
k.Direction = key.DirNone k.Direction = key.DirNone

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build linux darwin windows //go:build linux || darwin || windows
package app package app

View File

@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build darwin //go:build darwin && !ios
// +build !ios
package app package app
@ -59,7 +58,6 @@ func main(f func(App)) {
go func() { go func() {
f(theApp) f(theApp)
C.stopApp() C.stopApp()
// TODO(crawshaw): trigger runApp to return
}() }()
C.runApp() C.runApp()
@ -241,6 +239,7 @@ func convRune(r rune) rune {
// into the standard keycodes used by the key package. // into the standard keycodes used by the key package.
// //
// To get a sense of the key map, see the diagram on // To get a sense of the key map, see the diagram on
//
// http://boredzo.org/blog/archives/2007-05-22/virtual-key-codes // http://boredzo.org/blog/archives/2007-05-22/virtual-key-codes
func convVirtualKeyCode(vkcode uint16) key.Code { func convVirtualKeyCode(vkcode uint16) key.Code {
switch vkcode { switch vkcode {

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build darwin && !ios
// +build darwin // +build darwin
// +build !ios // +build !ios
@ -33,6 +34,7 @@ uint64 threadID() {
@implementation MobileGLView @implementation MobileGLView
- (void)prepareOpenGL { - (void)prepareOpenGL {
[super prepareOpenGL];
[self setWantsBestResolutionOpenGLSurface:YES]; [self setWantsBestResolutionOpenGLSurface:YES];
GLint swapInt = 1; GLint swapInt = 1;

View File

@ -2,13 +2,12 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build darwin //go:build darwin && ios
// +build ios
package app package app
/* /*
#cgo CFLAGS: -x objective-c -DGL_SILENCE_DEPRECATION #cgo CFLAGS: -x objective-c -DGL_SILENCE_DEPRECATION -DGLES_SILENCE_DEPRECATION
#cgo LDFLAGS: -framework Foundation -framework UIKit -framework GLKit -framework OpenGLES -framework QuartzCore #cgo LDFLAGS: -framework Foundation -framework UIKit -framework GLKit -framework OpenGLES -framework QuartzCore
#include <sys/utsname.h> #include <sys/utsname.h>
#include <stdint.h> #include <stdint.h>

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build darwin && ios
// +build darwin // +build darwin
// +build ios // +build ios
@ -135,8 +136,9 @@ static void sendTouches(int change, NSSet* touches) {
@end @end
void runApp(void) { void runApp(void) {
char* argv[] = {};
@autoreleasepool { @autoreleasepool {
UIApplicationMain(0, nil, nil, NSStringFromClass([GoAppAppDelegate class])); UIApplicationMain(0, argv, nil, NSStringFromClass([GoAppAppDelegate class]));
} }
} }

View File

@ -18,7 +18,7 @@ OpenGL, audio, and other Android NDK-like APIs. An all-Go app should
use this app package to initialize the app, manage its lifecycle, and use this app package to initialize the app, manage its lifecycle, and
receive events. receive events.
Building apps # Building apps
Apps written entirely in Go have a main function, and can be built Apps written entirely in Go have a main function, and can be built
with `gomobile build`, which directly produces runnable output for with `gomobile build`, which directly produces runnable output for
@ -30,7 +30,7 @@ https://golang.org/x/mobile/cmd/gomobile.
For detailed instructions and documentation, see For detailed instructions and documentation, see
https://golang.org/wiki/Mobile. https://golang.org/wiki/Mobile.
Event processing in Native Apps # Event processing in Native Apps
The Go runtime is initialized on Android when NativeActivity onCreate is The Go runtime is initialized on Android when NativeActivity onCreate is
called, and on iOS when the process starts. In both cases, Go init functions called, and on iOS when the process starts. In both cases, Go init functions
@ -69,17 +69,20 @@ goroutine as other code that calls OpenGL.
An event is represented by the empty interface type interface{}. Any value can An event is represented by the empty interface type interface{}. Any value can
be an event. Commonly used types include Event types defined by the following be an event. Commonly used types include Event types defined by the following
packages: packages:
- golang.org/x/mobile/event/lifecycle - golang.org/x/mobile/event/lifecycle
- golang.org/x/mobile/event/mouse - golang.org/x/mobile/event/mouse
- golang.org/x/mobile/event/paint - golang.org/x/mobile/event/paint
- golang.org/x/mobile/event/size - golang.org/x/mobile/event/size
- golang.org/x/mobile/event/touch - golang.org/x/mobile/event/touch
For example, touch.Event is the type that represents touch events. Other For example, touch.Event is the type that represents touch events. Other
packages may define their own events, and send them on an app's event channel. packages may define their own events, and send them on an app's event channel.
Other packages can also register event filters, e.g. to manage resources in Other packages can also register event filters, e.g. to manage resources in
response to lifecycle events. Such packages should call: response to lifecycle events. Such packages should call:
app.RegisterFilter(etc) app.RegisterFilter(etc)
in an init function inside that package. in an init function inside that package.
*/ */
package app // import "golang.org/x/mobile/app" package app // import "golang.org/x/mobile/app"

View File

@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build android //go:build android && (arm || 386 || amd64 || arm64)
// +build arm 386 amd64 arm64
// Package callfn provides an android entry point. // Package callfn provides an android entry point.
// //

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build windows //go:build windows
package app package app
@ -37,10 +37,23 @@ func main(f func(a App)) {
} }
}() }()
go f(theApp) donec := make(chan struct{})
go func() {
// close the donec channel in a defer statement
// so that we could still be able to return even
// if f panics.
defer close(donec)
f(theApp)
}()
for { for {
theApp.Send(convertEvent(w.NextEvent())) select {
case <-donec:
return
default:
theApp.Send(convertEvent(w.NextEvent()))
}
} }
}) })
} }

View File

@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build linux && !android
// +build linux,!android // +build linux,!android
#include "_cgo_export.h" #include "_cgo_export.h"
#include <EGL/egl.h> #include <EGL/egl.h>
#include <GLES2/gl2.h> #include <GLES2/gl2.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build linux,!android //go:build linux && !android
package app package app
@ -51,8 +51,12 @@ func main(f func(App)) {
donec := make(chan struct{}) donec := make(chan struct{})
go func() { go func() {
// close the donec channel in a defer statement
// so that we could still be able to return even
// if f panics.
defer close(donec)
f(theApp) f(theApp)
close(donec)
}() }()
// TODO: can we get the actual vsync signal? // TODO: can we get the actual vsync signal?

View File

@ -59,9 +59,10 @@ func (e Event) String() string {
} }
// Crosses reports whether the transition from From to To crosses the stage s: // Crosses reports whether the transition from From to To crosses the stage s:
// - It returns CrossOn if it does, and the lifecycle change is positive. // - It returns CrossOn if it does, and the lifecycle change is positive.
// - It returns CrossOff if it does, and the lifecycle change is negative. // - It returns CrossOff if it does, and the lifecycle change is negative.
// - Otherwise, it returns CrossNone. // - Otherwise, it returns CrossNone.
//
// See the documentation for Stage for more discussion of positive and negative // See the documentation for Stage for more discussion of positive and negative
// crosses. // crosses.
func (e Event) Crosses(s Stage) Cross { func (e Event) Crosses(s Stage) Cross {

View File

@ -9,7 +9,7 @@ package paint // import "golang.org/x/mobile/event/paint"
// Event indicates that the app is ready to paint the next frame of the GUI. // Event indicates that the app is ready to paint the next frame of the GUI.
// //
//A frame is completed by calling the App's Publish method. // A frame is completed by calling the App's Publish method.
type Event struct { type Event struct {
// External is true for paint events sent by the screen driver. // External is true for paint events sent by the screen driver.
// //

View File

@ -22,7 +22,7 @@ https://www.khronos.org/opengles/sdk/docs/man/
One notable departure from the C API is the introduction of types One notable departure from the C API is the introduction of types
to represent common uses of GLint: Texture, Surface, Buffer, etc. to represent common uses of GLint: Texture, Surface, Buffer, etc.
Debug Logging # Debug Logging
A tracing version of the OpenGL bindings is behind the `gldebug` build A tracing version of the OpenGL bindings is behind the `gldebug` build
tag. It acts as a simplified version of apitrace. Build your Go binary tag. It acts as a simplified version of apitrace. Build your Go binary

15
vendor/golang.org/x/mobile/gl/gl.go generated vendored
View File

@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build linux darwin windows openbsd //go:build (darwin || linux || openbsd || windows) && !gldebug
// +build !gldebug
package gl package gl
@ -1284,6 +1283,14 @@ func (ctx *context) TexImage2D(target Enum, level int, internalFormat int, width
} }
func (ctx *context) TexSubImage2D(target Enum, level int, x, y, width, height int, format, ty Enum, data []byte) { func (ctx *context) TexSubImage2D(target Enum, level int, x, y, width, height int, format, ty Enum, data []byte) {
// It is common to pass TexSubImage2D a nil data, indicating that a
// bound GL buffer is being used as the source. In that case, it
// is not necessary to block.
parg := unsafe.Pointer(nil)
if len(data) > 0 {
parg = unsafe.Pointer(&data[0])
}
ctx.enqueue(call{ ctx.enqueue(call{
args: fnargs{ args: fnargs{
fn: glfnTexSubImage2D, fn: glfnTexSubImage2D,
@ -1297,8 +1304,8 @@ func (ctx *context) TexSubImage2D(target Enum, level int, x, y, width, height in
a6: format.c(), a6: format.c(),
a7: ty.c(), a7: ty.c(),
}, },
parg: unsafe.Pointer(&data[0]), parg: parg,
blocking: true, blocking: parg != nil,
}) })
} }

View File

@ -5,8 +5,7 @@
// Code generated from gl.go using go generate. DO NOT EDIT. // Code generated from gl.go using go generate. DO NOT EDIT.
// See doc.go for details. // See doc.go for details.
// +build linux darwin windows openbsd //go:build (darwin || linux || openbsd || windows) && gldebug
// +build gldebug
package gl package gl

View File

@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build linux darwin windows openbsd //go:build (darwin || linux || openbsd || windows) && gldebug
// +build gldebug
package gl package gl

View File

@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build linux darwin windows openbsd //go:build (darwin || linux || openbsd || windows) && !gldebug
// +build !gldebug
package gl package gl

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build darwin || linux || openbsd
// +build darwin linux openbsd // +build darwin linux openbsd
#include <stdlib.h> #include <stdlib.h>
@ -356,7 +357,7 @@ uintptr_t processFn(struct fnargs* args, char* parg) {
glScissor((GLint)args->a0, (GLint)args->a1, (GLint)args->a2, (GLint)args->a3); glScissor((GLint)args->a0, (GLint)args->a1, (GLint)args->a2, (GLint)args->a3);
break; break;
case glfnShaderSource: case glfnShaderSource:
#if defined(os_ios) || defined(os_osx) #if defined(os_ios) || defined(os_macos)
glShaderSource((GLuint)args->a0, (GLsizei)args->a1, (const GLchar *const *)args->a2, NULL); glShaderSource((GLuint)args->a0, (GLsizei)args->a1, (const GLchar *const *)args->a2, NULL);
#else #else
glShaderSource((GLuint)args->a0, (GLsizei)args->a1, (const GLchar **)args->a2, NULL); glShaderSource((GLuint)args->a0, (GLsizei)args->a1, (const GLchar **)args->a2, NULL);

View File

@ -2,28 +2,24 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build darwin linux openbsd //go:build darwin || linux || openbsd
package gl package gl
/* /*
#cgo ios LDFLAGS: -framework OpenGLES #cgo ios LDFLAGS: -framework OpenGLES
#cgo darwin,amd64,!ios LDFLAGS: -framework OpenGL #cgo darwin,!ios LDFLAGS: -framework OpenGL
#cgo darwin,arm LDFLAGS: -framework OpenGLES #cgo linux LDFLAGS: -lGLESv2
#cgo darwin,arm64 LDFLAGS: -framework OpenGLES #cgo openbsd LDFLAGS: -L/usr/X11R6/lib/ -lGLESv2
#cgo linux LDFLAGS: -lGLESv2
#cgo openbsd LDFLAGS: -L/usr/X11R6/lib/ -lGLESv2
#cgo android CFLAGS: -Dos_android #cgo android CFLAGS: -Dos_android
#cgo ios CFLAGS: -Dos_ios #cgo ios CFLAGS: -Dos_ios
#cgo darwin,amd64,!ios CFLAGS: -Dos_osx #cgo darwin,!ios CFLAGS: -Dos_macos
#cgo darwin,arm CFLAGS: -Dos_ios #cgo darwin CFLAGS: -DGL_SILENCE_DEPRECATION -DGLES_SILENCE_DEPRECATION
#cgo darwin,arm64 CFLAGS: -Dos_ios #cgo linux CFLAGS: -Dos_linux
#cgo darwin CFLAGS: -DGL_SILENCE_DEPRECATION #cgo openbsd CFLAGS: -Dos_openbsd
#cgo linux CFLAGS: -Dos_linux
#cgo openbsd CFLAGS: -Dos_openbsd
#cgo openbsd CFLAGS: -I/usr/X11R6/include/ #cgo openbsd CFLAGS: -I/usr/X11R6/include/
#include <stdint.h> #include <stdint.h>
#include "work.h" #include "work.h"

View File

@ -18,7 +18,7 @@
#include <OpenGLES/ES2/glext.h> #include <OpenGLES/ES2/glext.h>
#endif #endif
#ifdef os_osx #ifdef os_macos
#include <OpenGL/gl3.h> #include <OpenGL/gl3.h>
#define GL_ES_VERSION_3_0 1 #define GL_ES_VERSION_3_0 1
#endif #endif

View File

@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build darwin
// +build arm arm64
package mobileinit package mobileinit
import ( import (
@ -15,24 +12,30 @@ import (
) )
/* /*
#include <asl.h>
#include <stdlib.h> #include <stdlib.h>
#include <os/log.h>
void asl_log_wrap(const char *str) { os_log_t create_os_log() {
asl_log(NULL, NULL, ASL_LEVEL_NOTICE, "%s", str); return os_log_create("org.golang.mobile", "os_log");
}
void os_log_wrap(os_log_t log, const char *str) {
os_log(log, "%s", str);
} }
*/ */
import "C" import "C"
type aslWriter struct{} type osWriter struct {
w C.os_log_t
}
func (aslWriter) Write(p []byte) (n int, err error) { func (o osWriter) Write(p []byte) (n int, err error) {
cstr := C.CString(string(p)) cstr := C.CString(string(p))
C.asl_log_wrap(cstr) C.os_log_wrap(o.w, cstr)
C.free(unsafe.Pointer(cstr)) C.free(unsafe.Pointer(cstr))
return len(p), nil return len(p), nil
} }
func init() { func init() {
log.SetOutput(io.MultiWriter(os.Stderr, aslWriter{})) log.SetOutput(io.MultiWriter(os.Stderr, osWriter{C.create_os_log()}))
} }

4
vendor/golang.org/x/sys/LICENSE generated vendored
View File

@ -1,4 +1,4 @@
Copyright (c) 2009 The Go Authors. All rights reserved. Copyright 2009 The Go Authors.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are modification, are permitted provided that the following conditions are
@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer.
copyright notice, this list of conditions and the following disclaimer copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the in the documentation and/or other materials provided with the
distribution. distribution.
* Neither the name of Google Inc. nor the names of its * Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived from contributors may be used to endorse or promote products derived from
this software without specific prior written permission. this software without specific prior written permission.

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build windows && go1.9 //go:build windows
package windows package windows

View File

@ -1,8 +0,0 @@
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !go1.12
// This file is here to allow bodyless functions with go:linkname for Go 1.11
// and earlier (see https://golang.org/issue/23311).

View File

@ -68,6 +68,7 @@ type UserInfo10 struct {
//sys NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) = netapi32.NetUserGetInfo //sys NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) = netapi32.NetUserGetInfo
//sys NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (neterr error) = netapi32.NetGetJoinInformation //sys NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (neterr error) = netapi32.NetGetJoinInformation
//sys NetApiBufferFree(buf *byte) (neterr error) = netapi32.NetApiBufferFree //sys NetApiBufferFree(buf *byte) (neterr error) = netapi32.NetApiBufferFree
//sys NetUserEnum(serverName *uint16, level uint32, filter uint32, buf **byte, prefMaxLen uint32, entriesRead *uint32, totalEntries *uint32, resumeHandle *uint32) (neterr error) = netapi32.NetUserEnum
const ( const (
// do not reorder // do not reorder
@ -893,7 +894,7 @@ type ACL struct {
aclRevision byte aclRevision byte
sbz1 byte sbz1 byte
aclSize uint16 aclSize uint16
aceCount uint16 AceCount uint16
sbz2 uint16 sbz2 uint16
} }
@ -1086,6 +1087,27 @@ type EXPLICIT_ACCESS struct {
Trustee TRUSTEE Trustee TRUSTEE
} }
// https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-ace_header
type ACE_HEADER struct {
AceType uint8
AceFlags uint8
AceSize uint16
}
// https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-access_allowed_ace
type ACCESS_ALLOWED_ACE struct {
Header ACE_HEADER
Mask ACCESS_MASK
SidStart uint32
}
const (
// Constants for AceType
// https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-ace_header
ACCESS_ALLOWED_ACE_TYPE = 0
ACCESS_DENIED_ACE_TYPE = 1
)
// This type is the union inside of TRUSTEE and must be created using one of the TrusteeValueFrom* functions. // This type is the union inside of TRUSTEE and must be created using one of the TrusteeValueFrom* functions.
type TrusteeValue uintptr type TrusteeValue uintptr
@ -1157,6 +1179,7 @@ type OBJECTS_AND_NAME struct {
//sys makeSelfRelativeSD(absoluteSD *SECURITY_DESCRIPTOR, selfRelativeSD *SECURITY_DESCRIPTOR, selfRelativeSDSize *uint32) (err error) = advapi32.MakeSelfRelativeSD //sys makeSelfRelativeSD(absoluteSD *SECURITY_DESCRIPTOR, selfRelativeSD *SECURITY_DESCRIPTOR, selfRelativeSDSize *uint32) (err error) = advapi32.MakeSelfRelativeSD
//sys setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCESS, oldACL *ACL, newACL **ACL) (ret error) = advapi32.SetEntriesInAclW //sys setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCESS, oldACL *ACL, newACL **ACL) (ret error) = advapi32.SetEntriesInAclW
//sys GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (err error) = advapi32.GetAce
// Control returns the security descriptor control bits. // Control returns the security descriptor control bits.
func (sd *SECURITY_DESCRIPTOR) Control() (control SECURITY_DESCRIPTOR_CONTROL, revision uint32, err error) { func (sd *SECURITY_DESCRIPTOR) Control() (control SECURITY_DESCRIPTOR_CONTROL, revision uint32, err error) {

View File

@ -17,8 +17,10 @@ import (
"unsafe" "unsafe"
) )
type Handle uintptr type (
type HWND uintptr Handle uintptr
HWND uintptr
)
const ( const (
InvalidHandle = ^Handle(0) InvalidHandle = ^Handle(0)
@ -165,6 +167,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) [failretval==InvalidHandle] = CreateFileW //sys CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) [failretval==InvalidHandle] = CreateFileW
//sys CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *SecurityAttributes) (handle Handle, err error) [failretval==InvalidHandle] = CreateNamedPipeW //sys CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *SecurityAttributes) (handle Handle, err error) [failretval==InvalidHandle] = CreateNamedPipeW
//sys ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error) //sys ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error)
//sys DisconnectNamedPipe(pipe Handle) (err error)
//sys GetNamedPipeInfo(pipe Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error) //sys GetNamedPipeInfo(pipe Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error)
//sys GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) = GetNamedPipeHandleStateW //sys GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) = GetNamedPipeHandleStateW
//sys SetNamedPipeHandleState(pipe Handle, state *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32) (err error) = SetNamedPipeHandleState //sys SetNamedPipeHandleState(pipe Handle, state *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32) (err error) = SetNamedPipeHandleState
@ -210,6 +213,10 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error) //sys OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error)
//sys ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) [failretval<=32] = shell32.ShellExecuteW //sys ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) [failretval<=32] = shell32.ShellExecuteW
//sys GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) = user32.GetWindowThreadProcessId //sys GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) = user32.GetWindowThreadProcessId
//sys LoadKeyboardLayout(name *uint16, flags uint32) (hkl Handle, err error) [failretval==0] = user32.LoadKeyboardLayoutW
//sys UnloadKeyboardLayout(hkl Handle) (err error) = user32.UnloadKeyboardLayout
//sys GetKeyboardLayout(tid uint32) (hkl Handle) = user32.GetKeyboardLayout
//sys ToUnicodeEx(vkey uint32, scancode uint32, keystate *byte, pwszBuff *uint16, cchBuff int32, flags uint32, hkl Handle) (ret int32) = user32.ToUnicodeEx
//sys GetShellWindow() (shellWindow HWND) = user32.GetShellWindow //sys GetShellWindow() (shellWindow HWND) = user32.GetShellWindow
//sys MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) [failretval==0] = user32.MessageBoxW //sys MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) [failretval==0] = user32.MessageBoxW
//sys ExitWindowsEx(flags uint32, reason uint32) (err error) = user32.ExitWindowsEx //sys ExitWindowsEx(flags uint32, reason uint32) (err error) = user32.ExitWindowsEx
@ -306,6 +313,10 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys SetConsoleMode(console Handle, mode uint32) (err error) = kernel32.SetConsoleMode //sys SetConsoleMode(console Handle, mode uint32) (err error) = kernel32.SetConsoleMode
//sys GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) = kernel32.GetConsoleScreenBufferInfo //sys GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) = kernel32.GetConsoleScreenBufferInfo
//sys setConsoleCursorPosition(console Handle, position uint32) (err error) = kernel32.SetConsoleCursorPosition //sys setConsoleCursorPosition(console Handle, position uint32) (err error) = kernel32.SetConsoleCursorPosition
//sys GetConsoleCP() (cp uint32, err error) = kernel32.GetConsoleCP
//sys GetConsoleOutputCP() (cp uint32, err error) = kernel32.GetConsoleOutputCP
//sys SetConsoleCP(cp uint32) (err error) = kernel32.SetConsoleCP
//sys SetConsoleOutputCP(cp uint32) (err error) = kernel32.SetConsoleOutputCP
//sys WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) = kernel32.WriteConsoleW //sys WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) = kernel32.WriteConsoleW
//sys ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) = kernel32.ReadConsoleW //sys ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) = kernel32.ReadConsoleW
//sys resizePseudoConsole(pconsole Handle, size uint32) (hr error) = kernel32.ResizePseudoConsole //sys resizePseudoConsole(pconsole Handle, size uint32) (hr error) = kernel32.ResizePseudoConsole
@ -348,8 +359,19 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys SetProcessPriorityBoost(process Handle, disable bool) (err error) = kernel32.SetProcessPriorityBoost //sys SetProcessPriorityBoost(process Handle, disable bool) (err error) = kernel32.SetProcessPriorityBoost
//sys GetProcessWorkingSetSizeEx(hProcess Handle, lpMinimumWorkingSetSize *uintptr, lpMaximumWorkingSetSize *uintptr, flags *uint32) //sys GetProcessWorkingSetSizeEx(hProcess Handle, lpMinimumWorkingSetSize *uintptr, lpMaximumWorkingSetSize *uintptr, flags *uint32)
//sys SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr, dwMaximumWorkingSetSize uintptr, flags uint32) (err error) //sys SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr, dwMaximumWorkingSetSize uintptr, flags uint32) (err error)
//sys ClearCommBreak(handle Handle) (err error)
//sys ClearCommError(handle Handle, lpErrors *uint32, lpStat *ComStat) (err error)
//sys EscapeCommFunction(handle Handle, dwFunc uint32) (err error)
//sys GetCommState(handle Handle, lpDCB *DCB) (err error)
//sys GetCommModemStatus(handle Handle, lpModemStat *uint32) (err error)
//sys GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) //sys GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error)
//sys PurgeComm(handle Handle, dwFlags uint32) (err error)
//sys SetCommBreak(handle Handle) (err error)
//sys SetCommMask(handle Handle, dwEvtMask uint32) (err error)
//sys SetCommState(handle Handle, lpDCB *DCB) (err error)
//sys SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) //sys SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error)
//sys SetupComm(handle Handle, dwInQueue uint32, dwOutQueue uint32) (err error)
//sys WaitCommEvent(handle Handle, lpEvtMask *uint32, lpOverlapped *Overlapped) (err error)
//sys GetActiveProcessorCount(groupNumber uint16) (ret uint32) //sys GetActiveProcessorCount(groupNumber uint16) (ret uint32)
//sys GetMaximumProcessorCount(groupNumber uint16) (ret uint32) //sys GetMaximumProcessorCount(groupNumber uint16) (ret uint32)
//sys EnumWindows(enumFunc uintptr, param unsafe.Pointer) (err error) = user32.EnumWindows //sys EnumWindows(enumFunc uintptr, param unsafe.Pointer) (err error) = user32.EnumWindows
@ -1356,9 +1378,11 @@ func SetsockoptLinger(fd Handle, level, opt int, l *Linger) (err error) {
func SetsockoptInet4Addr(fd Handle, level, opt int, value [4]byte) (err error) { func SetsockoptInet4Addr(fd Handle, level, opt int, value [4]byte) (err error) {
return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(&value[0])), 4) return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(&value[0])), 4)
} }
func SetsockoptIPMreq(fd Handle, level, opt int, mreq *IPMreq) (err error) { func SetsockoptIPMreq(fd Handle, level, opt int, mreq *IPMreq) (err error) {
return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(mreq)), int32(unsafe.Sizeof(*mreq))) return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(mreq)), int32(unsafe.Sizeof(*mreq)))
} }
func SetsockoptIPv6Mreq(fd Handle, level, opt int, mreq *IPv6Mreq) (err error) { func SetsockoptIPv6Mreq(fd Handle, level, opt int, mreq *IPv6Mreq) (err error) {
return syscall.EWINDOWS return syscall.EWINDOWS
} }
@ -1834,3 +1858,73 @@ func ResizePseudoConsole(pconsole Handle, size Coord) error {
// accept arguments that can be casted to uintptr, and Coord can't. // accept arguments that can be casted to uintptr, and Coord can't.
return resizePseudoConsole(pconsole, *((*uint32)(unsafe.Pointer(&size)))) return resizePseudoConsole(pconsole, *((*uint32)(unsafe.Pointer(&size))))
} }
// DCB constants. See https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-dcb.
const (
CBR_110 = 110
CBR_300 = 300
CBR_600 = 600
CBR_1200 = 1200
CBR_2400 = 2400
CBR_4800 = 4800
CBR_9600 = 9600
CBR_14400 = 14400
CBR_19200 = 19200
CBR_38400 = 38400
CBR_57600 = 57600
CBR_115200 = 115200
CBR_128000 = 128000
CBR_256000 = 256000
DTR_CONTROL_DISABLE = 0x00000000
DTR_CONTROL_ENABLE = 0x00000010
DTR_CONTROL_HANDSHAKE = 0x00000020
RTS_CONTROL_DISABLE = 0x00000000
RTS_CONTROL_ENABLE = 0x00001000
RTS_CONTROL_HANDSHAKE = 0x00002000
RTS_CONTROL_TOGGLE = 0x00003000
NOPARITY = 0
ODDPARITY = 1
EVENPARITY = 2
MARKPARITY = 3
SPACEPARITY = 4
ONESTOPBIT = 0
ONE5STOPBITS = 1
TWOSTOPBITS = 2
)
// EscapeCommFunction constants. See https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-escapecommfunction.
const (
SETXOFF = 1
SETXON = 2
SETRTS = 3
CLRRTS = 4
SETDTR = 5
CLRDTR = 6
SETBREAK = 8
CLRBREAK = 9
)
// PurgeComm constants. See https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-purgecomm.
const (
PURGE_TXABORT = 0x0001
PURGE_RXABORT = 0x0002
PURGE_TXCLEAR = 0x0004
PURGE_RXCLEAR = 0x0008
)
// SetCommMask constants. See https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setcommmask.
const (
EV_RXCHAR = 0x0001
EV_RXFLAG = 0x0002
EV_TXEMPTY = 0x0004
EV_CTS = 0x0008
EV_DSR = 0x0010
EV_RLSD = 0x0020
EV_BREAK = 0x0040
EV_ERR = 0x0080
EV_RING = 0x0100
)

View File

@ -1060,6 +1060,7 @@ const (
SIO_GET_EXTENSION_FUNCTION_POINTER = IOC_INOUT | IOC_WS2 | 6 SIO_GET_EXTENSION_FUNCTION_POINTER = IOC_INOUT | IOC_WS2 | 6
SIO_KEEPALIVE_VALS = IOC_IN | IOC_VENDOR | 4 SIO_KEEPALIVE_VALS = IOC_IN | IOC_VENDOR | 4
SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12 SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12
SIO_UDP_NETRESET = IOC_IN | IOC_VENDOR | 15
// cf. http://support.microsoft.com/default.aspx?scid=kb;en-us;257460 // cf. http://support.microsoft.com/default.aspx?scid=kb;en-us;257460
@ -2003,7 +2004,21 @@ const (
MOVEFILE_FAIL_IF_NOT_TRACKABLE = 0x20 MOVEFILE_FAIL_IF_NOT_TRACKABLE = 0x20
) )
const GAA_FLAG_INCLUDE_PREFIX = 0x00000010 // Flags for GetAdaptersAddresses, see
// https://learn.microsoft.com/en-us/windows/win32/api/iphlpapi/nf-iphlpapi-getadaptersaddresses.
const (
GAA_FLAG_SKIP_UNICAST = 0x1
GAA_FLAG_SKIP_ANYCAST = 0x2
GAA_FLAG_SKIP_MULTICAST = 0x4
GAA_FLAG_SKIP_DNS_SERVER = 0x8
GAA_FLAG_INCLUDE_PREFIX = 0x10
GAA_FLAG_SKIP_FRIENDLY_NAME = 0x20
GAA_FLAG_INCLUDE_WINS_INFO = 0x40
GAA_FLAG_INCLUDE_GATEWAYS = 0x80
GAA_FLAG_INCLUDE_ALL_INTERFACES = 0x100
GAA_FLAG_INCLUDE_ALL_COMPARTMENTS = 0x200
GAA_FLAG_INCLUDE_TUNNEL_BINDINGORDER = 0x400
)
const ( const (
IF_TYPE_OTHER = 1 IF_TYPE_OTHER = 1
@ -2017,6 +2032,50 @@ const (
IF_TYPE_IEEE1394 = 144 IF_TYPE_IEEE1394 = 144
) )
// Enum NL_PREFIX_ORIGIN for [IpAdapterUnicastAddress], see
// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_prefix_origin
const (
IpPrefixOriginOther = 0
IpPrefixOriginManual = 1
IpPrefixOriginWellKnown = 2
IpPrefixOriginDhcp = 3
IpPrefixOriginRouterAdvertisement = 4
IpPrefixOriginUnchanged = 1 << 4
)
// Enum NL_SUFFIX_ORIGIN for [IpAdapterUnicastAddress], see
// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_suffix_origin
const (
NlsoOther = 0
NlsoManual = 1
NlsoWellKnown = 2
NlsoDhcp = 3
NlsoLinkLayerAddress = 4
NlsoRandom = 5
IpSuffixOriginOther = 0
IpSuffixOriginManual = 1
IpSuffixOriginWellKnown = 2
IpSuffixOriginDhcp = 3
IpSuffixOriginLinkLayerAddress = 4
IpSuffixOriginRandom = 5
IpSuffixOriginUnchanged = 1 << 4
)
// Enum NL_DAD_STATE for [IpAdapterUnicastAddress], see
// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_dad_state
const (
NldsInvalid = 0
NldsTentative = 1
NldsDuplicate = 2
NldsDeprecated = 3
NldsPreferred = 4
IpDadStateInvalid = 0
IpDadStateTentative = 1
IpDadStateDuplicate = 2
IpDadStateDeprecated = 3
IpDadStatePreferred = 4
)
type SocketAddress struct { type SocketAddress struct {
Sockaddr *syscall.RawSockaddrAny Sockaddr *syscall.RawSockaddrAny
SockaddrLength int32 SockaddrLength int32
@ -3380,3 +3439,38 @@ type BLOB struct {
Size uint32 Size uint32
BlobData *byte BlobData *byte
} }
type ComStat struct {
Flags uint32
CBInQue uint32
CBOutQue uint32
}
type DCB struct {
DCBlength uint32
BaudRate uint32
Flags uint32
wReserved uint16
XonLim uint16
XoffLim uint16
ByteSize uint8
Parity uint8
StopBits uint8
XonChar byte
XoffChar byte
ErrorChar byte
EofChar byte
EvtChar byte
wReserved1 uint16
}
// Keyboard Layout Flags.
// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-loadkeyboardlayoutw
const (
KLF_ACTIVATE = 0x00000001
KLF_SUBSTITUTE_OK = 0x00000002
KLF_REORDER = 0x00000008
KLF_REPLACELANG = 0x00000010
KLF_NOTELLSHELL = 0x00000080
KLF_SETFORPROCESS = 0x00000100
)

View File

@ -91,6 +91,7 @@ var (
procEnumServicesStatusExW = modadvapi32.NewProc("EnumServicesStatusExW") procEnumServicesStatusExW = modadvapi32.NewProc("EnumServicesStatusExW")
procEqualSid = modadvapi32.NewProc("EqualSid") procEqualSid = modadvapi32.NewProc("EqualSid")
procFreeSid = modadvapi32.NewProc("FreeSid") procFreeSid = modadvapi32.NewProc("FreeSid")
procGetAce = modadvapi32.NewProc("GetAce")
procGetLengthSid = modadvapi32.NewProc("GetLengthSid") procGetLengthSid = modadvapi32.NewProc("GetLengthSid")
procGetNamedSecurityInfoW = modadvapi32.NewProc("GetNamedSecurityInfoW") procGetNamedSecurityInfoW = modadvapi32.NewProc("GetNamedSecurityInfoW")
procGetSecurityDescriptorControl = modadvapi32.NewProc("GetSecurityDescriptorControl") procGetSecurityDescriptorControl = modadvapi32.NewProc("GetSecurityDescriptorControl")
@ -188,6 +189,8 @@ var (
procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject") procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject")
procCancelIo = modkernel32.NewProc("CancelIo") procCancelIo = modkernel32.NewProc("CancelIo")
procCancelIoEx = modkernel32.NewProc("CancelIoEx") procCancelIoEx = modkernel32.NewProc("CancelIoEx")
procClearCommBreak = modkernel32.NewProc("ClearCommBreak")
procClearCommError = modkernel32.NewProc("ClearCommError")
procCloseHandle = modkernel32.NewProc("CloseHandle") procCloseHandle = modkernel32.NewProc("CloseHandle")
procClosePseudoConsole = modkernel32.NewProc("ClosePseudoConsole") procClosePseudoConsole = modkernel32.NewProc("ClosePseudoConsole")
procConnectNamedPipe = modkernel32.NewProc("ConnectNamedPipe") procConnectNamedPipe = modkernel32.NewProc("ConnectNamedPipe")
@ -212,7 +215,9 @@ var (
procDeleteProcThreadAttributeList = modkernel32.NewProc("DeleteProcThreadAttributeList") procDeleteProcThreadAttributeList = modkernel32.NewProc("DeleteProcThreadAttributeList")
procDeleteVolumeMountPointW = modkernel32.NewProc("DeleteVolumeMountPointW") procDeleteVolumeMountPointW = modkernel32.NewProc("DeleteVolumeMountPointW")
procDeviceIoControl = modkernel32.NewProc("DeviceIoControl") procDeviceIoControl = modkernel32.NewProc("DeviceIoControl")
procDisconnectNamedPipe = modkernel32.NewProc("DisconnectNamedPipe")
procDuplicateHandle = modkernel32.NewProc("DuplicateHandle") procDuplicateHandle = modkernel32.NewProc("DuplicateHandle")
procEscapeCommFunction = modkernel32.NewProc("EscapeCommFunction")
procExitProcess = modkernel32.NewProc("ExitProcess") procExitProcess = modkernel32.NewProc("ExitProcess")
procExpandEnvironmentStringsW = modkernel32.NewProc("ExpandEnvironmentStringsW") procExpandEnvironmentStringsW = modkernel32.NewProc("ExpandEnvironmentStringsW")
procFindClose = modkernel32.NewProc("FindClose") procFindClose = modkernel32.NewProc("FindClose")
@ -236,11 +241,15 @@ var (
procGenerateConsoleCtrlEvent = modkernel32.NewProc("GenerateConsoleCtrlEvent") procGenerateConsoleCtrlEvent = modkernel32.NewProc("GenerateConsoleCtrlEvent")
procGetACP = modkernel32.NewProc("GetACP") procGetACP = modkernel32.NewProc("GetACP")
procGetActiveProcessorCount = modkernel32.NewProc("GetActiveProcessorCount") procGetActiveProcessorCount = modkernel32.NewProc("GetActiveProcessorCount")
procGetCommModemStatus = modkernel32.NewProc("GetCommModemStatus")
procGetCommState = modkernel32.NewProc("GetCommState")
procGetCommTimeouts = modkernel32.NewProc("GetCommTimeouts") procGetCommTimeouts = modkernel32.NewProc("GetCommTimeouts")
procGetCommandLineW = modkernel32.NewProc("GetCommandLineW") procGetCommandLineW = modkernel32.NewProc("GetCommandLineW")
procGetComputerNameExW = modkernel32.NewProc("GetComputerNameExW") procGetComputerNameExW = modkernel32.NewProc("GetComputerNameExW")
procGetComputerNameW = modkernel32.NewProc("GetComputerNameW") procGetComputerNameW = modkernel32.NewProc("GetComputerNameW")
procGetConsoleCP = modkernel32.NewProc("GetConsoleCP")
procGetConsoleMode = modkernel32.NewProc("GetConsoleMode") procGetConsoleMode = modkernel32.NewProc("GetConsoleMode")
procGetConsoleOutputCP = modkernel32.NewProc("GetConsoleOutputCP")
procGetConsoleScreenBufferInfo = modkernel32.NewProc("GetConsoleScreenBufferInfo") procGetConsoleScreenBufferInfo = modkernel32.NewProc("GetConsoleScreenBufferInfo")
procGetCurrentDirectoryW = modkernel32.NewProc("GetCurrentDirectoryW") procGetCurrentDirectoryW = modkernel32.NewProc("GetCurrentDirectoryW")
procGetCurrentProcessId = modkernel32.NewProc("GetCurrentProcessId") procGetCurrentProcessId = modkernel32.NewProc("GetCurrentProcessId")
@ -322,6 +331,7 @@ var (
procProcess32NextW = modkernel32.NewProc("Process32NextW") procProcess32NextW = modkernel32.NewProc("Process32NextW")
procProcessIdToSessionId = modkernel32.NewProc("ProcessIdToSessionId") procProcessIdToSessionId = modkernel32.NewProc("ProcessIdToSessionId")
procPulseEvent = modkernel32.NewProc("PulseEvent") procPulseEvent = modkernel32.NewProc("PulseEvent")
procPurgeComm = modkernel32.NewProc("PurgeComm")
procQueryDosDeviceW = modkernel32.NewProc("QueryDosDeviceW") procQueryDosDeviceW = modkernel32.NewProc("QueryDosDeviceW")
procQueryFullProcessImageNameW = modkernel32.NewProc("QueryFullProcessImageNameW") procQueryFullProcessImageNameW = modkernel32.NewProc("QueryFullProcessImageNameW")
procQueryInformationJobObject = modkernel32.NewProc("QueryInformationJobObject") procQueryInformationJobObject = modkernel32.NewProc("QueryInformationJobObject")
@ -335,14 +345,18 @@ var (
procResetEvent = modkernel32.NewProc("ResetEvent") procResetEvent = modkernel32.NewProc("ResetEvent")
procResizePseudoConsole = modkernel32.NewProc("ResizePseudoConsole") procResizePseudoConsole = modkernel32.NewProc("ResizePseudoConsole")
procResumeThread = modkernel32.NewProc("ResumeThread") procResumeThread = modkernel32.NewProc("ResumeThread")
procSetCommBreak = modkernel32.NewProc("SetCommBreak")
procSetCommMask = modkernel32.NewProc("SetCommMask")
procSetCommState = modkernel32.NewProc("SetCommState")
procSetCommTimeouts = modkernel32.NewProc("SetCommTimeouts") procSetCommTimeouts = modkernel32.NewProc("SetCommTimeouts")
procSetConsoleCP = modkernel32.NewProc("SetConsoleCP")
procSetConsoleCursorPosition = modkernel32.NewProc("SetConsoleCursorPosition") procSetConsoleCursorPosition = modkernel32.NewProc("SetConsoleCursorPosition")
procSetConsoleMode = modkernel32.NewProc("SetConsoleMode") procSetConsoleMode = modkernel32.NewProc("SetConsoleMode")
procSetConsoleOutputCP = modkernel32.NewProc("SetConsoleOutputCP")
procSetCurrentDirectoryW = modkernel32.NewProc("SetCurrentDirectoryW") procSetCurrentDirectoryW = modkernel32.NewProc("SetCurrentDirectoryW")
procSetDefaultDllDirectories = modkernel32.NewProc("SetDefaultDllDirectories") procSetDefaultDllDirectories = modkernel32.NewProc("SetDefaultDllDirectories")
procSetDllDirectoryW = modkernel32.NewProc("SetDllDirectoryW") procSetDllDirectoryW = modkernel32.NewProc("SetDllDirectoryW")
procSetEndOfFile = modkernel32.NewProc("SetEndOfFile") procSetEndOfFile = modkernel32.NewProc("SetEndOfFile")
procSetFileValidData = modkernel32.NewProc("SetFileValidData")
procSetEnvironmentVariableW = modkernel32.NewProc("SetEnvironmentVariableW") procSetEnvironmentVariableW = modkernel32.NewProc("SetEnvironmentVariableW")
procSetErrorMode = modkernel32.NewProc("SetErrorMode") procSetErrorMode = modkernel32.NewProc("SetErrorMode")
procSetEvent = modkernel32.NewProc("SetEvent") procSetEvent = modkernel32.NewProc("SetEvent")
@ -351,6 +365,7 @@ var (
procSetFileInformationByHandle = modkernel32.NewProc("SetFileInformationByHandle") procSetFileInformationByHandle = modkernel32.NewProc("SetFileInformationByHandle")
procSetFilePointer = modkernel32.NewProc("SetFilePointer") procSetFilePointer = modkernel32.NewProc("SetFilePointer")
procSetFileTime = modkernel32.NewProc("SetFileTime") procSetFileTime = modkernel32.NewProc("SetFileTime")
procSetFileValidData = modkernel32.NewProc("SetFileValidData")
procSetHandleInformation = modkernel32.NewProc("SetHandleInformation") procSetHandleInformation = modkernel32.NewProc("SetHandleInformation")
procSetInformationJobObject = modkernel32.NewProc("SetInformationJobObject") procSetInformationJobObject = modkernel32.NewProc("SetInformationJobObject")
procSetNamedPipeHandleState = modkernel32.NewProc("SetNamedPipeHandleState") procSetNamedPipeHandleState = modkernel32.NewProc("SetNamedPipeHandleState")
@ -361,6 +376,7 @@ var (
procSetStdHandle = modkernel32.NewProc("SetStdHandle") procSetStdHandle = modkernel32.NewProc("SetStdHandle")
procSetVolumeLabelW = modkernel32.NewProc("SetVolumeLabelW") procSetVolumeLabelW = modkernel32.NewProc("SetVolumeLabelW")
procSetVolumeMountPointW = modkernel32.NewProc("SetVolumeMountPointW") procSetVolumeMountPointW = modkernel32.NewProc("SetVolumeMountPointW")
procSetupComm = modkernel32.NewProc("SetupComm")
procSizeofResource = modkernel32.NewProc("SizeofResource") procSizeofResource = modkernel32.NewProc("SizeofResource")
procSleepEx = modkernel32.NewProc("SleepEx") procSleepEx = modkernel32.NewProc("SleepEx")
procTerminateJobObject = modkernel32.NewProc("TerminateJobObject") procTerminateJobObject = modkernel32.NewProc("TerminateJobObject")
@ -379,6 +395,7 @@ var (
procVirtualQueryEx = modkernel32.NewProc("VirtualQueryEx") procVirtualQueryEx = modkernel32.NewProc("VirtualQueryEx")
procVirtualUnlock = modkernel32.NewProc("VirtualUnlock") procVirtualUnlock = modkernel32.NewProc("VirtualUnlock")
procWTSGetActiveConsoleSessionId = modkernel32.NewProc("WTSGetActiveConsoleSessionId") procWTSGetActiveConsoleSessionId = modkernel32.NewProc("WTSGetActiveConsoleSessionId")
procWaitCommEvent = modkernel32.NewProc("WaitCommEvent")
procWaitForMultipleObjects = modkernel32.NewProc("WaitForMultipleObjects") procWaitForMultipleObjects = modkernel32.NewProc("WaitForMultipleObjects")
procWaitForSingleObject = modkernel32.NewProc("WaitForSingleObject") procWaitForSingleObject = modkernel32.NewProc("WaitForSingleObject")
procWriteConsoleW = modkernel32.NewProc("WriteConsoleW") procWriteConsoleW = modkernel32.NewProc("WriteConsoleW")
@ -389,6 +406,7 @@ var (
procTransmitFile = modmswsock.NewProc("TransmitFile") procTransmitFile = modmswsock.NewProc("TransmitFile")
procNetApiBufferFree = modnetapi32.NewProc("NetApiBufferFree") procNetApiBufferFree = modnetapi32.NewProc("NetApiBufferFree")
procNetGetJoinInformation = modnetapi32.NewProc("NetGetJoinInformation") procNetGetJoinInformation = modnetapi32.NewProc("NetGetJoinInformation")
procNetUserEnum = modnetapi32.NewProc("NetUserEnum")
procNetUserGetInfo = modnetapi32.NewProc("NetUserGetInfo") procNetUserGetInfo = modnetapi32.NewProc("NetUserGetInfo")
procNtCreateFile = modntdll.NewProc("NtCreateFile") procNtCreateFile = modntdll.NewProc("NtCreateFile")
procNtCreateNamedPipeFile = modntdll.NewProc("NtCreateNamedPipeFile") procNtCreateNamedPipeFile = modntdll.NewProc("NtCreateNamedPipeFile")
@ -464,12 +482,16 @@ var (
procGetDesktopWindow = moduser32.NewProc("GetDesktopWindow") procGetDesktopWindow = moduser32.NewProc("GetDesktopWindow")
procGetForegroundWindow = moduser32.NewProc("GetForegroundWindow") procGetForegroundWindow = moduser32.NewProc("GetForegroundWindow")
procGetGUIThreadInfo = moduser32.NewProc("GetGUIThreadInfo") procGetGUIThreadInfo = moduser32.NewProc("GetGUIThreadInfo")
procGetKeyboardLayout = moduser32.NewProc("GetKeyboardLayout")
procGetShellWindow = moduser32.NewProc("GetShellWindow") procGetShellWindow = moduser32.NewProc("GetShellWindow")
procGetWindowThreadProcessId = moduser32.NewProc("GetWindowThreadProcessId") procGetWindowThreadProcessId = moduser32.NewProc("GetWindowThreadProcessId")
procIsWindow = moduser32.NewProc("IsWindow") procIsWindow = moduser32.NewProc("IsWindow")
procIsWindowUnicode = moduser32.NewProc("IsWindowUnicode") procIsWindowUnicode = moduser32.NewProc("IsWindowUnicode")
procIsWindowVisible = moduser32.NewProc("IsWindowVisible") procIsWindowVisible = moduser32.NewProc("IsWindowVisible")
procLoadKeyboardLayoutW = moduser32.NewProc("LoadKeyboardLayoutW")
procMessageBoxW = moduser32.NewProc("MessageBoxW") procMessageBoxW = moduser32.NewProc("MessageBoxW")
procToUnicodeEx = moduser32.NewProc("ToUnicodeEx")
procUnloadKeyboardLayout = moduser32.NewProc("UnloadKeyboardLayout")
procCreateEnvironmentBlock = moduserenv.NewProc("CreateEnvironmentBlock") procCreateEnvironmentBlock = moduserenv.NewProc("CreateEnvironmentBlock")
procDestroyEnvironmentBlock = moduserenv.NewProc("DestroyEnvironmentBlock") procDestroyEnvironmentBlock = moduserenv.NewProc("DestroyEnvironmentBlock")
procGetUserProfileDirectoryW = moduserenv.NewProc("GetUserProfileDirectoryW") procGetUserProfileDirectoryW = moduserenv.NewProc("GetUserProfileDirectoryW")
@ -775,6 +797,14 @@ func FreeSid(sid *SID) (err error) {
return return
} }
func GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (err error) {
r1, _, e1 := syscall.Syscall(procGetAce.Addr(), 3, uintptr(unsafe.Pointer(acl)), uintptr(aceIndex), uintptr(unsafe.Pointer(pAce)))
if r1 == 0 {
err = errnoErr(e1)
}
return
}
func GetLengthSid(sid *SID) (len uint32) { func GetLengthSid(sid *SID) (len uint32) {
r0, _, _ := syscall.Syscall(procGetLengthSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) r0, _, _ := syscall.Syscall(procGetLengthSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
len = uint32(r0) len = uint32(r0)
@ -1641,6 +1671,22 @@ func CancelIoEx(s Handle, o *Overlapped) (err error) {
return return
} }
func ClearCommBreak(handle Handle) (err error) {
r1, _, e1 := syscall.Syscall(procClearCommBreak.Addr(), 1, uintptr(handle), 0, 0)
if r1 == 0 {
err = errnoErr(e1)
}
return
}
func ClearCommError(handle Handle, lpErrors *uint32, lpStat *ComStat) (err error) {
r1, _, e1 := syscall.Syscall(procClearCommError.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(lpErrors)), uintptr(unsafe.Pointer(lpStat)))
if r1 == 0 {
err = errnoErr(e1)
}
return
}
func CloseHandle(handle Handle) (err error) { func CloseHandle(handle Handle) (err error) {
r1, _, e1 := syscall.Syscall(procCloseHandle.Addr(), 1, uintptr(handle), 0, 0) r1, _, e1 := syscall.Syscall(procCloseHandle.Addr(), 1, uintptr(handle), 0, 0)
if r1 == 0 { if r1 == 0 {
@ -1845,6 +1891,14 @@ func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBuff
return return
} }
func DisconnectNamedPipe(pipe Handle) (err error) {
r1, _, e1 := syscall.Syscall(procDisconnectNamedPipe.Addr(), 1, uintptr(pipe), 0, 0)
if r1 == 0 {
err = errnoErr(e1)
}
return
}
func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error) { func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error) {
var _p0 uint32 var _p0 uint32
if bInheritHandle { if bInheritHandle {
@ -1857,6 +1911,14 @@ func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetP
return return
} }
func EscapeCommFunction(handle Handle, dwFunc uint32) (err error) {
r1, _, e1 := syscall.Syscall(procEscapeCommFunction.Addr(), 2, uintptr(handle), uintptr(dwFunc), 0)
if r1 == 0 {
err = errnoErr(e1)
}
return
}
func ExitProcess(exitcode uint32) { func ExitProcess(exitcode uint32) {
syscall.Syscall(procExitProcess.Addr(), 1, uintptr(exitcode), 0, 0) syscall.Syscall(procExitProcess.Addr(), 1, uintptr(exitcode), 0, 0)
return return
@ -2058,6 +2120,22 @@ func GetActiveProcessorCount(groupNumber uint16) (ret uint32) {
return return
} }
func GetCommModemStatus(handle Handle, lpModemStat *uint32) (err error) {
r1, _, e1 := syscall.Syscall(procGetCommModemStatus.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(lpModemStat)), 0)
if r1 == 0 {
err = errnoErr(e1)
}
return
}
func GetCommState(handle Handle, lpDCB *DCB) (err error) {
r1, _, e1 := syscall.Syscall(procGetCommState.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(lpDCB)), 0)
if r1 == 0 {
err = errnoErr(e1)
}
return
}
func GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { func GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) {
r1, _, e1 := syscall.Syscall(procGetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0) r1, _, e1 := syscall.Syscall(procGetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0)
if r1 == 0 { if r1 == 0 {
@ -2088,6 +2166,15 @@ func GetComputerName(buf *uint16, n *uint32) (err error) {
return return
} }
func GetConsoleCP() (cp uint32, err error) {
r0, _, e1 := syscall.Syscall(procGetConsoleCP.Addr(), 0, 0, 0, 0)
cp = uint32(r0)
if cp == 0 {
err = errnoErr(e1)
}
return
}
func GetConsoleMode(console Handle, mode *uint32) (err error) { func GetConsoleMode(console Handle, mode *uint32) (err error) {
r1, _, e1 := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0) r1, _, e1 := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0)
if r1 == 0 { if r1 == 0 {
@ -2096,6 +2183,15 @@ func GetConsoleMode(console Handle, mode *uint32) (err error) {
return return
} }
func GetConsoleOutputCP() (cp uint32, err error) {
r0, _, e1 := syscall.Syscall(procGetConsoleOutputCP.Addr(), 0, 0, 0, 0)
cp = uint32(r0)
if cp == 0 {
err = errnoErr(e1)
}
return
}
func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) { func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) {
r1, _, e1 := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(info)), 0) r1, _, e1 := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(info)), 0)
if r1 == 0 { if r1 == 0 {
@ -2810,6 +2906,14 @@ func PulseEvent(event Handle) (err error) {
return return
} }
func PurgeComm(handle Handle, dwFlags uint32) (err error) {
r1, _, e1 := syscall.Syscall(procPurgeComm.Addr(), 2, uintptr(handle), uintptr(dwFlags), 0)
if r1 == 0 {
err = errnoErr(e1)
}
return
}
func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) { func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) {
r0, _, e1 := syscall.Syscall(procQueryDosDeviceW.Addr(), 3, uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)), uintptr(max)) r0, _, e1 := syscall.Syscall(procQueryDosDeviceW.Addr(), 3, uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)), uintptr(max))
n = uint32(r0) n = uint32(r0)
@ -2924,6 +3028,30 @@ func ResumeThread(thread Handle) (ret uint32, err error) {
return return
} }
func SetCommBreak(handle Handle) (err error) {
r1, _, e1 := syscall.Syscall(procSetCommBreak.Addr(), 1, uintptr(handle), 0, 0)
if r1 == 0 {
err = errnoErr(e1)
}
return
}
func SetCommMask(handle Handle, dwEvtMask uint32) (err error) {
r1, _, e1 := syscall.Syscall(procSetCommMask.Addr(), 2, uintptr(handle), uintptr(dwEvtMask), 0)
if r1 == 0 {
err = errnoErr(e1)
}
return
}
func SetCommState(handle Handle, lpDCB *DCB) (err error) {
r1, _, e1 := syscall.Syscall(procSetCommState.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(lpDCB)), 0)
if r1 == 0 {
err = errnoErr(e1)
}
return
}
func SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { func SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) {
r1, _, e1 := syscall.Syscall(procSetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0) r1, _, e1 := syscall.Syscall(procSetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0)
if r1 == 0 { if r1 == 0 {
@ -2932,6 +3060,14 @@ func SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) {
return return
} }
func SetConsoleCP(cp uint32) (err error) {
r1, _, e1 := syscall.Syscall(procSetConsoleCP.Addr(), 1, uintptr(cp), 0, 0)
if r1 == 0 {
err = errnoErr(e1)
}
return
}
func setConsoleCursorPosition(console Handle, position uint32) (err error) { func setConsoleCursorPosition(console Handle, position uint32) (err error) {
r1, _, e1 := syscall.Syscall(procSetConsoleCursorPosition.Addr(), 2, uintptr(console), uintptr(position), 0) r1, _, e1 := syscall.Syscall(procSetConsoleCursorPosition.Addr(), 2, uintptr(console), uintptr(position), 0)
if r1 == 0 { if r1 == 0 {
@ -2948,6 +3084,14 @@ func SetConsoleMode(console Handle, mode uint32) (err error) {
return return
} }
func SetConsoleOutputCP(cp uint32) (err error) {
r1, _, e1 := syscall.Syscall(procSetConsoleOutputCP.Addr(), 1, uintptr(cp), 0, 0)
if r1 == 0 {
err = errnoErr(e1)
}
return
}
func SetCurrentDirectory(path *uint16) (err error) { func SetCurrentDirectory(path *uint16) (err error) {
r1, _, e1 := syscall.Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) r1, _, e1 := syscall.Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
if r1 == 0 { if r1 == 0 {
@ -2989,14 +3133,6 @@ func SetEndOfFile(handle Handle) (err error) {
return return
} }
func SetFileValidData(handle Handle, validDataLength int64) (err error) {
r1, _, e1 := syscall.Syscall(procSetFileValidData.Addr(), 2, uintptr(handle), uintptr(validDataLength), 0)
if r1 == 0 {
err = errnoErr(e1)
}
return
}
func SetEnvironmentVariable(name *uint16, value *uint16) (err error) { func SetEnvironmentVariable(name *uint16, value *uint16) (err error) {
r1, _, e1 := syscall.Syscall(procSetEnvironmentVariableW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0) r1, _, e1 := syscall.Syscall(procSetEnvironmentVariableW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0)
if r1 == 0 { if r1 == 0 {
@ -3060,6 +3196,14 @@ func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetim
return return
} }
func SetFileValidData(handle Handle, validDataLength int64) (err error) {
r1, _, e1 := syscall.Syscall(procSetFileValidData.Addr(), 2, uintptr(handle), uintptr(validDataLength), 0)
if r1 == 0 {
err = errnoErr(e1)
}
return
}
func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) { func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) {
r1, _, e1 := syscall.Syscall(procSetHandleInformation.Addr(), 3, uintptr(handle), uintptr(mask), uintptr(flags)) r1, _, e1 := syscall.Syscall(procSetHandleInformation.Addr(), 3, uintptr(handle), uintptr(mask), uintptr(flags))
if r1 == 0 { if r1 == 0 {
@ -3145,6 +3289,14 @@ func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err erro
return return
} }
func SetupComm(handle Handle, dwInQueue uint32, dwOutQueue uint32) (err error) {
r1, _, e1 := syscall.Syscall(procSetupComm.Addr(), 3, uintptr(handle), uintptr(dwInQueue), uintptr(dwOutQueue))
if r1 == 0 {
err = errnoErr(e1)
}
return
}
func SizeofResource(module Handle, resInfo Handle) (size uint32, err error) { func SizeofResource(module Handle, resInfo Handle) (size uint32, err error) {
r0, _, e1 := syscall.Syscall(procSizeofResource.Addr(), 2, uintptr(module), uintptr(resInfo), 0) r0, _, e1 := syscall.Syscall(procSizeofResource.Addr(), 2, uintptr(module), uintptr(resInfo), 0)
size = uint32(r0) size = uint32(r0)
@ -3291,6 +3443,14 @@ func WTSGetActiveConsoleSessionId() (sessionID uint32) {
return return
} }
func WaitCommEvent(handle Handle, lpEvtMask *uint32, lpOverlapped *Overlapped) (err error) {
r1, _, e1 := syscall.Syscall(procWaitCommEvent.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(lpEvtMask)), uintptr(unsafe.Pointer(lpOverlapped)))
if r1 == 0 {
err = errnoErr(e1)
}
return
}
func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMilliseconds uint32) (event uint32, err error) { func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMilliseconds uint32) (event uint32, err error) {
var _p0 uint32 var _p0 uint32
if waitAll { if waitAll {
@ -3378,6 +3538,14 @@ func NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (nete
return return
} }
func NetUserEnum(serverName *uint16, level uint32, filter uint32, buf **byte, prefMaxLen uint32, entriesRead *uint32, totalEntries *uint32, resumeHandle *uint32) (neterr error) {
r0, _, _ := syscall.Syscall9(procNetUserEnum.Addr(), 8, uintptr(unsafe.Pointer(serverName)), uintptr(level), uintptr(filter), uintptr(unsafe.Pointer(buf)), uintptr(prefMaxLen), uintptr(unsafe.Pointer(entriesRead)), uintptr(unsafe.Pointer(totalEntries)), uintptr(unsafe.Pointer(resumeHandle)), 0)
if r0 != 0 {
neterr = syscall.Errno(r0)
}
return
}
func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) { func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) {
r0, _, _ := syscall.Syscall6(procNetUserGetInfo.Addr(), 4, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(unsafe.Pointer(buf)), 0, 0) r0, _, _ := syscall.Syscall6(procNetUserGetInfo.Addr(), 4, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(unsafe.Pointer(buf)), 0, 0)
if r0 != 0 { if r0 != 0 {
@ -3956,6 +4124,12 @@ func GetGUIThreadInfo(thread uint32, info *GUIThreadInfo) (err error) {
return return
} }
func GetKeyboardLayout(tid uint32) (hkl Handle) {
r0, _, _ := syscall.Syscall(procGetKeyboardLayout.Addr(), 1, uintptr(tid), 0, 0)
hkl = Handle(r0)
return
}
func GetShellWindow() (shellWindow HWND) { func GetShellWindow() (shellWindow HWND) {
r0, _, _ := syscall.Syscall(procGetShellWindow.Addr(), 0, 0, 0, 0) r0, _, _ := syscall.Syscall(procGetShellWindow.Addr(), 0, 0, 0, 0)
shellWindow = HWND(r0) shellWindow = HWND(r0)
@ -3989,6 +4163,15 @@ func IsWindowVisible(hwnd HWND) (isVisible bool) {
return return
} }
func LoadKeyboardLayout(name *uint16, flags uint32) (hkl Handle, err error) {
r0, _, e1 := syscall.Syscall(procLoadKeyboardLayoutW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(flags), 0)
hkl = Handle(r0)
if hkl == 0 {
err = errnoErr(e1)
}
return
}
func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) { func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) {
r0, _, e1 := syscall.Syscall6(procMessageBoxW.Addr(), 4, uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype), 0, 0) r0, _, e1 := syscall.Syscall6(procMessageBoxW.Addr(), 4, uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype), 0, 0)
ret = int32(r0) ret = int32(r0)
@ -3998,6 +4181,20 @@ func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret i
return return
} }
func ToUnicodeEx(vkey uint32, scancode uint32, keystate *byte, pwszBuff *uint16, cchBuff int32, flags uint32, hkl Handle) (ret int32) {
r0, _, _ := syscall.Syscall9(procToUnicodeEx.Addr(), 7, uintptr(vkey), uintptr(scancode), uintptr(unsafe.Pointer(keystate)), uintptr(unsafe.Pointer(pwszBuff)), uintptr(cchBuff), uintptr(flags), uintptr(hkl), 0, 0)
ret = int32(r0)
return
}
func UnloadKeyboardLayout(hkl Handle) (err error) {
r1, _, e1 := syscall.Syscall(procUnloadKeyboardLayout.Addr(), 1, uintptr(hkl), 0, 0)
if r1 == 0 {
err = errnoErr(e1)
}
return
}
func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) { func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) {
var _p0 uint32 var _p0 uint32
if inheritExisting { if inheritExisting {

144
vendor/modules.txt vendored
View File

@ -1,11 +1,42 @@
# github.com/TheTitanrain/w32 v0.0.0-20180517000239-4f5cfb03fabf # github.com/TheTitanrain/w32 v0.0.0-20180517000239-4f5cfb03fabf
## explicit ## explicit
github.com/TheTitanrain/w32 github.com/TheTitanrain/w32
# github.com/davecgh/go-spew v1.1.1
## explicit
github.com/davecgh/go-spew/spew
# github.com/disintegration/imaging v1.6.2
## explicit
github.com/disintegration/imaging
# github.com/ebitengine/gomobile v0.0.0-20240911145611-4856209ac325
## explicit; go 1.22.0
github.com/ebitengine/gomobile/app
github.com/ebitengine/gomobile/app/internal/callfn
github.com/ebitengine/gomobile/event/key
github.com/ebitengine/gomobile/event/lifecycle
github.com/ebitengine/gomobile/event/paint
github.com/ebitengine/gomobile/event/size
github.com/ebitengine/gomobile/event/touch
github.com/ebitengine/gomobile/geom
github.com/ebitengine/gomobile/gl
github.com/ebitengine/gomobile/internal/mobileinit
# github.com/ebitengine/hideconsole v1.0.0
## explicit; go 1.18
github.com/ebitengine/hideconsole
# github.com/ebitengine/purego v0.8.0
## explicit; go 1.18
github.com/ebitengine/purego
github.com/ebitengine/purego/internal/cgo
github.com/ebitengine/purego/internal/fakecgo
github.com/ebitengine/purego/internal/strings
github.com/ebitengine/purego/objc
# github.com/faiface/beep v1.1.0 # github.com/faiface/beep v1.1.0
## explicit; go 1.14 ## explicit; go 1.14
github.com/faiface/beep github.com/faiface/beep
github.com/faiface/beep/flac github.com/faiface/beep/flac
github.com/faiface/beep/speaker github.com/faiface/beep/speaker
# github.com/fogleman/gg v1.3.0
## explicit
github.com/fogleman/gg
# github.com/gen2brain/beeep v0.0.0-20240516210008-9c006672e7f4 # github.com/gen2brain/beeep v0.0.0-20240516210008-9c006672e7f4
## explicit; go 1.14 ## explicit; go 1.14
github.com/gen2brain/beeep github.com/gen2brain/beeep
@ -15,9 +46,55 @@ github.com/go-toast/toast
# github.com/godbus/dbus/v5 v5.1.0 # github.com/godbus/dbus/v5 v5.1.0
## explicit; go 1.12 ## explicit; go 1.12
github.com/godbus/dbus/v5 github.com/godbus/dbus/v5
# github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
## explicit
github.com/golang/freetype/raster
github.com/golang/freetype/truetype
# github.com/google/btree v1.1.2
## explicit; go 1.18
github.com/google/btree
# github.com/gorilla/websocket v1.5.3 # github.com/gorilla/websocket v1.5.3
## explicit; go 1.12 ## explicit; go 1.12
github.com/gorilla/websocket github.com/gorilla/websocket
# github.com/hajimehoshi/ebiten/v2 v2.8.6
## explicit; go 1.22.0
github.com/hajimehoshi/ebiten/v2
github.com/hajimehoshi/ebiten/v2/internal/affine
github.com/hajimehoshi/ebiten/v2/internal/atlas
github.com/hajimehoshi/ebiten/v2/internal/buffered
github.com/hajimehoshi/ebiten/v2/internal/builtinshader
github.com/hajimehoshi/ebiten/v2/internal/clock
github.com/hajimehoshi/ebiten/v2/internal/cocoa
github.com/hajimehoshi/ebiten/v2/internal/debug
github.com/hajimehoshi/ebiten/v2/internal/file
github.com/hajimehoshi/ebiten/v2/internal/gamepad
github.com/hajimehoshi/ebiten/v2/internal/gamepaddb
github.com/hajimehoshi/ebiten/v2/internal/glfw
github.com/hajimehoshi/ebiten/v2/internal/graphics
github.com/hajimehoshi/ebiten/v2/internal/graphicscommand
github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver
github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/directx
github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/metal
github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/metal/ca
github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/metal/mtl
github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/opengl
github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/opengl/gl
github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/playstation5
github.com/hajimehoshi/ebiten/v2/internal/hook
github.com/hajimehoshi/ebiten/v2/internal/microsoftgdk
github.com/hajimehoshi/ebiten/v2/internal/mipmap
github.com/hajimehoshi/ebiten/v2/internal/packing
github.com/hajimehoshi/ebiten/v2/internal/png
github.com/hajimehoshi/ebiten/v2/internal/restorable
github.com/hajimehoshi/ebiten/v2/internal/shader
github.com/hajimehoshi/ebiten/v2/internal/shaderir
github.com/hajimehoshi/ebiten/v2/internal/shaderir/glsl
github.com/hajimehoshi/ebiten/v2/internal/shaderir/hlsl
github.com/hajimehoshi/ebiten/v2/internal/shaderir/msl
github.com/hajimehoshi/ebiten/v2/internal/thread
github.com/hajimehoshi/ebiten/v2/internal/ui
github.com/hajimehoshi/ebiten/v2/internal/vibrate
github.com/hajimehoshi/ebiten/v2/internal/winver
# github.com/hajimehoshi/oto v0.7.1 # github.com/hajimehoshi/oto v0.7.1
## explicit; go 1.13 ## explicit; go 1.13
github.com/hajimehoshi/oto github.com/hajimehoshi/oto
@ -25,6 +102,12 @@ github.com/hajimehoshi/oto/internal/mux
# github.com/icza/bitio v1.0.0 # github.com/icza/bitio v1.0.0
## explicit; go 1.13 ## explicit; go 1.13
github.com/icza/bitio github.com/icza/bitio
# github.com/jezek/xgb v1.1.1
## explicit; go 1.11
github.com/jezek/xgb
github.com/jezek/xgb/randr
github.com/jezek/xgb/render
github.com/jezek/xgb/xproto
# github.com/jftuga/geodist v1.0.0 # github.com/jftuga/geodist v1.0.0
## explicit; go 1.17 ## explicit; go 1.17
github.com/jftuga/geodist github.com/jftuga/geodist
@ -46,21 +129,38 @@ github.com/mewkiz/flac/meta
## explicit; go 1.12 ## explicit; go 1.12
github.com/mewkiz/pkg/errutil github.com/mewkiz/pkg/errutil
github.com/mewkiz/pkg/term github.com/mewkiz/pkg/term
# github.com/mmcloughlin/globe v0.0.0-20240209192953-d41128bd4632
## explicit; go 1.10
github.com/mmcloughlin/globe
# github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d # github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d
## explicit ## explicit
github.com/nu7hatch/gouuid github.com/nu7hatch/gouuid
# github.com/pkg/errors v0.9.1 # github.com/pkg/errors v0.9.1
## explicit ## explicit
github.com/pkg/errors github.com/pkg/errors
# github.com/pmezard/go-difflib v1.0.0
## explicit
github.com/pmezard/go-difflib/difflib
# github.com/pymaxion/geographiclib-go v1.1.0
## explicit; go 1.17
github.com/pymaxion/geographiclib-go/geodesic
github.com/pymaxion/geographiclib-go/geodesic/capabilities
# github.com/sqweek/dialog v0.0.0-20240226140203-065105509627 # github.com/sqweek/dialog v0.0.0-20240226140203-065105509627
## explicit ## explicit
github.com/sqweek/dialog github.com/sqweek/dialog
github.com/sqweek/dialog/cocoa github.com/sqweek/dialog/cocoa
# github.com/stretchr/testify v1.8.4
## explicit; go 1.20
github.com/stretchr/testify/assert
github.com/stretchr/testify/require
# github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af # github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af
## explicit ## explicit
github.com/tadvi/systray github.com/tadvi/systray
# golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8 # github.com/tidwall/pinhole v0.0.0-20210130162507-d8644a7c3d19
## explicit ## explicit
github.com/tidwall/pinhole
# golang.org/x/exp/shiny v0.0.0-20250215185904-eff6e970281f
## explicit; go 1.23.0
golang.org/x/exp/shiny/driver/gldriver golang.org/x/exp/shiny/driver/gldriver
golang.org/x/exp/shiny/driver/internal/drawer golang.org/x/exp/shiny/driver/internal/drawer
golang.org/x/exp/shiny/driver/internal/errscreen golang.org/x/exp/shiny/driver/internal/errscreen
@ -69,11 +169,20 @@ golang.org/x/exp/shiny/driver/internal/lifecycler
golang.org/x/exp/shiny/driver/internal/win32 golang.org/x/exp/shiny/driver/internal/win32
golang.org/x/exp/shiny/driver/internal/x11key golang.org/x/exp/shiny/driver/internal/x11key
golang.org/x/exp/shiny/screen golang.org/x/exp/shiny/screen
# golang.org/x/image v0.0.0-20190227222117-0694c2d4d067 # golang.org/x/image v0.20.0
## explicit ## explicit; go 1.18
golang.org/x/image/bmp
golang.org/x/image/ccitt
golang.org/x/image/draw
golang.org/x/image/font
golang.org/x/image/font/basicfont
golang.org/x/image/font/gofont/goregular
golang.org/x/image/math/f64 golang.org/x/image/math/f64
# golang.org/x/mobile v0.0.0-20190415191353-3e0bab5405d6 golang.org/x/image/math/fixed
## explicit; go 1.11 golang.org/x/image/tiff
golang.org/x/image/tiff/lzw
# golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a
## explicit; go 1.18
golang.org/x/mobile/app golang.org/x/mobile/app
golang.org/x/mobile/app/internal/callfn golang.org/x/mobile/app/internal/callfn
golang.org/x/mobile/event/key golang.org/x/mobile/event/key
@ -85,10 +194,33 @@ golang.org/x/mobile/event/touch
golang.org/x/mobile/geom golang.org/x/mobile/geom
golang.org/x/mobile/gl golang.org/x/mobile/gl
golang.org/x/mobile/internal/mobileinit golang.org/x/mobile/internal/mobileinit
# golang.org/x/sys v0.18.0 # golang.org/x/sync v0.8.0
## explicit; go 1.18 ## explicit; go 1.18
golang.org/x/sync/errgroup
# golang.org/x/sys v0.25.0
## explicit; go 1.18
golang.org/x/sys/unix
golang.org/x/sys/windows golang.org/x/sys/windows
golang.org/x/sys/windows/registry golang.org/x/sys/windows/registry
# gonum.org/v1/gonum v0.15.1
## explicit; go 1.22
gonum.org/v1/gonum/blas
gonum.org/v1/gonum/blas/blas64
gonum.org/v1/gonum/blas/cblas128
gonum.org/v1/gonum/blas/gonum
gonum.org/v1/gonum/floats
gonum.org/v1/gonum/floats/scalar
gonum.org/v1/gonum/internal/asm/c128
gonum.org/v1/gonum/internal/asm/c64
gonum.org/v1/gonum/internal/asm/f32
gonum.org/v1/gonum/internal/asm/f64
gonum.org/v1/gonum/internal/cmplx64
gonum.org/v1/gonum/internal/math32
gonum.org/v1/gonum/interp
gonum.org/v1/gonum/lapack
gonum.org/v1/gonum/lapack/gonum
gonum.org/v1/gonum/lapack/lapack64
gonum.org/v1/gonum/mat
# gopkg.in/yaml.v3 v3.0.1 # gopkg.in/yaml.v3 v3.0.1
## explicit ## explicit
gopkg.in/yaml.v3 gopkg.in/yaml.v3

View File

@ -5,6 +5,8 @@ import (
"fmt" "fmt"
"hayai/config" "hayai/config"
"hayai/constants" "hayai/constants"
"hayai/jmaeew"
"hayai/render"
"hayai/seismo" "hayai/seismo"
"hayai/utils" "hayai/utils"
"log" "log"
@ -25,63 +27,6 @@ import (
//go:embed assets/alertv3-sat.flac //go:embed assets/alertv3-sat.flac
var alertSoundFile embed.FS var alertSoundFile embed.FS
type TypeMessage struct {
Type string
}
type Issue struct {
Source string
Status string
}
type Accuracy struct {
Epicenter string
Depth string
Magnitude string
}
type MaxIntChange struct {
String string
Reason string
}
type WarnArea struct {
Chiiki string
Shindo1 string
Shindo2 string
Time string
Type string
Arrive bool
}
type JMAEEW struct {
Type string
Title string
CodeType string
Issue Issue
EventID string
Serial int
AnnouncedTime string
OriginTime string
Hypocenter string
Latitude float64
Longitude float64
Magunitude float64
Depth int
MaxIntensity string
Accuracy Accuracy
MaxIntChange MaxIntChange
WarnArea []WarnArea
IsSea bool
IsTraining bool
IsAssumption bool
IsWarn bool
IsFinal bool
IsCancel bool
OriginalText string
Pond string
}
var LastRetry time.Time var LastRetry time.Time
func Listen() { func Listen() {
@ -121,14 +66,14 @@ func Listen() {
} }
break break
} }
var typeMessage TypeMessage var typeMessage jmaeew.TypeMessage
if config.Config.TestWarning { if config.Config.TestWarning {
message = constants.TestMessage message = constants.TestMessage
} }
json.Unmarshal(message, &typeMessage) json.Unmarshal(message, &typeMessage)
if typeMessage.Type == "jma_eew" { if typeMessage.Type == "jma_eew" {
log.Printf("recv: %s", message) log.Printf("recv: %s", message)
var jmaeew JMAEEW var jmaeew jmaeew.JMAEEW
json.Unmarshal(message, &jmaeew) json.Unmarshal(message, &jmaeew)
if !jmaeew.IsWarn && config.Config.OnlyWarnings { if !jmaeew.IsWarn && config.Config.OnlyWarnings {
continue continue
@ -169,6 +114,10 @@ func Listen() {
<-donep <-donep
speaker.Close() speaker.Close()
} }
if config.Config.RenderRealtimeVis {
go render.Render(jmaeew)
}
} }
} }
} }