Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
81943b12c0 | ||
|
|
18fa7c2832 | ||
|
|
dd02bf809e | ||
|
|
2f3a1a5d79 | ||
|
|
18654cb011 | ||
|
|
5954f80645 | ||
|
|
3e36357315 | ||
|
|
a06a454ade | ||
|
|
c0fab4b41f | ||
|
|
80b79f3636 | ||
|
|
b97ae25f93 | ||
|
|
4722ea6096 | ||
|
|
3e9781033a | ||
|
|
62b296cf85 | ||
|
|
dcbaa52683 | ||
|
|
1e29f61656 | ||
|
|
89319dc7aa | ||
|
|
5755afc4ea | ||
|
|
d00c434ccc | ||
|
|
4ada59ba48 | ||
|
|
14ccc38f4c | ||
|
|
a8be299bbd | ||
|
|
2e87f5ff85 | ||
|
|
829ebba622 | ||
|
|
81019fa2a8 | ||
|
|
1bc3675548 | ||
|
|
678ec979c9 | ||
|
|
d1a48ae641 | ||
|
|
eded86bc10 | ||
|
|
5a7a49d1d5 | ||
|
|
d3de8049bf | ||
|
|
d09dd90a73 | ||
|
|
78203eb9be | ||
|
|
31c7d4e36f | ||
|
|
d3949806f5 | ||
|
|
28ff15c99e | ||
|
|
bd2c74fe90 | ||
|
|
fb6995db94 | ||
|
|
8c2c4d3282 | ||
|
|
b81392b818 | ||
|
|
ad08440023 | ||
|
|
ec17623400 | ||
|
|
288eca7849 | ||
|
|
b5f202150e | ||
|
|
539bf0cb30 | ||
|
|
9385d62c89 | ||
|
|
897f916552 | ||
|
|
914cf6753e | ||
|
|
392208057e | ||
|
|
8d2cbf806d | ||
|
|
ab5025efbf | ||
|
|
912e51d863 | ||
|
|
d1c4ca5eae | ||
|
|
16bb4a148e | ||
|
|
d7071cb67f | ||
|
|
a13fb3d7c5 | ||
|
|
85558904a4 | ||
|
|
88ed72fdc1 | ||
|
|
586a93d7aa | ||
|
|
a446699c6c | ||
|
|
f1c459fd6c | ||
|
|
752f0a988b | ||
|
|
719b266691 | ||
|
|
dcba5762c7 | ||
|
|
0757717bea | ||
|
|
a9f762aa96 | ||
|
|
db45f46d9e | ||
|
|
f00653964e | ||
|
|
e0154f9314 | ||
|
|
4408a3a354 | ||
|
|
5abf5a157d | ||
|
|
d55d5f60a5 | ||
|
|
feacf2c359 | ||
|
|
72ea1601e9 | ||
|
|
02cfd8d978 | ||
|
|
728377cba3 | ||
|
|
f2283b56b9 | ||
|
|
b515f2a599 | ||
|
|
4354b49496 | ||
|
|
994312c212 | ||
|
|
5f25e0d4e2 | ||
|
|
4bbe571f5f | ||
|
|
c58d21375c | ||
|
|
ed128c558f | ||
|
|
828932d95c | ||
|
|
42ced309d3 | ||
|
|
1fcd306879 | ||
|
|
26c9ad7f06 | ||
|
|
4b7b01ce0a | ||
|
|
6632154906 | ||
|
|
ca67c7ef43 | ||
|
|
c4039a929c | ||
|
|
a1b74e1220 | ||
|
|
01f6188824 | ||
|
|
283f31a734 | ||
|
|
b800ce9ebe | ||
|
|
eb9d54465c | ||
|
|
eb9e1f81d4 | ||
|
|
ddfbd70b55 | ||
|
|
51e9ab83ad | ||
|
|
5ed7e03b2e | ||
|
|
0cb8d5b12f | ||
|
|
b4548c1af2 | ||
|
|
0a396f3112 | ||
|
|
2aa18dc88f | ||
|
|
8d89983eeb | ||
|
|
573c470965 | ||
|
|
daa0c751e2 | ||
|
|
e1babefc80 | ||
|
|
ce99b0e162 | ||
|
|
4c3a23b1bd | ||
|
|
12016af326 | ||
|
|
fc9871b075 | ||
|
|
3cb3c1c6d8 | ||
|
|
8fe3474589 | ||
|
|
dc3c565ec0 | ||
|
|
350c7d7081 | ||
|
|
0428bc8fe3 | ||
|
|
514a8575a2 | ||
|
|
fc11377552 | ||
|
|
fbaa70a2ae | ||
|
|
f30c11ddf4 | ||
|
|
51c4ecc879 | ||
|
|
080421f2fb | ||
|
|
8cc61ca8b8 | ||
|
|
400754c5b3 | ||
|
|
05e82c24f8 | ||
|
|
97c15c7876 | ||
|
|
36e7cc8e89 | ||
|
|
ad2ce4de53 | ||
|
|
2a28f7c4d2 | ||
|
|
0cdbe080a6 | ||
|
|
96fe1a7da1 | ||
|
|
4f73af2920 | ||
|
|
7ca4e49bf5 | ||
|
|
dfa63297fc | ||
|
|
402e8c1897 | ||
|
|
33e814122e | ||
|
|
f28a4df5ee | ||
|
|
417aa2815c | ||
|
|
2fdabe37aa | ||
|
|
d8270dfb6a | ||
|
|
b75f662c41 | ||
|
|
0d9d0845f5 | ||
|
|
5d66a1f298 | ||
|
|
9bf52eb63a | ||
|
|
0c9d72a9a1 | ||
|
|
c2c2bd2df6 | ||
|
|
78fc594d84 | ||
|
|
53b1e7c573 | ||
|
|
c14404a7c1 | ||
|
|
96e6750f9c | ||
|
|
dbafd05a4e | ||
|
|
d7fd578cc3 | ||
|
|
0e8572e1db | ||
|
|
98a997bd8e | ||
|
|
6fbc95cc41 | ||
|
|
1852f74e8b | ||
|
|
55e3e16860 | ||
|
|
7cf2a55b43 | ||
|
|
c41cbbd2da | ||
|
|
7283bb046b | ||
|
|
dd2df6cbcf | ||
|
|
01f1cac811 | ||
|
|
aaa112c3f3 | ||
|
|
dc0fa9c64d | ||
|
|
f749b38aa2 | ||
|
|
43d79673e1 | ||
|
|
fc841f572c | ||
|
|
df9f117a08 | ||
|
|
bedc46a1be | ||
|
|
a7c6095be5 | ||
|
|
f2d5cf785e | ||
|
|
f926ad9b5e | ||
|
|
68acf969f2 | ||
|
|
65d53e800b | ||
|
|
e44d8ac7e9 | ||
|
|
d1823dd6e1 | ||
|
|
80bfd3b8e9 | ||
|
|
07128cc7fe | ||
|
|
0892f0b0bb | ||
|
|
8cf7f3ac08 | ||
|
|
ab2bb51879 | ||
|
|
8cb98b5365 | ||
|
|
782c5f8a34 | ||
|
|
d6b5c5f63e | ||
|
|
ef6dfa6d91 | ||
|
|
3840ee8ee7 | ||
|
|
f47e40fa2a | ||
|
|
49a4a61876 | ||
|
|
669c1a6f0d | ||
|
|
15342190fa | ||
|
|
c98ef6e8a9 | ||
|
|
d36d5936da | ||
|
|
70de75ae3d | ||
|
|
ea62e33e51 | ||
|
|
524e92c81a | ||
|
|
d5a26b1d70 | ||
|
|
cd7649a666 | ||
|
|
847cc0a38a | ||
|
|
3588eb9bf8 | ||
|
|
296e22d3ca | ||
|
|
923e590da1 | ||
|
|
e56329d05a | ||
|
|
2452e80e57 | ||
|
|
b9019831a9 | ||
|
|
b3b49b440e | ||
|
|
cbedf0f74f | ||
|
|
6c980eba68 | ||
|
|
e9f766904e | ||
|
|
62d76c006d | ||
|
|
615b78a612 | ||
|
|
aaf0340d6c | ||
|
|
93ea437760 | ||
|
|
fe6a1244ed | ||
|
|
953858b0e7 | ||
|
|
f3da46833f | ||
|
|
ba2488b6e2 | ||
|
|
4e7e0d67e5 | ||
|
|
faa16b207c | ||
|
|
2d9f62761c | ||
|
|
60689f531d | ||
|
|
3f97692311 | ||
|
|
81221336f4 | ||
|
|
ecfc758ce4 | ||
|
|
2cb3a132c6 | ||
|
|
519473e498 | ||
|
|
9b271d918a | ||
|
|
5b4d874851 | ||
|
|
9dc1dbc002 | ||
|
|
7ee323f0d5 | ||
|
|
4bb6f711b9 | ||
|
|
816cec8f5c | ||
|
|
2394dfe88a | ||
|
|
dfc0d2303b | ||
|
|
598a48ec50 | ||
|
|
9f41e98e3f | ||
|
|
489891ff3c | ||
|
|
a44ed0b047 | ||
|
|
1aaa97b91d | ||
|
|
13d68e789f | ||
|
|
10dae7482c | ||
|
|
979de190dc | ||
|
|
46bcbda972 | ||
|
|
43bdc353fb | ||
|
|
6314676b9c | ||
|
|
9f77f3d968 | ||
|
|
f4733dbbe8 | ||
|
|
61fc0e4893 | ||
|
|
652ad86cad | ||
|
|
60f308bd76 | ||
|
|
b2113ff95b | ||
|
|
b8188a46a9 | ||
|
|
e790b0761e | ||
|
|
fa3317f6cd | ||
|
|
b080f7a81c | ||
|
|
57a1c5eb76 | ||
|
|
5b7e2521cc | ||
|
|
fced653c1c | ||
|
|
9253e6ac5e | ||
|
|
aff2ed22b9 | ||
|
|
5520a52379 | ||
|
|
505050e936 | ||
|
|
0437835bde | ||
|
|
77386f8dfc | ||
|
|
529fdf0341 | ||
|
|
fa74700ad9 | ||
|
|
caca491943 | ||
|
|
4794f44a6d | ||
|
|
f0119b1231 | ||
|
|
4c579aa826 | ||
|
|
b9463b3c0e | ||
|
|
cede6ce8a9 | ||
|
|
956e6e3638 | ||
|
|
b282c7d815 | ||
|
|
5b6142e2d9 | ||
|
|
58313ad8fc | ||
|
|
7aff148e9f | ||
|
|
ee5c61fb74 | ||
|
|
91be6c8028 | ||
|
|
2e0bd2ec28 | ||
|
|
a0151fbc04 | ||
|
|
d853782fea | ||
|
|
c6638a7154 | ||
|
|
4abebe3aec | ||
|
|
5aed8f928a | ||
|
|
afe6cfc383 | ||
|
|
174983ce1e | ||
|
|
1313c7b3bf | ||
|
|
bee622bcad | ||
|
|
8cefdeae49 | ||
|
|
7cf70b9607 | ||
|
|
add4b582b5 | ||
|
|
b419d21940 | ||
|
|
227ff4e13a | ||
|
|
8e6e70683e | ||
|
|
626f0aec6a |
@@ -1,10 +1,10 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us address issues in Moonlight
|
||||
about: Ask for help on Discord before reporting a bug
|
||||
|
||||
---
|
||||
**READ ME FIRST!**
|
||||
This issue tracker is not the right place to ask for troubleshooting help if you're not able to connect or stream at all. For those requests, please use the #pc-help channel on our Discord server where there are many more people who can help (or direct you back here if it looks like a Moonlight bug after all). https://discord.gg/MySTSdq
|
||||
This issue tracker is not the right place to ask for troubleshooting help if you're not able to connect or stream at all. For those requests, please use the #pc-help channel on our Discord server where there are many more people who can help (or direct you back here if it looks like a Moonlight bug after all). https://moonlight-stream.org/discord
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
blank_issues_enabled: false
|
||||
@@ -1,4 +1,4 @@
|
||||
issuesOpened: >
|
||||
If this is a question about Moonlight or you need help troubleshooting a streaming problem, please use the help channels on our [Discord server](https://discord.gg/MySTSdq) instead of GitHub issues. There are many more people available on Discord to help you and answer your questions.<br /><br />
|
||||
If this is a question about Moonlight or you need help troubleshooting a streaming problem, please use the help channels on our [Discord server](https://moonlight-stream.org/discord) instead of GitHub issues. There are many more people available on Discord to help you and answer your questions.<br /><br />
|
||||
This issue tracker should only be used for specific bugs or feature requests.<br /><br />
|
||||
Thank you, and happy streaming!
|
||||
|
||||
-72
@@ -1,72 +0,0 @@
|
||||
language: cpp
|
||||
|
||||
git:
|
||||
depth: 1
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: osx
|
||||
osx_image: xcode10.2
|
||||
compiler: clang
|
||||
env: TRAVIS_TARGET=osx
|
||||
addons:
|
||||
homebrew:
|
||||
packages:
|
||||
- qt
|
||||
- os: linux
|
||||
sudo: required
|
||||
dist: xenial
|
||||
compiler: gcc
|
||||
env: TRAVIS_TARGET=steamlink
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libc6:i386
|
||||
- libstdc++6:i386
|
||||
- os: linux
|
||||
sudo: required
|
||||
dist: bionic
|
||||
compiler: gcc
|
||||
env: TRAVIS_TARGET=linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:savoury1/multimedia'
|
||||
- sourceline: 'ppa:savoury1/ffmpeg4'
|
||||
packages:
|
||||
- qt5-default
|
||||
- qtbase5-dev
|
||||
- qtquickcontrols2-5-dev
|
||||
- libqt5svg5-dev
|
||||
- libgl1-mesa-dev
|
||||
- libegl1-mesa-dev
|
||||
- libxkbcommon-dev
|
||||
- wayland-protocols
|
||||
- libopus-dev
|
||||
- libva-dev
|
||||
- libvdpau-dev
|
||||
- libsdl2-dev
|
||||
- qtdeclarative5-dev
|
||||
- libssl-dev
|
||||
- libsdl2-ttf-dev
|
||||
- libavcodec-dev
|
||||
- libavutil-dev
|
||||
|
||||
install:
|
||||
- '[ "$TRAVIS_TARGET" != osx ] || brew link --force qt'
|
||||
- if [[ "$TRAVIS_TARGET" = "osx" ]]; then nvm use node && npm install --global create-dmg; fi
|
||||
- if [[ "$TRAVIS_TARGET" = "steamlink" ]]; then git clone --depth=1 https://github.com/ValveSoftware/steamlink-sdk.git $HOME/steamlink-sdk; fi
|
||||
|
||||
before_script:
|
||||
- '[ "$TRAVIS_TARGET" = "steamlink" ] || qmake -v'
|
||||
- '[[ "$TRAVIS_TARGET" != linux || "$CXX" != clang++ ]] || export QMAKESPEC=linux-clang'
|
||||
- '[[ "$TRAVIS_TARGET" != linux || "$CXX" != g++ ]] || export QMAKESPEC=linux-g++'
|
||||
- '[ "$TRAVIS_TARGET" != osx ] || export QMAKESPEC=macx-clang'
|
||||
- '[ "$TRAVIS_TARGET" != "steamlink" ] || export STEAMLINK_SDK_PATH=$HOME/steamlink-sdk'
|
||||
|
||||
script:
|
||||
- '[ "$TRAVIS_TARGET" != "linux" ] || qmake moonlight-qt.pro -spec $QMAKESPEC'
|
||||
- '[ "$TRAVIS_TARGET" != "linux" ] || make -j$(nproc) debug'
|
||||
- '[ "$TRAVIS_TARGET" != "linux" ] || make -j$(nproc) release'
|
||||
- '[ "$TRAVIS_TARGET" != "osx" ] || scripts/generate-dmg.sh Release'
|
||||
- '[ "$TRAVIS_TARGET" != "steamlink" ] || scripts/build-steamlink-app.sh'
|
||||
@@ -131,17 +131,22 @@ private:
|
||||
static LoadLibraryExWFunc s_RealLoadLibraryExW;
|
||||
|
||||
static constexpr LPCWSTR k_BlacklistedDlls[] = {
|
||||
// This DLL shipped with ASUS Sonic Radar 3 improperly handles
|
||||
// D3D9 exclusive fullscreen in a way that causes CreateDeviceEx()
|
||||
// to deadlock. https://github.com/moonlight-stream/moonlight-qt/issues/102
|
||||
L"NahimicOSD.dll",
|
||||
// These A-Volute DLLs shipped with various audio driver packages improperly handle
|
||||
// D3D9 exclusive fullscreen in a way that causes CreateDeviceEx() to deadlock.
|
||||
// https://github.com/moonlight-stream/moonlight-qt/issues/102
|
||||
L"NahimicOSD.dll", // ASUS Sonic Radar 3
|
||||
L"SSAudioOSD.dll", // SteelSeries headsets
|
||||
L"SS2OSD.dll", // ASUS Sonic Studio 2
|
||||
L"Nahimic2OSD.dll",
|
||||
L"NahimicMSIOSD.dll",
|
||||
L"nhAsusPhoebusOSD.dll" // ASUS Phoebus
|
||||
|
||||
// This DLL has been seen in several crash reports. Some Googling
|
||||
// suggests it's highly unstable and causes issues in many games.
|
||||
L"EZFRD32.dll",
|
||||
L"EZFRD64.dll",
|
||||
|
||||
// These are the dList DLLs for Optimus hybrid graphics DDI.
|
||||
// These are the newer dList DLLs for Optimus hybrid graphics DDI.
|
||||
// https://docs.microsoft.com/en-us/windows-hardware/drivers/display/hybrid-system-ddi
|
||||
//
|
||||
// We forcefully block them from loading because Optimus has a bug that
|
||||
@@ -152,6 +157,33 @@ private:
|
||||
L"nvdlist.dll",
|
||||
L"nvdlistx.dll",
|
||||
|
||||
// These are the older dList/AppInit DLLs for Optimus hybrid graphics DDI.
|
||||
// https://docs.microsoft.com/en-us/windows-hardware/drivers/display/hybrid-system-ddi
|
||||
//
|
||||
// These seem to cause a crash in PresentEx() in full-screen exclusive mode.
|
||||
// This block will prevent Optimus from ever using the dGPU even if the user has requested it.
|
||||
// https://github.com/moonlight-stream/moonlight-qt/issues/386
|
||||
//
|
||||
// d3d9!CSwapChain::BltToHybridPrimary+0x200:
|
||||
// 00007ffa`23f37e58 488b01 mov rax,qword ptr [rcx] ds:00000000`00000038=????????????????
|
||||
// 00 0000004e`496ff4e0 00007ffa`23f39e2c d3d9!CSwapChain::BltToHybridPrimary+0x200
|
||||
// 01 0000004e`496ff880 00007ffa`23ee39ce d3d9!CSwapChain::FlipToSurface+0x15c
|
||||
// 02 0000004e`496ff900 00007ffa`23f4dd75 d3d9!CSwapChain::PresentMain+0x3e13e
|
||||
// 03 0000004e`496ffab0 00007ffa`23f4dccd d3d9!CBaseDevice::PresentMain+0x9d
|
||||
// 04 0000004e`496ffb00 00007ff7`8e31016f d3d9!CBaseDevice::PresentEx+0xbd
|
||||
// 05 0000004e`496ffb50 00007ff7`8e30df1e Moonlight!DXVA2Renderer::renderFrame+0x61f [C:\moonlight-qt\app\streaming\video\ffmpeg-renderers\dxva2.cpp @ 1035]
|
||||
// 06 0000004e`496ffd50 00007ff7`8e30e46a Moonlight!Pacer::renderFrame+0x3e [C:\moonlight-qt\app\streaming\video\ffmpeg-renderers\pacer\pacer.cpp @ 265]
|
||||
// 07 (Inline Function) --------`-------- Moonlight!Pacer::renderLastFrameAndUnlock+0x197 [C:\moonlight-qt\app\streaming\video\ffmpeg-renderers\pacer\pacer.cpp @ 156]
|
||||
// 08 0000004e`496ffda0 00007ffa`14476978 Moonlight!Pacer::renderThread+0x1ca [C:\moonlight-qt\app\streaming\video\ffmpeg-renderers\pacer\pacer.cpp @ 88]
|
||||
// 09 0000004e`496ffde0 00007ffa`14476ee2 SDL2!SDL_RunThread+0x38 [C:\Users\camer\SDL\src\thread\SDL_thread.c @ 276]
|
||||
// 0a 0000004e`496ffe10 00007ffa`2aae0e82 SDL2!RunThread+0x12 [C:\Users\camer\SDL\src\thread\windows\SDL_systhread.c @ 83]
|
||||
// 0b 0000004e`496ffe40 00007ffa`2d627bd4 ucrtbase!thread_start<unsigned int (__cdecl*)(void *),1>+0x42
|
||||
// 0c 0000004e`496ffe70 00007ffa`2da4ce51 kernel32!BaseThreadInitThunk+0x14
|
||||
// 0d 0000004e`496ffea0 00000000`00000000 ntdll!RtlUserThreadStart+0x21
|
||||
//
|
||||
L"nvinit.dll",
|
||||
L"nvinitx.dll",
|
||||
|
||||
// In some unknown circumstances, RTSS tries to hook in the middle of an instruction, leaving garbage
|
||||
// code inside d3d9.dll that causes a crash when executed:
|
||||
//
|
||||
|
||||
@@ -4,31 +4,33 @@
|
||||
|
||||
Moonlight also has mobile versions for [Android](https://github.com/moonlight-stream/moonlight-android) and [iOS](https://github.com/moonlight-stream/moonlight-ios).
|
||||
|
||||
You can follow development on our [Discord server](https://discord.gg/6ERtzFY).
|
||||
You can follow development on our [Discord server](https://moonlight-stream.org/discord).
|
||||
|
||||
[](https://ci.appveyor.com/project/cgutman/moonlight-qt/branch/master)
|
||||
[](https://travis-ci.org/moonlight-stream/moonlight-qt)
|
||||
[](https://ci.appveyor.com/project/cgutman/moonlight-qt/branch/master)
|
||||
[](https://github.com/moonlight-stream/moonlight-qt/releases)
|
||||
|
||||
## Features
|
||||
- Hardware accelerated video decoding on Windows, Mac, and Linux
|
||||
- Supports streaming at up to 120 FPS (high refresh rate monitor recommended)
|
||||
- Supports streaming at 720p, 1080p, 1440p, 4K, and the client PC's native screen resolution
|
||||
- 5.1 surround sound audio
|
||||
- 7.1 surround sound audio support
|
||||
- Support for both pointer capture (for games) and direct mouse control (for remote desktop)
|
||||
- Direct touchscreen mouse control
|
||||
- HEVC support for better image quality at reduced bandwidth
|
||||
- Keyboard and mouse support
|
||||
- Gamepad support with force feedback for up to 4 players
|
||||
|
||||
## Downloads
|
||||
- [Windows, macOS, and Steam Link](https://github.com/moonlight-stream/moonlight-qt/releases)
|
||||
- [Snap (for Ubuntu-based Linux distros)](https://snapcraft.io/moonlight)
|
||||
- [Flatpak (for other Linux distros)](https://flathub.org/apps/details/com.moonlight_stream.Moonlight)
|
||||
- [AppImage](https://github.com/moonlight-stream/moonlight-qt/releases)
|
||||
- [Raspberry Pi 4](https://github.com/moonlight-stream/moonlight-docs/wiki/Installing-Moonlight-Qt-on-Raspberry-Pi-4)
|
||||
- [NVIDIA Jetson and Nintendo Switch (Ubuntu L4T)](https://github.com/moonlight-stream/moonlight-docs/wiki/Installing-Moonlight-Qt-on-Linux4Tegra-(L4T)-Ubuntu)
|
||||
|
||||
## Building
|
||||
### General Build Requirements
|
||||
* Qt 5.9 SDK or later
|
||||
|
||||
### Windows-specific Build Requirements
|
||||
### Windows Build Requirements
|
||||
* Qt 5.12.4 SDK or later
|
||||
* Windows 7 or later
|
||||
* [Visual Studio](https://visualstudio.microsoft.com/downloads/) 2017 (Community edition is fine)
|
||||
* Select MSVC Desktop toolchain during Qt installation
|
||||
@@ -36,17 +38,19 @@ You can follow development on our [Discord server](https://discord.gg/6ERtzFY).
|
||||
* [7-Zip](https://www.7-zip.org/) (only if building installers for non-development PCs)
|
||||
* [WiX Toolset](http://wixtoolset.org/releases/) v3.11 or later (only if building installers for non-development PCs)
|
||||
|
||||
### Mac-specific Build Requirements
|
||||
* macOS Sierra (10.12) or later
|
||||
* Xcode 10
|
||||
### macOS Build Requirements
|
||||
* Qt 5.14 SDK or later
|
||||
* macOS High Sierra (10.13) or later
|
||||
* Xcode 11
|
||||
* [create-dmg](https://github.com/sindresorhus/create-dmg) (only if building DMGs for use on non-development Macs)
|
||||
|
||||
### Linux-specific Build Requirements
|
||||
### Linux/Unix Build Requirements
|
||||
* Qt 5.9 SDK or later
|
||||
* GCC or Clang
|
||||
* Install your distro equivalents of: `openssl-devel qt5-devel SDL2-devel ffmpeg-devel qt5-qtquickcontrols2-devel libva-devel libvdpau-devel opus-devel pulseaudio-libs-devel alsa-lib-devel SDL2_ttf-devel`
|
||||
* FFmpeg 4.0 is required to build. If your distro doesn't package FFmpeg 4.0, you can build and install it from source on http://ffmpeg.org/
|
||||
|
||||
### Steam Link-specific Build Requirements
|
||||
### Steam Link Build Requirements
|
||||
* [Steam Link SDK](https://github.com/ValveSoftware/steamlink-sdk) cloned on your build system
|
||||
* STEAMLINK_SDK_PATH environment variable set to the Steam Link SDK path
|
||||
|
||||
|
||||
+1
-1
Submodule app/SDL_GameControllerDB updated: aeebc86f9f...7518c26389
+36
-19
@@ -46,7 +46,7 @@ win32 {
|
||||
LIBS += -L$$(DXSDK_DIR)/Lib/x64
|
||||
}
|
||||
|
||||
LIBS += ws2_32.lib winmm.lib dxva2.lib ole32.lib gdi32.lib user32.lib d3d9.lib dwmapi.lib dbghelp.lib
|
||||
LIBS += ws2_32.lib winmm.lib dxva2.lib ole32.lib gdi32.lib user32.lib d3d9.lib dwmapi.lib dbghelp.lib qwave.lib
|
||||
}
|
||||
macx {
|
||||
INCLUDEPATH += $$PWD/../libs/mac/include
|
||||
@@ -59,20 +59,6 @@ unix:!macx {
|
||||
CONFIG += link_pkgconfig
|
||||
PKGCONFIG += openssl sdl2 SDL2_ttf opus
|
||||
|
||||
# SLAudio is used on Steam Link
|
||||
!config_SL {
|
||||
CONFIG += soundio
|
||||
}
|
||||
|
||||
soundio {
|
||||
packagesExist(libpulse) {
|
||||
PKGCONFIG += libpulse
|
||||
}
|
||||
packagesExist(alsa) {
|
||||
PKGCONFIG += alsa
|
||||
}
|
||||
}
|
||||
|
||||
packagesExist(libavcodec) {
|
||||
PKGCONFIG += libavcodec libavutil
|
||||
CONFIG += ffmpeg
|
||||
@@ -104,6 +90,16 @@ unix:!macx {
|
||||
CONFIG += libdrm
|
||||
}
|
||||
}
|
||||
|
||||
packagesExist(wayland-client) {
|
||||
DEFINES += HAS_WAYLAND
|
||||
PKGCONFIG += wayland-client
|
||||
}
|
||||
|
||||
packagesExist(x11) {
|
||||
DEFINES += HAS_X11
|
||||
PKGCONFIG += x11
|
||||
}
|
||||
}
|
||||
win32 {
|
||||
LIBS += -llibssl -llibcrypto -lSDL2 -lSDL2_ttf -lavcodec -lavutil -lopus -ld3dx9
|
||||
@@ -123,6 +119,7 @@ macx {
|
||||
}
|
||||
|
||||
SOURCES += \
|
||||
backend/nvapp.cpp \
|
||||
main.cpp \
|
||||
backend/computerseeker.cpp \
|
||||
backend/identitymanager.cpp \
|
||||
@@ -136,7 +133,12 @@ SOURCES += \
|
||||
cli/quitstream.cpp \
|
||||
cli/startstream.cpp \
|
||||
settings/streamingpreferences.cpp \
|
||||
streaming/input.cpp \
|
||||
streaming/input/abstouch.cpp \
|
||||
streaming/input/gamepad.cpp \
|
||||
streaming/input/input.cpp \
|
||||
streaming/input/keyboard.cpp \
|
||||
streaming/input/mouse.cpp \
|
||||
streaming/input/reltouch.cpp \
|
||||
streaming/session.cpp \
|
||||
streaming/audio/audio.cpp \
|
||||
streaming/audio/renderers/sdlaud.cpp \
|
||||
@@ -148,9 +150,11 @@ SOURCES += \
|
||||
settings/mappingmanager.cpp \
|
||||
gui/sdlgamepadkeynavigation.cpp \
|
||||
streaming/video/overlaymanager.cpp \
|
||||
backend/systemproperties.cpp
|
||||
backend/systemproperties.cpp \
|
||||
wm.cpp
|
||||
|
||||
HEADERS += \
|
||||
backend/nvapp.h \
|
||||
utils.h \
|
||||
backend/computerseeker.h \
|
||||
backend/identitymanager.h \
|
||||
@@ -164,7 +168,7 @@ HEADERS += \
|
||||
cli/quitstream.h \
|
||||
cli/startstream.h \
|
||||
settings/streamingpreferences.h \
|
||||
streaming/input.h \
|
||||
streaming/input/input.h \
|
||||
streaming/session.h \
|
||||
streaming/audio/renderers/renderer.h \
|
||||
streaming/audio/renderers/sdl.h \
|
||||
@@ -246,6 +250,16 @@ libdrm {
|
||||
SOURCES += streaming/video/ffmpeg-renderers/drm.cpp
|
||||
HEADERS += streaming/video/ffmpeg-renderers/drm.h
|
||||
}
|
||||
config_EGL {
|
||||
message(EGL renderer selected)
|
||||
|
||||
CONFIG += egl
|
||||
DEFINES += HAVE_EGL
|
||||
SOURCES += \
|
||||
streaming/video/ffmpeg-renderers/eglvid.cpp \
|
||||
streaming/video/ffmpeg-renderers/egl_extensions.cpp
|
||||
HEADERS += streaming/video/ffmpeg-renderers/eglvid.h
|
||||
}
|
||||
config_SL {
|
||||
message(Steam Link build configuration selected)
|
||||
|
||||
@@ -387,7 +401,10 @@ macx {
|
||||
APP_BUNDLE_FRAMEWORKS.files = $$files(../libs/mac/Frameworks/*.framework, true) $$files(../libs/mac/lib/*.dylib, true)
|
||||
APP_BUNDLE_FRAMEWORKS.path = Contents/Frameworks
|
||||
|
||||
QMAKE_BUNDLE_DATA += APP_BUNDLE_RESOURCES APP_BUNDLE_FRAMEWORKS
|
||||
APP_BUNDLE_PLIST.files = $$OUT_PWD/Info.plist
|
||||
APP_BUNDLE_PLIST.path = Contents
|
||||
|
||||
QMAKE_BUNDLE_DATA += APP_BUNDLE_RESOURCES APP_BUNDLE_FRAMEWORKS APP_BUNDLE_PLIST
|
||||
|
||||
QMAKE_RPATHDIR += @executable_path/../Frameworks
|
||||
}
|
||||
|
||||
@@ -28,7 +28,15 @@ AutoUpdateChecker::AutoUpdateChecker(QObject *parent) :
|
||||
|
||||
void AutoUpdateChecker::start()
|
||||
{
|
||||
#if defined(Q_OS_WIN32) || defined(Q_OS_DARWIN) || defined(STEAM_LINK) // Only run update checker on platforms without auto-update
|
||||
#if defined(Q_OS_WIN32) || defined(Q_OS_DARWIN) || defined(STEAM_LINK) || defined(APP_IMAGE) // Only run update checker on platforms without auto-update
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) && QT_VERSION < QT_VERSION_CHECK(5, 15, 1) && !defined(QT_NO_BEARERMANAGEMENT)
|
||||
// HACK: Set network accessibility to work around QTBUG-80947 (introduced in Qt 5.14.0 and fixed in Qt 5.15.1)
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
m_Nam.setNetworkAccessible(QNetworkAccessManager::Accessible);
|
||||
QT_WARNING_POP
|
||||
#endif
|
||||
|
||||
// We'll get a callback when this is finished
|
||||
QUrl url("https://moonlight-stream.org/updates/qt.json");
|
||||
m_Nam.get(QNetworkRequest(url));
|
||||
@@ -45,8 +53,10 @@ void AutoUpdateChecker::parseStringToVersionQuad(QString& string, QVector<int>&
|
||||
|
||||
QString AutoUpdateChecker::getPlatform()
|
||||
{
|
||||
#ifdef STEAM_LINK
|
||||
#if defined(STEAM_LINK)
|
||||
return QStringLiteral("steamlink");
|
||||
#elif defined(APP_IMAGE)
|
||||
return QStringLiteral("appimage");
|
||||
#else
|
||||
return QSysInfo::productType();
|
||||
#endif
|
||||
|
||||
@@ -71,10 +71,10 @@ private:
|
||||
|
||||
QUrl BoxArtManager::loadBoxArt(NvComputer* computer, NvApp& app)
|
||||
{
|
||||
// Try to open the cached file
|
||||
QString cacheFilePath = getFilePathForBoxArt(computer, app.id);
|
||||
if (QFile::exists(cacheFilePath)) {
|
||||
return QUrl::fromLocalFile(cacheFilePath);
|
||||
// Try to open the cached file if it exists and contains data
|
||||
QFile cacheFile(getFilePathForBoxArt(computer, app.id));
|
||||
if (cacheFile.exists() && cacheFile.size() > 0) {
|
||||
return QUrl::fromLocalFile(cacheFile.fileName());
|
||||
}
|
||||
|
||||
// If we get here, we need to fetch asynchronously.
|
||||
@@ -87,6 +87,16 @@ QUrl BoxArtManager::loadBoxArt(NvComputer* computer, NvApp& app)
|
||||
return QUrl("qrc:/res/no_app_image.png");
|
||||
}
|
||||
|
||||
void BoxArtManager::deleteBoxArt(NvComputer* computer)
|
||||
{
|
||||
QDir dir(Path::getBoxArtCacheDir());
|
||||
|
||||
// Delete everything in this computer's box art directory
|
||||
if (dir.cd(computer->uuid)) {
|
||||
dir.removeRecursively();
|
||||
}
|
||||
}
|
||||
|
||||
void BoxArtManager::handleBoxArtLoadComplete(NvComputer* computer, NvApp app, QUrl image)
|
||||
{
|
||||
if (!image.isEmpty()) {
|
||||
@@ -109,6 +119,10 @@ QUrl BoxArtManager::loadBoxArtFromNetwork(NvComputer* computer, int appId)
|
||||
if (image.save(cachePath)) {
|
||||
return QUrl::fromLocalFile(cachePath);
|
||||
}
|
||||
else {
|
||||
// A failed save() may leave a zero byte file. Make sure that's removed.
|
||||
QFile(cachePath).remove();
|
||||
}
|
||||
}
|
||||
|
||||
return QUrl();
|
||||
|
||||
@@ -18,6 +18,10 @@ public:
|
||||
QUrl
|
||||
loadBoxArt(NvComputer* computer, NvApp& app);
|
||||
|
||||
static
|
||||
void
|
||||
deleteBoxArt(NvComputer* computer);
|
||||
|
||||
signals:
|
||||
void
|
||||
boxArtLoadComplete(NvComputer* computer, NvApp app, QUrl image);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "computermanager.h"
|
||||
#include "boxartmanager.h"
|
||||
#include "nvhttp.h"
|
||||
#include "settings/streamingpreferences.h"
|
||||
|
||||
@@ -32,7 +33,7 @@ private:
|
||||
|
||||
QString serverInfo;
|
||||
try {
|
||||
serverInfo = http.getServerInfo(NvHTTP::NvLogLevel::NVLL_NONE);
|
||||
serverInfo = http.getServerInfo(NvHTTP::NvLogLevel::NVLL_NONE, true);
|
||||
} catch (...) {
|
||||
return false;
|
||||
}
|
||||
@@ -67,12 +68,7 @@ private:
|
||||
}
|
||||
|
||||
QWriteLocker lock(&m_Computer->lock);
|
||||
if (m_Computer->appList != appList) {
|
||||
m_Computer->appList = appList;
|
||||
m_Computer->sortAppList();
|
||||
changed = true;
|
||||
}
|
||||
|
||||
changed = m_Computer->updateAppList(appList);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -84,7 +80,7 @@ private:
|
||||
bool stateChanged = false;
|
||||
bool online = false;
|
||||
bool wasOnline = m_Computer->state == NvComputer::CS_ONLINE;
|
||||
for (int i = 0; i < TRIES_BEFORE_OFFLINING && !online; i++) {
|
||||
for (int i = 0; i < (wasOnline ? TRIES_BEFORE_OFFLINING : 1) && !online; i++) {
|
||||
for (auto& address : m_Computer->uniqueAddresses()) {
|
||||
if (isInterruptionRequested()) {
|
||||
return;
|
||||
@@ -209,9 +205,10 @@ void ComputerManager::saveHosts()
|
||||
|
||||
settings.remove(SER_HOSTS);
|
||||
settings.beginWriteArray(SER_HOSTS);
|
||||
for (int i = 0; i < m_KnownHosts.count(); i++) {
|
||||
settings.setArrayIndex(i);
|
||||
m_KnownHosts.value(m_KnownHosts.keys()[i])->serialize(settings);
|
||||
int i = 0;
|
||||
for (const NvComputer* computer : m_KnownHosts) {
|
||||
settings.setArrayIndex(i++);
|
||||
computer->serialize(settings);
|
||||
}
|
||||
settings.endArray();
|
||||
}
|
||||
@@ -398,6 +395,9 @@ public:
|
||||
// Delete the polling entry first. This will stop all polling threads too.
|
||||
delete pollingEntry;
|
||||
|
||||
// Delete cached box art
|
||||
BoxArtManager::deleteBoxArt(m_Computer);
|
||||
|
||||
// Finally, delete the computer itself. This must be done
|
||||
// last because the polling thread might be using it.
|
||||
delete m_Computer;
|
||||
@@ -415,6 +415,28 @@ void ComputerManager::deleteHost(NvComputer* computer)
|
||||
QThreadPool::globalInstance()->start(new DeferredHostDeletionTask(this, computer));
|
||||
}
|
||||
|
||||
void ComputerManager::renameHost(NvComputer* computer, QString name)
|
||||
{
|
||||
{
|
||||
QWriteLocker(&computer->lock);
|
||||
|
||||
computer->name = name;
|
||||
computer->hasCustomName = true;
|
||||
}
|
||||
|
||||
// Notify the UI of the state change
|
||||
handleComputerStateChanged(computer);
|
||||
}
|
||||
|
||||
void ComputerManager::clientSideAttributeUpdated(NvComputer* computer)
|
||||
{
|
||||
// Persist the change
|
||||
saveHosts();
|
||||
|
||||
// Notify the UI of the state change
|
||||
handleComputerStateChanged(computer);
|
||||
}
|
||||
|
||||
void ComputerManager::handleAboutToQuit()
|
||||
{
|
||||
QWriteLocker lock(&m_Lock);
|
||||
@@ -585,7 +607,7 @@ public:
|
||||
}
|
||||
|
||||
signals:
|
||||
void computerAddCompleted(QVariant success);
|
||||
void computerAddCompleted(QVariant success, QVariant detectedPortBlocking);
|
||||
|
||||
void computerStateChanged(NvComputer* computer);
|
||||
|
||||
@@ -615,7 +637,20 @@ private:
|
||||
return serverInfo;
|
||||
} catch (...) {
|
||||
if (!m_Mdns) {
|
||||
emit computerAddCompleted(false);
|
||||
StreamingPreferences prefs;
|
||||
int portTestResult;
|
||||
|
||||
if (prefs.detectNetworkBlocking) {
|
||||
// We failed to connect to the specified PC. Let's test to make sure this network
|
||||
// isn't blocking Moonlight, so we can tell the user about it.
|
||||
portTestResult = LiTestClientConnectivity("qt.conntest.moonlight-stream.org", 443,
|
||||
ML_PORT_FLAG_TCP_47984 | ML_PORT_FLAG_TCP_47989);
|
||||
}
|
||||
else {
|
||||
portTestResult = 0;
|
||||
}
|
||||
|
||||
emit computerAddCompleted(false, portTestResult != 0 && portTestResult != ML_TEST_RESULT_INCONCLUSIVE);
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
@@ -693,6 +728,12 @@ private:
|
||||
newComputer->manualAddress = m_Address;
|
||||
}
|
||||
|
||||
QHostAddress hostAddress(m_Address);
|
||||
bool addressIsSiteLocalV4 =
|
||||
hostAddress.isInSubnet(QHostAddress("10.0.0.0"), 8) ||
|
||||
hostAddress.isInSubnet(QHostAddress("172.16.0.0"), 12) ||
|
||||
hostAddress.isInSubnet(QHostAddress("192.168.0.0"), 16);
|
||||
|
||||
{
|
||||
// Check if this PC already exists
|
||||
QWriteLocker lock(&m_ComputerManager->m_Lock);
|
||||
@@ -707,7 +748,7 @@ private:
|
||||
|
||||
// For non-mDNS clients, let them know it succeeded
|
||||
if (!m_Mdns) {
|
||||
emit computerAddCompleted(true);
|
||||
emit computerAddCompleted(true, false);
|
||||
}
|
||||
|
||||
// Tell our client if something changed
|
||||
@@ -726,9 +767,24 @@ private:
|
||||
// Drop the lock before notifying
|
||||
lock.unlock();
|
||||
|
||||
// If this wasn't added via mDNS but it is a RFC 1918 IPv4 address and not a VPN,
|
||||
// go ahead and do the STUN request now to populate an external address.
|
||||
if (!m_Mdns && addressIsSiteLocalV4 && !newComputer->isReachableOverVpn()) {
|
||||
quint32 addr;
|
||||
int err = LiFindExternalAddressIP4("stun.moonlight-stream.org", 3478, &addr);
|
||||
if (err == 0) {
|
||||
lock.relock();
|
||||
newComputer->remoteAddress = QHostAddress(qFromBigEndian(addr)).toString();
|
||||
lock.unlock();
|
||||
}
|
||||
else {
|
||||
qWarning() << "STUN failed to get WAN address:" << err;
|
||||
}
|
||||
}
|
||||
|
||||
// For non-mDNS clients, let them know it succeeded
|
||||
if (!m_Mdns) {
|
||||
emit computerAddCompleted(true);
|
||||
emit computerAddCompleted(true, false);
|
||||
}
|
||||
|
||||
// Tell our client about this new PC
|
||||
|
||||
@@ -179,12 +179,16 @@ public:
|
||||
// computer is deleted inside this call
|
||||
void deleteHost(NvComputer* computer);
|
||||
|
||||
void renameHost(NvComputer* computer, QString name);
|
||||
|
||||
void clientSideAttributeUpdated(NvComputer* computer);
|
||||
|
||||
signals:
|
||||
void computerStateChanged(NvComputer* computer);
|
||||
|
||||
void pairingCompleted(NvComputer* computer, QString error);
|
||||
|
||||
void computerAddCompleted(QVariant success);
|
||||
void computerAddCompleted(QVariant success, QVariant detectedPortBlocking);
|
||||
|
||||
void quitAppCompleted(QVariant error);
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/rsa.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/rand.h>
|
||||
|
||||
@@ -32,20 +31,19 @@ void IdentityManager::createCredentials(QSettings& settings)
|
||||
X509* cert = X509_new();
|
||||
THROW_BAD_ALLOC_IF_NULL(cert);
|
||||
|
||||
EVP_PKEY* pk = EVP_PKEY_new();
|
||||
EVP_PKEY_CTX* ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL);
|
||||
THROW_BAD_ALLOC_IF_NULL(ctx);
|
||||
|
||||
EVP_PKEY_keygen_init(ctx);
|
||||
EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, 2048);
|
||||
|
||||
// pk must be initialized on input
|
||||
EVP_PKEY* pk = NULL;
|
||||
EVP_PKEY_keygen(ctx, &pk);
|
||||
|
||||
EVP_PKEY_CTX_free(ctx);
|
||||
THROW_BAD_ALLOC_IF_NULL(pk);
|
||||
|
||||
BIGNUM* bne = BN_new();
|
||||
THROW_BAD_ALLOC_IF_NULL(bne);
|
||||
|
||||
RSA* rsa = RSA_new();
|
||||
THROW_BAD_ALLOC_IF_NULL(rsa);
|
||||
|
||||
BN_set_word(bne, RSA_F4);
|
||||
RSA_generate_key_ex(rsa, 2048, bne, nullptr);
|
||||
|
||||
EVP_PKEY_assign_RSA(pk, rsa);
|
||||
|
||||
X509_set_version(cert, 2);
|
||||
ASN1_INTEGER_set(X509_get_serialNumber(cert), 0);
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
@@ -94,7 +92,6 @@ void IdentityManager::createCredentials(QSettings& settings)
|
||||
|
||||
X509_free(cert);
|
||||
EVP_PKEY_free(pk);
|
||||
BN_free(bne);
|
||||
BIO_free(biokey);
|
||||
BIO_free(biocert);
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#include "nvapp.h"
|
||||
|
||||
#define SER_APPNAME "name"
|
||||
#define SER_APPID "id"
|
||||
#define SER_APPHDR "hdr"
|
||||
#define SER_APPCOLLECTOR "appcollector"
|
||||
#define SER_HIDDEN "hidden"
|
||||
|
||||
NvApp::NvApp(QSettings& settings)
|
||||
{
|
||||
name = settings.value(SER_APPNAME).toString();
|
||||
id = settings.value(SER_APPID).toInt();
|
||||
hdrSupported = settings.value(SER_APPHDR).toBool();
|
||||
isAppCollectorGame = settings.value(SER_APPCOLLECTOR).toBool();
|
||||
hidden = settings.value(SER_HIDDEN).toBool();
|
||||
}
|
||||
|
||||
void NvApp::serialize(QSettings& settings) const
|
||||
{
|
||||
settings.setValue(SER_APPNAME, name);
|
||||
settings.setValue(SER_APPID, id);
|
||||
settings.setValue(SER_APPHDR, hdrSupported);
|
||||
settings.setValue(SER_APPCOLLECTOR, isAppCollectorGame);
|
||||
settings.setValue(SER_HIDDEN, hidden);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
class NvApp
|
||||
{
|
||||
public:
|
||||
NvApp() {}
|
||||
explicit NvApp(QSettings& settings);
|
||||
|
||||
bool operator==(const NvApp& other) const
|
||||
{
|
||||
return id == other.id &&
|
||||
name == other.name &&
|
||||
hdrSupported == other.hdrSupported &&
|
||||
isAppCollectorGame == other.isAppCollectorGame &&
|
||||
hidden == other.hidden;
|
||||
}
|
||||
|
||||
bool operator!=(const NvApp& other) const
|
||||
{
|
||||
return !operator==(other);
|
||||
}
|
||||
|
||||
bool isInitialized()
|
||||
{
|
||||
return id != 0 && !name.isEmpty();
|
||||
}
|
||||
|
||||
void
|
||||
serialize(QSettings& settings) const;
|
||||
|
||||
int id = 0;
|
||||
QString name;
|
||||
bool hdrSupported = false;
|
||||
bool isAppCollectorGame = false;
|
||||
bool hidden = false;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(NvApp)
|
||||
+40
-19
@@ -1,4 +1,5 @@
|
||||
#include "nvcomputer.h"
|
||||
#include "nvapp.h"
|
||||
|
||||
#include <QUdpSocket>
|
||||
#include <QHostInfo>
|
||||
@@ -14,15 +15,13 @@
|
||||
#define SER_IPV6ADDR "ipv6address"
|
||||
#define SER_APPLIST "apps"
|
||||
#define SER_SRVCERT "srvcert"
|
||||
|
||||
#define SER_APPNAME "name"
|
||||
#define SER_APPID "id"
|
||||
#define SER_APPHDR "hdr"
|
||||
#define SER_CUSTOMNAME "customname"
|
||||
|
||||
NvComputer::NvComputer(QSettings& settings)
|
||||
{
|
||||
this->name = settings.value(SER_NAME).toString();
|
||||
this->uuid = settings.value(SER_UUID).toString();
|
||||
this->hasCustomName = settings.value(SER_CUSTOMNAME).toBool();
|
||||
this->macAddress = settings.value(SER_MAC).toByteArray();
|
||||
this->localAddress = settings.value(SER_LOCALADDR).toString();
|
||||
this->remoteAddress = settings.value(SER_REMOTEADDR).toString();
|
||||
@@ -32,14 +31,9 @@ NvComputer::NvComputer(QSettings& settings)
|
||||
|
||||
int appCount = settings.beginReadArray(SER_APPLIST);
|
||||
for (int i = 0; i < appCount; i++) {
|
||||
NvApp app;
|
||||
|
||||
settings.setArrayIndex(i);
|
||||
|
||||
app.name = settings.value(SER_APPNAME).toString();
|
||||
app.id = settings.value(SER_APPID).toInt();
|
||||
app.hdrSupported = settings.value(SER_APPHDR).toBool();
|
||||
|
||||
NvApp app(settings);
|
||||
this->appList.append(app);
|
||||
}
|
||||
settings.endArray();
|
||||
@@ -57,11 +51,12 @@ NvComputer::NvComputer(QSettings& settings)
|
||||
this->gpuModel = nullptr;
|
||||
}
|
||||
|
||||
void NvComputer::serialize(QSettings& settings)
|
||||
void NvComputer::serialize(QSettings& settings) const
|
||||
{
|
||||
QReadLocker lock(&this->lock);
|
||||
|
||||
settings.setValue(SER_NAME, name);
|
||||
settings.setValue(SER_CUSTOMNAME, hasCustomName);
|
||||
settings.setValue(SER_UUID, uuid);
|
||||
settings.setValue(SER_MAC, macAddress);
|
||||
settings.setValue(SER_LOCALADDR, localAddress);
|
||||
@@ -76,10 +71,7 @@ void NvComputer::serialize(QSettings& settings)
|
||||
settings.beginWriteArray(SER_APPLIST);
|
||||
for (int i = 0; i < appList.count(); i++) {
|
||||
settings.setArrayIndex(i);
|
||||
|
||||
settings.setValue(SER_APPNAME, appList[i].name);
|
||||
settings.setValue(SER_APPID, appList[i].id);
|
||||
settings.setValue(SER_APPHDR, appList[i].hdrSupported);
|
||||
appList[i].serialize(settings);
|
||||
}
|
||||
settings.endArray();
|
||||
}
|
||||
@@ -96,6 +88,7 @@ NvComputer::NvComputer(QString address, QString serverInfo, QSslCertificate serv
|
||||
{
|
||||
this->serverCert = serverCert;
|
||||
|
||||
this->hasCustomName = false;
|
||||
this->name = NvHTTP::getXmlString(serverInfo, "hostname");
|
||||
if (this->name.isEmpty()) {
|
||||
this->name = "UNKNOWN";
|
||||
@@ -164,8 +157,9 @@ bool NvComputer::wake()
|
||||
}
|
||||
|
||||
const quint16 WOL_PORTS[] = {
|
||||
7, 9, // Standard WOL ports
|
||||
9, // Standard WOL port (privileged port)
|
||||
47998, 47999, 48000, 48002, 48010, // Ports opened by GFE
|
||||
47009, // Port opened by Moonlight Internet Hosting Tool for WoL (non-privileged port)
|
||||
};
|
||||
|
||||
// Create the WoL payload
|
||||
@@ -313,7 +307,26 @@ bool NvComputer::isReachableOverVpn()
|
||||
}
|
||||
}
|
||||
|
||||
QVector<QString> NvComputer::uniqueAddresses()
|
||||
bool NvComputer::updateAppList(QVector<NvApp> newAppList) {
|
||||
if (appList == newAppList) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Propagate client-side attributes to the new app list
|
||||
for (const NvApp& existingApp : appList) {
|
||||
for (NvApp& newApp : newAppList) {
|
||||
if (existingApp.id == newApp.id) {
|
||||
newApp.hidden = existingApp.hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
appList = newAppList;
|
||||
sortAppList();
|
||||
return true;
|
||||
}
|
||||
|
||||
QVector<QString> NvComputer::uniqueAddresses() const
|
||||
{
|
||||
QVector<QString> uniqueAddressList;
|
||||
|
||||
@@ -377,7 +390,10 @@ bool NvComputer::update(NvComputer& that)
|
||||
changed = true; \
|
||||
}
|
||||
|
||||
ASSIGN_IF_CHANGED(name);
|
||||
if (!hasCustomName) {
|
||||
// Only overwrite the name if it's not custom
|
||||
ASSIGN_IF_CHANGED(name);
|
||||
}
|
||||
ASSIGN_IF_CHANGED_AND_NONEMPTY(macAddress);
|
||||
ASSIGN_IF_CHANGED_AND_NONEMPTY(localAddress);
|
||||
ASSIGN_IF_CHANGED_AND_NONEMPTY(remoteAddress);
|
||||
@@ -393,7 +409,12 @@ bool NvComputer::update(NvComputer& that)
|
||||
ASSIGN_IF_CHANGED(maxLumaPixelsHEVC);
|
||||
ASSIGN_IF_CHANGED(gpuModel);
|
||||
ASSIGN_IF_CHANGED_AND_NONNULL(serverCert);
|
||||
ASSIGN_IF_CHANGED_AND_NONEMPTY(appList);
|
||||
ASSIGN_IF_CHANGED_AND_NONEMPTY(displayModes);
|
||||
|
||||
if (!that.appList.isEmpty()) {
|
||||
// updateAppList() handles merging client-side attributes
|
||||
updateAppList(that.appList);
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ class NvComputer
|
||||
private:
|
||||
void sortAppList();
|
||||
|
||||
bool updateAppList(QVector<NvApp> newAppList);
|
||||
|
||||
bool pendingQuit;
|
||||
|
||||
public:
|
||||
@@ -33,10 +35,10 @@ public:
|
||||
isReachableOverVpn();
|
||||
|
||||
QVector<QString>
|
||||
uniqueAddresses();
|
||||
uniqueAddresses() const;
|
||||
|
||||
void
|
||||
serialize(QSettings& settings);
|
||||
serialize(QSettings& settings) const;
|
||||
|
||||
enum PairState
|
||||
{
|
||||
@@ -71,10 +73,11 @@ public:
|
||||
QString manualAddress;
|
||||
QByteArray macAddress;
|
||||
QString name;
|
||||
bool hasCustomName;
|
||||
QString uuid;
|
||||
QSslCertificate serverCert;
|
||||
QVector<NvApp> appList;
|
||||
|
||||
// Synchronization
|
||||
QReadWriteLock lock;
|
||||
mutable QReadWriteLock lock;
|
||||
};
|
||||
|
||||
+40
-42
@@ -12,6 +12,7 @@
|
||||
#include <QtEndian>
|
||||
#include <QNetworkProxy>
|
||||
|
||||
#define FAST_FAIL_TIMEOUT_MS 2000
|
||||
#define REQUEST_TIMEOUT_MS 5000
|
||||
#define LAUNCH_TIMEOUT_MS 120000
|
||||
#define RESUME_TIMEOUT_MS 30000
|
||||
@@ -92,7 +93,7 @@ NvHTTP::getCurrentGame(QString serverInfo)
|
||||
}
|
||||
|
||||
QString
|
||||
NvHTTP::getServerInfo(NvLogLevel logLevel)
|
||||
NvHTTP::getServerInfo(NvLogLevel logLevel, bool fastFail)
|
||||
{
|
||||
QString serverInfo;
|
||||
|
||||
@@ -106,7 +107,7 @@ NvHTTP::getServerInfo(NvLogLevel logLevel)
|
||||
serverInfo = openConnectionToString(m_BaseUrlHttps,
|
||||
"serverinfo",
|
||||
nullptr,
|
||||
REQUEST_TIMEOUT_MS,
|
||||
fastFail ? FAST_FAIL_TIMEOUT_MS : REQUEST_TIMEOUT_MS,
|
||||
logLevel);
|
||||
// Throws if the request failed
|
||||
verifyResponseStatus(serverInfo);
|
||||
@@ -119,7 +120,7 @@ NvHTTP::getServerInfo(NvLogLevel logLevel)
|
||||
serverInfo = openConnectionToString(m_BaseUrlHttp,
|
||||
"serverinfo",
|
||||
nullptr,
|
||||
REQUEST_TIMEOUT_MS,
|
||||
fastFail ? FAST_FAIL_TIMEOUT_MS : REQUEST_TIMEOUT_MS,
|
||||
logLevel);
|
||||
verifyResponseStatus(serverInfo);
|
||||
}
|
||||
@@ -136,7 +137,7 @@ NvHTTP::getServerInfo(NvLogLevel logLevel)
|
||||
serverInfo = openConnectionToString(m_BaseUrlHttp,
|
||||
"serverinfo",
|
||||
nullptr,
|
||||
REQUEST_TIMEOUT_MS,
|
||||
fastFail ? FAST_FAIL_TIMEOUT_MS : REQUEST_TIMEOUT_MS,
|
||||
logLevel);
|
||||
verifyResponseStatus(serverInfo);
|
||||
}
|
||||
@@ -144,30 +145,6 @@ NvHTTP::getServerInfo(NvLogLevel logLevel)
|
||||
return serverInfo;
|
||||
}
|
||||
|
||||
static QString
|
||||
getSurroundAudioInfoString(int audioConfig)
|
||||
{
|
||||
int channelMask;
|
||||
int channelCount;
|
||||
|
||||
switch (audioConfig)
|
||||
{
|
||||
case AUDIO_CONFIGURATION_STEREO:
|
||||
channelCount = 2;
|
||||
channelMask = 0x3;
|
||||
break;
|
||||
case AUDIO_CONFIGURATION_51_SURROUND:
|
||||
channelCount = 6;
|
||||
channelMask = 0xFC;
|
||||
break;
|
||||
default:
|
||||
Q_ASSERT(false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return QString::number(channelMask << 16 | channelCount);
|
||||
}
|
||||
|
||||
void
|
||||
NvHTTP::launchApp(int appId,
|
||||
PSTREAM_CONFIGURATION streamConfig,
|
||||
@@ -187,9 +164,10 @@ NvHTTP::launchApp(int appId,
|
||||
"&mode="+QString::number(streamConfig->width)+"x"+
|
||||
QString::number(streamConfig->height)+"x"+
|
||||
// Using an FPS value over 60 causes SOPS to default to 720p60,
|
||||
// so force it to 60 when starting. This won't impact our ability
|
||||
// to get > 60 FPS while actually streaming though.
|
||||
QString::number(streamConfig->fps > 60 ? 60 : streamConfig->fps)+
|
||||
// so force it to 0 to ensure the correct resolution is set. We
|
||||
// used to use 60 here but that locked the frame rate to 60 FPS
|
||||
// on GFE 3.20.3.
|
||||
QString::number(streamConfig->fps > 60 ? 0 : streamConfig->fps)+
|
||||
"&additionalStates=1&sops="+QString::number(sops ? 1 : 0)+
|
||||
"&rikey="+QByteArray(streamConfig->remoteInputAesKey, sizeof(streamConfig->remoteInputAesKey)).toHex()+
|
||||
"&rikeyid="+QString::number(riKeyId)+
|
||||
@@ -197,7 +175,7 @@ NvHTTP::launchApp(int appId,
|
||||
"&hdrMode=1&clientHdrCapVersion=0&clientHdrCapSupportedFlagsInUint32=0&clientHdrCapMetaDataId=NV_STATIC_METADATA_TYPE_1&clientHdrCapDisplayData=0x0x0x0x0x0x0x0x0x0x0" :
|
||||
"")+
|
||||
"&localAudioPlayMode="+QString::number(localAudio ? 1 : 0)+
|
||||
"&surroundAudioInfo="+getSurroundAudioInfoString(streamConfig->audioConfiguration)+
|
||||
"&surroundAudioInfo="+QString::number(SURROUNDAUDIOINFO_FROM_AUDIO_CONFIGURATION(streamConfig->audioConfiguration))+
|
||||
"&remoteControllersBitmap="+QString::number(gamepadMask)+
|
||||
"&gcmap="+QString::number(gamepadMask),
|
||||
LAUNCH_TIMEOUT_MS);
|
||||
@@ -219,7 +197,7 @@ NvHTTP::resumeApp(PSTREAM_CONFIGURATION streamConfig)
|
||||
"resume",
|
||||
"rikey="+QString(QByteArray(streamConfig->remoteInputAesKey, sizeof(streamConfig->remoteInputAesKey)).toHex())+
|
||||
"&rikeyid="+QString::number(riKeyId)+
|
||||
"&surroundAudioInfo="+getSurroundAudioInfoString(streamConfig->audioConfiguration),
|
||||
"&surroundAudioInfo="+QString::number(SURROUNDAUDIOINFO_FROM_AUDIO_CONFIGURATION(streamConfig->audioConfiguration)),
|
||||
RESUME_TIMEOUT_MS);
|
||||
|
||||
// Throws if the request failed
|
||||
@@ -256,16 +234,16 @@ NvHTTP::getDisplayModeList(QString serverInfo)
|
||||
while (!xmlReader.atEnd()) {
|
||||
while (xmlReader.readNextStartElement()) {
|
||||
QStringRef name = xmlReader.name();
|
||||
if (xmlReader.name() == "DisplayMode") {
|
||||
if (name == "DisplayMode") {
|
||||
modes.append(NvDisplayMode());
|
||||
}
|
||||
else if (xmlReader.name() == "Width") {
|
||||
else if (name == "Width") {
|
||||
modes.last().width = xmlReader.readElementText().toInt();
|
||||
}
|
||||
else if (xmlReader.name() == "Height") {
|
||||
else if (name == "Height") {
|
||||
modes.last().height = xmlReader.readElementText().toInt();
|
||||
}
|
||||
else if (xmlReader.name() == "RefreshRate") {
|
||||
else if (name == "RefreshRate") {
|
||||
modes.last().refreshRate = xmlReader.readElementText().toInt();
|
||||
}
|
||||
}
|
||||
@@ -289,7 +267,7 @@ NvHTTP::getAppList()
|
||||
while (!xmlReader.atEnd()) {
|
||||
while (xmlReader.readNextStartElement()) {
|
||||
QStringRef name = xmlReader.name();
|
||||
if (xmlReader.name() == "App") {
|
||||
if (name == "App") {
|
||||
// We must have a valid app before advancing to the next one
|
||||
if (!apps.isEmpty() && !apps.last().isInitialized()) {
|
||||
qWarning() << "Invalid applist XML";
|
||||
@@ -298,15 +276,18 @@ NvHTTP::getAppList()
|
||||
}
|
||||
apps.append(NvApp());
|
||||
}
|
||||
else if (xmlReader.name() == "AppTitle") {
|
||||
else if (name == "AppTitle") {
|
||||
apps.last().name = xmlReader.readElementText();
|
||||
}
|
||||
else if (xmlReader.name() == "ID") {
|
||||
else if (name == "ID") {
|
||||
apps.last().id = xmlReader.readElementText().toInt();
|
||||
}
|
||||
else if (xmlReader.name() == "IsHdrSupported") {
|
||||
else if (name == "IsHdrSupported") {
|
||||
apps.last().hdrSupported = xmlReader.readElementText() == "1";
|
||||
}
|
||||
else if (name == "IsAppCollectorGame") {
|
||||
apps.last().isAppCollectorGame = xmlReader.readElementText() == "1";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,7 +303,10 @@ NvHTTP::verifyResponseStatus(QString xml)
|
||||
{
|
||||
if (xmlReader.name() == "root")
|
||||
{
|
||||
int statusCode = xmlReader.attributes().value("status_code").toInt();
|
||||
// Status code can be 0xFFFFFFFF in some rare cases on GFE 3.20.3, and
|
||||
// QString::toInt() will fail in that case, so use QString::toUInt()
|
||||
// and cast the result to an int instead.
|
||||
int statusCode = (int)xmlReader.attributes().value("status_code").toUInt();
|
||||
if (statusCode == 200)
|
||||
{
|
||||
// Successful
|
||||
@@ -335,6 +319,12 @@ NvHTTP::verifyResponseStatus(QString xml)
|
||||
// 401 is expected for unpaired PCs when we fetch serverinfo over HTTPS
|
||||
qWarning() << "Request failed:" << statusCode << statusMessage;
|
||||
}
|
||||
if (statusCode == -1 && statusMessage == "Invalid") {
|
||||
// Special case handling an audio capture error which GFE doesn't
|
||||
// provide any useful status message for.
|
||||
statusCode = 418;
|
||||
statusMessage = "Missing audio capture device. Reinstalling GeForce Experience should resolve this error.";
|
||||
}
|
||||
throw GfeHttpResponseException(statusCode, statusMessage);
|
||||
}
|
||||
}
|
||||
@@ -454,6 +444,14 @@ NvHTTP::openConnection(QUrl baseUrl,
|
||||
// Add our client certificate
|
||||
request.setSslConfiguration(IdentityManager::get()->getSslConfig());
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) && QT_VERSION < QT_VERSION_CHECK(5, 15, 1) && !defined(QT_NO_BEARERMANAGEMENT)
|
||||
// HACK: Set network accessibility to work around QTBUG-80947 (introduced in Qt 5.14.0 and fixed in Qt 5.15.1)
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
m_Nam.setNetworkAccessible(QNetworkAccessManager::Accessible);
|
||||
QT_WARNING_POP
|
||||
#endif
|
||||
|
||||
QNetworkReply* reply = m_Nam.get(request);
|
||||
|
||||
// Run the request with a timeout if requested
|
||||
|
||||
+2
-21
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "identitymanager.h"
|
||||
#include "nvapp.h"
|
||||
|
||||
#include <Limelight.h>
|
||||
|
||||
@@ -8,26 +9,6 @@
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
|
||||
class NvApp
|
||||
{
|
||||
public:
|
||||
bool operator==(const NvApp& other) const
|
||||
{
|
||||
return id == other.id;
|
||||
}
|
||||
|
||||
bool isInitialized()
|
||||
{
|
||||
return id != 0 && !name.isEmpty();
|
||||
}
|
||||
|
||||
int id;
|
||||
QString name;
|
||||
bool hdrSupported;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(NvApp)
|
||||
|
||||
class NvDisplayMode
|
||||
{
|
||||
public:
|
||||
@@ -131,7 +112,7 @@ public:
|
||||
getCurrentGame(QString serverInfo);
|
||||
|
||||
QString
|
||||
getServerInfo(NvLogLevel logLevel);
|
||||
getServerInfo(NvLogLevel logLevel, bool fastFail = false);
|
||||
|
||||
static
|
||||
void
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#include "nvpairingmanager.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/aes.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/x509.h>
|
||||
@@ -51,39 +52,63 @@ NvPairingManager::generateRandomBytes(int length)
|
||||
}
|
||||
|
||||
QByteArray
|
||||
NvPairingManager::encrypt(QByteArray plaintext, AES_KEY* key)
|
||||
NvPairingManager::encrypt(const QByteArray& plaintext, const QByteArray& key)
|
||||
{
|
||||
QByteArray ciphertext(plaintext.size(), 0);
|
||||
EVP_CIPHER_CTX* cipher;
|
||||
int ciphertextLen;
|
||||
|
||||
for (int i = 0; i < plaintext.size(); i += 16)
|
||||
{
|
||||
AES_encrypt(reinterpret_cast<unsigned char*>(&plaintext.data()[i]),
|
||||
reinterpret_cast<unsigned char*>(&ciphertext.data()[i]),
|
||||
key);
|
||||
}
|
||||
cipher = EVP_CIPHER_CTX_new();
|
||||
THROW_BAD_ALLOC_IF_NULL(cipher);
|
||||
|
||||
EVP_EncryptInit(cipher, EVP_aes_128_ecb(), reinterpret_cast<const unsigned char*>(key.data()), NULL);
|
||||
EVP_CIPHER_CTX_set_padding(cipher, 0);
|
||||
|
||||
EVP_EncryptUpdate(cipher,
|
||||
reinterpret_cast<unsigned char*>(ciphertext.data()),
|
||||
&ciphertextLen,
|
||||
reinterpret_cast<const unsigned char*>(plaintext.data()),
|
||||
plaintext.length());
|
||||
Q_ASSERT(ciphertextLen == ciphertext.length());
|
||||
|
||||
EVP_CIPHER_CTX_free(cipher);
|
||||
|
||||
return ciphertext;
|
||||
}
|
||||
|
||||
QByteArray
|
||||
NvPairingManager::decrypt(QByteArray ciphertext, AES_KEY* key)
|
||||
NvPairingManager::decrypt(const QByteArray& ciphertext, const QByteArray& key)
|
||||
{
|
||||
QByteArray plaintext(ciphertext.size(), 0);
|
||||
EVP_CIPHER_CTX* cipher;
|
||||
int plaintextLen;
|
||||
|
||||
for (int i = 0; i < plaintext.size(); i += 16)
|
||||
{
|
||||
AES_decrypt(reinterpret_cast<unsigned char*>(&ciphertext.data()[i]),
|
||||
reinterpret_cast<unsigned char*>(&plaintext.data()[i]),
|
||||
key);
|
||||
}
|
||||
cipher = EVP_CIPHER_CTX_new();
|
||||
THROW_BAD_ALLOC_IF_NULL(cipher);
|
||||
|
||||
EVP_DecryptInit(cipher, EVP_aes_128_ecb(), reinterpret_cast<const unsigned char*>(key.data()), NULL);
|
||||
EVP_CIPHER_CTX_set_padding(cipher, 0);
|
||||
|
||||
EVP_DecryptUpdate(cipher,
|
||||
reinterpret_cast<unsigned char*>(plaintext.data()),
|
||||
&plaintextLen,
|
||||
reinterpret_cast<const unsigned char*>(ciphertext.data()),
|
||||
ciphertext.length());
|
||||
Q_ASSERT(plaintextLen == plaintext.length());
|
||||
|
||||
EVP_CIPHER_CTX_free(cipher);
|
||||
|
||||
return plaintext;
|
||||
}
|
||||
|
||||
QByteArray
|
||||
NvPairingManager::getSignatureFromPemCert(QByteArray certificate)
|
||||
NvPairingManager::getSignatureFromPemCert(const QByteArray& certificate)
|
||||
{
|
||||
#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
|
||||
BIO* bio = BIO_new_mem_buf(const_cast<char*>(certificate.data()), -1);
|
||||
#else
|
||||
BIO* bio = BIO_new_mem_buf(certificate.data(), -1);
|
||||
#endif
|
||||
THROW_BAD_ALLOC_IF_NULL(bio);
|
||||
|
||||
X509* cert = PEM_read_bio_X509(bio, nullptr, nullptr, nullptr);
|
||||
@@ -107,9 +132,13 @@ NvPairingManager::getSignatureFromPemCert(QByteArray certificate)
|
||||
}
|
||||
|
||||
bool
|
||||
NvPairingManager::verifySignature(QByteArray data, QByteArray signature, QByteArray serverCertificate)
|
||||
NvPairingManager::verifySignature(const QByteArray& data, const QByteArray& signature, const QByteArray& serverCertificate)
|
||||
{
|
||||
#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
|
||||
BIO* bio = BIO_new_mem_buf(const_cast<char*>(serverCertificate.data()), -1);
|
||||
#else
|
||||
BIO* bio = BIO_new_mem_buf(serverCertificate.data(), -1);
|
||||
#endif
|
||||
THROW_BAD_ALLOC_IF_NULL(bio);
|
||||
|
||||
X509* cert = PEM_read_bio_X509(bio, nullptr, nullptr, nullptr);
|
||||
@@ -123,7 +152,7 @@ NvPairingManager::verifySignature(QByteArray data, QByteArray signature, QByteAr
|
||||
|
||||
EVP_DigestVerifyInit(mdctx, nullptr, EVP_sha256(), nullptr, pubKey);
|
||||
EVP_DigestVerifyUpdate(mdctx, data.data(), data.length());
|
||||
int result = EVP_DigestVerifyFinal(mdctx, reinterpret_cast<unsigned char*>(signature.data()), signature.length());
|
||||
int result = EVP_DigestVerifyFinal(mdctx, reinterpret_cast<unsigned char*>(const_cast<char*>(signature.data())), signature.length());
|
||||
|
||||
EVP_PKEY_free(pubKey);
|
||||
EVP_MD_CTX_destroy(mdctx);
|
||||
@@ -133,7 +162,7 @@ NvPairingManager::verifySignature(QByteArray data, QByteArray signature, QByteAr
|
||||
}
|
||||
|
||||
QByteArray
|
||||
NvPairingManager::signMessage(QByteArray message)
|
||||
NvPairingManager::signMessage(const QByteArray& message)
|
||||
{
|
||||
EVP_MD_CTX *ctx = EVP_MD_CTX_create();
|
||||
THROW_BAD_ALLOC_IF_NULL(ctx);
|
||||
@@ -143,7 +172,7 @@ NvPairingManager::signMessage(QByteArray message)
|
||||
|
||||
EVP_DigestInit_ex(ctx, md, NULL);
|
||||
EVP_DigestSignInit(ctx, NULL, md, NULL, m_PrivateKey);
|
||||
EVP_DigestSignUpdate(ctx, reinterpret_cast<unsigned char*>(message.data()), message.length());
|
||||
EVP_DigestSignUpdate(ctx, reinterpret_cast<unsigned char*>(const_cast<char*>(message.data())), message.length());
|
||||
|
||||
size_t signatureLength = 0;
|
||||
EVP_DigestSignFinal(ctx, NULL, &signatureLength);
|
||||
@@ -157,7 +186,7 @@ NvPairingManager::signMessage(QByteArray message)
|
||||
}
|
||||
|
||||
QByteArray
|
||||
NvPairingManager::saltPin(QByteArray salt, QString pin)
|
||||
NvPairingManager::saltPin(const QByteArray& salt, QString pin)
|
||||
{
|
||||
return QByteArray().append(salt).append(pin.toLatin1());
|
||||
}
|
||||
@@ -186,9 +215,8 @@ NvPairingManager::pair(QString appVersion, QString pin, QSslCertificate& serverC
|
||||
QByteArray salt = generateRandomBytes(16);
|
||||
QByteArray saltedPin = saltPin(salt, pin);
|
||||
|
||||
AES_KEY encKey, decKey;
|
||||
AES_set_decrypt_key(reinterpret_cast<const unsigned char*>(QCryptographicHash::hash(saltedPin, hashAlgo).data()), 128, &decKey);
|
||||
AES_set_encrypt_key(reinterpret_cast<const unsigned char*>(QCryptographicHash::hash(saltedPin, hashAlgo).data()), 128, &encKey);
|
||||
QByteArray aesKey = QCryptographicHash::hash(saltedPin, hashAlgo).data();
|
||||
aesKey.truncate(16);
|
||||
|
||||
QString getCert = m_Http.openConnectionToString(m_Http.m_BaseUrlHttp,
|
||||
"pair",
|
||||
@@ -223,7 +251,7 @@ NvPairingManager::pair(QString appVersion, QString pin, QSslCertificate& serverC
|
||||
m_Http.setServerCert(serverCert);
|
||||
|
||||
QByteArray randomChallenge = generateRandomBytes(16);
|
||||
QByteArray encryptedChallenge = encrypt(randomChallenge, &encKey);
|
||||
QByteArray encryptedChallenge = encrypt(randomChallenge, aesKey);
|
||||
QString challengeXml = m_Http.openConnectionToString(m_Http.m_BaseUrlHttp,
|
||||
"pair",
|
||||
"devicename=roth&updateState=1&clientchallenge=" +
|
||||
@@ -237,7 +265,7 @@ NvPairingManager::pair(QString appVersion, QString pin, QSslCertificate& serverC
|
||||
return PairState::FAILED;
|
||||
}
|
||||
|
||||
QByteArray challengeResponseData = decrypt(m_Http.getXmlStringFromHex(challengeXml, "challengeresponse"), &decKey);
|
||||
QByteArray challengeResponseData = decrypt(m_Http.getXmlStringFromHex(challengeXml, "challengeresponse"), aesKey);
|
||||
QByteArray clientSecretData = generateRandomBytes(16);
|
||||
QByteArray challengeResponse;
|
||||
QByteArray serverResponse(challengeResponseData.data(), hashLength);
|
||||
@@ -258,7 +286,7 @@ NvPairingManager::pair(QString appVersion, QString pin, QSslCertificate& serverC
|
||||
|
||||
QByteArray paddedHash = QCryptographicHash::hash(challengeResponse, hashAlgo);
|
||||
paddedHash.resize(32);
|
||||
QByteArray encryptedChallengeResponseHash = encrypt(paddedHash, &encKey);
|
||||
QByteArray encryptedChallengeResponseHash = encrypt(paddedHash, aesKey);
|
||||
QString respXml = m_Http.openConnectionToString(m_Http.m_BaseUrlHttp,
|
||||
"pair",
|
||||
"devicename=roth&updateState=1&serverchallengeresp=" +
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "identitymanager.h"
|
||||
#include "nvhttp.h"
|
||||
|
||||
#include <openssl/aes.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/evp.h>
|
||||
|
||||
@@ -30,22 +29,22 @@ private:
|
||||
generateRandomBytes(int length);
|
||||
|
||||
QByteArray
|
||||
saltPin(QByteArray salt, QString pin);
|
||||
saltPin(const QByteArray& salt, QString pin);
|
||||
|
||||
QByteArray
|
||||
encrypt(QByteArray plaintext, AES_KEY* key);
|
||||
encrypt(const QByteArray& plaintext, const QByteArray& key);
|
||||
|
||||
QByteArray
|
||||
decrypt(QByteArray ciphertext, AES_KEY* key);
|
||||
decrypt(const QByteArray& ciphertext, const QByteArray& key);
|
||||
|
||||
QByteArray
|
||||
getSignatureFromPemCert(QByteArray certificate);
|
||||
getSignatureFromPemCert(const QByteArray& certificate);
|
||||
|
||||
bool
|
||||
verifySignature(QByteArray data, QByteArray signature, QByteArray serverCertificate);
|
||||
verifySignature(const QByteArray& data, const QByteArray& signature, const QByteArray& serverCertificate);
|
||||
|
||||
QByteArray
|
||||
signMessage(QByteArray message);
|
||||
signMessage(const QByteArray& message);
|
||||
|
||||
NvHTTP m_Http;
|
||||
X509* m_Cert;
|
||||
|
||||
@@ -24,6 +24,9 @@ RichPresenceManager::RichPresenceManager(StreamingPreferences& prefs, QString ga
|
||||
discordPresence.largeImageKey = "icon";
|
||||
Discord_UpdatePresence(&discordPresence);
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(prefs)
|
||||
Q_UNUSED(gameName)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "systemproperties.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <QGuiApplication>
|
||||
|
||||
@@ -7,8 +8,10 @@
|
||||
|
||||
SystemProperties::SystemProperties()
|
||||
{
|
||||
isRunningWayland = qgetenv("XDG_SESSION_TYPE") == "wayland";
|
||||
isRunningXWayland = qgetenv("XDG_SESSION_TYPE") == "wayland" && QGuiApplication::platformName() == "xcb";
|
||||
versionString = QString(VERSION_STR);
|
||||
hasWindowManager = WMUtils::isRunningWindowManager();
|
||||
isRunningWayland = WMUtils::isRunningWayland();
|
||||
isRunningXWayland = isRunningWayland && QGuiApplication::platformName() == "xcb";
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
isWow64 = QSysInfo::currentCpuArchitecture() != QSysInfo::buildCpuArchitecture();
|
||||
@@ -17,7 +20,8 @@ SystemProperties::SystemProperties()
|
||||
#endif
|
||||
|
||||
#ifndef STEAM_LINK
|
||||
hasBrowser = true;
|
||||
// Assume we can probably launch a browser if we're in a GUI environment
|
||||
hasBrowser = hasWindowManager;
|
||||
#else
|
||||
hasBrowser = false;
|
||||
#endif
|
||||
@@ -74,7 +78,14 @@ void SystemProperties::querySdlVideoInfo()
|
||||
|
||||
err = SDL_GetDesktopDisplayMode(displayIndex, &desktopMode);
|
||||
if (err == 0) {
|
||||
monitorDesktopResolutions.insert(displayIndex, QRect(0, 0, desktopMode.w, desktopMode.h));
|
||||
if (desktopMode.w <= 8192 && desktopMode.h <= 8192) {
|
||||
monitorDesktopResolutions.insert(displayIndex, QRect(0, 0, desktopMode.w, desktopMode.h));
|
||||
}
|
||||
else {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Skipping resolution over 8K: %dx%d",
|
||||
desktopMode.w, desktopMode.h);
|
||||
}
|
||||
}
|
||||
else {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
@@ -83,7 +94,14 @@ void SystemProperties::querySdlVideoInfo()
|
||||
}
|
||||
|
||||
if (StreamUtils::getRealDesktopMode(displayIndex, &desktopMode)) {
|
||||
monitorNativeResolutions.insert(displayIndex, QRect(0, 0, desktopMode.w, desktopMode.h));
|
||||
if (desktopMode.w <= 8192 && desktopMode.h <= 8192) {
|
||||
monitorNativeResolutions.insert(displayIndex, QRect(0, 0, desktopMode.w, desktopMode.h));
|
||||
}
|
||||
else {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Skipping resolution over 8K: %dx%d",
|
||||
desktopMode.w, desktopMode.h);
|
||||
}
|
||||
|
||||
// Start at desktop mode and work our way up
|
||||
bestMode = desktopMode;
|
||||
@@ -102,20 +120,24 @@ void SystemProperties::querySdlVideoInfo()
|
||||
}
|
||||
}
|
||||
|
||||
SDL_Window* testWindow = SDL_CreateWindow("", 0, 0, 1280, 720, SDL_WINDOW_HIDDEN);
|
||||
SDL_Window* testWindow = SDL_CreateWindow("", 0, 0, 1280, 720,
|
||||
SDL_WINDOW_HIDDEN | StreamUtils::getPlatformWindowFlags());
|
||||
if (!testWindow) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Failed to create window for hardware decode test: %s",
|
||||
SDL_GetError());
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
return;
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Failed to create test window with platform flags: %s",
|
||||
SDL_GetError());
|
||||
|
||||
testWindow = SDL_CreateWindow("", 0, 0, 1280, 720, SDL_WINDOW_HIDDEN);
|
||||
if (!testWindow) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Failed to create window for hardware decode test: %s",
|
||||
SDL_GetError());
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
hasHardwareAcceleration =
|
||||
Session::isHardwareDecodeAvailable(testWindow,
|
||||
StreamingPreferences::VDS_AUTO,
|
||||
VIDEO_FORMAT_H264,
|
||||
1920, 1080, 60);
|
||||
Session::getDecoderInfo(testWindow, hasHardwareAcceleration, rendererAlwaysFullScreen, maximumResolution);
|
||||
|
||||
SDL_DestroyWindow(testWindow);
|
||||
|
||||
|
||||
@@ -11,13 +11,17 @@ public:
|
||||
SystemProperties();
|
||||
|
||||
Q_PROPERTY(bool hasHardwareAcceleration MEMBER hasHardwareAcceleration CONSTANT)
|
||||
Q_PROPERTY(bool rendererAlwaysFullScreen MEMBER rendererAlwaysFullScreen CONSTANT)
|
||||
Q_PROPERTY(bool isRunningWayland MEMBER isRunningWayland CONSTANT)
|
||||
Q_PROPERTY(bool isRunningXWayland MEMBER isRunningXWayland CONSTANT)
|
||||
Q_PROPERTY(bool isWow64 MEMBER isWow64 CONSTANT)
|
||||
Q_PROPERTY(bool hasWindowManager MEMBER hasWindowManager CONSTANT)
|
||||
Q_PROPERTY(bool hasBrowser MEMBER hasBrowser CONSTANT)
|
||||
Q_PROPERTY(bool hasDiscordIntegration MEMBER hasDiscordIntegration CONSTANT)
|
||||
Q_PROPERTY(QString unmappedGamepads MEMBER unmappedGamepads NOTIFY unmappedGamepadsChanged)
|
||||
Q_PROPERTY(int maximumStreamingFrameRate MEMBER maximumStreamingFrameRate CONSTANT)
|
||||
Q_PROPERTY(QSize maximumResolution MEMBER maximumResolution CONSTANT)
|
||||
Q_PROPERTY(QString versionString MEMBER versionString CONSTANT)
|
||||
|
||||
Q_INVOKABLE QRect getDesktopResolution(int displayIndex);
|
||||
Q_INVOKABLE QRect getNativeResolution(int displayIndex);
|
||||
@@ -29,14 +33,18 @@ private:
|
||||
void querySdlVideoInfo();
|
||||
|
||||
bool hasHardwareAcceleration;
|
||||
bool rendererAlwaysFullScreen;
|
||||
bool isRunningWayland;
|
||||
bool isRunningXWayland;
|
||||
bool isWow64;
|
||||
bool hasWindowManager;
|
||||
bool hasBrowser;
|
||||
bool hasDiscordIntegration;
|
||||
QString unmappedGamepads;
|
||||
int maximumStreamingFrameRate;
|
||||
QSize maximumResolution;
|
||||
QList<QRect> monitorDesktopResolutions;
|
||||
QList<QRect> monitorNativeResolutions;
|
||||
QString versionString;
|
||||
};
|
||||
|
||||
|
||||
@@ -172,20 +172,31 @@ GlobalCommandLineParser::ParseResult GlobalCommandLineParser::parse(const QStrin
|
||||
parser.addPositionalArgument("action", "Action to execute", "<action>");
|
||||
parser.parse(args);
|
||||
auto posArgs = parser.positionalArguments();
|
||||
QString action = posArgs.isEmpty() ? QString() : posArgs.first().toLower();
|
||||
|
||||
if (action == "") {
|
||||
if (posArgs.isEmpty()) {
|
||||
// This method will not return and terminates the process if --version
|
||||
// or --help is specified
|
||||
parser.handleHelpAndVersionOptions();
|
||||
parser.handleUnknownOptions();
|
||||
return NormalStartRequested;
|
||||
} else if (action == "quit") {
|
||||
return QuitRequested;
|
||||
} else if (action == "stream") {
|
||||
return StreamRequested;
|
||||
} else {
|
||||
parser.showError(QString("Invalid action: %1").arg(action));
|
||||
}
|
||||
else {
|
||||
// If users supply arguments that accept values prior to the "quit"
|
||||
// or "stream" positional arguments, we will not be able to correctly
|
||||
// parse the value out of the input because this QCommandLineParser
|
||||
// doesn't know about all of the options that "quit" and "stream"
|
||||
// commands can accept. To work around this issue, we just look
|
||||
// for "quit" or "stream" positional arguments anywhere.
|
||||
for (int i = 0; i < posArgs.size(); i++) {
|
||||
QString action = posArgs.at(i).toLower();
|
||||
if (action == "quit") {
|
||||
return QuitRequested;
|
||||
} else if (action == "stream") {
|
||||
return StreamRequested;
|
||||
}
|
||||
}
|
||||
|
||||
parser.showError(QString("Invalid action"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,6 +252,7 @@ StreamCommandLineParser::StreamCommandLineParser()
|
||||
m_AudioConfigMap = {
|
||||
{"stereo", StreamingPreferences::AC_STEREO},
|
||||
{"5.1-surround", StreamingPreferences::AC_51_SURROUND},
|
||||
{"7.1-surround", StreamingPreferences::AC_71_SURROUND},
|
||||
};
|
||||
m_VideoCodecMap = {
|
||||
{"auto", StreamingPreferences::VCC_AUTO},
|
||||
@@ -249,8 +261,8 @@ StreamCommandLineParser::StreamCommandLineParser()
|
||||
};
|
||||
m_VideoDecoderMap = {
|
||||
{"auto", StreamingPreferences::VDS_AUTO},
|
||||
{"software", StreamingPreferences::VDS_FORCE_HARDWARE},
|
||||
{"hardware", StreamingPreferences::VDS_FORCE_SOFTWARE},
|
||||
{"software", StreamingPreferences::VDS_FORCE_SOFTWARE},
|
||||
{"hardware", StreamingPreferences::VDS_FORCE_HARDWARE},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -280,11 +292,14 @@ void StreamCommandLineParser::parse(const QStringList &args, StreamingPreference
|
||||
parser.addToggleOption("vsync", "V-Sync");
|
||||
parser.addValueOption("fps", "FPS");
|
||||
parser.addValueOption("bitrate", "bitrate in Kbps");
|
||||
parser.addValueOption("packet-size", "video packet size");
|
||||
parser.addChoiceOption("display-mode", "display mode", m_WindowModeMap.keys());
|
||||
parser.addChoiceOption("audio-config", "audio config", m_AudioConfigMap.keys());
|
||||
parser.addToggleOption("multi-controller", "multiple controller support");
|
||||
parser.addToggleOption("quit-after", "quit app after session");
|
||||
parser.addToggleOption("mouse-acceleration", "mouse acceleration");
|
||||
parser.addToggleOption("absolute-mouse", "remote desktop optimized mouse control");
|
||||
parser.addToggleOption("mouse-buttons-swap", "left and right mouse buttons swap");
|
||||
parser.addToggleOption("touchscreen-trackpad", "touchscreen in trackpad mode");
|
||||
parser.addToggleOption("game-optimization", "game optimizations");
|
||||
parser.addToggleOption("audio-on-host", "audio on host PC");
|
||||
parser.addToggleOption("frame-pacing", "frame pacing");
|
||||
@@ -345,6 +360,14 @@ void StreamCommandLineParser::parse(const QStringList &args, StreamingPreference
|
||||
preferences->width, preferences->height, preferences->fps);
|
||||
}
|
||||
|
||||
// Resolve --packet-size option
|
||||
if (parser.isSet("packet-size")) {
|
||||
preferences->packetSize = parser.getIntOption("packet-size");
|
||||
if (preferences->packetSize < 1024) {
|
||||
parser.showError("Packet size must be greater than 1024 bytes");
|
||||
}
|
||||
}
|
||||
|
||||
// Resolve --display option
|
||||
if (parser.isSet("display-mode")) {
|
||||
preferences->windowMode = mapValue(m_WindowModeMap, parser.getChoiceOptionValue("display-mode"));
|
||||
@@ -364,8 +387,14 @@ void StreamCommandLineParser::parse(const QStringList &args, StreamingPreference
|
||||
// Resolve --quit-after and --no-quit-after options
|
||||
preferences->quitAppAfter = parser.getToggleOptionValue("quit-after", preferences->quitAppAfter);
|
||||
|
||||
// Resolve --mouse-acceleration and --no-mouse-acceleration options
|
||||
preferences->mouseAcceleration = parser.getToggleOptionValue("mouse-acceleration", preferences->mouseAcceleration);
|
||||
// Resolve --absolute-mouse and --no-absolute-mouse options
|
||||
preferences->absoluteMouseMode = parser.getToggleOptionValue("absolute-mouse", preferences->absoluteMouseMode);
|
||||
|
||||
// Resolve --mouse-buttons-swap and --no-mouse-buttons-swap options
|
||||
preferences->swapMouseButtons = parser.getToggleOptionValue("mouse-buttons-swap", preferences->swapMouseButtons);
|
||||
|
||||
// Resolve --touchscreen-trackpad and --no-touchscreen-trackpad options
|
||||
preferences->absoluteTouchMode = !parser.getToggleOptionValue("touchscreen-trackpad", !preferences->absoluteTouchMode);
|
||||
|
||||
// Resolve --game-optimization and --no-game-optimization options
|
||||
preferences->gameOptimizations = parser.getToggleOptionValue("game-optimization", preferences->gameOptimizations);
|
||||
|
||||
@@ -7,13 +7,15 @@
|
||||
<summary>Play games remotely from your NVIDIA GameStream-enabled PC</summary>
|
||||
|
||||
<description>
|
||||
<p>Moonlight can stream games and other applications from a PC with an NVIDIA GeForce GTX 600-series or higher GPU and GeForce Experience installed.</p>
|
||||
<p>Moonlight can stream games and other applications from a PC with an NVIDIA GeForce GTX/RTX or NVIDIA Quadro GPU and GeForce/Quadro Experience installed.</p>
|
||||
<p>Features include:</p>
|
||||
<ul>
|
||||
<li>Streaming at up to 4K resolution</li>
|
||||
<li>Support for up to 120 FPS streaming (high refresh rate monitor recommended)</li>
|
||||
<li>Hardware accelerated video decoding with VAAPI, VDPAU, and NVDEC support</li>
|
||||
<li>5.1 surround sound audio support</li>
|
||||
<li>7.1 surround sound audio support</li>
|
||||
<li>Support for both pointer capture (for games) and direct mouse control (for remote desktop)</li>
|
||||
<li>Direct touchscreen mouse control</li>
|
||||
<li>HEVC support for better video compression efficiency</li>
|
||||
<li>Gamepad support with force feedback for up to 4 players</li>
|
||||
</ul>
|
||||
@@ -33,6 +35,76 @@
|
||||
</screenshots>
|
||||
|
||||
<releases>
|
||||
<release version="2.2.0" date="2020-09-10">
|
||||
<description>
|
||||
<p>New features:</p>
|
||||
<ul>
|
||||
<li>Added the ability to hide unwanted apps and games</li>
|
||||
<li>Added a network test to determine if your Internet connection is blocking Moonlight</li>
|
||||
<li>Added the option to swap mouse buttons</li>
|
||||
<li>Added codec and resolution to the on-screen performance stats</li>
|
||||
<li>Added a warning if the connection is too unstable to receive any complete video frames</li>
|
||||
<li>Added a Discord link to the toolbar in settings</li>
|
||||
<li>Enabled the new EGL renderer by default on Linux</li>
|
||||
</ul>
|
||||
<p>Bugfixes:</p>
|
||||
<ul>
|
||||
<li>Fixed streaming over networks that block QoS-tagged packets</li>
|
||||
<li>Selecting a frame rate higher than 60 FPS no longer sets the host desktop to 720p</li>
|
||||
<li>Right-side modifier keys no longer press the corresponding left-side keys too</li>
|
||||
<li>Fixed mouse position never reaching the edge of the screen with certain desktop resolutions</li>
|
||||
<li>Improved synchronization between host and client mouse cursor in remote desktop mouse mode</li>
|
||||
<li>Cached box art is now deleted when the PC is removed from Moonlight</li>
|
||||
<li>Fixed several CLI options not properly overriding GUI options</li>
|
||||
<li>Updated included gamepad mappings</li>
|
||||
<li>Updated to Qt 5.15.1</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="2.1.0" date="2020-05-17">
|
||||
<description>
|
||||
<p>New features:</p>
|
||||
<ul>
|
||||
<li>Remote desktop mode now allows interaction with the host without having to click to focus the Moonlight window first</li>
|
||||
<li>Added a new EGL renderer for improved performance on Wayland and XWayland</li>
|
||||
<li>Added the option to toggle between direct touchscreen mode and the old trackpad mode</li>
|
||||
<li>Added the option to rename host PCs</li>
|
||||
<li>Added the ability to scroll the settings page with the right analog stick</li>
|
||||
<li>Various UI improvements</li>
|
||||
</ul>
|
||||
<p>Bugfixes:</p>
|
||||
<ul>
|
||||
<li>Fixed unreliable mouse capture when the stream begins</li>
|
||||
<li>Fixed cursor being trapped in full-screen mode even when the mouse wasn't captured</li>
|
||||
<li>Fixed key presses not being sent to the host if the Super/Meta/Windows key is pressed</li>
|
||||
<li>Updated included gamepad mappings</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="2.0.0" date="2020-04-28">
|
||||
<description>
|
||||
<p>New features:</p>
|
||||
<ul>
|
||||
<li>Remote desktop-optimized mouse mode which doesn't require capturing the mouse cursor</li>
|
||||
<li>Touchscreen input now directly controls the mouse cursor</li>
|
||||
<li>7.1 surround sound support</li>
|
||||
</ul>
|
||||
<p>Bugfixes:</p>
|
||||
<ul>
|
||||
<li>Improved performance on some lossy networks</li>
|
||||
<li>Fixed disconnect delay when streaming from GeForce Experience 3.20.3.63</li>
|
||||
<li>Fixed frame rate not exceeding 60 when streaming from GeForce Experience 3.20.3.63</li>
|
||||
<li>Fixed parsing of command-line options when passing flags prior to the action</li>
|
||||
<li>Fixed an issue that may cause excessive mDNS network traffic while Moonlight is running</li>
|
||||
<li>Fixed hardware decoding on Intel GPUs running Mesa 20.0 and/or the Iris driver</li>
|
||||
<li>Fixed hardware decoding on Comet Lake and later Intel GPUs using the iHD VA-API driver</li>
|
||||
<li>Fixed hardware decoding on AMD Radeon GPUs with XWayland</li>
|
||||
<li>Fixed a crash when using the iHD VA-API driver on Wayland</li>
|
||||
<li>Fixed delay after exiting the stream on Wayland</li>
|
||||
<li>Updated included gamepad mappings</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="1.2.0" date="2019-12-17">
|
||||
<description>
|
||||
<p>Bugfixes:</p>
|
||||
|
||||
@@ -5,9 +5,19 @@
|
||||
# pairing data will be lost each reboot.
|
||||
HOME=/usr/local/moonlight
|
||||
|
||||
# For a seamless transition across the Qt 5.9 -> Qt 5.14 boundary,
|
||||
# we bundle binaries built with both Qt 5.9 and Qt 5.14 and pick
|
||||
# the correct one at runtime.
|
||||
if [ -d "/usr/local/Qt-5.14.1" ]; then
|
||||
BIN="moonlight"
|
||||
else
|
||||
BIN="moonlight59"
|
||||
fi
|
||||
|
||||
# Renice PE_Single_CPU which seems to host A/V stuff
|
||||
renice -10 -p $(pidof PE_Single_CPU)
|
||||
|
||||
# Renice Moonlight itself to avoid preemption by background tasks
|
||||
# Write output to a logfile in /tmp
|
||||
exec nice -n -10 ./bin/moonlight > /tmp/moonlight.log
|
||||
echo Launching $BIN
|
||||
exec nice -n -10 ./bin/$BIN > /tmp/moonlight.log
|
||||
|
||||
+35
-17
@@ -9,6 +9,7 @@ CenteredGridView {
|
||||
property int computerIndex
|
||||
property AppModel appModel : createModel()
|
||||
property bool activated
|
||||
property bool showHiddenGames
|
||||
|
||||
id: appGrid
|
||||
focus: true
|
||||
@@ -48,7 +49,7 @@ CenteredGridView {
|
||||
function createModel()
|
||||
{
|
||||
var model = Qt.createQmlObject('import AppModel 1.0; AppModel {}', parent, '')
|
||||
model.initialize(ComputerManager, computerIndex)
|
||||
model.initialize(ComputerManager, computerIndex, showHiddenGames)
|
||||
return model
|
||||
}
|
||||
|
||||
@@ -58,6 +59,9 @@ CenteredGridView {
|
||||
width: 220; height: 287;
|
||||
grid: appGrid
|
||||
|
||||
// Dim the app if it's hidden
|
||||
opacity: model.hidden ? 0.4 : 1.0
|
||||
|
||||
Image {
|
||||
property bool isPlaceholder: false
|
||||
|
||||
@@ -165,8 +169,8 @@ CenteredGridView {
|
||||
|
||||
function launchOrResumeSelectedApp()
|
||||
{
|
||||
var runningIndex = appModel.getRunningAppIndex()
|
||||
if (runningIndex >= 0 && runningIndex !== index) {
|
||||
var runningId = appModel.getRunningAppId()
|
||||
if (runningId !== 0 && runningId !== model.appid) {
|
||||
quitAppDialog.appName = appModel.getRunningAppName()
|
||||
quitAppDialog.segueToStream = true
|
||||
quitAppDialog.nextAppName = model.name
|
||||
@@ -190,6 +194,25 @@ CenteredGridView {
|
||||
}
|
||||
}
|
||||
|
||||
onPressAndHold: {
|
||||
// popup() ensures the menu appears under the mouse cursor
|
||||
if (appContextMenu.popup) {
|
||||
appContextMenu.popup()
|
||||
}
|
||||
else {
|
||||
// Qt 5.9 doesn't have popup()
|
||||
appContextMenu.open()
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.RightButton;
|
||||
onClicked: {
|
||||
parent.onPressAndHold()
|
||||
}
|
||||
}
|
||||
|
||||
Keys.onReturnPressed: {
|
||||
// Open the app context menu if activated via the gamepad or keyboard
|
||||
// for running games. If the game isn't running, the above onClicked
|
||||
@@ -228,6 +251,14 @@ CenteredGridView {
|
||||
onTriggered: doQuitGame()
|
||||
visible: model.running
|
||||
}
|
||||
NavigableMenuItem {
|
||||
parentMenu: appContextMenu
|
||||
checkable: true
|
||||
checked: model.hidden
|
||||
text: "Hide Game"
|
||||
onTriggered: appModel.setAppHidden(model.index, !model.hidden)
|
||||
visible: !model.running || model.hidden
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,18 +294,5 @@ CenteredGridView {
|
||||
onAccepted: quitApp()
|
||||
}
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
// Manually hide the scrollbar to prevent it from being drawn on top
|
||||
// of the StreamSegue during the transition. It can sometimes get stuck
|
||||
// there since we're not consistently pumping the event loop while
|
||||
// starting the stream.
|
||||
visible: activated
|
||||
|
||||
parent: appGrid.parent
|
||||
anchors {
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
ScrollBar.vertical: ScrollBar {}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,10 @@ import SdlGamepadKeyNavigation 1.0
|
||||
// https://stackoverflow.com/questions/45029968/how-do-i-set-the-combobox-width-to-fit-the-largest-item
|
||||
ComboBox {
|
||||
property int textWidth
|
||||
property int desiredWidth : leftPadding + textWidth + indicator.width + rightPadding
|
||||
property int maximumWidth : parent.width
|
||||
|
||||
implicitWidth: leftPadding + textWidth + indicator.width + rightPadding
|
||||
implicitWidth: desiredWidth < maximumWidth ? desiredWidth : maximumWidth
|
||||
|
||||
TextMetrics {
|
||||
id: popupMetrics
|
||||
|
||||
@@ -38,4 +38,6 @@ GridView {
|
||||
|
||||
updateMargins()
|
||||
}
|
||||
|
||||
boundsBehavior: Flickable.OvershootBounds
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import QtQuick 2.0
|
||||
import QtQuick.Controls 2.2
|
||||
|
||||
import ComputerManager 1.0
|
||||
import SdlGamepadKeyNavigation 1.0
|
||||
|
||||
Item {
|
||||
function onSearchingComputer() {
|
||||
@@ -35,6 +36,11 @@ Item {
|
||||
StackView.onActivated: {
|
||||
if (!launcher.isExecuted()) {
|
||||
toolBar.visible = false
|
||||
|
||||
// Normally this is enabled by PcView, but we will won't
|
||||
// load PcView when streaming from the command-line.
|
||||
SdlGamepadKeyNavigation.enable()
|
||||
|
||||
launcher.searchingComputer.connect(onSearchingComputer)
|
||||
launcher.searchingApp.connect(onSearchingApp)
|
||||
launcher.sessionCreated.connect(onSessionCreated)
|
||||
|
||||
@@ -6,6 +6,8 @@ NavigableDialog {
|
||||
id: dialog
|
||||
|
||||
property alias text: dialogLabel.dialogText
|
||||
property alias showSpinner: dialogSpinner.visible
|
||||
property alias imageSrc: dialogImage.source
|
||||
|
||||
property string helpText
|
||||
property string helpUrl : "https://github.com/moonlight-stream/moonlight-docs/wiki/Troubleshooting"
|
||||
@@ -19,7 +21,13 @@ NavigableDialog {
|
||||
RowLayout {
|
||||
spacing: 10
|
||||
|
||||
BusyIndicator {
|
||||
id: dialogSpinner
|
||||
visible: false
|
||||
}
|
||||
|
||||
Image {
|
||||
id: dialogImage
|
||||
source: (standardButtons & Dialog.Yes) ?
|
||||
"qrc:/res/baseline-help_outline-24px.svg" :
|
||||
"qrc:/res/baseline-error_outline-24px.svg"
|
||||
@@ -28,6 +36,7 @@ NavigableDialog {
|
||||
width: 50
|
||||
height: 50
|
||||
}
|
||||
visible: !showSpinner
|
||||
}
|
||||
|
||||
Label {
|
||||
|
||||
+129
-13
@@ -1,5 +1,6 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
import ComputerModel 1.0
|
||||
|
||||
@@ -25,6 +26,9 @@ CenteredGridView {
|
||||
currentIndex = -1
|
||||
}
|
||||
|
||||
// Note: Any initialization done here that is critical for streaming must
|
||||
// also be done in CliStartStreamSegue.qml, since this code does not run
|
||||
// for command-line initiated streams.
|
||||
StackView.onActivated: {
|
||||
// Setup signals on CM
|
||||
ComputerManager.computerAddCompleted.connect(addComplete)
|
||||
@@ -57,11 +61,18 @@ CenteredGridView {
|
||||
}
|
||||
}
|
||||
|
||||
function addComplete(success)
|
||||
function addComplete(success, detectedPortBlocking)
|
||||
{
|
||||
if (!success) {
|
||||
errorDialog.text = "Unable to connect to the specified PC."
|
||||
errorDialog.helpText = "Click the Help button for possible solutions."
|
||||
|
||||
if (detectedPortBlocking) {
|
||||
errorDialog.text += "\n\nThis PC's Internet connection is blocking Moonlight. Streaming over the Internet may not work while connected to this network."
|
||||
}
|
||||
else {
|
||||
errorDialog.helpText = "Click the Help button for possible solutions."
|
||||
}
|
||||
|
||||
errorDialog.open()
|
||||
}
|
||||
}
|
||||
@@ -71,6 +82,7 @@ CenteredGridView {
|
||||
var model = Qt.createQmlObject('import ComputerModel 1.0; ComputerModel {}', parent, '')
|
||||
model.initialize(ComputerManager)
|
||||
model.pairingCompleted.connect(pairingComplete)
|
||||
model.connectionTestCompleted.connect(testConnectionDialog.connectionTestComplete)
|
||||
return model
|
||||
}
|
||||
|
||||
@@ -152,12 +164,23 @@ CenteredGridView {
|
||||
id: pcContextMenu
|
||||
NavigableMenuItem {
|
||||
parentMenu: pcContextMenu
|
||||
text: "Delete PC"
|
||||
text: "View Apps"
|
||||
onTriggered: {
|
||||
deletePcDialog.pcIndex = index
|
||||
// get confirmation first, actual closing is called from the dialog
|
||||
deletePcDialog.open()
|
||||
var component = Qt.createComponent("AppView.qml")
|
||||
var appView = component.createObject(stackView, {"computerIndex": index, "objectName": model.name})
|
||||
stackView.push(appView)
|
||||
}
|
||||
visible: model.online && model.paired
|
||||
}
|
||||
NavigableMenuItem {
|
||||
parentMenu: pcContextMenu
|
||||
text: "View Hidden Apps"
|
||||
onTriggered: {
|
||||
var component = Qt.createComponent("AppView.qml")
|
||||
var appView = component.createObject(stackView, {"computerIndex": index, "objectName": model.name, "showHiddenGames": true})
|
||||
stackView.push(appView)
|
||||
}
|
||||
visible: model.online && model.paired
|
||||
}
|
||||
NavigableMenuItem {
|
||||
parentMenu: pcContextMenu
|
||||
@@ -165,6 +188,33 @@ CenteredGridView {
|
||||
onTriggered: computerModel.wakeComputer(index)
|
||||
visible: !model.online && model.wakeable
|
||||
}
|
||||
NavigableMenuItem {
|
||||
parentMenu: pcContextMenu
|
||||
text: "Test Network"
|
||||
onTriggered: {
|
||||
computerModel.testConnectionForComputer(index)
|
||||
testConnectionDialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
NavigableMenuItem {
|
||||
parentMenu: pcContextMenu
|
||||
text: "Rename PC"
|
||||
onTriggered: {
|
||||
renamePcDialog.pcIndex = index
|
||||
renamePcDialog.originalName = model.name
|
||||
renamePcDialog.open()
|
||||
}
|
||||
}
|
||||
NavigableMenuItem {
|
||||
parentMenu: pcContextMenu
|
||||
text: "Delete PC"
|
||||
onTriggered: {
|
||||
deletePcDialog.pcIndex = index
|
||||
// get confirmation first, actual closing is called from the dialog
|
||||
deletePcDialog.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
@@ -177,7 +227,7 @@ CenteredGridView {
|
||||
}
|
||||
else {
|
||||
if (!model.busy) {
|
||||
var pin = ("0000" + Math.floor(Math.random() * 10000)).slice(-4)
|
||||
var pin = computerModel.generatePinString()
|
||||
|
||||
// Kick off pairing in the background
|
||||
computerModel.pairComputer(index, pin)
|
||||
@@ -265,12 +315,78 @@ CenteredGridView {
|
||||
onAccepted: deletePc()
|
||||
}
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
parent: pcGrid.parent
|
||||
anchors {
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
NavigableMessageDialog {
|
||||
id: testConnectionDialog
|
||||
closePolicy: Popup.CloseOnEscape
|
||||
standardButtons: Dialog.Ok
|
||||
|
||||
onAboutToShow: {
|
||||
testConnectionDialog.text = "Moonlight is testing your network connection to determine if NVIDIA GameStream is blocked.\n\nThis may take a few seconds…"
|
||||
showSpinner = true
|
||||
}
|
||||
|
||||
function connectionTestComplete(result, blockedPorts)
|
||||
{
|
||||
if (result === -1) {
|
||||
text = "The network test could not be performed because none of Moonlight's connection testing servers were reachable from this PC. Check your Internet connection or try again later."
|
||||
imageSrc = "qrc:/res/baseline-warning-24px.svg"
|
||||
}
|
||||
else if (result === 0) {
|
||||
text = "This network does not appear to be blocking Moonlight. If you still have trouble connecting, check your PC's firewall settings.\n\nIf you are trying to stream over the Internet, install the Moonlight Internet Hosting Tool on your gaming PC and run the included Internet Streaming Tester to check your gaming PC's Internet connection."
|
||||
imageSrc = "qrc:/res/baseline-check_circle_outline-24px.svg"
|
||||
}
|
||||
else {
|
||||
text = "Your PC's current network connection seems to be blocking Moonlight. Streaming over the Internet may not work while connected to this network.\n\nThe following network ports were blocked:\n"
|
||||
text += blockedPorts
|
||||
imageSrc = "qrc:/res/baseline-error_outline-24px.svg"
|
||||
}
|
||||
|
||||
// Stop showing the spinner and show the image instead
|
||||
showSpinner = false
|
||||
}
|
||||
}
|
||||
|
||||
NavigableDialog {
|
||||
id: renamePcDialog
|
||||
property string label: "Enter the new name for this PC:"
|
||||
property string originalName
|
||||
property int pcIndex : -1;
|
||||
|
||||
standardButtons: Dialog.Ok | Dialog.Cancel
|
||||
|
||||
onOpened: {
|
||||
// Force keyboard focus on the textbox so keyboard navigation works
|
||||
editText.forceActiveFocus()
|
||||
}
|
||||
|
||||
onClosed: {
|
||||
editText.clear()
|
||||
}
|
||||
|
||||
onAccepted: {
|
||||
if (editText.text) {
|
||||
computerModel.renameComputer(pcIndex, editText.text)
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Label {
|
||||
text: renamePcDialog.label
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: editText
|
||||
placeholderText: renamePcDialog.originalName
|
||||
Layout.fillWidth: true
|
||||
focus: true
|
||||
|
||||
Keys.onReturnPressed: {
|
||||
renamePcDialog.accept()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScrollBar.vertical: ScrollBar {}
|
||||
}
|
||||
|
||||
+139
-41
@@ -10,16 +10,14 @@ Flickable {
|
||||
id: settingsPage
|
||||
objectName: "Settings"
|
||||
|
||||
boundsBehavior: Flickable.OvershootBounds
|
||||
|
||||
contentWidth: settingsColumn1.width > settingsColumn2.width ? settingsColumn1.width : settingsColumn2.width
|
||||
contentHeight: settingsColumn1.height > settingsColumn2.height ? settingsColumn1.height : settingsColumn2.height
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
parent: settingsPage.parent
|
||||
anchors {
|
||||
top: settingsPage.top
|
||||
left: settingsPage.right
|
||||
bottom: settingsPage.bottom
|
||||
|
||||
left: parent.right
|
||||
leftMargin: -10
|
||||
}
|
||||
}
|
||||
@@ -45,11 +43,12 @@ Flickable {
|
||||
Column {
|
||||
padding: 10
|
||||
id: settingsColumn1
|
||||
width: settingsPage.width / 2 - padding
|
||||
width: settingsPage.width / 2
|
||||
spacing: 15
|
||||
|
||||
GroupBox {
|
||||
id: basicSettingsGroupBox
|
||||
width: (parent.width - 2 * parent.padding)
|
||||
width: (parent.width - (parent.leftPadding + parent.rightPadding))
|
||||
padding: 12
|
||||
title: "<font color=\"skyblue\">Basic Settings</font>"
|
||||
font.pointSize: 12
|
||||
@@ -76,6 +75,7 @@ Flickable {
|
||||
|
||||
Row {
|
||||
spacing: 5
|
||||
width: parent.width
|
||||
|
||||
AutoResizingComboBox {
|
||||
// ignore setting the index at first, and actually set it when the component is loaded
|
||||
@@ -88,7 +88,7 @@ Flickable {
|
||||
|
||||
// Some platforms have different desktop resolutions
|
||||
// and native resolutions (like macOS with Retina displays)
|
||||
if (displayResIndex == 0) {
|
||||
if (displayResIndex === 0) {
|
||||
screenRect = SystemProperties.getDesktopResolution(displayIndex)
|
||||
}
|
||||
else {
|
||||
@@ -129,6 +129,20 @@ Flickable {
|
||||
}
|
||||
}
|
||||
|
||||
// Prune resolutions that are over the decoder's maximum
|
||||
var max_pixels = SystemProperties.maximumResolution.width * SystemProperties.maximumResolution.height;
|
||||
if (max_pixels > 0) {
|
||||
for (var j = 0; j < resolutionComboBox.count; j++) {
|
||||
var existing_width = parseInt(resolutionListModel.get(j).video_width);
|
||||
var existing_height = parseInt(resolutionListModel.get(j).video_height);
|
||||
|
||||
if (existing_width * existing_height > max_pixels) {
|
||||
resolutionListModel.remove(j)
|
||||
j--
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// load the saved width/height, and iterate through the ComboBox until a match is found
|
||||
// and set it to that index.
|
||||
var saved_width = StreamingPreferences.width
|
||||
@@ -149,6 +163,7 @@ Flickable {
|
||||
}
|
||||
|
||||
id: resolutionComboBox
|
||||
maximumWidth: parent.width / 2
|
||||
textRole: "text"
|
||||
model: ListModel {
|
||||
id: resolutionListModel
|
||||
@@ -265,6 +280,7 @@ Flickable {
|
||||
}
|
||||
|
||||
id: fpsComboBox
|
||||
maximumWidth: parent.width / 2
|
||||
textRole: "text"
|
||||
// ::onActivated must be used, as it only listens for when the index is changed by a human
|
||||
onActivated : {
|
||||
@@ -338,19 +354,24 @@ Flickable {
|
||||
}
|
||||
}
|
||||
|
||||
var savedWm = StreamingPreferences.windowMode
|
||||
currentIndex = 0
|
||||
for (var i = 0; i < windowModeListModel.count; i++) {
|
||||
var thisWm = windowModeListModel.get(i).val;
|
||||
if (savedWm === thisWm) {
|
||||
currentIndex = i
|
||||
break
|
||||
}
|
||||
|
||||
if (SystemProperties.hasWindowManager && !SystemProperties.rendererAlwaysFullScreen) {
|
||||
var savedWm = StreamingPreferences.windowMode
|
||||
for (var i = 0; i < windowModeListModel.count; i++) {
|
||||
var thisWm = windowModeListModel.get(i).val;
|
||||
if (savedWm === thisWm) {
|
||||
currentIndex = i
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
activated(currentIndex)
|
||||
}
|
||||
|
||||
id: windowModeComboBox
|
||||
enabled: SystemProperties.hasWindowManager && !SystemProperties.rendererAlwaysFullScreen
|
||||
hoverEnabled: true
|
||||
textRole: "text"
|
||||
model: ListModel {
|
||||
@@ -380,6 +401,7 @@ Flickable {
|
||||
|
||||
CheckBox {
|
||||
id: vsyncCheck
|
||||
width: parent.width
|
||||
hoverEnabled: true
|
||||
text: "V-Sync"
|
||||
font.pointSize: 12
|
||||
@@ -396,6 +418,7 @@ Flickable {
|
||||
|
||||
CheckBox {
|
||||
id: framePacingCheck
|
||||
width: parent.width
|
||||
hoverEnabled: true
|
||||
text: "Frame pacing"
|
||||
font.pointSize: 12
|
||||
@@ -415,7 +438,7 @@ Flickable {
|
||||
GroupBox {
|
||||
|
||||
id: audioSettingsGroupBox
|
||||
width: (parent.width - 2 * parent.padding)
|
||||
width: (parent.width - (parent.leftPadding + parent.rightPadding))
|
||||
padding: 12
|
||||
title: "<font color=\"skyblue\">Audio Settings</font>"
|
||||
font.pointSize: 12
|
||||
@@ -459,6 +482,10 @@ Flickable {
|
||||
text: "5.1 surround sound"
|
||||
val: StreamingPreferences.AC_51_SURROUND
|
||||
}
|
||||
ListElement {
|
||||
text: "7.1 surround sound"
|
||||
val: StreamingPreferences.AC_71_SURROUND
|
||||
}
|
||||
}
|
||||
// ::onActivated must be used, as it only listens for when the index is changed by a human
|
||||
onActivated : {
|
||||
@@ -471,7 +498,7 @@ Flickable {
|
||||
|
||||
GroupBox {
|
||||
id: uiSettingsGroupBox
|
||||
width: (parent.width - 2 * parent.padding)
|
||||
width: (parent.width - (parent.leftPadding + parent.rightPadding))
|
||||
padding: 12
|
||||
title: "<font color=\"skyblue\">UI Settings</font>"
|
||||
font.pointSize: 12
|
||||
@@ -482,9 +509,11 @@ Flickable {
|
||||
|
||||
CheckBox {
|
||||
id: startMaximizedCheck
|
||||
width: parent.width
|
||||
text: "Maximize Moonlight window on startup"
|
||||
font.pointSize: 12
|
||||
checked: !StreamingPreferences.startWindowed
|
||||
enabled: SystemProperties.hasWindowManager
|
||||
checked: !StreamingPreferences.startWindowed || !SystemProperties.hasWindowManager
|
||||
onCheckedChanged: {
|
||||
StreamingPreferences.startWindowed = !checked
|
||||
}
|
||||
@@ -492,6 +521,7 @@ Flickable {
|
||||
|
||||
CheckBox {
|
||||
id: connectionWarningsCheck
|
||||
width: parent.width
|
||||
text: "Show connection quality warnings"
|
||||
font.pointSize: 12
|
||||
checked: StreamingPreferences.connectionWarnings
|
||||
@@ -503,6 +533,7 @@ Flickable {
|
||||
CheckBox {
|
||||
visible: SystemProperties.hasDiscordIntegration
|
||||
id: discordPresenceCheck
|
||||
width: parent.width
|
||||
text: "Discord Rich Presence integration"
|
||||
font.pointSize: 12
|
||||
checked: StreamingPreferences.richPresence
|
||||
@@ -521,13 +552,15 @@ Flickable {
|
||||
|
||||
Column {
|
||||
padding: 10
|
||||
rightPadding: 20
|
||||
anchors.left: settingsColumn1.right
|
||||
id: settingsColumn2
|
||||
width: settingsPage.width / 2 - padding
|
||||
width: settingsPage.width / 2
|
||||
spacing: 15
|
||||
|
||||
GroupBox {
|
||||
id: gamepadSettingsGroupBox
|
||||
width: (parent.width - parent.padding)
|
||||
width: (parent.width - (parent.leftPadding + parent.rightPadding))
|
||||
padding: 12
|
||||
title: "<font color=\"skyblue\">Input Settings</font>"
|
||||
font.pointSize: 12
|
||||
@@ -538,6 +571,7 @@ Flickable {
|
||||
|
||||
CheckBox {
|
||||
id: singleControllerCheck
|
||||
width: parent.width
|
||||
text: "Force gamepad #1 always present"
|
||||
font.pointSize: 12
|
||||
checked: !StreamingPreferences.multiController
|
||||
@@ -553,24 +587,45 @@ Flickable {
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id: rawInputCheck
|
||||
id: absoluteMouseCheck
|
||||
hoverEnabled: true
|
||||
text: "Raw mouse input"
|
||||
width: parent.width
|
||||
text: "Optimize mouse for remote desktop instead of games"
|
||||
font.pointSize: 12
|
||||
checked: !StreamingPreferences.mouseAcceleration
|
||||
enabled: SystemProperties.hasWindowManager
|
||||
checked: StreamingPreferences.absoluteMouseMode && SystemProperties.hasWindowManager
|
||||
onCheckedChanged: {
|
||||
StreamingPreferences.mouseAcceleration = !checked
|
||||
StreamingPreferences.absoluteMouseMode = checked
|
||||
}
|
||||
|
||||
ToolTip.delay: 1000
|
||||
ToolTip.timeout: 3000
|
||||
ToolTip.timeout: 5000
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.text: "When checked, mouse input is not accelerated or scaled by the OS before passing to Moonlight"
|
||||
ToolTip.text: "This enables mouse control without capturing the client's mouse cursor. It will not work in most games.\n
|
||||
You can toggle this while streaming using Ctrl+Alt+Shift+M."
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id: absoluteTouchCheck
|
||||
hoverEnabled: true
|
||||
width: parent.width
|
||||
text: "Use touchscreen as a trackpad"
|
||||
font.pointSize: 12
|
||||
checked: !StreamingPreferences.absoluteTouchMode
|
||||
onCheckedChanged: {
|
||||
StreamingPreferences.absoluteTouchMode = !checked
|
||||
}
|
||||
|
||||
ToolTip.delay: 1000
|
||||
ToolTip.timeout: 5000
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.text: "When checked, the touchscreen acts like a trackpad. When unchecked, the touchscreen will directly control the mouse pointer."
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id: gamepadMouseCheck
|
||||
hoverEnabled: true
|
||||
width: parent.width
|
||||
text: "Gamepad mouse mode support"
|
||||
font.pointSize: 12
|
||||
checked: StreamingPreferences.gamepadMouse
|
||||
@@ -583,12 +638,29 @@ Flickable {
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.text: "When enabled, holding the Start button will toggle mouse mode"
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id: swapMouseButtonsCheck
|
||||
hoverEnabled: true
|
||||
width: parent.width
|
||||
text: "Swap mouse buttons"
|
||||
font.pointSize: 12
|
||||
checked: StreamingPreferences.swapMouseButtons
|
||||
onCheckedChanged: {
|
||||
StreamingPreferences.swapMouseButtons = checked
|
||||
}
|
||||
|
||||
ToolTip.delay: 1000
|
||||
ToolTip.timeout: 3000
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.text: "When checked, swap the left and right mouse buttons"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GroupBox {
|
||||
id: hostSettingsGroupBox
|
||||
width: (parent.width - parent.padding)
|
||||
width: (parent.width - (parent.leftPadding + parent.rightPadding))
|
||||
padding: 12
|
||||
title: "<font color=\"skyblue\">Host Settings</font>"
|
||||
font.pointSize: 12
|
||||
@@ -599,7 +671,8 @@ Flickable {
|
||||
|
||||
CheckBox {
|
||||
id: optimizeGameSettingsCheck
|
||||
text: "Optimize game settings"
|
||||
width: parent.width
|
||||
text: "Optimize game settings for streaming"
|
||||
font.pointSize: 12
|
||||
checked: StreamingPreferences.gameOptimizations
|
||||
onCheckedChanged: {
|
||||
@@ -609,6 +682,7 @@ Flickable {
|
||||
|
||||
CheckBox {
|
||||
id: audioPcCheck
|
||||
width: parent.width
|
||||
text: "Play audio on host PC"
|
||||
font.pointSize: 12
|
||||
checked: StreamingPreferences.playAudioOnHost
|
||||
@@ -616,12 +690,28 @@ Flickable {
|
||||
StreamingPreferences.playAudioOnHost = checked
|
||||
}
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id: quitAppAfter
|
||||
width: parent.width
|
||||
text: "Quit app on host PC after ending stream"
|
||||
font.pointSize: 12
|
||||
checked: StreamingPreferences.quitAppAfter
|
||||
onCheckedChanged: {
|
||||
StreamingPreferences.quitAppAfter = checked
|
||||
}
|
||||
|
||||
ToolTip.delay: 1000
|
||||
ToolTip.timeout: 5000
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.text: "This will close the app or game you are streaming when you end your stream. You will lose any unsaved progress!"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GroupBox {
|
||||
id: advancedSettingsGroupBox
|
||||
width: (parent.width - parent.padding)
|
||||
width: (parent.width - (parent.leftPadding + parent.rightPadding))
|
||||
padding: 12
|
||||
title: "<font color=\"skyblue\">Advanced Settings</font>"
|
||||
font.pointSize: 12
|
||||
@@ -708,20 +798,17 @@ Flickable {
|
||||
val: StreamingPreferences.VCC_AUTO
|
||||
}
|
||||
ListElement {
|
||||
text: "Force H.264"
|
||||
text: "H.264"
|
||||
val: StreamingPreferences.VCC_FORCE_H264
|
||||
}
|
||||
ListElement {
|
||||
text: "Force HEVC"
|
||||
text: "HEVC (H.265)"
|
||||
val: StreamingPreferences.VCC_FORCE_HEVC
|
||||
}
|
||||
// HDR seems to be broken in GFE 3.14.1, and even when that's fixed
|
||||
// we'll probably need to gate this feature on OS support in our
|
||||
// renderers.
|
||||
/* ListElement {
|
||||
text: "Force HEVC HDR"
|
||||
/*ListElement {
|
||||
text: "HEVC HDR (Experimental)"
|
||||
val: StreamingPreferences.VCC_FORCE_HEVC_HDR
|
||||
} */
|
||||
}*/
|
||||
}
|
||||
// ::onActivated must be used, as it only listens for when the index is changed by a human
|
||||
onActivated : {
|
||||
@@ -731,6 +818,7 @@ Flickable {
|
||||
|
||||
CheckBox {
|
||||
id: unlockUnsupportedFps
|
||||
width: parent.width
|
||||
text: "Unlock unsupported FPS options"
|
||||
font.pointSize: 12
|
||||
checked: StreamingPreferences.unsupportedFps
|
||||
@@ -749,6 +837,7 @@ Flickable {
|
||||
|
||||
CheckBox {
|
||||
id: enableMdns
|
||||
width: parent.width
|
||||
text: "Automatically find PCs on the local network (Recommended)"
|
||||
font.pointSize: 12
|
||||
checked: StreamingPreferences.enableMdns
|
||||
@@ -772,12 +861,21 @@ Flickable {
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id: quitAppAfter
|
||||
text: "Quit app after quitting session"
|
||||
id: detectNetworkBlocking
|
||||
width: parent.width
|
||||
text: "Automatically detect blocked connections (Recommended)"
|
||||
font.pointSize: 12
|
||||
checked: StreamingPreferences.quitAppAfter
|
||||
checked: StreamingPreferences.detectNetworkBlocking
|
||||
onCheckedChanged: {
|
||||
StreamingPreferences.quitAppAfter = checked
|
||||
// This is called on init, so only do the work if we've
|
||||
// actually changed the value.
|
||||
if (StreamingPreferences.detectNetworkBlocking != checked) {
|
||||
StreamingPreferences.detectNetworkBlocking = checked
|
||||
|
||||
// We must save the updated preference to ensure
|
||||
// ComputerManager can observe the change internally.
|
||||
StreamingPreferences.save()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+19
-1
@@ -62,8 +62,12 @@ Item {
|
||||
window.visible = true
|
||||
}
|
||||
|
||||
function sessionFinished()
|
||||
function sessionFinished(portTestResult)
|
||||
{
|
||||
if (portTestResult !== 0 && portTestResult !== -1 && streamSegueErrorDialog.text) {
|
||||
streamSegueErrorDialog.text += "\n\nThis PC's Internet connection is blocking Moonlight. Streaming over the Internet may not work while connected to this network."
|
||||
}
|
||||
|
||||
// Enable GUI gamepad usage now
|
||||
SdlGamepadKeyNavigation.enable()
|
||||
|
||||
@@ -117,9 +121,22 @@ Item {
|
||||
session.sessionFinished.connect(sessionFinished)
|
||||
|
||||
// Kick off the stream
|
||||
spinnerTimer.start()
|
||||
streamLoader.active = true
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: spinnerTimer
|
||||
|
||||
// Display the spinner appearance a bit to allow us to reach
|
||||
// the code in Session.exec() that pumps the event loop.
|
||||
// If we display it immediately, it will briefly hang in the
|
||||
// middle of the animation on Windows, which looks very
|
||||
// obviously broken.
|
||||
interval: 100
|
||||
onTriggered: stageSpinner.running = true
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: streamLoader
|
||||
active: false
|
||||
@@ -150,6 +167,7 @@ Item {
|
||||
|
||||
BusyIndicator {
|
||||
id: stageSpinner
|
||||
running: false
|
||||
}
|
||||
|
||||
Label {
|
||||
|
||||
+133
-32
@@ -7,7 +7,7 @@ AppModel::AppModel(QObject *parent)
|
||||
this, &AppModel::handleBoxArtLoaded);
|
||||
}
|
||||
|
||||
void AppModel::initialize(ComputerManager* computerManager, int computerIndex)
|
||||
void AppModel::initialize(ComputerManager* computerManager, int computerIndex, bool showHiddenGames)
|
||||
{
|
||||
m_ComputerManager = computerManager;
|
||||
connect(m_ComputerManager, &ComputerManager::computerStateChanged,
|
||||
@@ -15,29 +15,23 @@ void AppModel::initialize(ComputerManager* computerManager, int computerIndex)
|
||||
|
||||
Q_ASSERT(computerIndex < m_ComputerManager->getComputers().count());
|
||||
m_Computer = m_ComputerManager->getComputers().at(computerIndex);
|
||||
m_Apps = m_Computer->appList;
|
||||
m_CurrentGameId = m_Computer->currentGameId;
|
||||
m_ShowHiddenGames = showHiddenGames;
|
||||
|
||||
updateAppList(m_Computer->appList);
|
||||
}
|
||||
|
||||
int AppModel::getRunningAppIndex()
|
||||
int AppModel::getRunningAppId()
|
||||
{
|
||||
if (m_CurrentGameId != 0) {
|
||||
for (int i = 0; i < m_Apps.count(); i++) {
|
||||
if (m_Apps[i].id == m_CurrentGameId) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
return m_CurrentGameId;
|
||||
}
|
||||
|
||||
QString AppModel::getRunningAppName()
|
||||
{
|
||||
if (m_CurrentGameId != 0) {
|
||||
for (int i = 0; i < m_Apps.count(); i++) {
|
||||
if (m_Apps[i].id == m_CurrentGameId) {
|
||||
return m_Apps[i].name;
|
||||
for (int i = 0; i < m_AllApps.count(); i++) {
|
||||
if (m_AllApps[i].id == m_CurrentGameId) {
|
||||
return m_AllApps[i].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,8 +41,8 @@ QString AppModel::getRunningAppName()
|
||||
|
||||
Session* AppModel::createSessionForApp(int appIndex)
|
||||
{
|
||||
Q_ASSERT(appIndex < m_Apps.count());
|
||||
NvApp app = m_Apps.at(appIndex);
|
||||
Q_ASSERT(appIndex < m_VisibleApps.count());
|
||||
NvApp app = m_VisibleApps.at(appIndex);
|
||||
|
||||
return new Session(m_Computer, app);
|
||||
}
|
||||
@@ -60,7 +54,7 @@ int AppModel::rowCount(const QModelIndex &parent) const
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
|
||||
return m_Apps.count();
|
||||
return m_VisibleApps.count();
|
||||
}
|
||||
|
||||
QVariant AppModel::data(const QModelIndex &index, int role) const
|
||||
@@ -68,8 +62,8 @@ QVariant AppModel::data(const QModelIndex &index, int role) const
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
Q_ASSERT(index.row() < m_Apps.count());
|
||||
NvApp app = m_Apps.at(index.row());
|
||||
Q_ASSERT(index.row() < m_VisibleApps.count());
|
||||
NvApp app = m_VisibleApps.at(index.row());
|
||||
|
||||
switch (role)
|
||||
{
|
||||
@@ -80,6 +74,10 @@ QVariant AppModel::data(const QModelIndex &index, int role) const
|
||||
case BoxArtRole:
|
||||
// FIXME: const-correctness
|
||||
return const_cast<BoxArtManager&>(m_BoxArtManager).loadBoxArt(m_Computer, app);
|
||||
case HiddenRole:
|
||||
return app.hidden;
|
||||
case AppIdRole:
|
||||
return app.id;
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
@@ -92,6 +90,8 @@ QHash<int, QByteArray> AppModel::roleNames() const
|
||||
names[NameRole] = "name";
|
||||
names[RunningRole] = "running";
|
||||
names[BoxArtRole] = "boxart";
|
||||
names[HiddenRole] = "hidden";
|
||||
names[AppIdRole] = "appid";
|
||||
|
||||
return names;
|
||||
}
|
||||
@@ -101,6 +101,112 @@ void AppModel::quitRunningApp()
|
||||
m_ComputerManager->quitRunningApp(m_Computer);
|
||||
}
|
||||
|
||||
bool AppModel::isAppCurrentlyVisible(const NvApp& app)
|
||||
{
|
||||
for (const NvApp& visibleApp : m_VisibleApps) {
|
||||
if (app.id == visibleApp.id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
QVector<NvApp> AppModel::getVisibleApps(const QVector<NvApp>& appList)
|
||||
{
|
||||
QVector<NvApp> visibleApps;
|
||||
|
||||
for (const NvApp& app : appList) {
|
||||
// Don't immediately hide games that were previously visible. This
|
||||
// allows users to easily uncheck the "Hide App" checkbox if they
|
||||
// check it by mistake.
|
||||
if (m_ShowHiddenGames || !app.hidden || isAppCurrentlyVisible(app)) {
|
||||
visibleApps.append(app);
|
||||
}
|
||||
}
|
||||
|
||||
return visibleApps;
|
||||
}
|
||||
|
||||
void AppModel::updateAppList(QVector<NvApp> newList)
|
||||
{
|
||||
m_AllApps = newList;
|
||||
|
||||
QVector<NvApp> newVisibleList = getVisibleApps(newList);
|
||||
|
||||
// Process removals and updates first
|
||||
for (int i = 0; i < m_VisibleApps.count(); i++) {
|
||||
const NvApp& existingApp = m_VisibleApps.at(i);
|
||||
|
||||
bool found = false;
|
||||
for (const NvApp& newApp : newVisibleList) {
|
||||
if (existingApp.id == newApp.id) {
|
||||
// If the data changed, update it in our list
|
||||
if (existingApp != newApp) {
|
||||
m_VisibleApps.replace(i, newApp);
|
||||
emit dataChanged(createIndex(i, 0), createIndex(i, 0));
|
||||
}
|
||||
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
beginRemoveRows(QModelIndex(), i, i);
|
||||
m_VisibleApps.removeAt(i);
|
||||
endRemoveRows();
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
// Process additions now
|
||||
for (const NvApp& newApp : newVisibleList) {
|
||||
int insertionIndex = m_VisibleApps.size();
|
||||
bool found = false;
|
||||
|
||||
for (int i = 0; i < m_VisibleApps.count(); i++) {
|
||||
const NvApp& existingApp = m_VisibleApps.at(i);
|
||||
|
||||
if (existingApp.id == newApp.id) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
else if (existingApp.name.toLower() > newApp.name.toLower()) {
|
||||
insertionIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
beginInsertRows(QModelIndex(), insertionIndex, insertionIndex);
|
||||
m_VisibleApps.insert(insertionIndex, newApp);
|
||||
endInsertRows();
|
||||
}
|
||||
}
|
||||
|
||||
Q_ASSERT(newVisibleList == m_VisibleApps);
|
||||
}
|
||||
|
||||
void AppModel::setAppHidden(int appIndex, bool hidden)
|
||||
{
|
||||
Q_ASSERT(appIndex < m_VisibleApps.count());
|
||||
int appId = m_VisibleApps.at(appIndex).id;
|
||||
|
||||
{
|
||||
QWriteLocker lock(&m_Computer->lock);
|
||||
|
||||
for (NvApp& app : m_Computer->appList) {
|
||||
if (app.id == appId) {
|
||||
app.hidden = hidden;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_ComputerManager->clientSideAttributeUpdated(m_Computer);
|
||||
}
|
||||
|
||||
void AppModel::handleComputerStateChanged(NvComputer* computer)
|
||||
{
|
||||
// Ignore updates for computers that aren't ours
|
||||
@@ -119,20 +225,15 @@ void AppModel::handleComputerStateChanged(NvComputer* computer)
|
||||
// First, process additions/removals from the app list. This
|
||||
// is required because the new game may now be running, so
|
||||
// we can't check that first.
|
||||
if (computer->appList != m_Apps) {
|
||||
// Just reset the whole thing if the list changes
|
||||
beginResetModel();
|
||||
m_Apps = computer->appList;
|
||||
m_CurrentGameId = computer->currentGameId;
|
||||
endResetModel();
|
||||
return;
|
||||
if (computer->appList != m_AllApps) {
|
||||
updateAppList(computer->appList);
|
||||
}
|
||||
|
||||
// Finally, process changes to the active app
|
||||
if (computer->currentGameId != m_CurrentGameId) {
|
||||
// First, invalidate the running state of newly running game
|
||||
for (int i = 0; i < m_Apps.count(); i++) {
|
||||
if (m_Apps[i].id == computer->currentGameId) {
|
||||
for (int i = 0; i < m_VisibleApps.count(); i++) {
|
||||
if (m_VisibleApps[i].id == computer->currentGameId) {
|
||||
emit dataChanged(createIndex(i, 0),
|
||||
createIndex(i, 0),
|
||||
QVector<int>() << RunningRole);
|
||||
@@ -142,8 +243,8 @@ void AppModel::handleComputerStateChanged(NvComputer* computer)
|
||||
|
||||
// Next, invalidate the running state of the old game (if it exists)
|
||||
if (m_CurrentGameId != 0) {
|
||||
for (int i = 0; i < m_Apps.count(); i++) {
|
||||
if (m_Apps[i].id == m_CurrentGameId) {
|
||||
for (int i = 0; i < m_VisibleApps.count(); i++) {
|
||||
if (m_VisibleApps[i].id == m_CurrentGameId) {
|
||||
emit dataChanged(createIndex(i, 0),
|
||||
createIndex(i, 0),
|
||||
QVector<int>() << RunningRole);
|
||||
@@ -161,7 +262,7 @@ void AppModel::handleBoxArtLoaded(NvComputer* computer, NvApp app, QUrl /* image
|
||||
{
|
||||
Q_ASSERT(computer == m_Computer);
|
||||
|
||||
int index = m_Apps.indexOf(app);
|
||||
int index = m_VisibleApps.indexOf(app);
|
||||
|
||||
// Make sure we're not delivering a callback to an app that's already been removed
|
||||
if (index >= 0) {
|
||||
|
||||
+15
-4
@@ -14,23 +14,27 @@ class AppModel : public QAbstractListModel
|
||||
{
|
||||
NameRole = Qt::UserRole,
|
||||
RunningRole,
|
||||
BoxArtRole
|
||||
BoxArtRole,
|
||||
HiddenRole,
|
||||
AppIdRole,
|
||||
};
|
||||
|
||||
public:
|
||||
explicit AppModel(QObject *parent = nullptr);
|
||||
|
||||
// Must be called before any QAbstractListModel functions
|
||||
Q_INVOKABLE void initialize(ComputerManager* computerManager, int computerIndex);
|
||||
Q_INVOKABLE void initialize(ComputerManager* computerManager, int computerIndex, bool showHiddenGames);
|
||||
|
||||
Q_INVOKABLE Session* createSessionForApp(int appIndex);
|
||||
|
||||
Q_INVOKABLE int getRunningAppIndex();
|
||||
Q_INVOKABLE int getRunningAppId();
|
||||
|
||||
Q_INVOKABLE QString getRunningAppName();
|
||||
|
||||
Q_INVOKABLE void quitRunningApp();
|
||||
|
||||
Q_INVOKABLE void setAppHidden(int appIndex, bool hidden);
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
|
||||
int rowCount(const QModelIndex &parent) const override;
|
||||
@@ -46,9 +50,16 @@ signals:
|
||||
void computerLost();
|
||||
|
||||
private:
|
||||
void updateAppList(QVector<NvApp> newList);
|
||||
|
||||
QVector<NvApp> getVisibleApps(const QVector<NvApp>& appList);
|
||||
|
||||
bool isAppCurrentlyVisible(const NvApp& app);
|
||||
|
||||
NvComputer* m_Computer;
|
||||
BoxArtManager m_BoxArtManager;
|
||||
ComputerManager* m_ComputerManager;
|
||||
QVector<NvApp> m_Apps;
|
||||
QVector<NvApp> m_VisibleApps, m_AllApps;
|
||||
int m_CurrentGameId;
|
||||
bool m_ShowHiddenGames;
|
||||
};
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include <QThreadPool>
|
||||
|
||||
#include <random>
|
||||
|
||||
ComputerModel::ComputerModel(QObject* object)
|
||||
: QAbstractListModel(object) {}
|
||||
|
||||
@@ -128,6 +130,69 @@ void ComputerModel::wakeComputer(int computerIndex)
|
||||
QThreadPool::globalInstance()->start(wakeTask);
|
||||
}
|
||||
|
||||
void ComputerModel::renameComputer(int computerIndex, QString name)
|
||||
{
|
||||
Q_ASSERT(computerIndex < m_Computers.count());
|
||||
|
||||
m_ComputerManager->renameHost(m_Computers[computerIndex], name);
|
||||
}
|
||||
|
||||
// TODO: Use QRandomGenerator when we drop Qt 5.9 support
|
||||
QString ComputerModel::generatePinString()
|
||||
{
|
||||
std::uniform_int_distribution<int> dist(0, 9999);
|
||||
std::random_device rd;
|
||||
std::mt19937 engine(rd());
|
||||
|
||||
return QString::asprintf("%04u", dist(engine));
|
||||
}
|
||||
|
||||
class DeferredTestConnectionTask : public QObject, public QRunnable
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
void run()
|
||||
{
|
||||
unsigned int portTestResult = LiTestClientConnectivity("qt.conntest.moonlight-stream.org", 443, ML_PORT_FLAG_ALL);
|
||||
if (portTestResult == ML_TEST_RESULT_INCONCLUSIVE) {
|
||||
emit connectionTestCompleted(-1, QString());
|
||||
}
|
||||
else {
|
||||
QString blockedPorts;
|
||||
|
||||
for (int i = 0; i < 32; i++) {
|
||||
if (portTestResult & (1 << i)) {
|
||||
if (!blockedPorts.isEmpty()) {
|
||||
blockedPorts += "\n";
|
||||
}
|
||||
|
||||
if (LiGetProtocolFromPortFlagIndex(i) == 17 /* IPPROTO_UDP */) {
|
||||
blockedPorts += "UDP ";
|
||||
}
|
||||
else {
|
||||
blockedPorts += "TCP ";
|
||||
}
|
||||
|
||||
blockedPorts += QString::number(LiGetPortFromPortFlagIndex(i));
|
||||
}
|
||||
}
|
||||
|
||||
emit connectionTestCompleted(portTestResult, blockedPorts);
|
||||
}
|
||||
}
|
||||
|
||||
signals:
|
||||
void connectionTestCompleted(int result, QString blockedPorts);
|
||||
};
|
||||
|
||||
void ComputerModel::testConnectionForComputer(int)
|
||||
{
|
||||
DeferredTestConnectionTask* testConnectionTask = new DeferredTestConnectionTask();
|
||||
QObject::connect(testConnectionTask, &DeferredTestConnectionTask::connectionTestCompleted,
|
||||
this, &ComputerModel::connectionTestCompleted);
|
||||
QThreadPool::globalInstance()->start(testConnectionTask);
|
||||
}
|
||||
|
||||
void ComputerModel::pairComputer(int computerIndex, QString pin)
|
||||
{
|
||||
Q_ASSERT(computerIndex < m_Computers.count());
|
||||
@@ -158,3 +223,4 @@ void ComputerModel::handleComputerStateChanged(NvComputer* computer)
|
||||
}
|
||||
}
|
||||
|
||||
#include "computermodel.moc"
|
||||
|
||||
@@ -31,14 +31,21 @@ public:
|
||||
|
||||
Q_INVOKABLE void deleteComputer(int computerIndex);
|
||||
|
||||
Q_INVOKABLE QString generatePinString();
|
||||
|
||||
Q_INVOKABLE void pairComputer(int computerIndex, QString pin);
|
||||
|
||||
Q_INVOKABLE void testConnectionForComputer(int computerIndex);
|
||||
|
||||
Q_INVOKABLE void wakeComputer(int computerIndex);
|
||||
|
||||
Q_INVOKABLE void renameComputer(int computerIndex, QString name);
|
||||
|
||||
Q_INVOKABLE Session* createSessionForCurrentGame(int computerIndex);
|
||||
|
||||
signals:
|
||||
void pairingCompleted(QVariant error);
|
||||
void connectionTestCompleted(int result, QString blockedPorts);
|
||||
|
||||
private slots:
|
||||
void handleComputerStateChanged(NvComputer* computer);
|
||||
|
||||
+54
-4
@@ -17,7 +17,7 @@ ApplicationWindow {
|
||||
width: 1280
|
||||
height: 600
|
||||
|
||||
visibility: StreamingPreferences.startWindowed ? "Windowed" : "Maximized"
|
||||
visibility: (SystemProperties.hasWindowManager && StreamingPreferences.startWindowed) ? "Windowed" : "Maximized"
|
||||
|
||||
StackView {
|
||||
id: stackView
|
||||
@@ -175,6 +175,17 @@ ApplicationWindow {
|
||||
anchors.topMargin: 5
|
||||
anchors.bottomMargin: 5
|
||||
|
||||
Label {
|
||||
id: titleLabel
|
||||
visible: toolBar.width > 700
|
||||
anchors.fill: parent
|
||||
text: stackView.currentItem.objectName
|
||||
font.pointSize: 20
|
||||
elide: Label.ElideRight
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
spacing: 20
|
||||
anchors.leftMargin: 10
|
||||
@@ -194,14 +205,49 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
// This label will appear when the window gets too small and
|
||||
// we need to ensure the toolbar controls don't collide
|
||||
Label {
|
||||
id: titleLabel
|
||||
text: stackView.currentItem.objectName
|
||||
font.pointSize: 15
|
||||
id: titleRowLabel
|
||||
font.pointSize: titleLabel.font.pointSize
|
||||
elide: Label.ElideRight
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
Layout.fillWidth: true
|
||||
|
||||
// We need this label to always be visible so it can occupy
|
||||
// the remaining space in the RowLayout. To "hide" it, we
|
||||
// just set the text to empty string.
|
||||
text: !titleLabel.visible ? stackView.currentItem.objectName : ""
|
||||
}
|
||||
|
||||
Label {
|
||||
id: versionLabel
|
||||
visible: stackView.currentItem.objectName === "Settings"
|
||||
text: "Version " + SystemProperties.versionString
|
||||
font.pointSize: 12
|
||||
horizontalAlignment: Qt.AlignRight
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
}
|
||||
|
||||
NavigableToolButton {
|
||||
id: discordButton
|
||||
visible: SystemProperties.hasBrowser &&
|
||||
stackView.currentItem.objectName === "Settings"
|
||||
|
||||
iconSource: "qrc:/res/Discord-Logo-White.svg"
|
||||
|
||||
ToolTip.delay: 1000
|
||||
ToolTip.timeout: 3000
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.text: "Join our community on Discord"
|
||||
|
||||
// TODO need to make sure browser is brought to foreground.
|
||||
onClicked: Qt.openUrlExternally("https://moonlight-stream.org/discord");
|
||||
|
||||
Keys.onDownPressed: {
|
||||
stackView.currentItem.forceActiveFocus(Qt.TabFocus)
|
||||
}
|
||||
}
|
||||
|
||||
NavigableToolButton {
|
||||
@@ -413,6 +459,10 @@ ApplicationWindow {
|
||||
editText.forceActiveFocus()
|
||||
}
|
||||
|
||||
onClosed: {
|
||||
editText.clear()
|
||||
}
|
||||
|
||||
onAccepted: {
|
||||
if (editText.text) {
|
||||
ComputerManager.addNewHost(editText.text, false)
|
||||
|
||||
@@ -205,6 +205,31 @@ void SdlGamepadKeyNavigation::onPollingTimerFired()
|
||||
sendKey(QEvent::Type::KeyRelease, Qt::Key_Right);
|
||||
m_LastAxisNavigationEventTime = SDL_GetTicks();
|
||||
}
|
||||
|
||||
// In UI navigation mode (settings page), use the right stick to scroll
|
||||
if (m_UiNavMode) {
|
||||
short rightX = SDL_GameControllerGetAxis(gc, SDL_CONTROLLER_AXIS_RIGHTX);
|
||||
short rightY = SDL_GameControllerGetAxis(gc, SDL_CONTROLLER_AXIS_RIGHTY);
|
||||
|
||||
QPoint wheelDelta;
|
||||
if (rightX > 30000) {
|
||||
wheelDelta.setX(30);
|
||||
}
|
||||
else if (rightX < -30000) {
|
||||
wheelDelta.setX(-30);
|
||||
}
|
||||
|
||||
if (rightY > 30000) {
|
||||
wheelDelta.setY(-30);
|
||||
}
|
||||
else if (rightY < -30000) {
|
||||
wheelDelta.setY(30);
|
||||
}
|
||||
|
||||
if (!wheelDelta.isNull()) {
|
||||
sendWheel(wheelDelta);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,6 +243,22 @@ void SdlGamepadKeyNavigation::sendKey(QEvent::Type type, Qt::Key key, Qt::Keyboa
|
||||
}
|
||||
}
|
||||
|
||||
void SdlGamepadKeyNavigation::sendWheel(QPoint& angleDelta)
|
||||
{
|
||||
QGuiApplication* app = static_cast<QGuiApplication*>(QGuiApplication::instance());
|
||||
QWindow* focusWindow = app->focusWindow();
|
||||
if (focusWindow != nullptr) {
|
||||
QPoint mousePos(focusWindow->width() / 2, focusWindow->height() / 2);
|
||||
QPoint globalPos(focusWindow->mapToGlobal(mousePos));
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
|
||||
QWheelEvent wheelEvent(mousePos, globalPos, QPoint(), angleDelta, Qt::NoButton, Qt::NoModifier, Qt::NoScrollPhase, false, Qt::MouseEventSynthesizedByApplication);
|
||||
#else
|
||||
QWheelEvent wheelEvent(mousePos, globalPos, QPoint(), angleDelta, angleDelta.y(), Qt::Vertical, Qt::NoButton, Qt::NoModifier, Qt::NoScrollPhase, Qt::MouseEventSynthesizedByApplication, false);
|
||||
#endif
|
||||
app->sendEvent(focusWindow, &wheelEvent);
|
||||
}
|
||||
}
|
||||
|
||||
void SdlGamepadKeyNavigation::setUiNavMode(bool uiNavMode)
|
||||
{
|
||||
m_UiNavMode = uiNavMode;
|
||||
|
||||
@@ -24,6 +24,7 @@ public:
|
||||
|
||||
private:
|
||||
void sendKey(QEvent::Type type, Qt::Key key, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
|
||||
void sendWheel(QPoint& angleDelta);
|
||||
|
||||
private slots:
|
||||
void onPollingTimerFired();
|
||||
|
||||
+68
-9
@@ -10,6 +10,7 @@
|
||||
#include <QFont>
|
||||
#include <QCursor>
|
||||
#include <QElapsedTimer>
|
||||
#include <QFile>
|
||||
|
||||
// Don't let SDL hook our main function, since Qt is already
|
||||
// doing the same thing. This needs to be before any headers
|
||||
@@ -21,14 +22,17 @@
|
||||
#include "streaming/video/ffmpeg.h"
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
#if defined(Q_OS_WIN32)
|
||||
#include "antihookingprotection.h"
|
||||
#elif defined(Q_OS_LINUX)
|
||||
#include <openssl/ssl.h>
|
||||
#endif
|
||||
|
||||
#include "cli/quitstream.h"
|
||||
#include "cli/startstream.h"
|
||||
#include "cli/commandlineparser.h"
|
||||
#include "path.h"
|
||||
#include "utils.h"
|
||||
#include "gui/computermodel.h"
|
||||
#include "gui/appmodel.h"
|
||||
#include "backend/autoupdatechecker.h"
|
||||
@@ -72,7 +76,12 @@ void logToLoggerStream(QString& message)
|
||||
return;
|
||||
}
|
||||
else if (s_LogLinesWritten == MAX_LOG_LINES) {
|
||||
s_LoggerStream << "Log size limit reached!" << endl;
|
||||
s_LoggerStream << "Log size limit reached!";
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
s_LoggerStream << Qt::endl;
|
||||
#else
|
||||
s_LoggerStream << endl;
|
||||
#endif
|
||||
s_LogLimitReached = true;
|
||||
return;
|
||||
}
|
||||
@@ -279,19 +288,44 @@ int main(int argc, char *argv[])
|
||||
SetUnhandledExceptionFilter(UnhandledExceptionHandler);
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
#if defined(Q_OS_WIN32)
|
||||
// Force AntiHooking.dll to be statically imported and loaded
|
||||
// by ntdll by calling a dummy function.
|
||||
AntiHookingDummyImport();
|
||||
#elif defined(Q_OS_LINUX)
|
||||
// Force libssl.so to be directly linked to our binary, so
|
||||
// linuxdeployqt can find it and include it in our AppImage.
|
||||
// QtNetwork will pull it in via dlopen().
|
||||
SSL_free(nullptr);
|
||||
#endif
|
||||
|
||||
// Enable High DPI support
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
// Avoid using High DPI on EGLFS. It breaks font rendering.
|
||||
// https://bugreports.qt.io/browse/QTBUG-64377
|
||||
//
|
||||
// NB: We can't use QGuiApplication::platformName() here because it is only
|
||||
// set once the QGuiApplication is created, which is too late to enable High DPI :(
|
||||
if (WMUtils::isRunningWindowManager()) {
|
||||
// Enable High DPI support
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
// Enable fractional High DPI scaling on Qt 5.14 and later
|
||||
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||
// Enable fractional High DPI scaling on Qt 5.14 and later
|
||||
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#ifndef STEAM_LINK
|
||||
if (!qEnvironmentVariableIsSet("QT_QPA_PLATFORM")) {
|
||||
qInfo() << "Unable to detect Wayland or X11, so EGLFS will be used by default. Set QT_QPA_PLATFORM to override this.";
|
||||
qputenv("QT_QPA_PLATFORM", "eglfs");
|
||||
|
||||
if (!QFile("/dev/dri").exists()) {
|
||||
qWarning() << "Unable to find a KMSDRM display device!";
|
||||
qWarning() << "On the Raspberry Pi, you must enable the 'fake KMS' driver in raspi-config to use Moonlight outside of the GUI environment.";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// This avoids using the default keychain for SSL, which may cause
|
||||
// password prompts on macOS.
|
||||
@@ -333,6 +367,12 @@ int main(int argc, char *argv[])
|
||||
// initializing the SDL video subsystem to have any effect.
|
||||
SDL_SetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, "1");
|
||||
|
||||
// For SDL backends that support it, use double buffering instead of triple buffering
|
||||
// to save a frame of latency. This doesn't matter for MMAL or DRM renderers since they
|
||||
// are drawing directly to the screen without involving SDL, but it may matter for other
|
||||
// future KMSDRM platforms that use SDL for rendering.
|
||||
SDL_SetHint(SDL_HINT_VIDEO_DOUBLE_BUFFER, "1");
|
||||
|
||||
if (SDL_InitSubSystem(SDL_INIT_TIMER) != 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"SDL_InitSubSystem(SDL_INIT_TIMER) failed: %s",
|
||||
@@ -363,6 +403,11 @@ int main(int argc, char *argv[])
|
||||
// Disable minimize on focus loss by default. Users seem to want this off by default.
|
||||
SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
|
||||
|
||||
// SDL 2.0.12 changes the default behavior to use the button label rather than the button
|
||||
// position as most other software does. Set this back to 0 to stay consistent with prior
|
||||
// releases of Moonlight.
|
||||
SDL_SetHint("SDL_GAMECONTROLLER_USE_BUTTON_LABELS", "0");
|
||||
|
||||
#ifdef QT_DEBUG
|
||||
// Allow thread naming using exceptions on debug builds. SDL doesn't use SEH
|
||||
// when throwing the exceptions, so we don't enable it for release builds out
|
||||
@@ -374,12 +419,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
// After the QGuiApplication is created, the platform stuff will be initialized
|
||||
// and we can set the SDL video driver to match Qt.
|
||||
if (qgetenv("XDG_SESSION_TYPE") == "wayland" && QGuiApplication::platformName() == "xcb") {
|
||||
if (WMUtils::isRunningWayland() && QGuiApplication::platformName() == "xcb") {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Detected XWayland. This will probably break hardware decoding! Try running with QT_QPA_PLATFORM=wayland or switch to X11.");
|
||||
}
|
||||
else if (QGuiApplication::platformName().startsWith("wayland")) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Detected Wayland. Performance may be worse than X11.");
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Detected Wayland");
|
||||
qputenv("SDL_VIDEODRIVER", "wayland");
|
||||
}
|
||||
|
||||
@@ -397,6 +442,17 @@ int main(int argc, char *argv[])
|
||||
// Move the mouse to the bottom right so it's invisible when using
|
||||
// gamepad-only navigation.
|
||||
QCursor().setPos(0xFFFF, 0xFFFF);
|
||||
#elif !SDL_VERSION_ATLEAST(2, 0, 11) && defined(Q_OS_LINUX) && (defined(__arm__) || defined(__aarch64__))
|
||||
if (qgetenv("SDL_VIDEO_GL_DRIVER").isEmpty() && QGuiApplication::platformName() == "eglfs") {
|
||||
// Look for Raspberry Pi GLES libraries. SDL 2.0.10 and earlier needs some help finding
|
||||
// the correct libraries for the KMSDRM backend if not compiled with the RPI backend enabled.
|
||||
if (SDL_LoadObject("libbrcmGLESv2.so") != nullptr) {
|
||||
qputenv("SDL_VIDEO_GL_DRIVER", "libbrcmGLESv2.so");
|
||||
}
|
||||
else if (SDL_LoadObject("/opt/vc/lib/libbrcmGLESv2.so") != nullptr) {
|
||||
qputenv("SDL_VIDEO_GL_DRIVER", "/opt/vc/lib/libbrcmGLESv2.so");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
app.setWindowIcon(QIcon(":/res/moonlight.svg"));
|
||||
@@ -431,6 +487,9 @@ int main(int argc, char *argv[])
|
||||
return new StreamingPreferences();
|
||||
});
|
||||
|
||||
// Create the identity manager on the main thread
|
||||
IdentityManager::get();
|
||||
|
||||
#ifndef Q_OS_WINRT
|
||||
// Use the dense material dark theme by default
|
||||
if (!qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_STYLE")) {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 245 240"><style>.st0{fill:#FFFFFF;}</style><path class="st0" d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zM140.9 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"/><path class="st0" d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"/></svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="#FFFFFF"><path d="M0 0h24v24H0V0zm0 0h24v24H0V0z" fill="none"/><path d="M16.59 7.58L10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/></svg>
|
||||
|
After Width: | Height: | Size: 339 B |
@@ -15,9 +15,13 @@
|
||||
<file>res/update.svg</file>
|
||||
<file>res/baseline-help_outline-24px.svg</file>
|
||||
<file>res/baseline-error_outline-24px.svg</file>
|
||||
<file>res/baseline-check_circle_outline-24px.svg</file>
|
||||
<file>res/Discord-Logo-White.svg</file>
|
||||
</qresource>
|
||||
<qresource prefix="/data">
|
||||
<file alias="gamecontrollerdb.txt">SDL_GameControllerDB/gamecontrollerdb.txt</file>
|
||||
<file alias="ModeSeven.ttf">ModeSeven.ttf</file>
|
||||
<file alias="egl.frag">shaders/egl.frag</file>
|
||||
<file alias="egl.vert">shaders/egl.vert</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -26,7 +26,13 @@ MappingManager::MappingManager()
|
||||
settings.endArray();
|
||||
|
||||
// Finally load mappings from SDL_HINT_GAMECONTROLLERCONFIG
|
||||
QStringList sdlMappings = QString::fromLocal8Bit(SDL_GetHint(SDL_HINT_GAMECONTROLLERCONFIG)).split('\n', QString::SkipEmptyParts);
|
||||
QStringList sdlMappings =
|
||||
QString::fromLocal8Bit(SDL_GetHint(SDL_HINT_GAMECONTROLLERCONFIG))
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
.split('\n', Qt::SkipEmptyParts);
|
||||
#else
|
||||
.split('\n', QString::SkipEmptyParts);
|
||||
#endif
|
||||
for (QString sdlMapping : sdlMappings) {
|
||||
SdlGamepadMapping mapping(sdlMapping);
|
||||
addMapping(mapping);
|
||||
|
||||
@@ -19,13 +19,17 @@
|
||||
#define SER_UNSUPPORTEDFPS "unsupportedfps"
|
||||
#define SER_MDNS "mdns"
|
||||
#define SER_QUITAPPAFTER "quitAppAfter"
|
||||
#define SER_MOUSEACCELERATION "mouseacceleration"
|
||||
#define SER_ABSMOUSEMODE "mouseacceleration"
|
||||
#define SER_ABSTOUCHMODE "abstouchmode"
|
||||
#define SER_STARTWINDOWED "startwindowed"
|
||||
#define SER_FRAMEPACING "framepacing"
|
||||
#define SER_CONNWARNINGS "connwarnings"
|
||||
#define SER_RICHPRESENCE "richpresence"
|
||||
#define SER_GAMEPADMOUSE "gamepadmouse"
|
||||
#define SER_DEFAULTVER "defaultver"
|
||||
#define SER_PACKETSIZE "packetsize"
|
||||
#define SER_DETECTNETBLOCKING "detectnetblocking"
|
||||
#define SER_SWAPMOUSEBUTTONS "swapmousebuttons"
|
||||
|
||||
#define CURRENT_DEFAULT_VER 1
|
||||
|
||||
@@ -58,12 +62,16 @@ void StreamingPreferences::reload()
|
||||
unsupportedFps = settings.value(SER_UNSUPPORTEDFPS, false).toBool();
|
||||
enableMdns = settings.value(SER_MDNS, true).toBool();
|
||||
quitAppAfter = settings.value(SER_QUITAPPAFTER, false).toBool();
|
||||
mouseAcceleration = settings.value(SER_MOUSEACCELERATION, false).toBool();
|
||||
startWindowed = settings.value(SER_STARTWINDOWED, false).toBool();
|
||||
absoluteMouseMode = settings.value(SER_ABSMOUSEMODE, false).toBool();
|
||||
absoluteTouchMode = settings.value(SER_ABSTOUCHMODE, true).toBool();
|
||||
startWindowed = settings.value(SER_STARTWINDOWED, true).toBool();
|
||||
framePacing = settings.value(SER_FRAMEPACING, false).toBool();
|
||||
connectionWarnings = settings.value(SER_CONNWARNINGS, true).toBool();
|
||||
richPresence = settings.value(SER_RICHPRESENCE, true).toBool();
|
||||
gamepadMouse = settings.value(SER_GAMEPADMOUSE, true).toBool();
|
||||
detectNetworkBlocking = settings.value(SER_DETECTNETBLOCKING, true).toBool();
|
||||
packetSize = settings.value(SER_PACKETSIZE, 0).toInt();
|
||||
swapMouseButtons = settings.value(SER_SWAPMOUSEBUTTONS, false).toBool();
|
||||
audioConfig = static_cast<AudioConfig>(settings.value(SER_AUDIOCFG,
|
||||
static_cast<int>(AudioConfig::AC_STEREO)).toInt());
|
||||
videoCodecConfig = static_cast<VideoCodecConfig>(settings.value(SER_VIDEOCFG,
|
||||
@@ -101,17 +109,21 @@ void StreamingPreferences::save()
|
||||
settings.setValue(SER_UNSUPPORTEDFPS, unsupportedFps);
|
||||
settings.setValue(SER_MDNS, enableMdns);
|
||||
settings.setValue(SER_QUITAPPAFTER, quitAppAfter);
|
||||
settings.setValue(SER_MOUSEACCELERATION, mouseAcceleration);
|
||||
settings.setValue(SER_ABSMOUSEMODE, absoluteMouseMode);
|
||||
settings.setValue(SER_ABSTOUCHMODE, absoluteTouchMode);
|
||||
settings.setValue(SER_STARTWINDOWED, startWindowed);
|
||||
settings.setValue(SER_FRAMEPACING, framePacing);
|
||||
settings.setValue(SER_CONNWARNINGS, connectionWarnings);
|
||||
settings.setValue(SER_RICHPRESENCE, richPresence);
|
||||
settings.setValue(SER_GAMEPADMOUSE, gamepadMouse);
|
||||
settings.setValue(SER_PACKETSIZE, packetSize);
|
||||
settings.setValue(SER_DETECTNETBLOCKING, detectNetworkBlocking);
|
||||
settings.setValue(SER_AUDIOCFG, static_cast<int>(audioConfig));
|
||||
settings.setValue(SER_VIDEOCFG, static_cast<int>(videoCodecConfig));
|
||||
settings.setValue(SER_VIDEODEC, static_cast<int>(videoDecoderSelection));
|
||||
settings.setValue(SER_WINDOWMODE, static_cast<int>(windowMode));
|
||||
settings.setValue(SER_DEFAULTVER, CURRENT_DEFAULT_VER);
|
||||
settings.setValue(SER_SWAPMOUSEBUTTONS, swapMouseButtons);
|
||||
}
|
||||
|
||||
int StreamingPreferences::getDefaultBitrate(int width, int height, int fps)
|
||||
|
||||
@@ -20,7 +20,8 @@ public:
|
||||
enum AudioConfig
|
||||
{
|
||||
AC_STEREO,
|
||||
AC_51_SURROUND
|
||||
AC_51_SURROUND,
|
||||
AC_71_SURROUND
|
||||
};
|
||||
Q_ENUM(AudioConfig)
|
||||
|
||||
@@ -60,17 +61,20 @@ public:
|
||||
Q_PROPERTY(bool unsupportedFps MEMBER unsupportedFps NOTIFY unsupportedFpsChanged)
|
||||
Q_PROPERTY(bool enableMdns MEMBER enableMdns NOTIFY enableMdnsChanged)
|
||||
Q_PROPERTY(bool quitAppAfter MEMBER quitAppAfter NOTIFY quitAppAfterChanged)
|
||||
Q_PROPERTY(bool mouseAcceleration MEMBER mouseAcceleration NOTIFY mouseAccelerationChanged)
|
||||
Q_PROPERTY(bool absoluteMouseMode MEMBER absoluteMouseMode NOTIFY absoluteMouseModeChanged)
|
||||
Q_PROPERTY(bool absoluteTouchMode MEMBER absoluteTouchMode NOTIFY absoluteTouchModeChanged)
|
||||
Q_PROPERTY(bool startWindowed MEMBER startWindowed NOTIFY startWindowedChanged)
|
||||
Q_PROPERTY(bool framePacing MEMBER framePacing NOTIFY framePacingChanged)
|
||||
Q_PROPERTY(bool connectionWarnings MEMBER connectionWarnings NOTIFY connectionWarningsChanged)
|
||||
Q_PROPERTY(bool richPresence MEMBER richPresence NOTIFY richPresenceChanged)
|
||||
Q_PROPERTY(bool gamepadMouse MEMBER gamepadMouse NOTIFY gamepadMouseChanged)
|
||||
Q_PROPERTY(bool detectNetworkBlocking MEMBER detectNetworkBlocking NOTIFY detectNetworkBlockingChanged);
|
||||
Q_PROPERTY(AudioConfig audioConfig MEMBER audioConfig NOTIFY audioConfigChanged)
|
||||
Q_PROPERTY(VideoCodecConfig videoCodecConfig MEMBER videoCodecConfig NOTIFY videoCodecConfigChanged)
|
||||
Q_PROPERTY(VideoDecoderSelection videoDecoderSelection MEMBER videoDecoderSelection NOTIFY videoDecoderSelectionChanged)
|
||||
Q_PROPERTY(WindowMode windowMode MEMBER windowMode NOTIFY windowModeChanged)
|
||||
Q_PROPERTY(WindowMode recommendedFullScreenMode MEMBER recommendedFullScreenMode CONSTANT)
|
||||
Q_PROPERTY(bool swapMouseButtons MEMBER swapMouseButtons NOTIFY mouseButtonsChanged)
|
||||
|
||||
// Directly accessible members for preferences
|
||||
int width;
|
||||
@@ -84,12 +88,16 @@ public:
|
||||
bool unsupportedFps;
|
||||
bool enableMdns;
|
||||
bool quitAppAfter;
|
||||
bool mouseAcceleration;
|
||||
bool absoluteMouseMode;
|
||||
bool absoluteTouchMode;
|
||||
bool startWindowed;
|
||||
bool framePacing;
|
||||
bool connectionWarnings;
|
||||
bool richPresence;
|
||||
bool gamepadMouse;
|
||||
bool detectNetworkBlocking;
|
||||
bool swapMouseButtons;
|
||||
int packetSize;
|
||||
AudioConfig audioConfig;
|
||||
VideoCodecConfig videoCodecConfig;
|
||||
VideoDecoderSelection videoDecoderSelection;
|
||||
@@ -106,7 +114,8 @@ signals:
|
||||
void unsupportedFpsChanged();
|
||||
void enableMdnsChanged();
|
||||
void quitAppAfterChanged();
|
||||
void mouseAccelerationChanged();
|
||||
void absoluteMouseModeChanged();
|
||||
void absoluteTouchModeChanged();
|
||||
void audioConfigChanged();
|
||||
void videoCodecConfigChanged();
|
||||
void videoDecoderSelectionChanged();
|
||||
@@ -116,5 +125,7 @@ signals:
|
||||
void connectionWarningsChanged();
|
||||
void richPresenceChanged();
|
||||
void gamepadMouseChanged();
|
||||
void detectNetworkBlockingChanged();
|
||||
void mouseButtonsChanged();
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#version 300 es
|
||||
#extension GL_OES_EGL_image_external : require
|
||||
precision mediump float;
|
||||
out vec4 FragColor;
|
||||
|
||||
in vec2 vTextCoord;
|
||||
|
||||
uniform mat3 yuvmat;
|
||||
uniform vec3 offset;
|
||||
uniform samplerExternalOES plane1;
|
||||
uniform samplerExternalOES plane2;
|
||||
|
||||
void main() {
|
||||
vec3 YCbCr = vec3(
|
||||
texture2D(plane1, vTextCoord)[0],
|
||||
texture2D(plane2, vTextCoord).xy
|
||||
);
|
||||
|
||||
YCbCr -= offset;
|
||||
FragColor = vec4(clamp(yuvmat * YCbCr, 0.0, 1.0), 1.0f);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
#version 300 es
|
||||
|
||||
layout (location = 0) in vec2 aPosition; // 2D: X,Y
|
||||
layout (location = 1) in vec2 aTexCoord;
|
||||
out vec2 vTextCoord;
|
||||
|
||||
void main() {
|
||||
vTextCoord = aTexCoord;
|
||||
gl_Position = vec4(aPosition, 0, 1);
|
||||
}
|
||||
@@ -80,19 +80,7 @@ int Session::getAudioRendererCapabilities(int audioConfiguration)
|
||||
OPUS_MULTISTREAM_CONFIGURATION opusConfig = {};
|
||||
opusConfig.sampleRate = 48000;
|
||||
opusConfig.samplesPerFrame = 240;
|
||||
|
||||
switch (audioConfiguration)
|
||||
{
|
||||
case AUDIO_CONFIGURATION_STEREO:
|
||||
opusConfig.channelCount = 2;
|
||||
break;
|
||||
case AUDIO_CONFIGURATION_51_SURROUND:
|
||||
opusConfig.channelCount = 6;
|
||||
break;
|
||||
default:
|
||||
SDL_assert(false);
|
||||
return 0;
|
||||
}
|
||||
opusConfig.channelCount = CHANNEL_COUNT_FROM_AUDIO_CONFIGURATION(audioConfiguration);
|
||||
|
||||
IAudioRenderer* audioRenderer = createAudioRenderer(&opusConfig);
|
||||
if (audioRenderer == nullptr) {
|
||||
@@ -113,19 +101,7 @@ bool Session::testAudio(int audioConfiguration)
|
||||
OPUS_MULTISTREAM_CONFIGURATION opusConfig = {};
|
||||
opusConfig.sampleRate = 48000;
|
||||
opusConfig.samplesPerFrame = 240;
|
||||
|
||||
switch (audioConfiguration)
|
||||
{
|
||||
case AUDIO_CONFIGURATION_STEREO:
|
||||
opusConfig.channelCount = 2;
|
||||
break;
|
||||
case AUDIO_CONFIGURATION_51_SURROUND:
|
||||
opusConfig.channelCount = 6;
|
||||
break;
|
||||
default:
|
||||
SDL_assert(false);
|
||||
return false;
|
||||
}
|
||||
opusConfig.channelCount = CHANNEL_COUNT_FROM_AUDIO_CONFIGURATION(audioConfiguration);
|
||||
|
||||
IAudioRenderer* audioRenderer = createAudioRenderer(&opusConfig);
|
||||
if (audioRenderer == nullptr) {
|
||||
@@ -237,7 +213,7 @@ void Session::arDecodeAndPlaySample(char* sampleData, int sampleLength)
|
||||
|
||||
// Update desiredSize with the number of bytes actually populated by the decoding operation
|
||||
if (samplesDecoded > 0) {
|
||||
SDL_assert(desiredSize >= sizeof(short) * samplesDecoded * s_ActiveSession->m_AudioConfig.channelCount);
|
||||
SDL_assert(desiredSize >= (int)(sizeof(short) * samplesDecoded * s_ActiveSession->m_AudioConfig.channelCount));
|
||||
desiredSize = sizeof(short) * samplesDecoded * s_ActiveSession->m_AudioConfig.channelCount;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -4,12 +4,42 @@
|
||||
#include <SDL.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
|
||||
SdlAudioRenderer::SdlAudioRenderer()
|
||||
: m_AudioDevice(0),
|
||||
m_AudioBuffer(nullptr)
|
||||
{
|
||||
SDL_assert(!SDL_WasInit(SDL_INIT_AUDIO));
|
||||
|
||||
#ifdef HAVE_MMAL
|
||||
// HACK: PulseAudio on Raspberry Pi suffers from horrible underruns,
|
||||
// so switch to ALSA if we detect that we're on a Pi. We need to
|
||||
// actually set a bogus PULSE_SERVER so it doesn't try to get smart on us
|
||||
// and find PA anyway. SDL_AUDIODRIVER=pulseaudio can override this logic.
|
||||
if (qgetenv("SDL_AUDIODRIVER").toLower() != "pulseaudio") {
|
||||
QFile file("/proc/cpuinfo");
|
||||
if (file.open(QIODevice::ReadOnly | QFile::Text)) {
|
||||
QTextStream textStream(&file);
|
||||
if (textStream.readAll().contains("Raspberry Pi")) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Avoiding PulseAudio on Raspberry Pi");
|
||||
|
||||
qputenv("PULSE_SERVER", "");
|
||||
if (SDL_InitSubSystem(SDL_INIT_AUDIO) != 0) {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"ALSA failed; falling back to default");
|
||||
qunsetenv("PULSE_SERVER");
|
||||
}
|
||||
else {
|
||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (SDL_InitSubSystem(SDL_INIT_AUDIO) != 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"SDL_InitSubSystem(SDL_INIT_AUDIO) failed: %s",
|
||||
@@ -51,9 +81,9 @@ bool SdlAudioRenderer::prepareForPlayback(const OPUS_MULTISTREAM_CONFIGURATION*
|
||||
}
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Desired audio buffer: %u samples (%lu bytes)",
|
||||
"Desired audio buffer: %u samples (%u bytes)",
|
||||
want.samples,
|
||||
want.samples * sizeof(short) * want.channels);
|
||||
want.samples * (Uint32)sizeof(short) * want.channels);
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Obtained audio buffer: %u samples (%u bytes)",
|
||||
|
||||
@@ -42,26 +42,26 @@ bool SLAudioRenderer::prepareForPlayback(const OPUS_MULTISTREAM_CONFIGURATION* o
|
||||
return true;
|
||||
}
|
||||
|
||||
#define SWAP_CHANNEL(i, j) \
|
||||
tmp = opusConfig->mapping[i]; \
|
||||
opusConfig->mapping[i] = opusConfig->mapping[j]; \
|
||||
opusConfig->mapping[j] = tmp
|
||||
|
||||
void SLAudioRenderer::remapChannels(POPUS_MULTISTREAM_CONFIGURATION opusConfig) {
|
||||
unsigned char tmp;
|
||||
OPUS_MULTISTREAM_CONFIGURATION originalConfig = *opusConfig;
|
||||
|
||||
if (opusConfig->channelCount == 6) {
|
||||
// The Moonlight's default channel order is FL,FR,C,LFE,RL,RR
|
||||
// SLAudio expects FL,C,FR,RL,RR,LFE so we swap the channels around to match
|
||||
// The Moonlight's default channel order is FL,FR,C,LFE,RL,RR,SL,SR
|
||||
// SLAudio expects FL,C,FR,RL,RR,(SL,SR),LFE for 5.1/7.1 so we swap the channels around to match
|
||||
|
||||
// Swap FR and C - now FL,C,FR,LFE,RL,RR
|
||||
SWAP_CHANNEL(1, 2);
|
||||
if (opusConfig->channelCount == 3 || opusConfig->channelCount >= 6) {
|
||||
// Swap FR and C
|
||||
opusConfig->mapping[1] = originalConfig.mapping[2];
|
||||
opusConfig->mapping[2] = originalConfig.mapping[1];
|
||||
}
|
||||
|
||||
// Swap LFE and RR - now FL,C,FR,RR,RL,LFE
|
||||
SWAP_CHANNEL(3, 5);
|
||||
if (opusConfig->channelCount >= 6) {
|
||||
// SLAudio expects the LFE channel at the end
|
||||
opusConfig->mapping[opusConfig->channelCount - 1] = originalConfig.mapping[3];
|
||||
|
||||
// Swap RR and RL - now FL,C,FR,RL,RR,LFE
|
||||
SWAP_CHANNEL(3, 4);
|
||||
// Slide the other channels down
|
||||
memcpy(&opusConfig->mapping[3],
|
||||
&originalConfig.mapping[4],
|
||||
opusConfig->channelCount - 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,11 +72,17 @@ int SoundIoAudioRenderer::scoreChannelLayout(const struct SoundIoChannelLayout*
|
||||
score++;
|
||||
break;
|
||||
|
||||
// Score layouts using the back L/R as higher
|
||||
// value than those using side L/R.
|
||||
case SoundIoChannelIdBackLeft:
|
||||
case SoundIoChannelIdBackRight:
|
||||
score += 2;
|
||||
if (opusConfig->channelCount == 6) {
|
||||
// Score back channels higher in 5.1 mode to
|
||||
// discourage selection of side channel layouts.
|
||||
score += 2;
|
||||
}
|
||||
else {
|
||||
// Score back channels normally for 7.1 mode
|
||||
score++;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -211,13 +217,25 @@ bool SoundIoAudioRenderer::prepareForPlayback(const OPUS_MULTISTREAM_CONFIGURATI
|
||||
|
||||
m_EffectiveLayout = m_OutputStream->layout;
|
||||
for (int i = 0; i < m_EffectiveLayout.channel_count; i++) {
|
||||
// Fixup the layout to use back L/R so our channel position
|
||||
// logic in sioWriteCallback() works.
|
||||
if (m_EffectiveLayout.channels[i] == SoundIoChannelIdSideLeft) {
|
||||
m_EffectiveLayout.channels[i] = SoundIoChannelIdBackLeft;
|
||||
if (opusConfig->channelCount == 6) {
|
||||
// For 5.1, replace side L/R with back L/R so our channel position
|
||||
// logic in sioWriteCallback() works.
|
||||
if (m_EffectiveLayout.channels[i] == SoundIoChannelIdSideLeft) {
|
||||
m_EffectiveLayout.channels[i] = SoundIoChannelIdBackLeft;
|
||||
}
|
||||
if (m_EffectiveLayout.channels[i] == SoundIoChannelIdSideRight) {
|
||||
m_EffectiveLayout.channels[i] = SoundIoChannelIdBackRight;
|
||||
}
|
||||
}
|
||||
if (m_EffectiveLayout.channels[i] == SoundIoChannelIdSideRight) {
|
||||
m_EffectiveLayout.channels[i] = SoundIoChannelIdBackRight;
|
||||
else if (opusConfig->channelCount == 8) {
|
||||
// For 5.1, replace side L/R with LOC/ROC so our channel position
|
||||
// logic in sioWriteCallback() works.
|
||||
if (m_EffectiveLayout.channels[i] == SoundIoChannelIdSideLeft) {
|
||||
m_EffectiveLayout.channels[i] = SoundIoChannelIdFrontLeftCenter;
|
||||
}
|
||||
if (m_EffectiveLayout.channels[i] == SoundIoChannelIdSideRight) {
|
||||
m_EffectiveLayout.channels[i] = SoundIoChannelIdFrontRightCenter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,9 +429,8 @@ void SoundIoAudioRenderer::sioWriteCallback(SoundIoOutStream* stream, int frameC
|
||||
|
||||
for (int frame = 0; frame < frameCount; frame++) {
|
||||
for (int ch = 0; ch < me->m_EffectiveLayout.channel_count; ch++) {
|
||||
// SoundIoChannelId - 1 happens to match Moonlight's channel layout.
|
||||
// For side L/R, this logic depends on us fixing those up
|
||||
// in m_EffectiveLayout to back L/R.
|
||||
// SoundIoChannelId - 1 happens to match Moonlight's channel layout
|
||||
// after we've applied our fixups to m_EffectiveLayout for 5.1 and 7.1.
|
||||
int readPtrChannel = me->m_EffectiveLayout.channels[ch] - 1;
|
||||
|
||||
if (frame >= framesLeft || readPtrChannel >= me->m_OpusChannelCount) {
|
||||
|
||||
@@ -1,1423 +0,0 @@
|
||||
#include <Limelight.h>
|
||||
#include <SDL.h>
|
||||
#include "streaming/session.h"
|
||||
#include "settings/mappingmanager.h"
|
||||
#include "path.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QtMath>
|
||||
#include <QDir>
|
||||
|
||||
#define VK_0 0x30
|
||||
#define VK_A 0x41
|
||||
|
||||
// These are real Windows VK_* codes
|
||||
#ifndef VK_F1
|
||||
#define VK_F1 0x70
|
||||
#define VK_F13 0x7C
|
||||
#define VK_NUMPAD0 0x60
|
||||
#endif
|
||||
|
||||
#define MOUSE_POLLING_INTERVAL 5
|
||||
|
||||
// How long the mouse button will be pressed for a tap to click gesture
|
||||
#define TAP_BUTTON_RELEASE_DELAY 100
|
||||
|
||||
// How long the fingers must be stationary to start a drag
|
||||
#define DRAG_ACTIVATION_DELAY 650
|
||||
|
||||
// How far the finger can move before it cancels a drag or tap
|
||||
#define DEAD_ZONE_DELTA 0.1f
|
||||
|
||||
// How long the Start button must be pressed to toggle mouse emulation
|
||||
#define MOUSE_EMULATION_LONG_PRESS_TIME 750
|
||||
|
||||
// How long between polling the gamepad to send virtual mouse input
|
||||
#define MOUSE_EMULATION_POLLING_INTERVAL 50
|
||||
|
||||
// Determines how fast the mouse will move each interval
|
||||
#define MOUSE_EMULATION_MOTION_MULTIPLIER 4
|
||||
|
||||
// Determines the maximum motion amount before allowing movement
|
||||
#define MOUSE_EMULATION_DEADZONE 2
|
||||
|
||||
// Haptic capabilities (in addition to those from SDL_HapticQuery())
|
||||
#define ML_HAPTIC_GC_RUMBLE (1U << 16)
|
||||
#define ML_HAPTIC_SIMPLE_RUMBLE (1U << 17)
|
||||
|
||||
const int SdlInputHandler::k_ButtonMap[] = {
|
||||
A_FLAG, B_FLAG, X_FLAG, Y_FLAG,
|
||||
BACK_FLAG, SPECIAL_FLAG, PLAY_FLAG,
|
||||
LS_CLK_FLAG, RS_CLK_FLAG,
|
||||
LB_FLAG, RB_FLAG,
|
||||
UP_FLAG, DOWN_FLAG, LEFT_FLAG, RIGHT_FLAG
|
||||
};
|
||||
|
||||
SdlInputHandler::SdlInputHandler(StreamingPreferences& prefs, NvComputer*, int streamWidth, int streamHeight)
|
||||
: m_MultiController(prefs.multiController),
|
||||
m_GamepadMouse(prefs.gamepadMouse),
|
||||
m_MouseMoveTimer(0),
|
||||
m_FakeCaptureActive(false),
|
||||
m_LeftButtonReleaseTimer(0),
|
||||
m_RightButtonReleaseTimer(0),
|
||||
m_DragTimer(0),
|
||||
m_DragButton(0),
|
||||
m_NumFingersDown(0),
|
||||
m_StreamWidth(streamWidth),
|
||||
m_StreamHeight(streamHeight)
|
||||
{
|
||||
// Allow gamepad input when the app doesn't have focus
|
||||
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
|
||||
|
||||
// If mouse acceleration is enabled, use relative mode warp (which
|
||||
// is via normal motion events that are influenced by mouse acceleration).
|
||||
// Otherwise, we'll use raw input capture which is straight from the device
|
||||
// without modification by the OS.
|
||||
SDL_SetHintWithPriority(SDL_HINT_MOUSE_RELATIVE_MODE_WARP,
|
||||
prefs.mouseAcceleration ? "1" : "0",
|
||||
SDL_HINT_OVERRIDE);
|
||||
|
||||
#if defined(Q_OS_DARWIN) && !SDL_VERSION_ATLEAST(2, 0, 10)
|
||||
// SDL 2.0.9 on macOS has a broken HIDAPI mapping for the older Xbox One S
|
||||
// firmware, so we have to disable HIDAPI for Xbox gamepads on macOS until
|
||||
// SDL 2.0.10 where the bug is fixed.
|
||||
// https://github.com/moonlight-stream/moonlight-qt/issues/133
|
||||
// https://bugzilla.libsdl.org/show_bug.cgi?id=4395
|
||||
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_XBOX, "0");
|
||||
#endif
|
||||
|
||||
// We must initialize joystick explicitly before gamecontroller in order
|
||||
// to ensure we receive gamecontroller attach events for gamepads where
|
||||
// SDL doesn't have a built-in mapping. By starting joystick first, we
|
||||
// can allow mapping manager to update the mappings before GC attach
|
||||
// events are generated.
|
||||
SDL_assert(!SDL_WasInit(SDL_INIT_JOYSTICK));
|
||||
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"SDL_InitSubSystem(SDL_INIT_JOYSTICK) failed: %s",
|
||||
SDL_GetError());
|
||||
}
|
||||
|
||||
MappingManager mappingManager;
|
||||
mappingManager.applyMappings();
|
||||
|
||||
// Flush gamepad arrival and departure events which may be queued before
|
||||
// starting the gamecontroller subsystem again. This prevents us from
|
||||
// receiving duplicate arrival and departure events for the same gamepad.
|
||||
SDL_FlushEvent(SDL_CONTROLLERDEVICEADDED);
|
||||
SDL_FlushEvent(SDL_CONTROLLERDEVICEREMOVED);
|
||||
|
||||
// We need to reinit this each time, since you only get
|
||||
// an initial set of gamepad arrival events once per init.
|
||||
SDL_assert(!SDL_WasInit(SDL_INIT_GAMECONTROLLER));
|
||||
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) != 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) failed: %s",
|
||||
SDL_GetError());
|
||||
}
|
||||
|
||||
#if !SDL_VERSION_ATLEAST(2, 0, 9)
|
||||
SDL_assert(!SDL_WasInit(SDL_INIT_HAPTIC));
|
||||
if (SDL_InitSubSystem(SDL_INIT_HAPTIC) != 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"SDL_InitSubSystem(SDL_INIT_HAPTIC) failed: %s",
|
||||
SDL_GetError());
|
||||
}
|
||||
#endif
|
||||
|
||||
// Initialize the gamepad mask with currently attached gamepads to avoid
|
||||
// causing gamepads to unexpectedly disappear and reappear on the host
|
||||
// during stream startup as we detect currently attached gamepads one at a time.
|
||||
m_GamepadMask = getAttachedGamepadMask();
|
||||
|
||||
SDL_zero(m_GamepadState);
|
||||
SDL_zero(m_TouchDownEvent);
|
||||
SDL_zero(m_CumulativeDelta);
|
||||
|
||||
SDL_AtomicSet(&m_MouseDeltaX, 0);
|
||||
SDL_AtomicSet(&m_MouseDeltaY, 0);
|
||||
|
||||
m_MouseMoveTimer = SDL_AddTimer(MOUSE_POLLING_INTERVAL, SdlInputHandler::mouseMoveTimerCallback, this);
|
||||
}
|
||||
|
||||
SdlInputHandler::~SdlInputHandler()
|
||||
{
|
||||
for (int i = 0; i < MAX_GAMEPADS; i++) {
|
||||
if (m_GamepadState[i].mouseEmulationTimer != 0) {
|
||||
Session::get()->notifyMouseEmulationMode(false);
|
||||
SDL_RemoveTimer(m_GamepadState[i].mouseEmulationTimer);
|
||||
}
|
||||
#if !SDL_VERSION_ATLEAST(2, 0, 9)
|
||||
if (m_GamepadState[i].haptic != nullptr) {
|
||||
SDL_HapticClose(m_GamepadState[i].haptic);
|
||||
}
|
||||
#endif
|
||||
if (m_GamepadState[i].controller != nullptr) {
|
||||
SDL_GameControllerClose(m_GamepadState[i].controller);
|
||||
}
|
||||
}
|
||||
|
||||
SDL_RemoveTimer(m_MouseMoveTimer);
|
||||
SDL_RemoveTimer(m_LeftButtonReleaseTimer);
|
||||
SDL_RemoveTimer(m_RightButtonReleaseTimer);
|
||||
SDL_RemoveTimer(m_DragTimer);
|
||||
|
||||
#if !SDL_VERSION_ATLEAST(2, 0, 9)
|
||||
SDL_QuitSubSystem(SDL_INIT_HAPTIC);
|
||||
SDL_assert(!SDL_WasInit(SDL_INIT_HAPTIC));
|
||||
#endif
|
||||
|
||||
SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER);
|
||||
SDL_assert(!SDL_WasInit(SDL_INIT_GAMECONTROLLER));
|
||||
|
||||
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
|
||||
SDL_assert(!SDL_WasInit(SDL_INIT_JOYSTICK));
|
||||
|
||||
// Return background event handling to off
|
||||
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "0");
|
||||
|
||||
#ifdef STEAM_LINK
|
||||
// Hide SDL's cursor on Steam Link after quitting the stream.
|
||||
// FIXME: We should also do this for other situations where SDL
|
||||
// and Qt will draw their own mouse cursors like KMSDRM or RPi
|
||||
// video backends.
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SdlInputHandler::handleKeyEvent(SDL_KeyboardEvent* event)
|
||||
{
|
||||
short keyCode;
|
||||
char modifiers;
|
||||
|
||||
// Check for our special key combos
|
||||
if ((event->state == SDL_PRESSED) &&
|
||||
(event->keysym.mod & KMOD_CTRL) &&
|
||||
(event->keysym.mod & KMOD_ALT) &&
|
||||
(event->keysym.mod & KMOD_SHIFT)) {
|
||||
// First we test the SDLK combos for matches,
|
||||
// that way we ensure that latin keyboard users
|
||||
// can match to the key they see on their keyboards.
|
||||
// If nothing matches that, we'll then go on to
|
||||
// checking scancodes so non-latin keyboard users
|
||||
// can have working hotkeys (though possibly in
|
||||
// odd positions). We must do all SDLK tests before
|
||||
// any scancode tests to avoid issues in cases
|
||||
// where the SDLK for one shortcut collides with
|
||||
// the scancode of another.
|
||||
|
||||
// Check for quit combo (Ctrl+Alt+Shift+Q)
|
||||
if (event->keysym.sym == SDLK_q) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Detected quit key combo (SDLK)");
|
||||
|
||||
// Push a quit event to the main loop
|
||||
SDL_Event event;
|
||||
event.type = SDL_QUIT;
|
||||
event.quit.timestamp = SDL_GetTicks();
|
||||
SDL_PushEvent(&event);
|
||||
return;
|
||||
}
|
||||
// Check for the unbind combo (Ctrl+Alt+Shift+Z)
|
||||
else if (event->keysym.sym == SDLK_z) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Detected mouse capture toggle combo (SDLK)");
|
||||
|
||||
// Stop handling future input
|
||||
setCaptureActive(!isCaptureActive());
|
||||
|
||||
// Force raise all keys to ensure they aren't stuck,
|
||||
// since we won't get their key up events.
|
||||
raiseAllKeys();
|
||||
return;
|
||||
}
|
||||
else if (event->keysym.sym == SDLK_x) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Detected full-screen toggle combo (SDLK)");
|
||||
Session::s_ActiveSession->toggleFullscreen();
|
||||
|
||||
// Force raise all keys just be safe across this full-screen/windowed
|
||||
// transition just in case key events get lost.
|
||||
raiseAllKeys();
|
||||
return;
|
||||
}
|
||||
else if (event->keysym.sym == SDLK_s) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Detected stats toggle combo (SDLK)");
|
||||
|
||||
// Toggle the stats overlay
|
||||
Session::get()->getOverlayManager().setOverlayState(Overlay::OverlayDebug,
|
||||
!Session::get()->getOverlayManager().isOverlayEnabled(Overlay::OverlayDebug));
|
||||
|
||||
// Force raise all keys just be safe across this full-screen/windowed
|
||||
// transition just in case key events get lost.
|
||||
raiseAllKeys();
|
||||
return;
|
||||
}
|
||||
// Check for quit combo (Ctrl+Alt+Shift+Q)
|
||||
else if (event->keysym.scancode == SDL_SCANCODE_Q) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Detected quit key combo (scancode)");
|
||||
|
||||
// Push a quit event to the main loop
|
||||
SDL_Event event;
|
||||
event.type = SDL_QUIT;
|
||||
event.quit.timestamp = SDL_GetTicks();
|
||||
SDL_PushEvent(&event);
|
||||
return;
|
||||
}
|
||||
// Check for the unbind combo (Ctrl+Alt+Shift+Z)
|
||||
else if (event->keysym.scancode == SDL_SCANCODE_Z) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Detected mouse capture toggle combo (scancode)");
|
||||
|
||||
// Stop handling future input
|
||||
setCaptureActive(!isCaptureActive());
|
||||
|
||||
// Force raise all keys to ensure they aren't stuck,
|
||||
// since we won't get their key up events.
|
||||
raiseAllKeys();
|
||||
return;
|
||||
}
|
||||
// Check for the full-screen combo (Ctrl+Alt+Shift+X)
|
||||
else if (event->keysym.scancode == SDL_SCANCODE_X) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Detected full-screen toggle combo (scancode)");
|
||||
Session::s_ActiveSession->toggleFullscreen();
|
||||
|
||||
// Force raise all keys just be safe across this full-screen/windowed
|
||||
// transition just in case key events get lost.
|
||||
raiseAllKeys();
|
||||
return;
|
||||
}
|
||||
else if (event->keysym.scancode == SDL_SCANCODE_S) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Detected stats toggle combo (scancode)");
|
||||
|
||||
// Toggle the stats overlay
|
||||
Session::get()->getOverlayManager().setOverlayState(Overlay::OverlayDebug,
|
||||
!Session::get()->getOverlayManager().isOverlayEnabled(Overlay::OverlayDebug));
|
||||
|
||||
// Force raise all keys just be safe across this full-screen/windowed
|
||||
// transition just in case key events get lost.
|
||||
raiseAllKeys();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isCaptureActive()) {
|
||||
// Not capturing
|
||||
return;
|
||||
}
|
||||
|
||||
// Set modifier flags
|
||||
modifiers = 0;
|
||||
if (event->keysym.mod & KMOD_CTRL) {
|
||||
modifiers |= MODIFIER_CTRL;
|
||||
}
|
||||
if (event->keysym.mod & KMOD_ALT) {
|
||||
modifiers |= MODIFIER_ALT;
|
||||
}
|
||||
if (event->keysym.mod & KMOD_SHIFT) {
|
||||
modifiers |= MODIFIER_SHIFT;
|
||||
}
|
||||
|
||||
// Set keycode. We explicitly use scancode here because GFE will try to correct
|
||||
// for AZERTY layouts on the host but it depends on receiving VK_ values matching
|
||||
// a QWERTY layout to work.
|
||||
if (event->keysym.scancode >= SDL_SCANCODE_1 && event->keysym.scancode <= SDL_SCANCODE_9) {
|
||||
// SDL defines SDL_SCANCODE_0 > SDL_SCANCODE_9, so we need to handle that manually
|
||||
keyCode = (event->keysym.scancode - SDL_SCANCODE_1) + VK_0 + 1;
|
||||
}
|
||||
else if (event->keysym.scancode >= SDL_SCANCODE_A && event->keysym.scancode <= SDL_SCANCODE_Z) {
|
||||
keyCode = (event->keysym.scancode - SDL_SCANCODE_A) + VK_A;
|
||||
}
|
||||
else if (event->keysym.scancode >= SDL_SCANCODE_F1 && event->keysym.scancode <= SDL_SCANCODE_F12) {
|
||||
keyCode = (event->keysym.scancode - SDL_SCANCODE_F1) + VK_F1;
|
||||
}
|
||||
else if (event->keysym.scancode >= SDL_SCANCODE_F13 && event->keysym.scancode <= SDL_SCANCODE_F24) {
|
||||
keyCode = (event->keysym.scancode - SDL_SCANCODE_F13) + VK_F13;
|
||||
}
|
||||
else if (event->keysym.scancode >= SDL_SCANCODE_KP_1 && event->keysym.scancode <= SDL_SCANCODE_KP_9) {
|
||||
// SDL defines SDL_SCANCODE_KP_0 > SDL_SCANCODE_KP_9, so we need to handle that manually
|
||||
keyCode = (event->keysym.scancode - SDL_SCANCODE_KP_1) + VK_NUMPAD0 + 1;
|
||||
}
|
||||
else {
|
||||
switch (event->keysym.scancode) {
|
||||
case SDL_SCANCODE_BACKSPACE:
|
||||
keyCode = 0x08;
|
||||
break;
|
||||
case SDL_SCANCODE_TAB:
|
||||
keyCode = 0x09;
|
||||
break;
|
||||
case SDL_SCANCODE_CLEAR:
|
||||
keyCode = 0x0C;
|
||||
break;
|
||||
case SDL_SCANCODE_KP_ENTER: // FIXME: Is this correct?
|
||||
case SDL_SCANCODE_RETURN:
|
||||
keyCode = 0x0D;
|
||||
break;
|
||||
case SDL_SCANCODE_PAUSE:
|
||||
keyCode = 0x13;
|
||||
break;
|
||||
case SDL_SCANCODE_CAPSLOCK:
|
||||
keyCode = 0x14;
|
||||
break;
|
||||
case SDL_SCANCODE_ESCAPE:
|
||||
keyCode = 0x1B;
|
||||
break;
|
||||
case SDL_SCANCODE_SPACE:
|
||||
keyCode = 0x20;
|
||||
break;
|
||||
case SDL_SCANCODE_PAGEUP:
|
||||
keyCode = 0x21;
|
||||
break;
|
||||
case SDL_SCANCODE_PAGEDOWN:
|
||||
keyCode = 0x22;
|
||||
break;
|
||||
case SDL_SCANCODE_END:
|
||||
keyCode = 0x23;
|
||||
break;
|
||||
case SDL_SCANCODE_HOME:
|
||||
keyCode = 0x24;
|
||||
break;
|
||||
case SDL_SCANCODE_LEFT:
|
||||
keyCode = 0x25;
|
||||
break;
|
||||
case SDL_SCANCODE_UP:
|
||||
keyCode = 0x26;
|
||||
break;
|
||||
case SDL_SCANCODE_RIGHT:
|
||||
keyCode = 0x27;
|
||||
break;
|
||||
case SDL_SCANCODE_DOWN:
|
||||
keyCode = 0x28;
|
||||
break;
|
||||
case SDL_SCANCODE_SELECT:
|
||||
keyCode = 0x29;
|
||||
break;
|
||||
case SDL_SCANCODE_EXECUTE:
|
||||
keyCode = 0x2B;
|
||||
break;
|
||||
case SDL_SCANCODE_PRINTSCREEN:
|
||||
keyCode = 0x2C;
|
||||
break;
|
||||
case SDL_SCANCODE_INSERT:
|
||||
keyCode = 0x2D;
|
||||
break;
|
||||
case SDL_SCANCODE_DELETE:
|
||||
keyCode = 0x2E;
|
||||
break;
|
||||
case SDL_SCANCODE_HELP:
|
||||
keyCode = 0x2F;
|
||||
break;
|
||||
case SDL_SCANCODE_KP_0:
|
||||
// See comment above about why we only handle SDL_SCANCODE_KP_0 here
|
||||
keyCode = VK_NUMPAD0;
|
||||
break;
|
||||
case SDL_SCANCODE_0:
|
||||
// See comment above about why we only handle SDL_SCANCODE_0 here
|
||||
keyCode = VK_0;
|
||||
break;
|
||||
case SDL_SCANCODE_KP_MULTIPLY:
|
||||
keyCode = 0x6A;
|
||||
break;
|
||||
case SDL_SCANCODE_KP_PLUS:
|
||||
keyCode = 0x6B;
|
||||
break;
|
||||
case SDL_SCANCODE_KP_COMMA:
|
||||
keyCode = 0x6C;
|
||||
break;
|
||||
case SDL_SCANCODE_KP_MINUS:
|
||||
keyCode = 0x6D;
|
||||
break;
|
||||
case SDL_SCANCODE_KP_PERIOD:
|
||||
keyCode = 0x6E;
|
||||
break;
|
||||
case SDL_SCANCODE_KP_DIVIDE:
|
||||
keyCode = 0x6F;
|
||||
break;
|
||||
case SDL_SCANCODE_NUMLOCKCLEAR:
|
||||
keyCode = 0x90;
|
||||
break;
|
||||
case SDL_SCANCODE_SCROLLLOCK:
|
||||
keyCode = 0x91;
|
||||
break;
|
||||
case SDL_SCANCODE_LSHIFT:
|
||||
keyCode = 0xA0;
|
||||
break;
|
||||
case SDL_SCANCODE_RSHIFT:
|
||||
keyCode = 0xA1;
|
||||
break;
|
||||
case SDL_SCANCODE_LCTRL:
|
||||
keyCode = 0xA2;
|
||||
break;
|
||||
case SDL_SCANCODE_RCTRL:
|
||||
keyCode = 0xA3;
|
||||
break;
|
||||
case SDL_SCANCODE_LALT:
|
||||
keyCode = 0xA4;
|
||||
break;
|
||||
case SDL_SCANCODE_RALT:
|
||||
keyCode = 0xA5;
|
||||
break;
|
||||
case SDL_SCANCODE_AC_BACK:
|
||||
keyCode = 0xA6;
|
||||
break;
|
||||
case SDL_SCANCODE_AC_FORWARD:
|
||||
keyCode = 0xA7;
|
||||
break;
|
||||
case SDL_SCANCODE_AC_REFRESH:
|
||||
keyCode = 0xA8;
|
||||
break;
|
||||
case SDL_SCANCODE_AC_STOP:
|
||||
keyCode = 0xA9;
|
||||
break;
|
||||
case SDL_SCANCODE_AC_SEARCH:
|
||||
keyCode = 0xAA;
|
||||
break;
|
||||
case SDL_SCANCODE_AC_BOOKMARKS:
|
||||
keyCode = 0xAB;
|
||||
break;
|
||||
case SDL_SCANCODE_AC_HOME:
|
||||
keyCode = 0xAC;
|
||||
break;
|
||||
case SDL_SCANCODE_SEMICOLON:
|
||||
keyCode = 0xBA;
|
||||
break;
|
||||
case SDL_SCANCODE_EQUALS:
|
||||
keyCode = 0xBB;
|
||||
break;
|
||||
case SDL_SCANCODE_COMMA:
|
||||
keyCode = 0xBC;
|
||||
break;
|
||||
case SDL_SCANCODE_MINUS:
|
||||
keyCode = 0xBD;
|
||||
break;
|
||||
case SDL_SCANCODE_PERIOD:
|
||||
keyCode = 0xBE;
|
||||
break;
|
||||
case SDL_SCANCODE_SLASH:
|
||||
keyCode = 0xBF;
|
||||
break;
|
||||
case SDL_SCANCODE_GRAVE:
|
||||
keyCode = 0xC0;
|
||||
break;
|
||||
case SDL_SCANCODE_LEFTBRACKET:
|
||||
keyCode = 0xDB;
|
||||
break;
|
||||
case SDL_SCANCODE_BACKSLASH:
|
||||
keyCode = 0xDC;
|
||||
break;
|
||||
case SDL_SCANCODE_RIGHTBRACKET:
|
||||
keyCode = 0xDD;
|
||||
break;
|
||||
case SDL_SCANCODE_APOSTROPHE:
|
||||
keyCode = 0xDE;
|
||||
break;
|
||||
case SDL_SCANCODE_NONUSBACKSLASH:
|
||||
keyCode = 0xE2;
|
||||
break;
|
||||
default:
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Unhandled button event: %d",
|
||||
event->keysym.scancode);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Track the key state so we always know which keys are down
|
||||
if (event->state == SDL_PRESSED) {
|
||||
m_KeysDown.insert(keyCode);
|
||||
}
|
||||
else {
|
||||
m_KeysDown.remove(keyCode);
|
||||
}
|
||||
|
||||
LiSendKeyboardEvent(keyCode,
|
||||
event->state == SDL_PRESSED ?
|
||||
KEY_ACTION_DOWN : KEY_ACTION_UP,
|
||||
modifiers);
|
||||
}
|
||||
|
||||
void SdlInputHandler::handleMouseButtonEvent(SDL_MouseButtonEvent* event)
|
||||
{
|
||||
int button;
|
||||
|
||||
// Capture the mouse again if clicked when unbound.
|
||||
// We start capture on left button released instead of
|
||||
// pressed to avoid sending an errant mouse button released
|
||||
// event to the host when clicking into our window (since
|
||||
// the pressed event was consumed by this code).
|
||||
if (event->button == SDL_BUTTON_LEFT &&
|
||||
event->state == SDL_RELEASED &&
|
||||
!isCaptureActive()) {
|
||||
setCaptureActive(true);
|
||||
return;
|
||||
}
|
||||
else if (!isCaptureActive()) {
|
||||
// Not capturing
|
||||
return;
|
||||
}
|
||||
else if (event->which == SDL_TOUCH_MOUSEID) {
|
||||
// Ignore synthetic mouse events
|
||||
return;
|
||||
}
|
||||
|
||||
switch (event->button)
|
||||
{
|
||||
case SDL_BUTTON_LEFT:
|
||||
button = BUTTON_LEFT;
|
||||
break;
|
||||
case SDL_BUTTON_MIDDLE:
|
||||
button = BUTTON_MIDDLE;
|
||||
break;
|
||||
case SDL_BUTTON_RIGHT:
|
||||
button = BUTTON_RIGHT;
|
||||
break;
|
||||
case SDL_BUTTON_X1:
|
||||
button = BUTTON_X1;
|
||||
break;
|
||||
case SDL_BUTTON_X2:
|
||||
button = BUTTON_X2;
|
||||
break;
|
||||
default:
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Unhandled button event: %d",
|
||||
event->button);
|
||||
return;
|
||||
}
|
||||
|
||||
LiSendMouseButtonEvent(event->state == SDL_PRESSED ?
|
||||
BUTTON_ACTION_PRESS :
|
||||
BUTTON_ACTION_RELEASE,
|
||||
button);
|
||||
}
|
||||
|
||||
void SdlInputHandler::handleMouseMotionEvent(SDL_MouseMotionEvent* event)
|
||||
{
|
||||
if (!isCaptureActive()) {
|
||||
// Not capturing
|
||||
return;
|
||||
}
|
||||
else if (event->which == SDL_TOUCH_MOUSEID) {
|
||||
// Ignore synthetic mouse events
|
||||
return;
|
||||
}
|
||||
|
||||
// Batch until the next mouse polling window or we'll get awful
|
||||
// input lag everything except GFE 3.14 and 3.15.
|
||||
SDL_AtomicAdd(&m_MouseDeltaX, event->xrel);
|
||||
SDL_AtomicAdd(&m_MouseDeltaY, event->yrel);
|
||||
}
|
||||
|
||||
void SdlInputHandler::handleMouseWheelEvent(SDL_MouseWheelEvent* event)
|
||||
{
|
||||
if (!isCaptureActive()) {
|
||||
// Not capturing
|
||||
return;
|
||||
}
|
||||
else if (event->which == SDL_TOUCH_MOUSEID) {
|
||||
// Ignore synthetic mouse events
|
||||
return;
|
||||
}
|
||||
|
||||
if (event->y != 0) {
|
||||
LiSendScrollEvent((signed char)event->y);
|
||||
}
|
||||
}
|
||||
|
||||
GamepadState*
|
||||
SdlInputHandler::findStateForGamepad(SDL_JoystickID id)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_GAMEPADS; i++) {
|
||||
if (m_GamepadState[i].jsId == id) {
|
||||
SDL_assert(!m_MultiController || m_GamepadState[i].index == i);
|
||||
return &m_GamepadState[i];
|
||||
}
|
||||
}
|
||||
|
||||
// This should only happen with > 4 gamepads
|
||||
SDL_assert(SDL_NumJoysticks() > 4);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SdlInputHandler::sendGamepadState(GamepadState* state)
|
||||
{
|
||||
SDL_assert(m_GamepadMask == 0x1 || m_MultiController);
|
||||
LiSendMultiControllerEvent(state->index,
|
||||
m_GamepadMask,
|
||||
state->buttons,
|
||||
state->lt,
|
||||
state->rt,
|
||||
state->lsX,
|
||||
state->lsY,
|
||||
state->rsX,
|
||||
state->rsY);
|
||||
}
|
||||
|
||||
Uint32 SdlInputHandler::releaseLeftButtonTimerCallback(Uint32, void*)
|
||||
{
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Uint32 SdlInputHandler::releaseRightButtonTimerCallback(Uint32, void*)
|
||||
{
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_RIGHT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Uint32 SdlInputHandler::dragTimerCallback(Uint32, void *param)
|
||||
{
|
||||
auto me = reinterpret_cast<SdlInputHandler*>(param);
|
||||
|
||||
// Check how many fingers are down now to decide
|
||||
// which button to hold down
|
||||
if (me->m_NumFingersDown == 2) {
|
||||
me->m_DragButton = BUTTON_RIGHT;
|
||||
}
|
||||
else if (me->m_NumFingersDown == 1) {
|
||||
me->m_DragButton = BUTTON_LEFT;
|
||||
}
|
||||
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, me->m_DragButton);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Uint32 SdlInputHandler::mouseMoveTimerCallback(Uint32 interval, void *param)
|
||||
{
|
||||
auto me = reinterpret_cast<SdlInputHandler*>(param);
|
||||
|
||||
short deltaX = (short)SDL_AtomicSet(&me->m_MouseDeltaX, 0);
|
||||
short deltaY = (short)SDL_AtomicSet(&me->m_MouseDeltaY, 0);
|
||||
|
||||
if (deltaX != 0 || deltaY != 0) {
|
||||
LiSendMouseMoveEvent(deltaX, deltaY);
|
||||
}
|
||||
|
||||
return interval;
|
||||
}
|
||||
|
||||
Uint32 SdlInputHandler::mouseEmulationTimerCallback(Uint32 interval, void *param)
|
||||
{
|
||||
auto gamepad = reinterpret_cast<GamepadState*>(param);
|
||||
|
||||
short rawX;
|
||||
short rawY;
|
||||
|
||||
// Determine which analog stick is currently receiving the strongest input
|
||||
if ((uint32_t)qAbs(gamepad->lsX) + qAbs(gamepad->lsY) > (uint32_t)qAbs(gamepad->rsX) + qAbs(gamepad->rsY)) {
|
||||
rawX = gamepad->lsX;
|
||||
rawY = -gamepad->lsY;
|
||||
}
|
||||
else {
|
||||
rawX = gamepad->rsX;
|
||||
rawY = -gamepad->rsY;
|
||||
}
|
||||
|
||||
float deltaX;
|
||||
float deltaY;
|
||||
|
||||
// Produce a base vector for mouse movement with increased speed as we deviate further from center
|
||||
deltaX = qPow(rawX / 32766.0f * MOUSE_EMULATION_MOTION_MULTIPLIER, 3);
|
||||
deltaY = qPow(rawY / 32766.0f * MOUSE_EMULATION_MOTION_MULTIPLIER, 3);
|
||||
|
||||
// Enforce deadzones
|
||||
deltaX = qAbs(deltaX) > MOUSE_EMULATION_DEADZONE ? deltaX - MOUSE_EMULATION_DEADZONE : 0;
|
||||
deltaY = qAbs(deltaY) > MOUSE_EMULATION_DEADZONE ? deltaY - MOUSE_EMULATION_DEADZONE : 0;
|
||||
|
||||
if (deltaX != 0 || deltaY != 0) {
|
||||
LiSendMouseMoveEvent((short)deltaX, (short)deltaY);
|
||||
}
|
||||
|
||||
return interval;
|
||||
}
|
||||
|
||||
void SdlInputHandler::handleControllerAxisEvent(SDL_ControllerAxisEvent* event)
|
||||
{
|
||||
SDL_JoystickID gameControllerId = event->which;
|
||||
GamepadState* state = findStateForGamepad(gameControllerId);
|
||||
if (state == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Batch all pending axis motion events for this gamepad to save CPU time
|
||||
SDL_Event nextEvent;
|
||||
for (;;) {
|
||||
switch (event->axis)
|
||||
{
|
||||
case SDL_CONTROLLER_AXIS_LEFTX:
|
||||
state->lsX = event->value;
|
||||
break;
|
||||
case SDL_CONTROLLER_AXIS_LEFTY:
|
||||
// Signed values have one more negative value than
|
||||
// positive value, so inverting the sign on -32768
|
||||
// could actually cause the value to overflow and
|
||||
// wrap around to be negative again. Avoid that by
|
||||
// capping the value at 32767.
|
||||
state->lsY = -qMax(event->value, (short)-32767);
|
||||
break;
|
||||
case SDL_CONTROLLER_AXIS_RIGHTX:
|
||||
state->rsX = event->value;
|
||||
break;
|
||||
case SDL_CONTROLLER_AXIS_RIGHTY:
|
||||
state->rsY = -qMax(event->value, (short)-32767);
|
||||
break;
|
||||
case SDL_CONTROLLER_AXIS_TRIGGERLEFT:
|
||||
state->lt = (unsigned char)(event->value * 255UL / 32767);
|
||||
break;
|
||||
case SDL_CONTROLLER_AXIS_TRIGGERRIGHT:
|
||||
state->rt = (unsigned char)(event->value * 255UL / 32767);
|
||||
break;
|
||||
default:
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Unhandled controller axis: %d",
|
||||
event->axis);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for another event to batch with
|
||||
if (SDL_PeepEvents(&nextEvent, 1, SDL_PEEKEVENT, SDL_CONTROLLERAXISMOTION, SDL_CONTROLLERAXISMOTION) <= 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
event = &nextEvent.caxis;
|
||||
if (event->which != gameControllerId) {
|
||||
// Stop batching if a different gamepad interrupts us
|
||||
break;
|
||||
}
|
||||
|
||||
// Remove the next event to batch
|
||||
SDL_PeepEvents(&nextEvent, 1, SDL_GETEVENT, SDL_CONTROLLERAXISMOTION, SDL_CONTROLLERAXISMOTION);
|
||||
}
|
||||
|
||||
// Only send the gamepad state to the host if it's not in mouse emulation mode
|
||||
if (state->mouseEmulationTimer == 0) {
|
||||
sendGamepadState(state);
|
||||
}
|
||||
}
|
||||
|
||||
void SdlInputHandler::handleControllerButtonEvent(SDL_ControllerButtonEvent* event)
|
||||
{
|
||||
GamepadState* state = findStateForGamepad(event->which);
|
||||
if (state == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event->state == SDL_PRESSED) {
|
||||
state->buttons |= k_ButtonMap[event->button];
|
||||
|
||||
if (event->button == SDL_CONTROLLER_BUTTON_START) {
|
||||
state->lastStartDownTime = SDL_GetTicks();
|
||||
}
|
||||
else if (state->mouseEmulationTimer != 0) {
|
||||
if (event->button == SDL_CONTROLLER_BUTTON_A) {
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_LEFT);
|
||||
}
|
||||
else if (event->button == SDL_CONTROLLER_BUTTON_B) {
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_RIGHT);
|
||||
}
|
||||
else if (event->button == SDL_CONTROLLER_BUTTON_X) {
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_MIDDLE);
|
||||
}
|
||||
else if (event->button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER) {
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_X1);
|
||||
}
|
||||
else if (event->button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER) {
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_X2);
|
||||
}
|
||||
else if (event->button == SDL_CONTROLLER_BUTTON_DPAD_UP) {
|
||||
LiSendScrollEvent(1);
|
||||
}
|
||||
else if (event->button == SDL_CONTROLLER_BUTTON_DPAD_DOWN) {
|
||||
LiSendScrollEvent(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
state->buttons &= ~k_ButtonMap[event->button];
|
||||
|
||||
if (event->button == SDL_CONTROLLER_BUTTON_START) {
|
||||
if (SDL_GetTicks() - state->lastStartDownTime > MOUSE_EMULATION_LONG_PRESS_TIME) {
|
||||
if (state->mouseEmulationTimer != 0) {
|
||||
SDL_RemoveTimer(state->mouseEmulationTimer);
|
||||
state->mouseEmulationTimer = 0;
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Mouse emulation deactivated");
|
||||
Session::get()->notifyMouseEmulationMode(false);
|
||||
}
|
||||
else if (m_GamepadMouse) {
|
||||
// Send the start button up event to the host, since we won't do it below
|
||||
sendGamepadState(state);
|
||||
|
||||
state->mouseEmulationTimer = SDL_AddTimer(MOUSE_EMULATION_POLLING_INTERVAL, SdlInputHandler::mouseEmulationTimerCallback, state);
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Mouse emulation active");
|
||||
Session::get()->notifyMouseEmulationMode(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (state->mouseEmulationTimer != 0) {
|
||||
if (event->button == SDL_CONTROLLER_BUTTON_A) {
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT);
|
||||
}
|
||||
else if (event->button == SDL_CONTROLLER_BUTTON_B) {
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_RIGHT);
|
||||
}
|
||||
else if (event->button == SDL_CONTROLLER_BUTTON_X) {
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_MIDDLE);
|
||||
}
|
||||
else if (event->button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER) {
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_X1);
|
||||
}
|
||||
else if (event->button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER) {
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_X2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Start+Select+L1+R1 as a gamepad quit combo
|
||||
if (state->buttons == (PLAY_FLAG | BACK_FLAG | LB_FLAG | RB_FLAG)) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Detected quit gamepad button combo");
|
||||
|
||||
// Push a quit event to the main loop
|
||||
SDL_Event event;
|
||||
event.type = SDL_QUIT;
|
||||
event.quit.timestamp = SDL_GetTicks();
|
||||
SDL_PushEvent(&event);
|
||||
|
||||
// Clear buttons down on this gameapd
|
||||
LiSendMultiControllerEvent(state->index, m_GamepadMask,
|
||||
0, 0, 0, 0, 0, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
// Only send the gamepad state to the host if it's not in mouse emulation mode
|
||||
if (state->mouseEmulationTimer == 0) {
|
||||
sendGamepadState(state);
|
||||
}
|
||||
}
|
||||
|
||||
void SdlInputHandler::handleControllerDeviceEvent(SDL_ControllerDeviceEvent* event)
|
||||
{
|
||||
GamepadState* state;
|
||||
|
||||
if (event->type == SDL_CONTROLLERDEVICEADDED) {
|
||||
int i;
|
||||
const char* name;
|
||||
SDL_GameController* controller;
|
||||
const char* mapping;
|
||||
char guidStr[33];
|
||||
uint32_t hapticCaps;
|
||||
|
||||
controller = SDL_GameControllerOpen(event->which);
|
||||
if (controller == NULL) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Failed to open gamepad: %s",
|
||||
SDL_GetError());
|
||||
return;
|
||||
}
|
||||
|
||||
// We used to use SDL_GameControllerGetPlayerIndex() here but that
|
||||
// can lead to strange issues due to bugs in Windows where an Xbox
|
||||
// controller will join as player 2, even though no player 1 controller
|
||||
// is connected at all. This pretty much screws any attempt to use
|
||||
// the gamepad in single player games, so just assign them in order from 0.
|
||||
i = 0;
|
||||
|
||||
for (; i < MAX_GAMEPADS; i++) {
|
||||
SDL_assert(m_GamepadState[i].controller != controller);
|
||||
if (m_GamepadState[i].controller == NULL) {
|
||||
// Found an empty slot
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == MAX_GAMEPADS) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"No open gamepad slots found!");
|
||||
SDL_GameControllerClose(controller);
|
||||
return;
|
||||
}
|
||||
|
||||
state = &m_GamepadState[i];
|
||||
if (m_MultiController) {
|
||||
state->index = i;
|
||||
}
|
||||
else {
|
||||
// Always player 1 in single controller mode
|
||||
state->index = 0;
|
||||
}
|
||||
|
||||
state->controller = controller;
|
||||
state->jsId = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(state->controller));
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 9)
|
||||
// Perform a no-op rumble to see if haptics are supported
|
||||
hapticCaps = SDL_GameControllerRumble(controller, 0, 0, 0) == 0 ?
|
||||
ML_HAPTIC_GC_RUMBLE : 0;
|
||||
#else
|
||||
state->haptic = SDL_HapticOpenFromJoystick(SDL_GameControllerGetJoystick(state->controller));
|
||||
state->hapticEffectId = -1;
|
||||
state->hapticMethod = GAMEPAD_HAPTIC_METHOD_NONE;
|
||||
if (state->haptic != nullptr) {
|
||||
// Query for supported haptic effects
|
||||
hapticCaps = SDL_HapticQuery(state->haptic);
|
||||
hapticCaps |= SDL_HapticRumbleSupported(state->haptic) ?
|
||||
ML_HAPTIC_SIMPLE_RUMBLE : 0;
|
||||
|
||||
if ((SDL_HapticQuery(state->haptic) & SDL_HAPTIC_LEFTRIGHT) == 0) {
|
||||
if (SDL_HapticRumbleSupported(state->haptic)) {
|
||||
if (SDL_HapticRumbleInit(state->haptic) == 0) {
|
||||
state->hapticMethod = GAMEPAD_HAPTIC_METHOD_SIMPLERUMBLE;
|
||||
}
|
||||
}
|
||||
if (state->hapticMethod == GAMEPAD_HAPTIC_METHOD_NONE) {
|
||||
SDL_HapticClose(state->haptic);
|
||||
state->haptic = nullptr;
|
||||
}
|
||||
} else {
|
||||
state->hapticMethod = GAMEPAD_HAPTIC_METHOD_LEFTRIGHT;
|
||||
}
|
||||
}
|
||||
else {
|
||||
hapticCaps = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(SDL_GameControllerGetJoystick(state->controller)),
|
||||
guidStr, sizeof(guidStr));
|
||||
mapping = SDL_GameControllerMapping(state->controller);
|
||||
name = SDL_GameControllerName(state->controller);
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Gamepad %d (player %d) is: %s (haptic capabilities: 0x%x) (mapping: %s -> %s)",
|
||||
i,
|
||||
state->index,
|
||||
name != nullptr ? name : "<null>",
|
||||
hapticCaps,
|
||||
guidStr,
|
||||
mapping != nullptr ? mapping : "<null>");
|
||||
if (mapping != nullptr) {
|
||||
SDL_free((void*)mapping);
|
||||
}
|
||||
|
||||
// Add this gamepad to the gamepad mask
|
||||
if (m_MultiController) {
|
||||
// NB: Don't assert that it's unset here because we will already
|
||||
// have the mask set for initially attached gamepads to avoid confusing
|
||||
// apps running on the host.
|
||||
m_GamepadMask |= (1 << state->index);
|
||||
}
|
||||
else {
|
||||
SDL_assert(m_GamepadMask == 0x1);
|
||||
}
|
||||
|
||||
// Send an empty event to tell the PC we've arrived
|
||||
sendGamepadState(state);
|
||||
}
|
||||
else if (event->type == SDL_CONTROLLERDEVICEREMOVED) {
|
||||
state = findStateForGamepad(event->which);
|
||||
if (state != NULL) {
|
||||
if (state->mouseEmulationTimer != 0) {
|
||||
Session::get()->notifyMouseEmulationMode(false);
|
||||
SDL_RemoveTimer(state->mouseEmulationTimer);
|
||||
}
|
||||
|
||||
SDL_GameControllerClose(state->controller);
|
||||
|
||||
#if !SDL_VERSION_ATLEAST(2, 0, 9)
|
||||
if (state->haptic != nullptr) {
|
||||
SDL_HapticClose(state->haptic);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Remove this from the gamepad mask in MC-mode
|
||||
if (m_MultiController) {
|
||||
SDL_assert(m_GamepadMask & (1 << state->index));
|
||||
m_GamepadMask &= ~(1 << state->index);
|
||||
}
|
||||
else {
|
||||
SDL_assert(m_GamepadMask == 0x1);
|
||||
}
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Gamepad %d is gone",
|
||||
state->index);
|
||||
|
||||
// Send a final event to let the PC know this gamepad is gone
|
||||
LiSendMultiControllerEvent(state->index, m_GamepadMask,
|
||||
0, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
// Clear all remaining state from this slot
|
||||
SDL_memset(state, 0, sizeof(*state));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SdlInputHandler::handleJoystickArrivalEvent(SDL_JoyDeviceEvent* event)
|
||||
{
|
||||
SDL_assert(event->type == SDL_JOYDEVICEADDED);
|
||||
|
||||
if (!SDL_IsGameController(event->which)) {
|
||||
char guidStr[33];
|
||||
SDL_JoystickGetGUIDString(SDL_JoystickGetDeviceGUID(event->which),
|
||||
guidStr, sizeof(guidStr));
|
||||
const char* name = SDL_JoystickNameForIndex(event->which);
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Joystick discovered with no mapping: %s %s",
|
||||
name ? name : "<UNKNOWN>",
|
||||
guidStr);
|
||||
SDL_Joystick* joy = SDL_JoystickOpen(event->which);
|
||||
if (joy != nullptr) {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Number of axes: %d | Number of buttons: %d | Number of hats: %d",
|
||||
SDL_JoystickNumAxes(joy), SDL_JoystickNumButtons(joy),
|
||||
SDL_JoystickNumHats(joy));
|
||||
SDL_JoystickClose(joy);
|
||||
}
|
||||
else {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Unable to open joystick for query: %s",
|
||||
SDL_GetError());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SdlInputHandler::rumble(unsigned short controllerNumber, unsigned short lowFreqMotor, unsigned short highFreqMotor)
|
||||
{
|
||||
// Make sure the controller number is within our supported count
|
||||
if (controllerNumber >= MAX_GAMEPADS) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 9)
|
||||
if (m_GamepadState[controllerNumber].controller != nullptr) {
|
||||
SDL_GameControllerRumble(m_GamepadState[controllerNumber].controller, lowFreqMotor, highFreqMotor, 30000);
|
||||
}
|
||||
#else
|
||||
// Check if the controller supports haptics (and if the controller exists at all)
|
||||
SDL_Haptic* haptic = m_GamepadState[controllerNumber].haptic;
|
||||
if (haptic == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Stop the last effect we played
|
||||
if (m_GamepadState[controllerNumber].hapticMethod == GAMEPAD_HAPTIC_METHOD_LEFTRIGHT) {
|
||||
if (m_GamepadState[controllerNumber].hapticEffectId >= 0) {
|
||||
SDL_HapticDestroyEffect(haptic, m_GamepadState[controllerNumber].hapticEffectId);
|
||||
}
|
||||
} else if (m_GamepadState[controllerNumber].hapticMethod == GAMEPAD_HAPTIC_METHOD_SIMPLERUMBLE) {
|
||||
SDL_HapticRumbleStop(haptic);
|
||||
}
|
||||
|
||||
// If this callback is telling us to stop both motors, don't bother queuing a new effect
|
||||
if (lowFreqMotor == 0 && highFreqMotor == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_GamepadState[controllerNumber].hapticMethod == GAMEPAD_HAPTIC_METHOD_LEFTRIGHT) {
|
||||
SDL_HapticEffect effect;
|
||||
SDL_memset(&effect, 0, sizeof(effect));
|
||||
effect.type = SDL_HAPTIC_LEFTRIGHT;
|
||||
|
||||
// The effect should last until we are instructed to stop or change it
|
||||
effect.leftright.length = SDL_HAPTIC_INFINITY;
|
||||
|
||||
// SDL haptics range from 0-32767 but XInput uses 0-65535, so divide by 2 to correct for SDL's scaling
|
||||
effect.leftright.large_magnitude = lowFreqMotor / 2;
|
||||
effect.leftright.small_magnitude = highFreqMotor / 2;
|
||||
|
||||
// Play the new effect
|
||||
m_GamepadState[controllerNumber].hapticEffectId = SDL_HapticNewEffect(haptic, &effect);
|
||||
if (m_GamepadState[controllerNumber].hapticEffectId >= 0) {
|
||||
SDL_HapticRunEffect(haptic, m_GamepadState[controllerNumber].hapticEffectId, 1);
|
||||
}
|
||||
} else if (m_GamepadState[controllerNumber].hapticMethod == GAMEPAD_HAPTIC_METHOD_SIMPLERUMBLE) {
|
||||
SDL_HapticRumblePlay(haptic,
|
||||
std::min(1.0, (GAMEPAD_HAPTIC_SIMPLE_HIFREQ_MOTOR_WEIGHT*highFreqMotor +
|
||||
GAMEPAD_HAPTIC_SIMPLE_LOWFREQ_MOTOR_WEIGHT*lowFreqMotor) / 65535.0),
|
||||
SDL_HAPTIC_INFINITY);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void SdlInputHandler::handleTouchFingerEvent(SDL_TouchFingerEvent* event)
|
||||
{
|
||||
int fingerIndex = -1;
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 10)
|
||||
if (SDL_GetTouchDeviceType(event->touchId) != SDL_TOUCH_DEVICE_DIRECT) {
|
||||
// Ignore anything that isn't a touchscreen. We may get callbacks
|
||||
// for trackpads, but we want to handle those in the mouse path.
|
||||
return;
|
||||
}
|
||||
#elif defined(Q_OS_DARWIN)
|
||||
// SDL2 sends touch events from trackpads by default on
|
||||
// macOS. This totally screws our actual mouse handling,
|
||||
// so we must explicitly ignore touch events on macOS
|
||||
// until SDL 2.0.10 where we have SDL_GetTouchDeviceType()
|
||||
// to tell them apart.
|
||||
return;
|
||||
#endif
|
||||
|
||||
// Observations on Windows 10: x and y appear to be relative to 0,0 of the window client area.
|
||||
// Although SDL documentation states they are 0.0 - 1.0 float values, they can actually be higher
|
||||
// or lower than those values as touch events continue for touches started within the client area that
|
||||
// leave the client area during a drag motion.
|
||||
// dx and dy are deltas from the last touch event, not the first touch down.
|
||||
|
||||
// Determine the index of this finger using our list
|
||||
// of fingers that are currently active on screen.
|
||||
// This is also required to handle finger up which
|
||||
// where the finger will not be in SDL_GetTouchFinger()
|
||||
// anymore.
|
||||
if (event->type != SDL_FINGERDOWN) {
|
||||
for (int i = 0; i < MAX_FINGERS; i++) {
|
||||
if (event->fingerId == m_TouchDownEvent[i].fingerId) {
|
||||
fingerIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Resolve the new finger by determining the ID of each
|
||||
// finger on the display.
|
||||
int numTouchFingers = SDL_GetNumTouchFingers(event->touchId);
|
||||
for (int i = 0; i < numTouchFingers; i++) {
|
||||
SDL_Finger* finger = SDL_GetTouchFinger(event->touchId, i);
|
||||
SDL_assert(finger != nullptr);
|
||||
if (finger != nullptr) {
|
||||
if (finger->id == event->fingerId) {
|
||||
fingerIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fingerIndex < 0 || fingerIndex >= MAX_FINGERS) {
|
||||
// Too many fingers
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle cursor motion based on the position of the
|
||||
// primary finger on screen
|
||||
if (fingerIndex == 0) {
|
||||
// The event x and y values are relative to our window width
|
||||
// and height. However, we want to scale them to be relative
|
||||
// to the host resolution. Fortunately this is easy since we
|
||||
// already have normalized values. We'll just multiply them
|
||||
// by the stream dimensions to get real X and Y values rather
|
||||
// than the client window dimensions.
|
||||
short deltaX = static_cast<short>(event->dx * m_StreamWidth);
|
||||
short deltaY = static_cast<short>(event->dy * m_StreamHeight);
|
||||
if (deltaX != 0 || deltaY != 0) {
|
||||
LiSendMouseMoveEvent(deltaX, deltaY);
|
||||
}
|
||||
}
|
||||
|
||||
// Start a drag timer when primary or secondary
|
||||
// fingers go down
|
||||
if (event->type == SDL_FINGERDOWN &&
|
||||
(fingerIndex == 0 || fingerIndex == 1)) {
|
||||
SDL_RemoveTimer(m_DragTimer);
|
||||
m_DragTimer = SDL_AddTimer(DRAG_ACTIVATION_DELAY,
|
||||
dragTimerCallback,
|
||||
this);
|
||||
}
|
||||
|
||||
if (event->type == SDL_FINGERMOTION) {
|
||||
// Count the total cumulative dx/dy that the finger
|
||||
// has moved.
|
||||
m_CumulativeDelta[fingerIndex] += qAbs(event->x);
|
||||
m_CumulativeDelta[fingerIndex] += qAbs(event->y);
|
||||
|
||||
// If it's outside the deadzone delta, cancel drags and taps
|
||||
if (m_CumulativeDelta[fingerIndex] > DEAD_ZONE_DELTA) {
|
||||
SDL_RemoveTimer(m_DragTimer);
|
||||
m_DragTimer = 0;
|
||||
|
||||
// This effectively cancels the tap logic below
|
||||
m_TouchDownEvent[fingerIndex].timestamp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (event->type == SDL_FINGERUP) {
|
||||
// Cancel the drag timer on finger up
|
||||
SDL_RemoveTimer(m_DragTimer);
|
||||
m_DragTimer = 0;
|
||||
|
||||
// Release any drag
|
||||
if (m_DragButton != 0) {
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, m_DragButton);
|
||||
m_DragButton = 0;
|
||||
}
|
||||
// 2 finger tap
|
||||
else if (event->timestamp - m_TouchDownEvent[1].timestamp < 250) {
|
||||
// Zero timestamp of the primary finger to ensure we won't
|
||||
// generate a left click if the primary finger comes up soon.
|
||||
m_TouchDownEvent[0].timestamp = 0;
|
||||
|
||||
// Press down the right mouse button
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_RIGHT);
|
||||
|
||||
// Queue a timer to release it in 100 ms
|
||||
SDL_RemoveTimer(m_RightButtonReleaseTimer);
|
||||
m_RightButtonReleaseTimer = SDL_AddTimer(TAP_BUTTON_RELEASE_DELAY,
|
||||
releaseRightButtonTimerCallback,
|
||||
nullptr);
|
||||
}
|
||||
// 1 finger tap
|
||||
else if (event->timestamp - m_TouchDownEvent[0].timestamp < 250) {
|
||||
// Press down the left mouse button
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_LEFT);
|
||||
|
||||
// Queue a timer to release it in 100 ms
|
||||
SDL_RemoveTimer(m_LeftButtonReleaseTimer);
|
||||
m_LeftButtonReleaseTimer = SDL_AddTimer(TAP_BUTTON_RELEASE_DELAY,
|
||||
releaseLeftButtonTimerCallback,
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
m_NumFingersDown = SDL_GetNumTouchFingers(event->touchId);
|
||||
|
||||
if (event->type == SDL_FINGERDOWN) {
|
||||
m_TouchDownEvent[fingerIndex] = *event;
|
||||
m_CumulativeDelta[fingerIndex] = 0;
|
||||
}
|
||||
else if (event->type == SDL_FINGERUP) {
|
||||
m_TouchDownEvent[fingerIndex] = {};
|
||||
}
|
||||
}
|
||||
|
||||
int SdlInputHandler::getAttachedGamepadMask()
|
||||
{
|
||||
int count;
|
||||
int mask;
|
||||
|
||||
if (!m_MultiController) {
|
||||
// Player 1 is always present in non-MC mode
|
||||
return 0x1;
|
||||
}
|
||||
|
||||
count = mask = 0;
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++) {
|
||||
if (SDL_IsGameController(i)) {
|
||||
mask |= (1 << count++);
|
||||
}
|
||||
}
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
void SdlInputHandler::raiseAllKeys()
|
||||
{
|
||||
if (m_KeysDown.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Raising %d keys",
|
||||
m_KeysDown.count());
|
||||
|
||||
for (auto keyDown : m_KeysDown) {
|
||||
LiSendKeyboardEvent(keyDown, KEY_ACTION_UP, 0);
|
||||
}
|
||||
|
||||
m_KeysDown.clear();
|
||||
}
|
||||
|
||||
bool SdlInputHandler::isCaptureActive()
|
||||
{
|
||||
if (SDL_GetRelativeMouseMode()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Some platforms don't support SDL_SetRelativeMouseMode
|
||||
return m_FakeCaptureActive;
|
||||
}
|
||||
|
||||
void SdlInputHandler::setCaptureActive(bool active)
|
||||
{
|
||||
if (active) {
|
||||
// Try to activate SDL's relative mouse mode
|
||||
if (SDL_SetRelativeMouseMode(SDL_TRUE) < 0) {
|
||||
// Relative mouse mode didn't work, so we'll use fake capture
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
m_FakeCaptureActive = true;
|
||||
}
|
||||
}
|
||||
else if (m_FakeCaptureActive) {
|
||||
SDL_ShowCursor(SDL_ENABLE);
|
||||
m_FakeCaptureActive = false;
|
||||
}
|
||||
else {
|
||||
SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
QString SdlInputHandler::getUnmappedGamepads()
|
||||
{
|
||||
QString ret;
|
||||
|
||||
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) != 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) failed: %s",
|
||||
SDL_GetError());
|
||||
}
|
||||
|
||||
MappingManager mappingManager;
|
||||
mappingManager.applyMappings();
|
||||
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++) {
|
||||
if (!SDL_IsGameController(i)) {
|
||||
char guidStr[33];
|
||||
SDL_JoystickGetGUIDString(SDL_JoystickGetDeviceGUID(i),
|
||||
guidStr, sizeof(guidStr));
|
||||
const char* name = SDL_JoystickNameForIndex(i);
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Unmapped joystick: %s %s",
|
||||
name ? name : "<UNKNOWN>",
|
||||
guidStr);
|
||||
SDL_Joystick* joy = SDL_JoystickOpen(i);
|
||||
if (joy != nullptr) {
|
||||
int numButtons = SDL_JoystickNumButtons(joy);
|
||||
int numHats = SDL_JoystickNumHats(joy);
|
||||
int numAxes = SDL_JoystickNumAxes(joy);
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Number of axes: %d | Number of buttons: %d | Number of hats: %d",
|
||||
numAxes, numButtons, numHats);
|
||||
|
||||
if ((numAxes >= 4 && numAxes <= 8) && numButtons >= 8 && numHats <= 1) {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Joystick likely to be an unmapped game controller");
|
||||
if (!ret.isEmpty()) {
|
||||
ret += ", ";
|
||||
}
|
||||
|
||||
ret += name;
|
||||
}
|
||||
|
||||
SDL_JoystickClose(joy);
|
||||
}
|
||||
else {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Unable to open joystick for query: %s",
|
||||
SDL_GetError());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
#include "input.h"
|
||||
|
||||
#include <Limelight.h>
|
||||
#include <SDL.h>
|
||||
#include "streaming/streamutils.h"
|
||||
|
||||
#include <QtMath>
|
||||
|
||||
// How long the fingers must be stationary to start a right click
|
||||
#define LONG_PRESS_ACTIVATION_DELAY 650
|
||||
|
||||
// How far the finger can move before it cancels a right click
|
||||
#define LONG_PRESS_ACTIVATION_DELTA 0.01f
|
||||
|
||||
// How long the double tap deadzone stays in effect between touch up and touch down
|
||||
#define DOUBLE_TAP_DEAD_ZONE_DELAY 250
|
||||
|
||||
// How far the finger can move before it can override the double tap deadzone
|
||||
#define DOUBLE_TAP_DEAD_ZONE_DELTA 0.025f
|
||||
|
||||
Uint32 SdlInputHandler::longPressTimerCallback(Uint32, void*)
|
||||
{
|
||||
// Raise the left click and start a right click
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT);
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_RIGHT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SdlInputHandler::handleAbsoluteFingerEvent(SDL_TouchFingerEvent* event)
|
||||
{
|
||||
// Observations on Windows 10: x and y appear to be relative to 0,0 of the window client area.
|
||||
// Although SDL documentation states they are 0.0 - 1.0 float values, they can actually be higher
|
||||
// or lower than those values as touch events continue for touches started within the client area that
|
||||
// leave the client area during a drag motion.
|
||||
// dx and dy are deltas from the last touch event, not the first touch down.
|
||||
|
||||
// Ignore touch down events with more than one finger
|
||||
if (event->type == SDL_FINGERDOWN && SDL_GetNumTouchFingers(event->touchId) > 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Ignore touch move and touch up events from the non-primary finger
|
||||
if (event->type != SDL_FINGERDOWN && event->fingerId != m_LastTouchDownEvent.fingerId) {
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_Rect src, dst;
|
||||
int windowWidth, windowHeight;
|
||||
|
||||
SDL_GetWindowSize(m_Window, &windowWidth, &windowHeight);
|
||||
|
||||
src.x = src.y = 0;
|
||||
src.w = m_StreamWidth;
|
||||
src.h = m_StreamHeight;
|
||||
|
||||
dst.x = dst.y = 0;
|
||||
dst.w = windowWidth;
|
||||
dst.h = windowHeight;
|
||||
|
||||
// Use the stream and window sizes to determine the video region
|
||||
StreamUtils::scaleSourceToDestinationSurface(&src, &dst);
|
||||
|
||||
if (qSqrt(qPow(event->x - m_LastTouchDownEvent.x, 2) + qPow(event->y - m_LastTouchDownEvent.y, 2)) > LONG_PRESS_ACTIVATION_DELTA) {
|
||||
// Moved too far since touch down. Cancel the long press timer.
|
||||
SDL_RemoveTimer(m_LongPressTimer);
|
||||
m_LongPressTimer = 0;
|
||||
}
|
||||
|
||||
// Don't reposition for finger down events within the deadzone. This makes double-clicking easier.
|
||||
if (event->type != SDL_FINGERDOWN ||
|
||||
event->timestamp - m_LastTouchUpEvent.timestamp > DOUBLE_TAP_DEAD_ZONE_DELAY ||
|
||||
qSqrt(qPow(event->x - m_LastTouchUpEvent.x, 2) + qPow(event->y - m_LastTouchUpEvent.y, 2)) > DOUBLE_TAP_DEAD_ZONE_DELTA) {
|
||||
// Scale window-relative events to be video-relative and clamp to video region
|
||||
short x = qMin(qMax((int)(event->x * windowWidth), dst.x), dst.x + dst.w);
|
||||
short y = qMin(qMax((int)(event->y * windowHeight), dst.y), dst.y + dst.h);
|
||||
|
||||
// Update the cursor position relative to the video region
|
||||
LiSendMousePositionEvent(x - dst.x, y - dst.y, dst.w, dst.h);
|
||||
}
|
||||
|
||||
if (event->type == SDL_FINGERDOWN) {
|
||||
m_LastTouchDownEvent = *event;
|
||||
|
||||
// Start/restart the long press timer
|
||||
SDL_RemoveTimer(m_LongPressTimer);
|
||||
m_LongPressTimer = SDL_AddTimer(LONG_PRESS_ACTIVATION_DELAY,
|
||||
longPressTimerCallback,
|
||||
nullptr);
|
||||
|
||||
// Left button down on finger down
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_LEFT);
|
||||
}
|
||||
else if (event->type == SDL_FINGERUP) {
|
||||
m_LastTouchUpEvent = *event;
|
||||
|
||||
// Cancel the long press timer
|
||||
SDL_RemoveTimer(m_LongPressTimer);
|
||||
m_LongPressTimer = 0;
|
||||
|
||||
// Left button up on finger up
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT);
|
||||
|
||||
// Raise right button too in case we triggered a long press gesture
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_RIGHT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,595 @@
|
||||
#include "streaming/session.h"
|
||||
|
||||
#include <Limelight.h>
|
||||
#include <SDL.h>
|
||||
#include "settings/mappingmanager.h"
|
||||
|
||||
#include <QtMath>
|
||||
|
||||
// How long the Start button must be pressed to toggle mouse emulation
|
||||
#define MOUSE_EMULATION_LONG_PRESS_TIME 750
|
||||
|
||||
// How long between polling the gamepad to send virtual mouse input
|
||||
#define MOUSE_EMULATION_POLLING_INTERVAL 50
|
||||
|
||||
// Determines how fast the mouse will move each interval
|
||||
#define MOUSE_EMULATION_MOTION_MULTIPLIER 4
|
||||
|
||||
// Determines the maximum motion amount before allowing movement
|
||||
#define MOUSE_EMULATION_DEADZONE 2
|
||||
|
||||
// Haptic capabilities (in addition to those from SDL_HapticQuery())
|
||||
#define ML_HAPTIC_GC_RUMBLE (1U << 16)
|
||||
#define ML_HAPTIC_SIMPLE_RUMBLE (1U << 17)
|
||||
|
||||
const int SdlInputHandler::k_ButtonMap[] = {
|
||||
A_FLAG, B_FLAG, X_FLAG, Y_FLAG,
|
||||
BACK_FLAG, SPECIAL_FLAG, PLAY_FLAG,
|
||||
LS_CLK_FLAG, RS_CLK_FLAG,
|
||||
LB_FLAG, RB_FLAG,
|
||||
UP_FLAG, DOWN_FLAG, LEFT_FLAG, RIGHT_FLAG
|
||||
};
|
||||
|
||||
GamepadState*
|
||||
SdlInputHandler::findStateForGamepad(SDL_JoystickID id)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_GAMEPADS; i++) {
|
||||
if (m_GamepadState[i].jsId == id) {
|
||||
SDL_assert(!m_MultiController || m_GamepadState[i].index == i);
|
||||
return &m_GamepadState[i];
|
||||
}
|
||||
}
|
||||
|
||||
// This should only happen with > 4 gamepads
|
||||
SDL_assert(SDL_NumJoysticks() > 4);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SdlInputHandler::sendGamepadState(GamepadState* state)
|
||||
{
|
||||
SDL_assert(m_GamepadMask == 0x1 || m_MultiController);
|
||||
LiSendMultiControllerEvent(state->index,
|
||||
m_GamepadMask,
|
||||
state->buttons,
|
||||
state->lt,
|
||||
state->rt,
|
||||
state->lsX,
|
||||
state->lsY,
|
||||
state->rsX,
|
||||
state->rsY);
|
||||
}
|
||||
|
||||
Uint32 SdlInputHandler::mouseEmulationTimerCallback(Uint32 interval, void *param)
|
||||
{
|
||||
auto gamepad = reinterpret_cast<GamepadState*>(param);
|
||||
|
||||
short rawX;
|
||||
short rawY;
|
||||
|
||||
// Determine which analog stick is currently receiving the strongest input
|
||||
if ((uint32_t)qAbs(gamepad->lsX) + qAbs(gamepad->lsY) > (uint32_t)qAbs(gamepad->rsX) + qAbs(gamepad->rsY)) {
|
||||
rawX = gamepad->lsX;
|
||||
rawY = -gamepad->lsY;
|
||||
}
|
||||
else {
|
||||
rawX = gamepad->rsX;
|
||||
rawY = -gamepad->rsY;
|
||||
}
|
||||
|
||||
float deltaX;
|
||||
float deltaY;
|
||||
|
||||
// Produce a base vector for mouse movement with increased speed as we deviate further from center
|
||||
deltaX = qPow(rawX / 32766.0f * MOUSE_EMULATION_MOTION_MULTIPLIER, 3);
|
||||
deltaY = qPow(rawY / 32766.0f * MOUSE_EMULATION_MOTION_MULTIPLIER, 3);
|
||||
|
||||
// Enforce deadzones
|
||||
deltaX = qAbs(deltaX) > MOUSE_EMULATION_DEADZONE ? deltaX - MOUSE_EMULATION_DEADZONE : 0;
|
||||
deltaY = qAbs(deltaY) > MOUSE_EMULATION_DEADZONE ? deltaY - MOUSE_EMULATION_DEADZONE : 0;
|
||||
|
||||
if (deltaX != 0 || deltaY != 0) {
|
||||
LiSendMouseMoveEvent((short)deltaX, (short)deltaY);
|
||||
}
|
||||
|
||||
return interval;
|
||||
}
|
||||
|
||||
void SdlInputHandler::handleControllerAxisEvent(SDL_ControllerAxisEvent* event)
|
||||
{
|
||||
SDL_JoystickID gameControllerId = event->which;
|
||||
GamepadState* state = findStateForGamepad(gameControllerId);
|
||||
if (state == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Batch all pending axis motion events for this gamepad to save CPU time
|
||||
SDL_Event nextEvent;
|
||||
for (;;) {
|
||||
switch (event->axis)
|
||||
{
|
||||
case SDL_CONTROLLER_AXIS_LEFTX:
|
||||
state->lsX = event->value;
|
||||
break;
|
||||
case SDL_CONTROLLER_AXIS_LEFTY:
|
||||
// Signed values have one more negative value than
|
||||
// positive value, so inverting the sign on -32768
|
||||
// could actually cause the value to overflow and
|
||||
// wrap around to be negative again. Avoid that by
|
||||
// capping the value at 32767.
|
||||
state->lsY = -qMax(event->value, (short)-32767);
|
||||
break;
|
||||
case SDL_CONTROLLER_AXIS_RIGHTX:
|
||||
state->rsX = event->value;
|
||||
break;
|
||||
case SDL_CONTROLLER_AXIS_RIGHTY:
|
||||
state->rsY = -qMax(event->value, (short)-32767);
|
||||
break;
|
||||
case SDL_CONTROLLER_AXIS_TRIGGERLEFT:
|
||||
state->lt = (unsigned char)(event->value * 255UL / 32767);
|
||||
break;
|
||||
case SDL_CONTROLLER_AXIS_TRIGGERRIGHT:
|
||||
state->rt = (unsigned char)(event->value * 255UL / 32767);
|
||||
break;
|
||||
default:
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Unhandled controller axis: %d",
|
||||
event->axis);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for another event to batch with
|
||||
if (SDL_PeepEvents(&nextEvent, 1, SDL_PEEKEVENT, SDL_CONTROLLERAXISMOTION, SDL_CONTROLLERAXISMOTION) <= 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
event = &nextEvent.caxis;
|
||||
if (event->which != gameControllerId) {
|
||||
// Stop batching if a different gamepad interrupts us
|
||||
break;
|
||||
}
|
||||
|
||||
// Remove the next event to batch
|
||||
SDL_PeepEvents(&nextEvent, 1, SDL_GETEVENT, SDL_CONTROLLERAXISMOTION, SDL_CONTROLLERAXISMOTION);
|
||||
}
|
||||
|
||||
// Only send the gamepad state to the host if it's not in mouse emulation mode
|
||||
if (state->mouseEmulationTimer == 0) {
|
||||
sendGamepadState(state);
|
||||
}
|
||||
}
|
||||
|
||||
void SdlInputHandler::handleControllerButtonEvent(SDL_ControllerButtonEvent* event)
|
||||
{
|
||||
GamepadState* state = findStateForGamepad(event->which);
|
||||
if (state == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event->state == SDL_PRESSED) {
|
||||
state->buttons |= k_ButtonMap[event->button];
|
||||
|
||||
if (event->button == SDL_CONTROLLER_BUTTON_START) {
|
||||
state->lastStartDownTime = SDL_GetTicks();
|
||||
}
|
||||
else if (state->mouseEmulationTimer != 0) {
|
||||
if (event->button == SDL_CONTROLLER_BUTTON_A) {
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_LEFT);
|
||||
}
|
||||
else if (event->button == SDL_CONTROLLER_BUTTON_B) {
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_RIGHT);
|
||||
}
|
||||
else if (event->button == SDL_CONTROLLER_BUTTON_X) {
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_MIDDLE);
|
||||
}
|
||||
else if (event->button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER) {
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_X1);
|
||||
}
|
||||
else if (event->button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER) {
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_X2);
|
||||
}
|
||||
else if (event->button == SDL_CONTROLLER_BUTTON_DPAD_UP) {
|
||||
LiSendScrollEvent(1);
|
||||
}
|
||||
else if (event->button == SDL_CONTROLLER_BUTTON_DPAD_DOWN) {
|
||||
LiSendScrollEvent(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
state->buttons &= ~k_ButtonMap[event->button];
|
||||
|
||||
if (event->button == SDL_CONTROLLER_BUTTON_START) {
|
||||
if (SDL_GetTicks() - state->lastStartDownTime > MOUSE_EMULATION_LONG_PRESS_TIME) {
|
||||
if (state->mouseEmulationTimer != 0) {
|
||||
SDL_RemoveTimer(state->mouseEmulationTimer);
|
||||
state->mouseEmulationTimer = 0;
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Mouse emulation deactivated");
|
||||
Session::get()->notifyMouseEmulationMode(false);
|
||||
}
|
||||
else if (m_GamepadMouse) {
|
||||
// Send the start button up event to the host, since we won't do it below
|
||||
sendGamepadState(state);
|
||||
|
||||
state->mouseEmulationTimer = SDL_AddTimer(MOUSE_EMULATION_POLLING_INTERVAL, SdlInputHandler::mouseEmulationTimerCallback, state);
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Mouse emulation active");
|
||||
Session::get()->notifyMouseEmulationMode(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (state->mouseEmulationTimer != 0) {
|
||||
if (event->button == SDL_CONTROLLER_BUTTON_A) {
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT);
|
||||
}
|
||||
else if (event->button == SDL_CONTROLLER_BUTTON_B) {
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_RIGHT);
|
||||
}
|
||||
else if (event->button == SDL_CONTROLLER_BUTTON_X) {
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_MIDDLE);
|
||||
}
|
||||
else if (event->button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER) {
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_X1);
|
||||
}
|
||||
else if (event->button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER) {
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_X2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Start+Select+L1+R1 as a gamepad quit combo
|
||||
if (state->buttons == (PLAY_FLAG | BACK_FLAG | LB_FLAG | RB_FLAG)) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Detected quit gamepad button combo");
|
||||
|
||||
// Push a quit event to the main loop
|
||||
SDL_Event event;
|
||||
event.type = SDL_QUIT;
|
||||
event.quit.timestamp = SDL_GetTicks();
|
||||
SDL_PushEvent(&event);
|
||||
|
||||
// Clear buttons down on this gameapd
|
||||
LiSendMultiControllerEvent(state->index, m_GamepadMask,
|
||||
0, 0, 0, 0, 0, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
// Only send the gamepad state to the host if it's not in mouse emulation mode
|
||||
if (state->mouseEmulationTimer == 0) {
|
||||
sendGamepadState(state);
|
||||
}
|
||||
}
|
||||
|
||||
void SdlInputHandler::handleControllerDeviceEvent(SDL_ControllerDeviceEvent* event)
|
||||
{
|
||||
GamepadState* state;
|
||||
|
||||
if (event->type == SDL_CONTROLLERDEVICEADDED) {
|
||||
int i;
|
||||
const char* name;
|
||||
SDL_GameController* controller;
|
||||
const char* mapping;
|
||||
char guidStr[33];
|
||||
uint32_t hapticCaps;
|
||||
|
||||
controller = SDL_GameControllerOpen(event->which);
|
||||
if (controller == NULL) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Failed to open gamepad: %s",
|
||||
SDL_GetError());
|
||||
return;
|
||||
}
|
||||
|
||||
// We used to use SDL_GameControllerGetPlayerIndex() here but that
|
||||
// can lead to strange issues due to bugs in Windows where an Xbox
|
||||
// controller will join as player 2, even though no player 1 controller
|
||||
// is connected at all. This pretty much screws any attempt to use
|
||||
// the gamepad in single player games, so just assign them in order from 0.
|
||||
i = 0;
|
||||
|
||||
for (; i < MAX_GAMEPADS; i++) {
|
||||
SDL_assert(m_GamepadState[i].controller != controller);
|
||||
if (m_GamepadState[i].controller == NULL) {
|
||||
// Found an empty slot
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == MAX_GAMEPADS) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"No open gamepad slots found!");
|
||||
SDL_GameControllerClose(controller);
|
||||
return;
|
||||
}
|
||||
|
||||
state = &m_GamepadState[i];
|
||||
if (m_MultiController) {
|
||||
state->index = i;
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 12)
|
||||
// This will change indicators on the controller to show the assigned
|
||||
// player index. For Xbox 360 controllers, that means updating the LED
|
||||
// ring to light up the corresponding quadrant for this player.
|
||||
SDL_GameControllerSetPlayerIndex(controller, state->index);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
// Always player 1 in single controller mode
|
||||
state->index = 0;
|
||||
}
|
||||
|
||||
state->controller = controller;
|
||||
state->jsId = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(state->controller));
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 9)
|
||||
// Perform a tiny rumble to see if haptics are supported.
|
||||
// NB: We cannot use zeros for rumble intensity or SDL will not actually call the JS driver
|
||||
// and we'll get a (potentially false) success value returned.
|
||||
hapticCaps = SDL_GameControllerRumble(controller, 1, 1, 1) == 0 ?
|
||||
ML_HAPTIC_GC_RUMBLE : 0;
|
||||
#else
|
||||
state->haptic = SDL_HapticOpenFromJoystick(SDL_GameControllerGetJoystick(state->controller));
|
||||
state->hapticEffectId = -1;
|
||||
state->hapticMethod = GAMEPAD_HAPTIC_METHOD_NONE;
|
||||
if (state->haptic != nullptr) {
|
||||
// Query for supported haptic effects
|
||||
hapticCaps = SDL_HapticQuery(state->haptic);
|
||||
hapticCaps |= SDL_HapticRumbleSupported(state->haptic) ?
|
||||
ML_HAPTIC_SIMPLE_RUMBLE : 0;
|
||||
|
||||
if ((SDL_HapticQuery(state->haptic) & SDL_HAPTIC_LEFTRIGHT) == 0) {
|
||||
if (SDL_HapticRumbleSupported(state->haptic)) {
|
||||
if (SDL_HapticRumbleInit(state->haptic) == 0) {
|
||||
state->hapticMethod = GAMEPAD_HAPTIC_METHOD_SIMPLERUMBLE;
|
||||
}
|
||||
}
|
||||
if (state->hapticMethod == GAMEPAD_HAPTIC_METHOD_NONE) {
|
||||
SDL_HapticClose(state->haptic);
|
||||
state->haptic = nullptr;
|
||||
}
|
||||
} else {
|
||||
state->hapticMethod = GAMEPAD_HAPTIC_METHOD_LEFTRIGHT;
|
||||
}
|
||||
}
|
||||
else {
|
||||
hapticCaps = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(SDL_GameControllerGetJoystick(state->controller)),
|
||||
guidStr, sizeof(guidStr));
|
||||
mapping = SDL_GameControllerMapping(state->controller);
|
||||
name = SDL_GameControllerName(state->controller);
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Gamepad %d (player %d) is: %s (haptic capabilities: 0x%x) (mapping: %s -> %s)",
|
||||
i,
|
||||
state->index,
|
||||
name != nullptr ? name : "<null>",
|
||||
hapticCaps,
|
||||
guidStr,
|
||||
mapping != nullptr ? mapping : "<null>");
|
||||
if (mapping != nullptr) {
|
||||
SDL_free((void*)mapping);
|
||||
}
|
||||
|
||||
// Add this gamepad to the gamepad mask
|
||||
if (m_MultiController) {
|
||||
// NB: Don't assert that it's unset here because we will already
|
||||
// have the mask set for initially attached gamepads to avoid confusing
|
||||
// apps running on the host.
|
||||
m_GamepadMask |= (1 << state->index);
|
||||
}
|
||||
else {
|
||||
SDL_assert(m_GamepadMask == 0x1);
|
||||
}
|
||||
|
||||
// Send an empty event to tell the PC we've arrived
|
||||
sendGamepadState(state);
|
||||
}
|
||||
else if (event->type == SDL_CONTROLLERDEVICEREMOVED) {
|
||||
state = findStateForGamepad(event->which);
|
||||
if (state != NULL) {
|
||||
if (state->mouseEmulationTimer != 0) {
|
||||
Session::get()->notifyMouseEmulationMode(false);
|
||||
SDL_RemoveTimer(state->mouseEmulationTimer);
|
||||
}
|
||||
|
||||
SDL_GameControllerClose(state->controller);
|
||||
|
||||
#if !SDL_VERSION_ATLEAST(2, 0, 9)
|
||||
if (state->haptic != nullptr) {
|
||||
SDL_HapticClose(state->haptic);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Remove this from the gamepad mask in MC-mode
|
||||
if (m_MultiController) {
|
||||
SDL_assert(m_GamepadMask & (1 << state->index));
|
||||
m_GamepadMask &= ~(1 << state->index);
|
||||
}
|
||||
else {
|
||||
SDL_assert(m_GamepadMask == 0x1);
|
||||
}
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Gamepad %d is gone",
|
||||
state->index);
|
||||
|
||||
// Send a final event to let the PC know this gamepad is gone
|
||||
LiSendMultiControllerEvent(state->index, m_GamepadMask,
|
||||
0, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
// Clear all remaining state from this slot
|
||||
SDL_memset(state, 0, sizeof(*state));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SdlInputHandler::handleJoystickArrivalEvent(SDL_JoyDeviceEvent* event)
|
||||
{
|
||||
SDL_assert(event->type == SDL_JOYDEVICEADDED);
|
||||
|
||||
if (!SDL_IsGameController(event->which)) {
|
||||
char guidStr[33];
|
||||
SDL_JoystickGetGUIDString(SDL_JoystickGetDeviceGUID(event->which),
|
||||
guidStr, sizeof(guidStr));
|
||||
const char* name = SDL_JoystickNameForIndex(event->which);
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Joystick discovered with no mapping: %s %s",
|
||||
name ? name : "<UNKNOWN>",
|
||||
guidStr);
|
||||
SDL_Joystick* joy = SDL_JoystickOpen(event->which);
|
||||
if (joy != nullptr) {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Number of axes: %d | Number of buttons: %d | Number of hats: %d",
|
||||
SDL_JoystickNumAxes(joy), SDL_JoystickNumButtons(joy),
|
||||
SDL_JoystickNumHats(joy));
|
||||
SDL_JoystickClose(joy);
|
||||
}
|
||||
else {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Unable to open joystick for query: %s",
|
||||
SDL_GetError());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SdlInputHandler::rumble(unsigned short controllerNumber, unsigned short lowFreqMotor, unsigned short highFreqMotor)
|
||||
{
|
||||
// Make sure the controller number is within our supported count
|
||||
if (controllerNumber >= MAX_GAMEPADS) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 9)
|
||||
if (m_GamepadState[controllerNumber].controller != nullptr) {
|
||||
SDL_GameControllerRumble(m_GamepadState[controllerNumber].controller, lowFreqMotor, highFreqMotor, 30000);
|
||||
}
|
||||
#else
|
||||
// Check if the controller supports haptics (and if the controller exists at all)
|
||||
SDL_Haptic* haptic = m_GamepadState[controllerNumber].haptic;
|
||||
if (haptic == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Stop the last effect we played
|
||||
if (m_GamepadState[controllerNumber].hapticMethod == GAMEPAD_HAPTIC_METHOD_LEFTRIGHT) {
|
||||
if (m_GamepadState[controllerNumber].hapticEffectId >= 0) {
|
||||
SDL_HapticDestroyEffect(haptic, m_GamepadState[controllerNumber].hapticEffectId);
|
||||
}
|
||||
} else if (m_GamepadState[controllerNumber].hapticMethod == GAMEPAD_HAPTIC_METHOD_SIMPLERUMBLE) {
|
||||
SDL_HapticRumbleStop(haptic);
|
||||
}
|
||||
|
||||
// If this callback is telling us to stop both motors, don't bother queuing a new effect
|
||||
if (lowFreqMotor == 0 && highFreqMotor == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_GamepadState[controllerNumber].hapticMethod == GAMEPAD_HAPTIC_METHOD_LEFTRIGHT) {
|
||||
SDL_HapticEffect effect;
|
||||
SDL_memset(&effect, 0, sizeof(effect));
|
||||
effect.type = SDL_HAPTIC_LEFTRIGHT;
|
||||
|
||||
// The effect should last until we are instructed to stop or change it
|
||||
effect.leftright.length = SDL_HAPTIC_INFINITY;
|
||||
|
||||
// SDL haptics range from 0-32767 but XInput uses 0-65535, so divide by 2 to correct for SDL's scaling
|
||||
effect.leftright.large_magnitude = lowFreqMotor / 2;
|
||||
effect.leftright.small_magnitude = highFreqMotor / 2;
|
||||
|
||||
// Play the new effect
|
||||
m_GamepadState[controllerNumber].hapticEffectId = SDL_HapticNewEffect(haptic, &effect);
|
||||
if (m_GamepadState[controllerNumber].hapticEffectId >= 0) {
|
||||
SDL_HapticRunEffect(haptic, m_GamepadState[controllerNumber].hapticEffectId, 1);
|
||||
}
|
||||
} else if (m_GamepadState[controllerNumber].hapticMethod == GAMEPAD_HAPTIC_METHOD_SIMPLERUMBLE) {
|
||||
SDL_HapticRumblePlay(haptic,
|
||||
std::min(1.0, (GAMEPAD_HAPTIC_SIMPLE_HIFREQ_MOTOR_WEIGHT*highFreqMotor +
|
||||
GAMEPAD_HAPTIC_SIMPLE_LOWFREQ_MOTOR_WEIGHT*lowFreqMotor) / 65535.0),
|
||||
SDL_HAPTIC_INFINITY);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
QString SdlInputHandler::getUnmappedGamepads()
|
||||
{
|
||||
QString ret;
|
||||
|
||||
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) != 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) failed: %s",
|
||||
SDL_GetError());
|
||||
}
|
||||
|
||||
MappingManager mappingManager;
|
||||
mappingManager.applyMappings();
|
||||
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++) {
|
||||
if (!SDL_IsGameController(i)) {
|
||||
char guidStr[33];
|
||||
SDL_JoystickGetGUIDString(SDL_JoystickGetDeviceGUID(i),
|
||||
guidStr, sizeof(guidStr));
|
||||
const char* name = SDL_JoystickNameForIndex(i);
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Unmapped joystick: %s %s",
|
||||
name ? name : "<UNKNOWN>",
|
||||
guidStr);
|
||||
SDL_Joystick* joy = SDL_JoystickOpen(i);
|
||||
if (joy != nullptr) {
|
||||
int numButtons = SDL_JoystickNumButtons(joy);
|
||||
int numHats = SDL_JoystickNumHats(joy);
|
||||
int numAxes = SDL_JoystickNumAxes(joy);
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Number of axes: %d | Number of buttons: %d | Number of hats: %d",
|
||||
numAxes, numButtons, numHats);
|
||||
|
||||
if ((numAxes >= 4 && numAxes <= 8) && numButtons >= 8 && numHats <= 1) {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Joystick likely to be an unmapped game controller");
|
||||
if (!ret.isEmpty()) {
|
||||
ret += ", ";
|
||||
}
|
||||
|
||||
ret += name;
|
||||
}
|
||||
|
||||
SDL_JoystickClose(joy);
|
||||
}
|
||||
else {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Unable to open joystick for query: %s",
|
||||
SDL_GetError());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int SdlInputHandler::getAttachedGamepadMask()
|
||||
{
|
||||
int count;
|
||||
int mask;
|
||||
|
||||
if (!m_MultiController) {
|
||||
// Player 1 is always present in non-MC mode
|
||||
return 0x1;
|
||||
}
|
||||
|
||||
count = mask = 0;
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++) {
|
||||
if (SDL_IsGameController(i)) {
|
||||
mask |= (1 << count++);
|
||||
}
|
||||
}
|
||||
|
||||
return mask;
|
||||
}
|
||||
@@ -0,0 +1,346 @@
|
||||
#include <Limelight.h>
|
||||
#include <SDL.h>
|
||||
#include "streaming/session.h"
|
||||
#include "settings/mappingmanager.h"
|
||||
#include "path.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QDir>
|
||||
|
||||
#define MOUSE_POLLING_INTERVAL 5
|
||||
|
||||
SdlInputHandler::SdlInputHandler(StreamingPreferences& prefs, NvComputer*, int streamWidth, int streamHeight)
|
||||
: m_MultiController(prefs.multiController),
|
||||
m_GamepadMouse(prefs.gamepadMouse),
|
||||
m_SwapMouseButtons(prefs.swapMouseButtons),
|
||||
m_MouseMoveTimer(0),
|
||||
m_MousePositionLock(0),
|
||||
m_MouseWasInVideoRegion(false),
|
||||
m_PendingMouseButtonsAllUpOnVideoRegionLeave(false),
|
||||
m_FakeCaptureActive(false),
|
||||
m_LongPressTimer(0),
|
||||
m_StreamWidth(streamWidth),
|
||||
m_StreamHeight(streamHeight),
|
||||
m_AbsoluteMouseMode(prefs.absoluteMouseMode),
|
||||
m_AbsoluteTouchMode(prefs.absoluteTouchMode),
|
||||
m_PendingMouseLeaveButtonUp(0),
|
||||
m_LeftButtonReleaseTimer(0),
|
||||
m_RightButtonReleaseTimer(0),
|
||||
m_DragTimer(0),
|
||||
m_DragButton(0),
|
||||
m_NumFingersDown(0)
|
||||
{
|
||||
// Allow gamepad input when the app doesn't have focus
|
||||
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
|
||||
|
||||
// If absolute mouse mode is enabled, use relative mode warp (which
|
||||
// is via normal motion events that are influenced by mouse acceleration).
|
||||
// Otherwise, we'll use raw input capture which is straight from the device
|
||||
// without modification by the OS.
|
||||
SDL_SetHintWithPriority(SDL_HINT_MOUSE_RELATIVE_MODE_WARP,
|
||||
prefs.absoluteMouseMode ? "1" : "0",
|
||||
SDL_HINT_OVERRIDE);
|
||||
|
||||
// Allow clicks to pass through to us when focusing the window. If we're in
|
||||
// absolute mouse mode, this will avoid the user having to click twice to
|
||||
// trigger a click on the host if the Moonlight window is not focused. In
|
||||
// relative mode, the click event will trigger the mouse to be recaptured.
|
||||
SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1");
|
||||
|
||||
#if defined(Q_OS_DARWIN) && !SDL_VERSION_ATLEAST(2, 0, 10)
|
||||
// SDL 2.0.9 on macOS has a broken HIDAPI mapping for the older Xbox One S
|
||||
// firmware, so we have to disable HIDAPI for Xbox gamepads on macOS until
|
||||
// SDL 2.0.10 where the bug is fixed.
|
||||
// https://github.com/moonlight-stream/moonlight-qt/issues/133
|
||||
// https://bugzilla.libsdl.org/show_bug.cgi?id=4395
|
||||
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_XBOX, "0");
|
||||
#endif
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 9)
|
||||
// Enabling extended input reports allows rumble to function on Bluetooth PS4
|
||||
// controllers, but breaks DirectInput applications. We will enable it because
|
||||
// it's likely that working rumble is what the user is expecting. If they don't
|
||||
// want this behavior, they can override it with the environment variable.
|
||||
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, "1");
|
||||
#endif
|
||||
|
||||
m_OldIgnoreDevices = SDL_GetHint(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES);
|
||||
m_OldIgnoreDevicesExcept = SDL_GetHint(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT);
|
||||
|
||||
QString streamIgnoreDevices = qgetenv("STREAM_GAMECONTROLLER_IGNORE_DEVICES");
|
||||
QString streamIgnoreDevicesExcept = qgetenv("STREAM_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT");
|
||||
|
||||
if (!streamIgnoreDevices.isEmpty() && !streamIgnoreDevices.endsWith(',')) {
|
||||
streamIgnoreDevices += ',';
|
||||
}
|
||||
streamIgnoreDevices += m_OldIgnoreDevices;
|
||||
|
||||
// For SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES, we use the union of SDL_GAMECONTROLLER_IGNORE_DEVICES
|
||||
// and STREAM_GAMECONTROLLER_IGNORE_DEVICES while streaming. STREAM_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT
|
||||
// overrides SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT while streaming.
|
||||
SDL_SetHint(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES, streamIgnoreDevices.toUtf8());
|
||||
SDL_SetHint(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT, streamIgnoreDevicesExcept.toUtf8());
|
||||
|
||||
// We must initialize joystick explicitly before gamecontroller in order
|
||||
// to ensure we receive gamecontroller attach events for gamepads where
|
||||
// SDL doesn't have a built-in mapping. By starting joystick first, we
|
||||
// can allow mapping manager to update the mappings before GC attach
|
||||
// events are generated.
|
||||
SDL_assert(!SDL_WasInit(SDL_INIT_JOYSTICK));
|
||||
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"SDL_InitSubSystem(SDL_INIT_JOYSTICK) failed: %s",
|
||||
SDL_GetError());
|
||||
}
|
||||
|
||||
MappingManager mappingManager;
|
||||
mappingManager.applyMappings();
|
||||
|
||||
// Flush gamepad arrival and departure events which may be queued before
|
||||
// starting the gamecontroller subsystem again. This prevents us from
|
||||
// receiving duplicate arrival and departure events for the same gamepad.
|
||||
SDL_FlushEvent(SDL_CONTROLLERDEVICEADDED);
|
||||
SDL_FlushEvent(SDL_CONTROLLERDEVICEREMOVED);
|
||||
|
||||
// We need to reinit this each time, since you only get
|
||||
// an initial set of gamepad arrival events once per init.
|
||||
SDL_assert(!SDL_WasInit(SDL_INIT_GAMECONTROLLER));
|
||||
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) != 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) failed: %s",
|
||||
SDL_GetError());
|
||||
}
|
||||
|
||||
#if !SDL_VERSION_ATLEAST(2, 0, 9)
|
||||
SDL_assert(!SDL_WasInit(SDL_INIT_HAPTIC));
|
||||
if (SDL_InitSubSystem(SDL_INIT_HAPTIC) != 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"SDL_InitSubSystem(SDL_INIT_HAPTIC) failed: %s",
|
||||
SDL_GetError());
|
||||
}
|
||||
#endif
|
||||
|
||||
// Initialize the gamepad mask with currently attached gamepads to avoid
|
||||
// causing gamepads to unexpectedly disappear and reappear on the host
|
||||
// during stream startup as we detect currently attached gamepads one at a time.
|
||||
m_GamepadMask = getAttachedGamepadMask();
|
||||
|
||||
SDL_zero(m_GamepadState);
|
||||
SDL_zero(m_LastTouchDownEvent);
|
||||
SDL_zero(m_LastTouchUpEvent);
|
||||
SDL_zero(m_TouchDownEvent);
|
||||
SDL_zero(m_MousePositionReport);
|
||||
|
||||
SDL_AtomicSet(&m_MouseDeltaX, 0);
|
||||
SDL_AtomicSet(&m_MouseDeltaY, 0);
|
||||
SDL_AtomicSet(&m_MousePositionUpdated, 0);
|
||||
|
||||
Uint32 pollingInterval = QString(qgetenv("MOUSE_POLLING_INTERVAL")).toUInt();
|
||||
if (pollingInterval == 0) {
|
||||
pollingInterval = MOUSE_POLLING_INTERVAL;
|
||||
}
|
||||
else {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Using custom mouse polling interval: %u ms",
|
||||
pollingInterval);
|
||||
}
|
||||
|
||||
m_MouseMoveTimer = SDL_AddTimer(pollingInterval, SdlInputHandler::mouseMoveTimerCallback, this);
|
||||
}
|
||||
|
||||
SdlInputHandler::~SdlInputHandler()
|
||||
{
|
||||
for (int i = 0; i < MAX_GAMEPADS; i++) {
|
||||
if (m_GamepadState[i].mouseEmulationTimer != 0) {
|
||||
Session::get()->notifyMouseEmulationMode(false);
|
||||
SDL_RemoveTimer(m_GamepadState[i].mouseEmulationTimer);
|
||||
}
|
||||
#if !SDL_VERSION_ATLEAST(2, 0, 9)
|
||||
if (m_GamepadState[i].haptic != nullptr) {
|
||||
SDL_HapticClose(m_GamepadState[i].haptic);
|
||||
}
|
||||
#endif
|
||||
if (m_GamepadState[i].controller != nullptr) {
|
||||
SDL_GameControllerClose(m_GamepadState[i].controller);
|
||||
}
|
||||
}
|
||||
|
||||
SDL_RemoveTimer(m_MouseMoveTimer);
|
||||
SDL_RemoveTimer(m_LongPressTimer);
|
||||
SDL_RemoveTimer(m_LeftButtonReleaseTimer);
|
||||
SDL_RemoveTimer(m_RightButtonReleaseTimer);
|
||||
SDL_RemoveTimer(m_DragTimer);
|
||||
|
||||
#if !SDL_VERSION_ATLEAST(2, 0, 9)
|
||||
SDL_QuitSubSystem(SDL_INIT_HAPTIC);
|
||||
SDL_assert(!SDL_WasInit(SDL_INIT_HAPTIC));
|
||||
#endif
|
||||
|
||||
SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER);
|
||||
SDL_assert(!SDL_WasInit(SDL_INIT_GAMECONTROLLER));
|
||||
|
||||
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
|
||||
SDL_assert(!SDL_WasInit(SDL_INIT_JOYSTICK));
|
||||
|
||||
// Return background event handling to off
|
||||
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "0");
|
||||
|
||||
// Restore the ignored devices
|
||||
SDL_SetHint(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES, m_OldIgnoreDevices.toUtf8());
|
||||
SDL_SetHint(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT, m_OldIgnoreDevicesExcept.toUtf8());
|
||||
|
||||
#ifdef STEAM_LINK
|
||||
// Hide SDL's cursor on Steam Link after quitting the stream.
|
||||
// FIXME: We should also do this for other situations where SDL
|
||||
// and Qt will draw their own mouse cursors like KMSDRM or RPi
|
||||
// video backends.
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SdlInputHandler::setWindow(SDL_Window *window)
|
||||
{
|
||||
m_Window = window;
|
||||
}
|
||||
|
||||
void SdlInputHandler::raiseAllKeys()
|
||||
{
|
||||
if (m_KeysDown.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Raising %d keys",
|
||||
m_KeysDown.count());
|
||||
|
||||
for (auto keyDown : m_KeysDown) {
|
||||
LiSendKeyboardEvent(keyDown, KEY_ACTION_UP, 0);
|
||||
}
|
||||
|
||||
m_KeysDown.clear();
|
||||
}
|
||||
|
||||
void SdlInputHandler::notifyMouseLeave()
|
||||
{
|
||||
#ifdef Q_OS_WIN32
|
||||
// SDL on Windows doesn't send the mouse button up until the mouse re-enters the window
|
||||
// after leaving it. This breaks some of the Aero snap gestures, so we'll fake it here.
|
||||
if (m_AbsoluteMouseMode && isCaptureActive()) {
|
||||
// NB: Not using SDL_GetGlobalMouseState() because we want our state not the system's
|
||||
Uint32 mouseState = SDL_GetMouseState(nullptr, nullptr);
|
||||
for (Uint32 button = SDL_BUTTON_LEFT; button <= SDL_BUTTON_X2; button++) {
|
||||
if (mouseState & SDL_BUTTON(button)) {
|
||||
m_PendingMouseLeaveButtonUp = button;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void SdlInputHandler::notifyFocusLost()
|
||||
{
|
||||
// Release mouse cursor when another window is activated (e.g. by using ALT+TAB).
|
||||
// This lets user to interact with our window's title bar and with the buttons in it.
|
||||
// Doing this while the window is full-screen breaks the transition out of FS
|
||||
// (desktop and exclusive), so we must check for that before releasing mouse capture.
|
||||
if (!(SDL_GetWindowFlags(m_Window) & SDL_WINDOW_FULLSCREEN) && !m_AbsoluteMouseMode) {
|
||||
setCaptureActive(false);
|
||||
}
|
||||
|
||||
// Raise all keys that are currently pressed. If we don't do this, certain keys
|
||||
// used in shortcuts that cause focus loss (such as Alt+Tab) may get stuck down.
|
||||
raiseAllKeys();
|
||||
}
|
||||
|
||||
bool SdlInputHandler::isCaptureActive()
|
||||
{
|
||||
if (SDL_GetRelativeMouseMode()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Some platforms don't support SDL_SetRelativeMouseMode
|
||||
return m_FakeCaptureActive;
|
||||
}
|
||||
|
||||
void SdlInputHandler::setCaptureActive(bool active)
|
||||
{
|
||||
if (active) {
|
||||
// If we're in full-screen exclusive mode, grab the cursor so it can't accidentally leave our window.
|
||||
if ((SDL_GetWindowFlags(m_Window) & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN) {
|
||||
SDL_SetWindowGrab(m_Window, SDL_TRUE);
|
||||
}
|
||||
|
||||
if (!m_AbsoluteMouseMode) {
|
||||
// If our window is occluded when mouse is captured, the mouse may
|
||||
// get stuck on top of the occluding window and not be properly
|
||||
// captured. We can avoid this by raising our window before we
|
||||
// capture the mouse.
|
||||
SDL_RaiseWindow(m_Window);
|
||||
}
|
||||
|
||||
// If we're in relative mode, try to activate SDL's relative mouse mode
|
||||
if (m_AbsoluteMouseMode || SDL_SetRelativeMouseMode(SDL_TRUE) < 0) {
|
||||
// Relative mouse mode didn't work or was disabled, so we'll just hide the cursor
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
m_FakeCaptureActive = true;
|
||||
}
|
||||
|
||||
// Synchronize the client and host cursor when activating absolute capture
|
||||
if (m_AbsoluteMouseMode) {
|
||||
int mouseX, mouseY;
|
||||
int windowX, windowY;
|
||||
|
||||
// We have to use SDL_GetGlobalMouseState() because macOS may not reflect
|
||||
// the new position of the mouse when outside the window.
|
||||
SDL_GetGlobalMouseState(&mouseX, &mouseY);
|
||||
|
||||
// Convert global mouse state to window-relative
|
||||
SDL_GetWindowPosition(m_Window, &windowX, &windowY);
|
||||
mouseX -= windowX;
|
||||
mouseY -= windowY;
|
||||
|
||||
if (isMouseInVideoRegion(mouseX, mouseY)) {
|
||||
updateMousePositionReport(mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (m_FakeCaptureActive) {
|
||||
// Display the cursor again
|
||||
SDL_ShowCursor(SDL_ENABLE);
|
||||
m_FakeCaptureActive = false;
|
||||
}
|
||||
else {
|
||||
SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||
}
|
||||
|
||||
// Allow the cursor to leave the bounds of our window again.
|
||||
SDL_SetWindowGrab(m_Window, SDL_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void SdlInputHandler::handleTouchFingerEvent(SDL_TouchFingerEvent* event)
|
||||
{
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 10)
|
||||
if (SDL_GetTouchDeviceType(event->touchId) != SDL_TOUCH_DEVICE_DIRECT) {
|
||||
// Ignore anything that isn't a touchscreen. We may get callbacks
|
||||
// for trackpads, but we want to handle those in the mouse path.
|
||||
return;
|
||||
}
|
||||
#elif defined(Q_OS_DARWIN)
|
||||
// SDL2 sends touch events from trackpads by default on
|
||||
// macOS. This totally screws our actual mouse handling,
|
||||
// so we must explicitly ignore touch events on macOS
|
||||
// until SDL 2.0.10 where we have SDL_GetTouchDeviceType()
|
||||
// to tell them apart.
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (m_AbsoluteTouchMode) {
|
||||
handleAbsoluteFingerEvent(event);
|
||||
}
|
||||
else {
|
||||
handleRelativeFingerEvent(event);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,9 @@
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
#define SDL_CODE_HIDE_CURSOR 1
|
||||
#define SDL_CODE_SHOW_CURSOR 2
|
||||
|
||||
struct GamepadState {
|
||||
SDL_GameController* controller;
|
||||
SDL_JoystickID jsId;
|
||||
@@ -43,6 +46,8 @@ public:
|
||||
|
||||
~SdlInputHandler();
|
||||
|
||||
void setWindow(SDL_Window* window);
|
||||
|
||||
void handleKeyEvent(SDL_KeyboardEvent* event);
|
||||
|
||||
void handleMouseButtonEvent(SDL_MouseButtonEvent* event);
|
||||
@@ -67,10 +72,20 @@ public:
|
||||
|
||||
void raiseAllKeys();
|
||||
|
||||
void notifyMouseLeave();
|
||||
|
||||
void notifyFocusLost();
|
||||
|
||||
bool isCaptureActive();
|
||||
|
||||
void setCaptureActive(bool active);
|
||||
|
||||
bool isMouseInVideoRegion(int mouseX, int mouseY, int windowWidth = -1, int windowHeight = -1);
|
||||
|
||||
void updateMousePositionReport(int mouseX, int mouseY);
|
||||
|
||||
void flushMousePositionUpdate();
|
||||
|
||||
static
|
||||
QString getUnmappedGamepads();
|
||||
|
||||
@@ -80,6 +95,19 @@ private:
|
||||
|
||||
void sendGamepadState(GamepadState* state);
|
||||
|
||||
void handleAbsoluteFingerEvent(SDL_TouchFingerEvent* event);
|
||||
|
||||
void handleRelativeFingerEvent(SDL_TouchFingerEvent* event);
|
||||
|
||||
static
|
||||
Uint32 longPressTimerCallback(Uint32 interval, void* param);
|
||||
|
||||
static
|
||||
Uint32 mouseMoveTimerCallback(Uint32 interval, void* param);
|
||||
|
||||
static
|
||||
Uint32 mouseEmulationTimerCallback(Uint32 interval, void* param);
|
||||
|
||||
static
|
||||
Uint32 releaseLeftButtonTimerCallback(Uint32 interval, void* param);
|
||||
|
||||
@@ -89,31 +117,45 @@ private:
|
||||
static
|
||||
Uint32 dragTimerCallback(Uint32 interval, void* param);
|
||||
|
||||
static
|
||||
Uint32 mouseMoveTimerCallback(Uint32 interval, void* param);
|
||||
|
||||
static
|
||||
Uint32 mouseEmulationTimerCallback(Uint32 interval, void* param);
|
||||
|
||||
SDL_Window* m_Window;
|
||||
bool m_MultiController;
|
||||
bool m_GamepadMouse;
|
||||
bool m_SwapMouseButtons;
|
||||
SDL_TimerID m_MouseMoveTimer;
|
||||
SDL_atomic_t m_MouseDeltaX;
|
||||
SDL_atomic_t m_MouseDeltaY;
|
||||
|
||||
SDL_SpinLock m_MousePositionLock;
|
||||
struct {
|
||||
int x, y;
|
||||
int windowWidth, windowHeight;
|
||||
} m_MousePositionReport;
|
||||
SDL_atomic_t m_MousePositionUpdated;
|
||||
bool m_MouseWasInVideoRegion;
|
||||
bool m_PendingMouseButtonsAllUpOnVideoRegionLeave;
|
||||
|
||||
int m_GamepadMask;
|
||||
GamepadState m_GamepadState[MAX_GAMEPADS];
|
||||
QSet<short> m_KeysDown;
|
||||
bool m_FakeCaptureActive;
|
||||
QString m_OldIgnoreDevices;
|
||||
QString m_OldIgnoreDevicesExcept;
|
||||
|
||||
SDL_TouchFingerEvent m_LastTouchDownEvent;
|
||||
SDL_TouchFingerEvent m_LastTouchUpEvent;
|
||||
SDL_TimerID m_LongPressTimer;
|
||||
int m_StreamWidth;
|
||||
int m_StreamHeight;
|
||||
bool m_AbsoluteMouseMode;
|
||||
bool m_AbsoluteTouchMode;
|
||||
Uint32 m_PendingMouseLeaveButtonUp;
|
||||
|
||||
SDL_TouchFingerEvent m_TouchDownEvent[MAX_FINGERS];
|
||||
float m_CumulativeDelta[MAX_FINGERS];
|
||||
SDL_TimerID m_LeftButtonReleaseTimer;
|
||||
SDL_TimerID m_RightButtonReleaseTimer;
|
||||
SDL_TimerID m_DragTimer;
|
||||
char m_DragButton;
|
||||
int m_NumFingersDown;
|
||||
int m_StreamWidth;
|
||||
int m_StreamHeight;
|
||||
|
||||
static const int k_ButtonMap[];
|
||||
};
|
||||
@@ -0,0 +1,420 @@
|
||||
#include "streaming/session.h"
|
||||
|
||||
#include <Limelight.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#include <QGuiApplication>
|
||||
|
||||
// Until we can fully capture these on all platforms (without conflicting with
|
||||
// OS-provided shortcuts), we should avoid passing them through to the host.
|
||||
//#define ENABLE_META
|
||||
|
||||
#define VK_0 0x30
|
||||
#define VK_A 0x41
|
||||
|
||||
// These are real Windows VK_* codes
|
||||
#ifndef VK_F1
|
||||
#define VK_F1 0x70
|
||||
#define VK_F13 0x7C
|
||||
#define VK_NUMPAD0 0x60
|
||||
#endif
|
||||
|
||||
void SdlInputHandler::handleKeyEvent(SDL_KeyboardEvent* event)
|
||||
{
|
||||
short keyCode;
|
||||
char modifiers;
|
||||
|
||||
// Check for our special key combos
|
||||
if ((event->state == SDL_PRESSED) &&
|
||||
(event->keysym.mod & KMOD_CTRL) &&
|
||||
(event->keysym.mod & KMOD_ALT) &&
|
||||
(event->keysym.mod & KMOD_SHIFT)) {
|
||||
// First we test the SDLK combos for matches,
|
||||
// that way we ensure that latin keyboard users
|
||||
// can match to the key they see on their keyboards.
|
||||
// If nothing matches that, we'll then go on to
|
||||
// checking scancodes so non-latin keyboard users
|
||||
// can have working hotkeys (though possibly in
|
||||
// odd positions). We must do all SDLK tests before
|
||||
// any scancode tests to avoid issues in cases
|
||||
// where the SDLK for one shortcut collides with
|
||||
// the scancode of another.
|
||||
|
||||
// Check for quit combo (Ctrl+Alt+Shift+Q)
|
||||
if (event->keysym.sym == SDLK_q) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Detected quit key combo (SDLK)");
|
||||
|
||||
// Push a quit event to the main loop
|
||||
SDL_Event event;
|
||||
event.type = SDL_QUIT;
|
||||
event.quit.timestamp = SDL_GetTicks();
|
||||
SDL_PushEvent(&event);
|
||||
return;
|
||||
}
|
||||
// Check for the unbind combo (Ctrl+Alt+Shift+Z) unless on EGLFS which has no window manager
|
||||
else if (event->keysym.sym == SDLK_z && QGuiApplication::platformName() != "eglfs") {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Detected mouse capture toggle combo (SDLK)");
|
||||
|
||||
// Stop handling future input
|
||||
setCaptureActive(!isCaptureActive());
|
||||
|
||||
// Force raise all keys to ensure they aren't stuck,
|
||||
// since we won't get their key up events.
|
||||
raiseAllKeys();
|
||||
return;
|
||||
}
|
||||
// Check for the mouse mode combo (Ctrl+Alt+Shift+M) unless on EGLFS which has no window manager
|
||||
else if (event->keysym.sym == SDLK_m && QGuiApplication::platformName() != "eglfs") {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Detected mouse mode toggle combo (SDLK)");
|
||||
|
||||
// Uncapture input
|
||||
setCaptureActive(false);
|
||||
|
||||
// Toggle mouse mode
|
||||
m_AbsoluteMouseMode = !m_AbsoluteMouseMode;
|
||||
|
||||
// Recapture input
|
||||
setCaptureActive(true);
|
||||
return;
|
||||
}
|
||||
else if (event->keysym.sym == SDLK_x && QGuiApplication::platformName() != "eglfs") {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Detected full-screen toggle combo (SDLK)");
|
||||
Session::s_ActiveSession->toggleFullscreen();
|
||||
|
||||
// Force raise all keys just be safe across this full-screen/windowed
|
||||
// transition just in case key events get lost.
|
||||
raiseAllKeys();
|
||||
return;
|
||||
}
|
||||
// Check for overlay combo (Ctrl+Alt+Shift+S)
|
||||
else if (event->keysym.sym == SDLK_s) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Detected stats toggle combo (SDLK)");
|
||||
|
||||
// Toggle the stats overlay
|
||||
Session::get()->getOverlayManager().setOverlayState(Overlay::OverlayDebug,
|
||||
!Session::get()->getOverlayManager().isOverlayEnabled(Overlay::OverlayDebug));
|
||||
|
||||
// Force raise all keys just be safe across this full-screen/windowed
|
||||
// transition just in case key events get lost.
|
||||
raiseAllKeys();
|
||||
return;
|
||||
}
|
||||
// Check for quit combo (Ctrl+Alt+Shift+Q)
|
||||
else if (event->keysym.scancode == SDL_SCANCODE_Q) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Detected quit key combo (scancode)");
|
||||
|
||||
// Push a quit event to the main loop
|
||||
SDL_Event event;
|
||||
event.type = SDL_QUIT;
|
||||
event.quit.timestamp = SDL_GetTicks();
|
||||
SDL_PushEvent(&event);
|
||||
return;
|
||||
}
|
||||
// Check for the unbind combo (Ctrl+Alt+Shift+Z)
|
||||
else if (event->keysym.scancode == SDL_SCANCODE_Z && QGuiApplication::platformName() != "eglfs") {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Detected mouse capture toggle combo (scancode)");
|
||||
|
||||
// Stop handling future input
|
||||
setCaptureActive(!isCaptureActive());
|
||||
|
||||
// Force raise all keys to ensure they aren't stuck,
|
||||
// since we won't get their key up events.
|
||||
raiseAllKeys();
|
||||
return;
|
||||
}
|
||||
// Check for the full-screen combo (Ctrl+Alt+Shift+X) unless on EGLFS which has no window manager
|
||||
else if (event->keysym.scancode == SDL_SCANCODE_X && QGuiApplication::platformName() != "eglfs") {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Detected full-screen toggle combo (scancode)");
|
||||
Session::s_ActiveSession->toggleFullscreen();
|
||||
|
||||
// Force raise all keys just be safe across this full-screen/windowed
|
||||
// transition just in case key events get lost.
|
||||
raiseAllKeys();
|
||||
return;
|
||||
}
|
||||
// Check for the mouse mode toggle combo (Ctrl+Alt+Shift+M) unless on EGLFS which has no window manager
|
||||
else if (event->keysym.scancode == SDL_SCANCODE_M && QGuiApplication::platformName() != "eglfs") {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Detected mouse mode toggle combo (scancode)");
|
||||
|
||||
// Uncapture input
|
||||
setCaptureActive(false);
|
||||
|
||||
// Toggle mouse mode
|
||||
m_AbsoluteMouseMode = !m_AbsoluteMouseMode;
|
||||
|
||||
// Recapture input
|
||||
setCaptureActive(true);
|
||||
return;
|
||||
}
|
||||
else if (event->keysym.scancode == SDL_SCANCODE_S) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Detected stats toggle combo (scancode)");
|
||||
|
||||
// Toggle the stats overlay
|
||||
Session::get()->getOverlayManager().setOverlayState(Overlay::OverlayDebug,
|
||||
!Session::get()->getOverlayManager().isOverlayEnabled(Overlay::OverlayDebug));
|
||||
|
||||
// Force raise all keys just be safe across this full-screen/windowed
|
||||
// transition just in case key events get lost.
|
||||
raiseAllKeys();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (event->repeat) {
|
||||
// Ignore repeat key down events
|
||||
SDL_assert(event->state == SDL_PRESSED);
|
||||
return;
|
||||
}
|
||||
|
||||
// Set modifier flags
|
||||
modifiers = 0;
|
||||
if (event->keysym.mod & KMOD_CTRL) {
|
||||
modifiers |= MODIFIER_CTRL;
|
||||
}
|
||||
if (event->keysym.mod & KMOD_ALT) {
|
||||
modifiers |= MODIFIER_ALT;
|
||||
}
|
||||
if (event->keysym.mod & KMOD_SHIFT) {
|
||||
modifiers |= MODIFIER_SHIFT;
|
||||
}
|
||||
#ifdef ENABLE_META
|
||||
if (event->keysym.mod & KMOD_GUI) {
|
||||
modifiers |= MODIFIER_META;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Set keycode. We explicitly use scancode here because GFE will try to correct
|
||||
// for AZERTY layouts on the host but it depends on receiving VK_ values matching
|
||||
// a QWERTY layout to work.
|
||||
if (event->keysym.scancode >= SDL_SCANCODE_1 && event->keysym.scancode <= SDL_SCANCODE_9) {
|
||||
// SDL defines SDL_SCANCODE_0 > SDL_SCANCODE_9, so we need to handle that manually
|
||||
keyCode = (event->keysym.scancode - SDL_SCANCODE_1) + VK_0 + 1;
|
||||
}
|
||||
else if (event->keysym.scancode >= SDL_SCANCODE_A && event->keysym.scancode <= SDL_SCANCODE_Z) {
|
||||
keyCode = (event->keysym.scancode - SDL_SCANCODE_A) + VK_A;
|
||||
}
|
||||
else if (event->keysym.scancode >= SDL_SCANCODE_F1 && event->keysym.scancode <= SDL_SCANCODE_F12) {
|
||||
keyCode = (event->keysym.scancode - SDL_SCANCODE_F1) + VK_F1;
|
||||
}
|
||||
else if (event->keysym.scancode >= SDL_SCANCODE_F13 && event->keysym.scancode <= SDL_SCANCODE_F24) {
|
||||
keyCode = (event->keysym.scancode - SDL_SCANCODE_F13) + VK_F13;
|
||||
}
|
||||
else if (event->keysym.scancode >= SDL_SCANCODE_KP_1 && event->keysym.scancode <= SDL_SCANCODE_KP_9) {
|
||||
// SDL defines SDL_SCANCODE_KP_0 > SDL_SCANCODE_KP_9, so we need to handle that manually
|
||||
keyCode = (event->keysym.scancode - SDL_SCANCODE_KP_1) + VK_NUMPAD0 + 1;
|
||||
}
|
||||
else {
|
||||
switch (event->keysym.scancode) {
|
||||
case SDL_SCANCODE_BACKSPACE:
|
||||
keyCode = 0x08;
|
||||
break;
|
||||
case SDL_SCANCODE_TAB:
|
||||
keyCode = 0x09;
|
||||
break;
|
||||
case SDL_SCANCODE_CLEAR:
|
||||
keyCode = 0x0C;
|
||||
break;
|
||||
case SDL_SCANCODE_KP_ENTER: // FIXME: Is this correct?
|
||||
case SDL_SCANCODE_RETURN:
|
||||
keyCode = 0x0D;
|
||||
break;
|
||||
case SDL_SCANCODE_PAUSE:
|
||||
keyCode = 0x13;
|
||||
break;
|
||||
case SDL_SCANCODE_CAPSLOCK:
|
||||
keyCode = 0x14;
|
||||
break;
|
||||
case SDL_SCANCODE_ESCAPE:
|
||||
keyCode = 0x1B;
|
||||
break;
|
||||
case SDL_SCANCODE_SPACE:
|
||||
keyCode = 0x20;
|
||||
break;
|
||||
case SDL_SCANCODE_PAGEUP:
|
||||
keyCode = 0x21;
|
||||
break;
|
||||
case SDL_SCANCODE_PAGEDOWN:
|
||||
keyCode = 0x22;
|
||||
break;
|
||||
case SDL_SCANCODE_END:
|
||||
keyCode = 0x23;
|
||||
break;
|
||||
case SDL_SCANCODE_HOME:
|
||||
keyCode = 0x24;
|
||||
break;
|
||||
case SDL_SCANCODE_LEFT:
|
||||
keyCode = 0x25;
|
||||
break;
|
||||
case SDL_SCANCODE_UP:
|
||||
keyCode = 0x26;
|
||||
break;
|
||||
case SDL_SCANCODE_RIGHT:
|
||||
keyCode = 0x27;
|
||||
break;
|
||||
case SDL_SCANCODE_DOWN:
|
||||
keyCode = 0x28;
|
||||
break;
|
||||
case SDL_SCANCODE_SELECT:
|
||||
keyCode = 0x29;
|
||||
break;
|
||||
case SDL_SCANCODE_EXECUTE:
|
||||
keyCode = 0x2B;
|
||||
break;
|
||||
case SDL_SCANCODE_PRINTSCREEN:
|
||||
keyCode = 0x2C;
|
||||
break;
|
||||
case SDL_SCANCODE_INSERT:
|
||||
keyCode = 0x2D;
|
||||
break;
|
||||
case SDL_SCANCODE_DELETE:
|
||||
keyCode = 0x2E;
|
||||
break;
|
||||
case SDL_SCANCODE_HELP:
|
||||
keyCode = 0x2F;
|
||||
break;
|
||||
case SDL_SCANCODE_KP_0:
|
||||
// See comment above about why we only handle SDL_SCANCODE_KP_0 here
|
||||
keyCode = VK_NUMPAD0;
|
||||
break;
|
||||
case SDL_SCANCODE_0:
|
||||
// See comment above about why we only handle SDL_SCANCODE_0 here
|
||||
keyCode = VK_0;
|
||||
break;
|
||||
case SDL_SCANCODE_KP_MULTIPLY:
|
||||
keyCode = 0x6A;
|
||||
break;
|
||||
case SDL_SCANCODE_KP_PLUS:
|
||||
keyCode = 0x6B;
|
||||
break;
|
||||
case SDL_SCANCODE_KP_COMMA:
|
||||
keyCode = 0x6C;
|
||||
break;
|
||||
case SDL_SCANCODE_KP_MINUS:
|
||||
keyCode = 0x6D;
|
||||
break;
|
||||
case SDL_SCANCODE_KP_PERIOD:
|
||||
keyCode = 0x6E;
|
||||
break;
|
||||
case SDL_SCANCODE_KP_DIVIDE:
|
||||
keyCode = 0x6F;
|
||||
break;
|
||||
case SDL_SCANCODE_NUMLOCKCLEAR:
|
||||
keyCode = 0x90;
|
||||
break;
|
||||
case SDL_SCANCODE_SCROLLLOCK:
|
||||
keyCode = 0x91;
|
||||
break;
|
||||
case SDL_SCANCODE_LSHIFT:
|
||||
keyCode = 0xA0;
|
||||
break;
|
||||
case SDL_SCANCODE_RSHIFT:
|
||||
keyCode = 0xA1;
|
||||
break;
|
||||
case SDL_SCANCODE_LCTRL:
|
||||
keyCode = 0xA2;
|
||||
break;
|
||||
case SDL_SCANCODE_RCTRL:
|
||||
keyCode = 0xA3;
|
||||
break;
|
||||
case SDL_SCANCODE_LALT:
|
||||
keyCode = 0xA4;
|
||||
break;
|
||||
case SDL_SCANCODE_RALT:
|
||||
keyCode = 0xA5;
|
||||
break;
|
||||
#ifdef ENABLE_META
|
||||
case SDL_SCANCODE_LGUI:
|
||||
keyCode = 0x5B;
|
||||
break;
|
||||
case SDL_SCANCODE_RGUI:
|
||||
keyCode = 0x5C;
|
||||
break;
|
||||
#endif
|
||||
case SDL_SCANCODE_AC_BACK:
|
||||
keyCode = 0xA6;
|
||||
break;
|
||||
case SDL_SCANCODE_AC_FORWARD:
|
||||
keyCode = 0xA7;
|
||||
break;
|
||||
case SDL_SCANCODE_AC_REFRESH:
|
||||
keyCode = 0xA8;
|
||||
break;
|
||||
case SDL_SCANCODE_AC_STOP:
|
||||
keyCode = 0xA9;
|
||||
break;
|
||||
case SDL_SCANCODE_AC_SEARCH:
|
||||
keyCode = 0xAA;
|
||||
break;
|
||||
case SDL_SCANCODE_AC_BOOKMARKS:
|
||||
keyCode = 0xAB;
|
||||
break;
|
||||
case SDL_SCANCODE_AC_HOME:
|
||||
keyCode = 0xAC;
|
||||
break;
|
||||
case SDL_SCANCODE_SEMICOLON:
|
||||
keyCode = 0xBA;
|
||||
break;
|
||||
case SDL_SCANCODE_EQUALS:
|
||||
keyCode = 0xBB;
|
||||
break;
|
||||
case SDL_SCANCODE_COMMA:
|
||||
keyCode = 0xBC;
|
||||
break;
|
||||
case SDL_SCANCODE_MINUS:
|
||||
keyCode = 0xBD;
|
||||
break;
|
||||
case SDL_SCANCODE_PERIOD:
|
||||
keyCode = 0xBE;
|
||||
break;
|
||||
case SDL_SCANCODE_SLASH:
|
||||
keyCode = 0xBF;
|
||||
break;
|
||||
case SDL_SCANCODE_GRAVE:
|
||||
keyCode = 0xC0;
|
||||
break;
|
||||
case SDL_SCANCODE_LEFTBRACKET:
|
||||
keyCode = 0xDB;
|
||||
break;
|
||||
case SDL_SCANCODE_BACKSLASH:
|
||||
keyCode = 0xDC;
|
||||
break;
|
||||
case SDL_SCANCODE_RIGHTBRACKET:
|
||||
keyCode = 0xDD;
|
||||
break;
|
||||
case SDL_SCANCODE_APOSTROPHE:
|
||||
keyCode = 0xDE;
|
||||
break;
|
||||
case SDL_SCANCODE_NONUSBACKSLASH:
|
||||
keyCode = 0xE2;
|
||||
break;
|
||||
default:
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Unhandled button event: %d",
|
||||
event->keysym.scancode);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Track the key state so we always know which keys are down
|
||||
if (event->state == SDL_PRESSED) {
|
||||
m_KeysDown.insert(keyCode);
|
||||
}
|
||||
else {
|
||||
m_KeysDown.remove(keyCode);
|
||||
}
|
||||
|
||||
LiSendKeyboardEvent(keyCode,
|
||||
event->state == SDL_PRESSED ?
|
||||
KEY_ACTION_DOWN : KEY_ACTION_UP,
|
||||
modifiers);
|
||||
}
|
||||
@@ -0,0 +1,277 @@
|
||||
#include "input.h"
|
||||
|
||||
#include <Limelight.h>
|
||||
#include <SDL.h>
|
||||
#include "streaming/streamutils.h"
|
||||
|
||||
void SdlInputHandler::handleMouseButtonEvent(SDL_MouseButtonEvent* event)
|
||||
{
|
||||
int button;
|
||||
|
||||
if (event->which == SDL_TOUCH_MOUSEID) {
|
||||
// Ignore synthetic mouse events
|
||||
return;
|
||||
}
|
||||
else if (!isCaptureActive()) {
|
||||
if (event->button == SDL_BUTTON_LEFT && event->state == SDL_RELEASED &&
|
||||
isMouseInVideoRegion(event->x, event->y)) {
|
||||
// Capture the mouse again if clicked when unbound.
|
||||
// We start capture on left button released instead of
|
||||
// pressed to avoid sending an errant mouse button released
|
||||
// event to the host when clicking into our window (since
|
||||
// the pressed event was consumed by this code).
|
||||
setCaptureActive(true);
|
||||
}
|
||||
|
||||
// Not capturing
|
||||
return;
|
||||
}
|
||||
else if (m_AbsoluteMouseMode && !isMouseInVideoRegion(event->x, event->y) && event->state == SDL_PRESSED) {
|
||||
// Ignore button presses outside the video region, but allow button releases
|
||||
return;
|
||||
}
|
||||
|
||||
switch (event->button)
|
||||
{
|
||||
case SDL_BUTTON_LEFT:
|
||||
button = BUTTON_LEFT;
|
||||
break;
|
||||
case SDL_BUTTON_MIDDLE:
|
||||
button = BUTTON_MIDDLE;
|
||||
break;
|
||||
case SDL_BUTTON_RIGHT:
|
||||
button = BUTTON_RIGHT;
|
||||
break;
|
||||
case SDL_BUTTON_X1:
|
||||
button = BUTTON_X1;
|
||||
break;
|
||||
case SDL_BUTTON_X2:
|
||||
button = BUTTON_X2;
|
||||
break;
|
||||
default:
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Unhandled button event: %d",
|
||||
event->button);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_SwapMouseButtons) {
|
||||
if (button == BUTTON_RIGHT)
|
||||
button = BUTTON_LEFT;
|
||||
else if (button == BUTTON_LEFT)
|
||||
button = BUTTON_RIGHT;
|
||||
}
|
||||
|
||||
// Ensure any pending mouse position update has been sent before we send
|
||||
// our button event. This ensures that the cursor is in the correct location
|
||||
// when the button event is issued.
|
||||
//
|
||||
// On platforms like macOS, the mouse doesn't track when the window isn't
|
||||
// focused. When we gain focus via mouse click, we immediately get a mouse
|
||||
// move event and a mouse button event. If we don't flush here, the button
|
||||
// will probably arrive before the mouse timer issues the position update.
|
||||
flushMousePositionUpdate();
|
||||
|
||||
LiSendMouseButtonEvent(event->state == SDL_PRESSED ?
|
||||
BUTTON_ACTION_PRESS :
|
||||
BUTTON_ACTION_RELEASE,
|
||||
button);
|
||||
}
|
||||
|
||||
void SdlInputHandler::updateMousePositionReport(int mouseX, int mouseY)
|
||||
{
|
||||
int windowWidth, windowHeight;
|
||||
|
||||
// Call SDL_GetWindowSize() before entering the spinlock
|
||||
SDL_GetWindowSize(m_Window, &windowWidth, &windowHeight);
|
||||
|
||||
SDL_AtomicLock(&m_MousePositionLock);
|
||||
m_MousePositionReport.x = mouseX;
|
||||
m_MousePositionReport.y = mouseY;
|
||||
m_MousePositionReport.windowWidth = windowWidth;
|
||||
m_MousePositionReport.windowHeight = windowHeight;
|
||||
SDL_AtomicUnlock(&m_MousePositionLock);
|
||||
SDL_AtomicSet(&m_MousePositionUpdated, 1);
|
||||
}
|
||||
|
||||
void SdlInputHandler::flushMousePositionUpdate()
|
||||
{
|
||||
bool hasNewPosition = SDL_AtomicSet(&m_MousePositionUpdated, 0) != 0;
|
||||
if (hasNewPosition) {
|
||||
// If the lock is held now, the main thread is trying to update
|
||||
// the mouse position. We'll pick up the new position next time.
|
||||
if (SDL_AtomicTryLock(&m_MousePositionLock)) {
|
||||
SDL_Rect src, dst;
|
||||
bool mouseInVideoRegion;
|
||||
|
||||
src.x = src.y = 0;
|
||||
src.w = m_StreamWidth;
|
||||
src.h = m_StreamHeight;
|
||||
|
||||
dst.x = dst.y = 0;
|
||||
dst.w = m_MousePositionReport.windowWidth;
|
||||
dst.h = m_MousePositionReport.windowHeight;
|
||||
|
||||
// Use the stream and window sizes to determine the video region
|
||||
StreamUtils::scaleSourceToDestinationSurface(&src, &dst);
|
||||
|
||||
mouseInVideoRegion = isMouseInVideoRegion(m_MousePositionReport.x,
|
||||
m_MousePositionReport.y,
|
||||
m_MousePositionReport.windowWidth,
|
||||
m_MousePositionReport.windowHeight);
|
||||
|
||||
// Clamp motion to the video region
|
||||
short x = qMin(qMax(m_MousePositionReport.x - dst.x, 0), dst.w);
|
||||
short y = qMin(qMax(m_MousePositionReport.y - dst.y, 0), dst.h);
|
||||
|
||||
// Release the spinlock to unblock the main thread
|
||||
SDL_AtomicUnlock(&m_MousePositionLock);
|
||||
|
||||
// Send the mouse position update if one of the following is true:
|
||||
// a) it is in the video region now
|
||||
// b) it just left the video region (to ensure the mouse is clamped to the video boundary)
|
||||
// c) a mouse button is still down from before the cursor left the video region (to allow smooth dragging)
|
||||
Uint32 buttonState = SDL_GetMouseState(nullptr, nullptr);
|
||||
if (buttonState == 0) {
|
||||
m_PendingMouseButtonsAllUpOnVideoRegionLeave = false;
|
||||
}
|
||||
if (mouseInVideoRegion || m_MouseWasInVideoRegion || m_PendingMouseButtonsAllUpOnVideoRegionLeave) {
|
||||
LiSendMousePositionEvent(x, y, dst.w, dst.h);
|
||||
}
|
||||
|
||||
// Adjust the cursor visibility if applicable
|
||||
if (mouseInVideoRegion ^ m_MouseWasInVideoRegion) {
|
||||
// We must push an event for the main thread to process, because it's not safe
|
||||
// to directly can SDL_ShowCursor() on the arbitrary thread on which this timer
|
||||
// executes.
|
||||
SDL_Event event;
|
||||
event.type = SDL_USEREVENT;
|
||||
event.user.code = mouseInVideoRegion ? SDL_CODE_HIDE_CURSOR : SDL_CODE_SHOW_CURSOR;
|
||||
SDL_PushEvent(&event);
|
||||
|
||||
if (!mouseInVideoRegion && buttonState != 0) {
|
||||
// If we still have a button pressed on leave, wait for that to come up
|
||||
// before we stop sending mouse position events.
|
||||
m_PendingMouseButtonsAllUpOnVideoRegionLeave = true;
|
||||
}
|
||||
}
|
||||
|
||||
m_MouseWasInVideoRegion = mouseInVideoRegion;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SdlInputHandler::handleMouseMotionEvent(SDL_MouseMotionEvent* event)
|
||||
{
|
||||
if (!isCaptureActive()) {
|
||||
// Not capturing
|
||||
return;
|
||||
}
|
||||
else if (event->which == SDL_TOUCH_MOUSEID) {
|
||||
// Ignore synthetic mouse events
|
||||
return;
|
||||
}
|
||||
|
||||
// Batch until the next mouse polling window or we'll get awful
|
||||
// input lag everything except GFE 3.14 and 3.15.
|
||||
if (m_AbsoluteMouseMode) {
|
||||
updateMousePositionReport(event->x, event->y);
|
||||
}
|
||||
else {
|
||||
SDL_AtomicAdd(&m_MouseDeltaX, event->xrel);
|
||||
SDL_AtomicAdd(&m_MouseDeltaY, event->yrel);
|
||||
}
|
||||
}
|
||||
|
||||
void SdlInputHandler::handleMouseWheelEvent(SDL_MouseWheelEvent* event)
|
||||
{
|
||||
if (!isCaptureActive()) {
|
||||
// Not capturing
|
||||
return;
|
||||
}
|
||||
else if (event->which == SDL_TOUCH_MOUSEID) {
|
||||
// Ignore synthetic mouse events
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_AbsoluteMouseMode) {
|
||||
int mouseX, mouseY;
|
||||
SDL_GetMouseState(&mouseX, &mouseY);
|
||||
if (!isMouseInVideoRegion(mouseX, mouseY)) {
|
||||
// Ignore scroll events outside the video region
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (event->y != 0) {
|
||||
LiSendScrollEvent((signed char)event->y);
|
||||
}
|
||||
}
|
||||
|
||||
bool SdlInputHandler::isMouseInVideoRegion(int mouseX, int mouseY, int windowWidth, int windowHeight)
|
||||
{
|
||||
SDL_Rect src, dst;
|
||||
|
||||
if (windowWidth < 0 || windowHeight < 0) {
|
||||
SDL_GetWindowSize(m_Window, &windowWidth, &windowHeight);
|
||||
}
|
||||
|
||||
src.x = src.y = 0;
|
||||
src.w = m_StreamWidth;
|
||||
src.h = m_StreamHeight;
|
||||
|
||||
dst.x = dst.y = 0;
|
||||
dst.w = windowWidth;
|
||||
dst.h = windowHeight;
|
||||
|
||||
// Use the stream and window sizes to determine the video region
|
||||
StreamUtils::scaleSourceToDestinationSurface(&src, &dst);
|
||||
|
||||
return (mouseX >= dst.x && mouseX <= dst.x + dst.w) &&
|
||||
(mouseY >= dst.y && mouseY <= dst.y + dst.h);
|
||||
}
|
||||
|
||||
Uint32 SdlInputHandler::mouseMoveTimerCallback(Uint32 interval, void *param)
|
||||
{
|
||||
auto me = reinterpret_cast<SdlInputHandler*>(param);
|
||||
|
||||
short deltaX = (short)SDL_AtomicSet(&me->m_MouseDeltaX, 0);
|
||||
short deltaY = (short)SDL_AtomicSet(&me->m_MouseDeltaY, 0);
|
||||
|
||||
if (deltaX != 0 || deltaY != 0) {
|
||||
LiSendMouseMoveEvent(deltaX, deltaY);
|
||||
}
|
||||
|
||||
// Send mouse position updates if applicable
|
||||
me->flushMousePositionUpdate();
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
// See comment in SdlInputHandler::notifyMouseLeave()
|
||||
if (me->m_AbsoluteMouseMode && me->m_PendingMouseLeaveButtonUp != 0 && me->isCaptureActive()) {
|
||||
int mouseX, mouseY;
|
||||
int windowX, windowY;
|
||||
Uint32 mouseState = SDL_GetGlobalMouseState(&mouseX, &mouseY);
|
||||
SDL_GetWindowPosition(me->m_Window, &windowX, &windowY);
|
||||
|
||||
// If the button is now up, send the synthetic mouse up event
|
||||
if ((mouseState & SDL_BUTTON(me->m_PendingMouseLeaveButtonUp)) == 0) {
|
||||
SDL_Event event;
|
||||
|
||||
event.button.type = SDL_MOUSEBUTTONUP;
|
||||
event.button.timestamp = SDL_GetTicks();
|
||||
event.button.windowID = SDL_GetWindowID(me->m_Window);
|
||||
event.button.which = 0;
|
||||
event.button.button = me->m_PendingMouseLeaveButtonUp;
|
||||
event.button.state = SDL_RELEASED;
|
||||
event.button.clicks = 1;
|
||||
event.button.x = mouseX - windowX;
|
||||
event.button.y = mouseY - windowY;
|
||||
SDL_PushEvent(&event);
|
||||
|
||||
me->m_PendingMouseLeaveButtonUp = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return interval;
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
#include "input.h"
|
||||
|
||||
#include <Limelight.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#include <QtMath>
|
||||
|
||||
// How long the mouse button will be pressed for a tap to click gesture
|
||||
#define TAP_BUTTON_RELEASE_DELAY 100
|
||||
|
||||
// How long the fingers must be stationary to start a drag
|
||||
#define DRAG_ACTIVATION_DELAY 650
|
||||
|
||||
// How far the finger can move before it cancels a drag or tap
|
||||
#define DEAD_ZONE_DELTA 0.01f
|
||||
|
||||
Uint32 SdlInputHandler::releaseLeftButtonTimerCallback(Uint32, void*)
|
||||
{
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Uint32 SdlInputHandler::releaseRightButtonTimerCallback(Uint32, void*)
|
||||
{
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_RIGHT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Uint32 SdlInputHandler::dragTimerCallback(Uint32, void *param)
|
||||
{
|
||||
auto me = reinterpret_cast<SdlInputHandler*>(param);
|
||||
|
||||
// Check how many fingers are down now to decide
|
||||
// which button to hold down
|
||||
if (me->m_NumFingersDown == 2) {
|
||||
me->m_DragButton = BUTTON_RIGHT;
|
||||
}
|
||||
else if (me->m_NumFingersDown == 1) {
|
||||
me->m_DragButton = BUTTON_LEFT;
|
||||
}
|
||||
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, me->m_DragButton);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SdlInputHandler::handleRelativeFingerEvent(SDL_TouchFingerEvent* event)
|
||||
{
|
||||
int fingerIndex = -1;
|
||||
|
||||
// Observations on Windows 10: x and y appear to be relative to 0,0 of the window client area.
|
||||
// Although SDL documentation states they are 0.0 - 1.0 float values, they can actually be higher
|
||||
// or lower than those values as touch events continue for touches started within the client area that
|
||||
// leave the client area during a drag motion.
|
||||
// dx and dy are deltas from the last touch event, not the first touch down.
|
||||
|
||||
// Determine the index of this finger using our list
|
||||
// of fingers that are currently active on screen.
|
||||
// This is also required to handle finger up which
|
||||
// where the finger will not be in SDL_GetTouchFinger()
|
||||
// anymore.
|
||||
if (event->type != SDL_FINGERDOWN) {
|
||||
for (int i = 0; i < MAX_FINGERS; i++) {
|
||||
if (event->fingerId == m_TouchDownEvent[i].fingerId) {
|
||||
fingerIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Resolve the new finger by determining the ID of each
|
||||
// finger on the display.
|
||||
int numTouchFingers = SDL_GetNumTouchFingers(event->touchId);
|
||||
for (int i = 0; i < numTouchFingers; i++) {
|
||||
SDL_Finger* finger = SDL_GetTouchFinger(event->touchId, i);
|
||||
SDL_assert(finger != nullptr);
|
||||
if (finger != nullptr) {
|
||||
if (finger->id == event->fingerId) {
|
||||
fingerIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fingerIndex < 0 || fingerIndex >= MAX_FINGERS) {
|
||||
// Too many fingers
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle cursor motion based on the position of the
|
||||
// primary finger on screen
|
||||
if (fingerIndex == 0) {
|
||||
// The event x and y values are relative to our window width
|
||||
// and height. However, we want to scale them to be relative
|
||||
// to the host resolution. Fortunately this is easy since we
|
||||
// already have normalized values. We'll just multiply them
|
||||
// by the stream dimensions to get real X and Y values rather
|
||||
// than the client window dimensions.
|
||||
short deltaX = static_cast<short>(event->dx * m_StreamWidth);
|
||||
short deltaY = static_cast<short>(event->dy * m_StreamHeight);
|
||||
if (deltaX != 0 || deltaY != 0) {
|
||||
LiSendMouseMoveEvent(deltaX, deltaY);
|
||||
}
|
||||
}
|
||||
|
||||
// Start a drag timer when primary or secondary
|
||||
// fingers go down
|
||||
if (event->type == SDL_FINGERDOWN &&
|
||||
(fingerIndex == 0 || fingerIndex == 1)) {
|
||||
SDL_RemoveTimer(m_DragTimer);
|
||||
m_DragTimer = SDL_AddTimer(DRAG_ACTIVATION_DELAY,
|
||||
dragTimerCallback,
|
||||
this);
|
||||
}
|
||||
|
||||
if (event->type == SDL_FINGERMOTION) {
|
||||
// If it's outside the deadzone delta, cancel drags and taps
|
||||
if (qSqrt(qPow(event->x - m_TouchDownEvent[fingerIndex].x, 2) +
|
||||
qPow(event->y - m_TouchDownEvent[fingerIndex].y, 2)) > DEAD_ZONE_DELTA) {
|
||||
SDL_RemoveTimer(m_DragTimer);
|
||||
m_DragTimer = 0;
|
||||
|
||||
// This effectively cancels the tap logic below
|
||||
m_TouchDownEvent[fingerIndex].timestamp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (event->type == SDL_FINGERUP) {
|
||||
// Cancel the drag timer on finger up
|
||||
SDL_RemoveTimer(m_DragTimer);
|
||||
m_DragTimer = 0;
|
||||
|
||||
// Release any drag
|
||||
if (m_DragButton != 0) {
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, m_DragButton);
|
||||
m_DragButton = 0;
|
||||
}
|
||||
// 2 finger tap
|
||||
else if (event->timestamp - m_TouchDownEvent[1].timestamp < 250) {
|
||||
// Zero timestamp of the primary finger to ensure we won't
|
||||
// generate a left click if the primary finger comes up soon.
|
||||
m_TouchDownEvent[0].timestamp = 0;
|
||||
|
||||
// Press down the right mouse button
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_RIGHT);
|
||||
|
||||
// Queue a timer to release it in 100 ms
|
||||
SDL_RemoveTimer(m_RightButtonReleaseTimer);
|
||||
m_RightButtonReleaseTimer = SDL_AddTimer(TAP_BUTTON_RELEASE_DELAY,
|
||||
releaseRightButtonTimerCallback,
|
||||
nullptr);
|
||||
}
|
||||
// 1 finger tap
|
||||
else if (event->timestamp - m_TouchDownEvent[0].timestamp < 250) {
|
||||
// Press down the left mouse button
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_LEFT);
|
||||
|
||||
// Queue a timer to release it in 100 ms
|
||||
SDL_RemoveTimer(m_LeftButtonReleaseTimer);
|
||||
m_LeftButtonReleaseTimer = SDL_AddTimer(TAP_BUTTON_RELEASE_DELAY,
|
||||
releaseLeftButtonTimerCallback,
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
m_NumFingersDown = SDL_GetNumTouchFingers(event->touchId);
|
||||
|
||||
if (event->type == SDL_FINGERDOWN) {
|
||||
m_TouchDownEvent[fingerIndex] = *event;
|
||||
}
|
||||
else if (event->type == SDL_FINGERUP) {
|
||||
m_TouchDownEvent[fingerIndex] = {};
|
||||
}
|
||||
}
|
||||
+323
-147
@@ -30,6 +30,18 @@
|
||||
#include <QSvgRenderer>
|
||||
#include <QPainter>
|
||||
#include <QImage>
|
||||
#include <QGuiApplication>
|
||||
#include <QCursor>
|
||||
|
||||
#define CONN_TEST_SERVER "qt.conntest.moonlight-stream.org"
|
||||
|
||||
// Running the connection process asynchronously seems to reliably
|
||||
// cause a crash in QSGRenderThread on Wayland and strange crashes
|
||||
// elsewhere. Until these are figured out, avoid the async connect
|
||||
// thread on Linux and BSDs.
|
||||
#if !defined(Q_OS_UNIX) || defined(Q_OS_DARWIN)
|
||||
#define USE_ASYNC_CONNECT_THREAD 1
|
||||
#endif
|
||||
|
||||
CONNECTION_LISTENER_CALLBACKS Session::k_ConnCallbacks = {
|
||||
Session::clStageStarting,
|
||||
@@ -37,8 +49,6 @@ CONNECTION_LISTENER_CALLBACKS Session::k_ConnCallbacks = {
|
||||
Session::clStageFailed,
|
||||
nullptr,
|
||||
Session::clConnectionTerminated,
|
||||
nullptr,
|
||||
nullptr,
|
||||
Session::clLogMessage,
|
||||
Session::clRumble,
|
||||
Session::clConnectionStatusUpdate
|
||||
@@ -53,28 +63,53 @@ void Session::clStageStarting(int stage)
|
||||
// which happens to be the main thread, so it's cool to interact
|
||||
// with the GUI in these callbacks.
|
||||
emit s_ActiveSession->stageStarting(QString::fromLocal8Bit(LiGetStageName(stage)));
|
||||
|
||||
#ifndef USE_ASYNC_CONNECT_THREAD
|
||||
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
QCoreApplication::sendPostedEvents();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Session::clStageFailed(int stage, long errorCode)
|
||||
void Session::clStageFailed(int stage, int errorCode)
|
||||
{
|
||||
// We know this is called on the same thread as LiStartConnection()
|
||||
// which happens to be the main thread, so it's cool to interact
|
||||
// with the GUI in these callbacks.
|
||||
// Perform the port test now, while we're on the async connection thread and not blocking the UI.
|
||||
s_ActiveSession->m_PortTestResults = LiTestClientConnectivity(CONN_TEST_SERVER, 443, LiGetPortFlagsFromStage(stage));
|
||||
|
||||
emit s_ActiveSession->stageFailed(QString::fromLocal8Bit(LiGetStageName(stage)), errorCode);
|
||||
|
||||
#ifndef USE_ASYNC_CONNECT_THREAD
|
||||
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
QCoreApplication::sendPostedEvents();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Session::clConnectionTerminated(long errorCode)
|
||||
void Session::clConnectionTerminated(int errorCode)
|
||||
{
|
||||
s_ActiveSession->m_PortTestResults = LiTestClientConnectivity(CONN_TEST_SERVER, 443, LiGetPortFlagsFromTerminationErrorCode(errorCode));
|
||||
|
||||
// Display the termination dialog if this was not intended
|
||||
if (errorCode != 0) {
|
||||
switch (errorCode) {
|
||||
case ML_ERROR_GRACEFUL_TERMINATION:
|
||||
break;
|
||||
|
||||
case ML_ERROR_NO_VIDEO_TRAFFIC:
|
||||
s_ActiveSession->m_UnexpectedTermination = true;
|
||||
emit s_ActiveSession->displayLaunchError("No video received from host. Check the host PC's firewall and port forwarding rules.");
|
||||
break;
|
||||
|
||||
case ML_ERROR_NO_VIDEO_FRAME:
|
||||
s_ActiveSession->m_UnexpectedTermination = true;
|
||||
emit s_ActiveSession->displayLaunchError("Your network connection isn't performing well. Reduce your video bitrate setting or try a faster connection.");
|
||||
break;
|
||||
|
||||
default:
|
||||
s_ActiveSession->m_UnexpectedTermination = true;
|
||||
emit s_ActiveSession->displayLaunchError("Connection terminated");
|
||||
break;
|
||||
}
|
||||
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Connection terminated: %ld",
|
||||
"Connection terminated: %d",
|
||||
errorCode);
|
||||
|
||||
// Push a quit event to the main loop
|
||||
@@ -250,6 +285,25 @@ int Session::drSubmitDecodeUnit(PDECODE_UNIT du)
|
||||
}
|
||||
}
|
||||
|
||||
void Session::getDecoderInfo(SDL_Window* window,
|
||||
bool& isHardwareAccelerated, bool& isFullScreenOnly, QSize& maxResolution)
|
||||
{
|
||||
IVideoDecoder* decoder;
|
||||
|
||||
if (!chooseDecoder(StreamingPreferences::VDS_AUTO,
|
||||
window, VIDEO_FORMAT_H264, 1920, 1080, 60,
|
||||
true, false, true, decoder)) {
|
||||
isHardwareAccelerated = isFullScreenOnly = false;
|
||||
return;
|
||||
}
|
||||
|
||||
isHardwareAccelerated = decoder->isHardwareAccelerated();
|
||||
isFullScreenOnly = decoder->isAlwaysFullScreen();
|
||||
maxResolution = decoder->getDecoderMaxResolution();
|
||||
|
||||
delete decoder;
|
||||
}
|
||||
|
||||
bool Session::isHardwareDecodeAvailable(SDL_Window* window,
|
||||
StreamingPreferences::VideoDecoderSelection vds,
|
||||
int videoFormat, int width, int height, int frameRate)
|
||||
@@ -307,6 +361,8 @@ Session::Session(NvComputer* computer, NvApp& app, StreamingPreferences *prefere
|
||||
m_InputHandler(nullptr),
|
||||
m_InputHandlerLock(0),
|
||||
m_MouseEmulationRefCount(0),
|
||||
m_AsyncConnectionSuccess(false),
|
||||
m_PortTestResults(0),
|
||||
m_OpusDecoder(nullptr),
|
||||
m_AudioRenderer(nullptr),
|
||||
m_AudioSampleCount(0),
|
||||
@@ -334,13 +390,21 @@ bool Session::initialize()
|
||||
}
|
||||
|
||||
// Create a hidden window to use for decoder initialization tests
|
||||
SDL_Window* testWindow = SDL_CreateWindow("", 0, 0, 1280, 720, SDL_WINDOW_HIDDEN);
|
||||
SDL_Window* testWindow = SDL_CreateWindow("", 0, 0, 1280, 720,
|
||||
SDL_WINDOW_HIDDEN | StreamUtils::getPlatformWindowFlags());
|
||||
if (!testWindow) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Failed to create window for hardware decode test: %s",
|
||||
SDL_GetError());
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
return false;
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Failed to create test window with platform flags: %s",
|
||||
SDL_GetError());
|
||||
|
||||
testWindow = SDL_CreateWindow("", 0, 0, 1280, 720, SDL_WINDOW_HIDDEN);
|
||||
if (!testWindow) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Failed to create window for hardware decode test: %s",
|
||||
SDL_GetError());
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
qInfo() << "Server GPU:" << m_Computer->gpuModel;
|
||||
@@ -375,6 +439,9 @@ bool Session::initialize()
|
||||
case StreamingPreferences::AC_51_SURROUND:
|
||||
m_StreamConfig.audioConfiguration = AUDIO_CONFIGURATION_51_SURROUND;
|
||||
break;
|
||||
case StreamingPreferences::AC_71_SURROUND:
|
||||
m_StreamConfig.audioConfiguration = AUDIO_CONFIGURATION_71_SURROUND;
|
||||
break;
|
||||
}
|
||||
|
||||
LiInitializeAudioCallbacks(&m_AudioCallbacks);
|
||||
@@ -384,8 +451,11 @@ bool Session::initialize()
|
||||
m_AudioCallbacks.capabilities = getAudioRendererCapabilities(m_StreamConfig.audioConfiguration);
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Audio configuration: %d",
|
||||
m_StreamConfig.audioConfiguration);
|
||||
"Audio channel count: %d",
|
||||
CHANNEL_COUNT_FROM_AUDIO_CONFIGURATION(m_StreamConfig.audioConfiguration));
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Audio channel mask: %X",
|
||||
CHANNEL_MASK_FROM_AUDIO_CONFIGURATION(m_StreamConfig.audioConfiguration));
|
||||
|
||||
switch (m_Preferences->videoCodecConfig)
|
||||
{
|
||||
@@ -441,6 +511,17 @@ bool Session::initialize()
|
||||
break;
|
||||
}
|
||||
|
||||
#if !SDL_VERSION_ATLEAST(2, 0, 11)
|
||||
// HACK: Using a full-screen window breaks mouse capture on the Pi's LXDE
|
||||
// GUI environment. Force the session to use windowed mode (which won't
|
||||
// really matter anyway because the MMAL renderer always draws full-screen).
|
||||
if (qgetenv("DESKTOP_SESSION") == "LXDE-pi") {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Forcing windowed mode on LXDE-Pi");
|
||||
m_FullScreenFlag = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Check for validation errors/warnings and emit
|
||||
// signals for them, if appropriate
|
||||
bool ret = validateLaunch(testWindow);
|
||||
@@ -474,6 +555,7 @@ void Session::emitLaunchWarning(QString text)
|
||||
// Pump the UI loop while we wait
|
||||
SDL_Delay(5);
|
||||
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
QCoreApplication::sendPostedEvents();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -481,8 +563,18 @@ bool Session::validateLaunch(SDL_Window* testWindow)
|
||||
{
|
||||
QStringList warningList;
|
||||
|
||||
if (m_Preferences->absoluteMouseMode && !m_App.isAppCollectorGame) {
|
||||
emitLaunchWarning("Your selection to enable remote desktop mouse mode may cause problems in games.");
|
||||
}
|
||||
|
||||
if (m_Preferences->videoDecoderSelection == StreamingPreferences::VDS_FORCE_SOFTWARE) {
|
||||
emitLaunchWarning("Your settings selection to force software decoding may cause poor streaming performance.");
|
||||
if (m_Preferences->videoCodecConfig == StreamingPreferences::VCC_FORCE_HEVC_HDR) {
|
||||
emitLaunchWarning("HDR is not supported with software decoding.");
|
||||
m_StreamConfig.enableHdr = false;
|
||||
}
|
||||
else {
|
||||
emitLaunchWarning("Your settings selection to force software decoding may cause poor streaming performance.");
|
||||
}
|
||||
}
|
||||
|
||||
if (m_Preferences->unsupportedFps && m_StreamConfig.fps > 60) {
|
||||
@@ -569,12 +661,12 @@ bool Session::validateLaunch(SDL_Window* testWindow)
|
||||
// Test if audio works at the specified audio configuration
|
||||
bool audioTestPassed = testAudio(m_StreamConfig.audioConfiguration);
|
||||
|
||||
// Gracefully degrade to stereo if 5.1 doesn't work
|
||||
if (!audioTestPassed && m_StreamConfig.audioConfiguration == AUDIO_CONFIGURATION_51_SURROUND) {
|
||||
// Gracefully degrade to stereo if surround sound doesn't work
|
||||
if (!audioTestPassed && CHANNEL_COUNT_FROM_AUDIO_CONFIGURATION(m_StreamConfig.audioConfiguration) > 2) {
|
||||
audioTestPassed = testAudio(AUDIO_CONFIGURATION_STEREO);
|
||||
if (audioTestPassed) {
|
||||
m_StreamConfig.audioConfiguration = AUDIO_CONFIGURATION_STEREO;
|
||||
emitLaunchWarning("5.1 surround sound is not supported by the current audio device.");
|
||||
emitLaunchWarning("Your selected surround sound setting is not supported by the current audio device.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -589,6 +681,18 @@ bool Session::validateLaunch(SDL_Window* testWindow)
|
||||
emitLaunchWarning("An attached gamepad has no mapping and won't be usable. Visit the Moonlight help to resolve this.");
|
||||
}
|
||||
|
||||
// NVENC will fail to initialize when using dimensions over 4096 and H.264.
|
||||
if (m_StreamConfig.width > 4096 || m_StreamConfig.height > 4096) {
|
||||
if (m_Computer->maxLumaPixelsHEVC == 0) {
|
||||
emit displayLaunchError("Your host PC's GPU doesn't support streaming video resolutions over 4K.");
|
||||
return false;
|
||||
}
|
||||
else if (!m_StreamConfig.supportsHevc) {
|
||||
emit displayLaunchError("Video resolutions over 4K are only supported by the HEVC codec.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_Preferences->videoDecoderSelection == StreamingPreferences::VDS_FORCE_HARDWARE &&
|
||||
!m_StreamConfig.enableHdr && // HEVC Main10 was already checked for hardware decode support above
|
||||
!isHardwareDecodeAvailable(testWindow,
|
||||
@@ -638,7 +742,7 @@ private:
|
||||
emit m_Session->quitStarting();
|
||||
}
|
||||
else {
|
||||
emit m_Session->sessionFinished();
|
||||
emit m_Session->sessionFinished(m_Session->m_PortTestResults);
|
||||
}
|
||||
|
||||
// Finish cleanup of the connection state
|
||||
@@ -656,7 +760,7 @@ private:
|
||||
}
|
||||
|
||||
// Session is finished now
|
||||
emit m_Session->sessionFinished();
|
||||
emit m_Session->sessionFinished(m_Session->m_PortTestResults);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -809,10 +913,18 @@ void Session::toggleFullscreen()
|
||||
bool fullScreen = !(SDL_GetWindowFlags(m_Window) & m_FullScreenFlag);
|
||||
|
||||
if (fullScreen) {
|
||||
if (m_FullScreenFlag == SDL_WINDOW_FULLSCREEN && m_InputHandler->isCaptureActive()) {
|
||||
// Confine the cursor to the window if we're capturing input
|
||||
SDL_SetWindowGrab(m_Window, SDL_TRUE);
|
||||
}
|
||||
|
||||
SDL_SetWindowResizable(m_Window, SDL_FALSE);
|
||||
SDL_SetWindowFullscreen(m_Window, m_FullScreenFlag);
|
||||
}
|
||||
else {
|
||||
// Unconfine the cursor
|
||||
SDL_SetWindowGrab(m_Window, SDL_FALSE);
|
||||
|
||||
SDL_SetWindowFullscreen(m_Window, 0);
|
||||
SDL_SetWindowResizable(m_Window, SDL_TRUE);
|
||||
|
||||
@@ -837,39 +949,37 @@ void Session::notifyMouseEmulationMode(bool enabled)
|
||||
}
|
||||
}
|
||||
|
||||
void Session::exec(int displayOriginX, int displayOriginY)
|
||||
class AsyncConnectionStartThread : public QThread
|
||||
{
|
||||
m_DisplayOriginX = displayOriginX;
|
||||
m_DisplayOriginY = displayOriginY;
|
||||
public:
|
||||
AsyncConnectionStartThread(Session* session) :
|
||||
QThread(nullptr),
|
||||
m_Session(session) {}
|
||||
|
||||
// Complete initialization in this deferred context to avoid
|
||||
// calling expensive functions in the constructor (during the
|
||||
// process of loading the StreamSegue).
|
||||
if (!initialize()) {
|
||||
emit sessionFinished();
|
||||
return;
|
||||
void run() override
|
||||
{
|
||||
m_Session->m_AsyncConnectionSuccess = m_Session->startConnectionAsync();
|
||||
}
|
||||
|
||||
Session* m_Session;
|
||||
};
|
||||
|
||||
// Called in a non-main thread
|
||||
bool Session::startConnectionAsync()
|
||||
{
|
||||
// Wait 1.5 seconds before connecting to let the user
|
||||
// have time to read any messages present on the segue
|
||||
#ifdef USE_ASYNC_CONNECT_THREAD
|
||||
SDL_Delay(1500);
|
||||
#else
|
||||
uint32_t start = SDL_GetTicks();
|
||||
while (!SDL_TICKS_PASSED(SDL_GetTicks(), start + 1500)) {
|
||||
// Pump the UI loop while we wait
|
||||
// Pump the UI loop while we wait since we're not async
|
||||
SDL_Delay(5);
|
||||
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
QCoreApplication::sendPostedEvents();
|
||||
}
|
||||
|
||||
// Wait for any old session to finish cleanup
|
||||
s_ActiveSessionSemaphore.acquire();
|
||||
|
||||
// We're now active
|
||||
s_ActiveSession = this;
|
||||
|
||||
// Initialize the gamepad code with our preferences
|
||||
StreamingPreferences prefs;
|
||||
m_InputHandler = new SdlInputHandler(prefs, m_Computer,
|
||||
m_StreamConfig.width,
|
||||
m_StreamConfig.height);
|
||||
#endif
|
||||
|
||||
// The UI should have ensured the old game was already quit
|
||||
// if we decide to stream a different game.
|
||||
@@ -886,7 +996,7 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Found host supported resolution: %dx%d",
|
||||
mode.width, mode.height);
|
||||
enableGameOptimizations = prefs.gameOptimizations;
|
||||
enableGameOptimizations = m_Preferences->gameOptimizations;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -899,23 +1009,15 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
||||
else {
|
||||
http.launchApp(m_App.id, &m_StreamConfig,
|
||||
enableGameOptimizations,
|
||||
prefs.playAudioOnHost,
|
||||
m_Preferences->playAudioOnHost,
|
||||
m_InputHandler->getAttachedGamepadMask());
|
||||
}
|
||||
} catch (const GfeHttpResponseException& e) {
|
||||
delete m_InputHandler;
|
||||
m_InputHandler = nullptr;
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
emit displayLaunchError("GeForce Experience returned error: " + e.toQString());
|
||||
QThreadPool::globalInstance()->start(new DeferredSessionCleanupTask(this));
|
||||
return;
|
||||
return false;
|
||||
} catch (const QtNetworkReplyException& e) {
|
||||
delete m_InputHandler;
|
||||
m_InputHandler = nullptr;
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
emit displayLaunchError(e.toQString());
|
||||
QThreadPool::globalInstance()->start(new DeferredSessionCleanupTask(this));
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
QByteArray hostnameStr = m_Computer->activeAddress.toLatin1();
|
||||
@@ -934,17 +1036,28 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
||||
hostInfo.serverInfoGfeVersion = siGfeVersion.data();
|
||||
}
|
||||
|
||||
// isReachableOverVpn() does network I/O, so we only attempt to check
|
||||
// VPN reachability if we've already contacted the PC successfully
|
||||
if (m_Computer->isReachableOverVpn()) {
|
||||
// It looks like our route to this PC is over a VPN.
|
||||
// Treat it as remote even if the target address is in RFC 1918 address space.
|
||||
m_StreamConfig.streamingRemotely = STREAM_CFG_REMOTE;
|
||||
m_StreamConfig.packetSize = 1024;
|
||||
if (m_Preferences->packetSize != 0) {
|
||||
// Override default packet size and remote streaming detection
|
||||
// NB: Using STREAM_CFG_AUTO will cap our packet size at 1024 for remote hosts.
|
||||
m_StreamConfig.streamingRemotely = STREAM_CFG_LOCAL;
|
||||
m_StreamConfig.packetSize = m_Preferences->packetSize;
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Using custom packet size: %d bytes",
|
||||
m_Preferences->packetSize);
|
||||
}
|
||||
else {
|
||||
m_StreamConfig.streamingRemotely = STREAM_CFG_AUTO;
|
||||
m_StreamConfig.packetSize = 1392;
|
||||
// isReachableOverVpn() does network I/O, so we only attempt to check
|
||||
// VPN reachability if we've already contacted the PC successfully
|
||||
if (m_Computer->isReachableOverVpn()) {
|
||||
// It looks like our route to this PC is over a VPN.
|
||||
// Treat it as remote even if the target address is in RFC 1918 address space.
|
||||
m_StreamConfig.streamingRemotely = STREAM_CFG_REMOTE;
|
||||
m_StreamConfig.packetSize = 1024;
|
||||
}
|
||||
else {
|
||||
m_StreamConfig.streamingRemotely = STREAM_CFG_AUTO;
|
||||
m_StreamConfig.packetSize = 1392;
|
||||
}
|
||||
}
|
||||
|
||||
int err = LiStartConnection(&hostInfo, &m_StreamConfig, &k_ConnCallbacks,
|
||||
@@ -954,6 +1067,60 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
||||
if (err != 0) {
|
||||
// We already displayed an error dialog in the stage failure
|
||||
// listener.
|
||||
return false;
|
||||
}
|
||||
|
||||
emit connectionStarted();
|
||||
return true;
|
||||
}
|
||||
|
||||
void Session::exec(int displayOriginX, int displayOriginY)
|
||||
{
|
||||
m_DisplayOriginX = displayOriginX;
|
||||
m_DisplayOriginY = displayOriginY;
|
||||
|
||||
// Complete initialization in this deferred context to avoid
|
||||
// calling expensive functions in the constructor (during the
|
||||
// process of loading the StreamSegue).
|
||||
//
|
||||
// NB: This initializes the SDL video subsystem, so it must be
|
||||
// called on the main thread.
|
||||
if (!initialize()) {
|
||||
emit sessionFinished(0);
|
||||
return;
|
||||
}
|
||||
|
||||
// Wait for any old session to finish cleanup
|
||||
s_ActiveSessionSemaphore.acquire();
|
||||
|
||||
// We're now active
|
||||
s_ActiveSession = this;
|
||||
|
||||
// Initialize the gamepad code with our preferences
|
||||
// NB: m_InputHandler must be initialize before starting the connection.
|
||||
m_InputHandler = new SdlInputHandler(*m_Preferences, m_Computer,
|
||||
m_StreamConfig.width,
|
||||
m_StreamConfig.height);
|
||||
|
||||
// Kick off the async connection thread while we sit here and pump the event loop
|
||||
AsyncConnectionStartThread asyncConnThread(this);
|
||||
#ifdef USE_ASYNC_CONNECT_THREAD
|
||||
asyncConnThread.start();
|
||||
while (!asyncConnThread.wait(10)) {
|
||||
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
QCoreApplication::sendPostedEvents();
|
||||
}
|
||||
#else
|
||||
asyncConnThread.run();
|
||||
#endif
|
||||
|
||||
// Pump the event loop one last time to ensure we pick up any events from
|
||||
// the thread that happened while it was in the final successful QThread::wait().
|
||||
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
QCoreApplication::sendPostedEvents();
|
||||
|
||||
// If the connection failed, clean up and abort the connection.
|
||||
if (!m_AsyncConnectionSuccess) {
|
||||
delete m_InputHandler;
|
||||
m_InputHandler = nullptr;
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
@@ -961,30 +1128,48 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
||||
return;
|
||||
}
|
||||
|
||||
// Pump the message loop to update the UI
|
||||
emit connectionStarted();
|
||||
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
|
||||
int x, y, width, height;
|
||||
getWindowDimensions(x, y, width, height);
|
||||
|
||||
#ifdef STEAM_LINK
|
||||
// We need a little delay before creating the window or we will trigger some kind
|
||||
// of graphics driver bug on Steam Link that causes a jagged overlay to appear in
|
||||
// the top right corner randomly.
|
||||
SDL_Delay(500);
|
||||
#endif
|
||||
|
||||
m_Window = SDL_CreateWindow("Moonlight",
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
SDL_WINDOW_ALLOW_HIGHDPI);
|
||||
SDL_WINDOW_ALLOW_HIGHDPI | StreamUtils::getPlatformWindowFlags());
|
||||
if (!m_Window) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"SDL_CreateWindow() failed: %s",
|
||||
SDL_GetError());
|
||||
delete m_InputHandler;
|
||||
m_InputHandler = nullptr;
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
QThreadPool::globalInstance()->start(new DeferredSessionCleanupTask(this));
|
||||
return;
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"SDL_CreateWindow() failed with platform flags: %s",
|
||||
SDL_GetError());
|
||||
|
||||
m_Window = SDL_CreateWindow("Moonlight",
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
SDL_WINDOW_ALLOW_HIGHDPI);
|
||||
if (!m_Window) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"SDL_CreateWindow() failed: %s",
|
||||
SDL_GetError());
|
||||
|
||||
delete m_InputHandler;
|
||||
m_InputHandler = nullptr;
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
QThreadPool::globalInstance()->start(new DeferredSessionCleanupTask(this));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_InputHandler->setWindow(m_Window);
|
||||
|
||||
QSvgRenderer svgIconRenderer(QString(":/res/moonlight.svg"));
|
||||
QImage svgImage(ICON_SIZE, ICON_SIZE, QImage::Format_RGBA8888);
|
||||
svgImage.fill(0);
|
||||
@@ -1029,18 +1214,21 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
||||
SDL_SetWindowFullscreen(m_Window, m_FullScreenFlag);
|
||||
}
|
||||
|
||||
#ifndef QT_DEBUG
|
||||
// Capture the mouse by default on release builds only.
|
||||
// This prevents the mouse from becoming trapped inside
|
||||
// Moonlight when it's halted at a debug break.
|
||||
if (m_Preferences->windowMode != StreamingPreferences::WM_WINDOWED) {
|
||||
// HACK: This doesn't work on Wayland until we render a frame, so
|
||||
// just don't do it for now.
|
||||
if (strcmp(SDL_GetCurrentVideoDriver(), "wayland") != 0) {
|
||||
m_InputHandler->setCaptureActive(true);
|
||||
}
|
||||
bool needsFirstEnterCapture = false;
|
||||
bool needsPostDecoderCreationCapture = false;
|
||||
|
||||
// HACK: For Wayland, we wait until we get the first SDL_WINDOWEVENT_ENTER
|
||||
// event where it seems to work consistently on GNOME. For other platforms,
|
||||
// especially where SDL may call SDL_RecreateWindow(), we must only capture
|
||||
// after the decoder is created.
|
||||
if (strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0) {
|
||||
// Native Wayland: Capture on SDL_WINDOWEVENT_ENTER
|
||||
needsFirstEnterCapture = true;
|
||||
}
|
||||
else {
|
||||
// X11/XWayland: Capture after decoder creation
|
||||
needsPostDecoderCreationCapture = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Stop text input. SDL enables it by default
|
||||
// when we initialize the video subsystem, but this
|
||||
@@ -1051,6 +1239,11 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
||||
// Disable the screen saver
|
||||
SDL_DisableScreenSaver();
|
||||
|
||||
// Hide Qt's fake mouse cursor on EGLFS systems
|
||||
if (QGuiApplication::platformName() == "eglfs") {
|
||||
QGuiApplication::setOverrideCursor(QCursor(Qt::BlankCursor));
|
||||
}
|
||||
|
||||
// Set timer resolution to 1 ms on Windows for greater
|
||||
// sleep precision and more accurate callback timing.
|
||||
SDL_SetHint(SDL_HINT_TIMER_RESOLUTION, "1");
|
||||
@@ -1063,7 +1256,7 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
||||
m_UnexpectedTermination = false;
|
||||
|
||||
// Start rich presence to indicate we're in game
|
||||
RichPresenceManager presence(prefs, m_App.name);
|
||||
RichPresenceManager presence(*m_Preferences, m_App.name);
|
||||
|
||||
// Hijack this thread to be the SDL main thread. We have to do this
|
||||
// because we want to suspend all Qt processing until the stream is over.
|
||||
@@ -1091,48 +1284,33 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
||||
goto DispatchDeferredCleanup;
|
||||
|
||||
case SDL_USEREVENT:
|
||||
SDL_assert(event.user.code == SDL_CODE_FRAME_READY);
|
||||
m_VideoDecoder->renderFrameOnMainThread();
|
||||
switch (event.user.code) {
|
||||
case SDL_CODE_FRAME_READY:
|
||||
m_VideoDecoder->renderFrameOnMainThread();
|
||||
break;
|
||||
case SDL_CODE_HIDE_CURSOR:
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
break;
|
||||
case SDL_CODE_SHOW_CURSOR:
|
||||
SDL_ShowCursor(SDL_ENABLE);
|
||||
break;
|
||||
default:
|
||||
SDL_assert(false);
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_WINDOWEVENT:
|
||||
// Capture mouse cursor when user actives the window by clicking on
|
||||
// window's client area (borders and title bar excluded).
|
||||
// Without this you would have to click the window twice (once to
|
||||
// activate it, second time to enable capture). With this you need to
|
||||
// click it only once.
|
||||
// On Linux, the button press event is delivered after the focus gain
|
||||
// so this is not neccessary (and leads to a click sent to the host
|
||||
// when focusing the window by clicking).
|
||||
// By excluding window's borders and title bar out, lets user still
|
||||
// interact with them without mouse capture kicking in.
|
||||
#if defined(Q_OS_WIN32) || defined(Q_OS_DARWIN)
|
||||
if (event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED) {
|
||||
int mouseX, mouseY;
|
||||
Uint32 mouseState = SDL_GetGlobalMouseState(&mouseX, &mouseY);
|
||||
if (mouseState & SDL_BUTTON(SDL_BUTTON_LEFT)) {
|
||||
int x, y, width, height;
|
||||
SDL_GetWindowPosition(m_Window, &x, &y);
|
||||
SDL_GetWindowSize(m_Window, &width, &height);
|
||||
if (mouseX > x && mouseX < x+width && mouseY > y && mouseY < y+height) {
|
||||
m_InputHandler->setCaptureActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST) {
|
||||
// Release mouse cursor when another window is activated (e.g. by using ALT+TAB).
|
||||
// This lets user to interact with our window's title bar and with the buttons in it.
|
||||
// Doing this while the window is full-screen breaks the transition out of FS
|
||||
// (desktop and exclusive), so we must check for that before releasing mouse capture.
|
||||
if (!(SDL_GetWindowFlags(m_Window) & SDL_WINDOW_FULLSCREEN)) {
|
||||
m_InputHandler->setCaptureActive(false);
|
||||
}
|
||||
m_InputHandler->notifyFocusLost();
|
||||
}
|
||||
else if (event.window.event == SDL_WINDOWEVENT_LEAVE) {
|
||||
m_InputHandler->notifyMouseLeave();
|
||||
}
|
||||
|
||||
// Raise all keys that are currently pressed. If we don't do this, certain keys
|
||||
// used in shortcuts that cause focus loss (such as Alt+Tab) may get stuck down.
|
||||
m_InputHandler->raiseAllKeys();
|
||||
// Capture the mouse on SDL_WINDOWEVENT_ENTER if needed
|
||||
if (needsFirstEnterCapture && event.window.event == SDL_WINDOWEVENT_ENTER) {
|
||||
m_InputHandler->setCaptureActive(true);
|
||||
needsFirstEnterCapture = false;
|
||||
}
|
||||
|
||||
// We want to recreate the decoder for resizes (full-screen toggles) and the initial shown event.
|
||||
@@ -1161,6 +1339,12 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
||||
SDL_SetWindowPosition(m_Window, x, y);
|
||||
}
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Recreating renderer for window event: %d (%d %d)",
|
||||
event.window.event,
|
||||
event.window.data1,
|
||||
event.window.data2);
|
||||
|
||||
// Fall through
|
||||
case SDL_RENDER_DEVICE_RESET:
|
||||
case SDL_RENDER_TARGETS_RESET:
|
||||
@@ -1213,6 +1397,14 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
||||
emit displayLaunchError("Unable to initialize video decoder. Please check your streaming settings and try again.");
|
||||
goto DispatchDeferredCleanup;
|
||||
}
|
||||
|
||||
// As of SDL 2.0.12, SDL_RecreateWindow() doesn't carry over mouse capture
|
||||
// or mouse hiding state to the new window. By capturing after the decoder
|
||||
// is set up, this ensures the window re-creation is already done.
|
||||
if (needsPostDecoderCreationCapture) {
|
||||
m_InputHandler->setCaptureActive(true);
|
||||
needsFirstEnterCapture = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Request an IDR frame to complete the reset
|
||||
@@ -1263,6 +1455,9 @@ DispatchDeferredCleanup:
|
||||
m_InputHandler->setCaptureActive(false);
|
||||
SDL_EnableScreenSaver();
|
||||
SDL_SetHint(SDL_HINT_TIMER_RESOLUTION, "0");
|
||||
if (QGuiApplication::platformName() == "eglfs") {
|
||||
QGuiApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
// Raise any keys that are still down
|
||||
m_InputHandler->raiseAllKeys();
|
||||
@@ -1282,25 +1477,6 @@ DispatchDeferredCleanup:
|
||||
m_VideoDecoder = nullptr;
|
||||
SDL_AtomicUnlock(&m_DecoderLock);
|
||||
|
||||
if (strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0) {
|
||||
// HACK: SDL (as of 2.0.10) has a bug that causes Mutter not to destroy the window
|
||||
// surface when in full-screen unless we render more frames after we request
|
||||
// to exit full-screen. The amount of frames required is variable but 500 ms
|
||||
// of frames seems sufficient in my testing.
|
||||
SDL_SetWindowFullscreen(m_Window, 0);
|
||||
SDL_Renderer* renderer = SDL_CreateRenderer(m_Window, -1, SDL_RENDERER_PRESENTVSYNC);
|
||||
if (renderer != nullptr) {
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
SDL_RenderClear(renderer);
|
||||
SDL_RenderPresent(renderer);
|
||||
SDL_Delay(50);
|
||||
}
|
||||
SDL_DestroyRenderer(renderer);
|
||||
}
|
||||
}
|
||||
|
||||
// This must be called after the decoder is deleted, because
|
||||
// the renderer may want to interact with the window
|
||||
SDL_DestroyWindow(m_Window);
|
||||
|
||||
+18
-8
@@ -5,7 +5,7 @@
|
||||
#include <Limelight.h>
|
||||
#include <opus_multistream.h>
|
||||
#include "settings/streamingpreferences.h"
|
||||
#include "input.h"
|
||||
#include "input/input.h"
|
||||
#include "video/decoder.h"
|
||||
#include "audio/renderers/renderer.h"
|
||||
#include "video/overlaymanager.h"
|
||||
@@ -16,6 +16,7 @@ class Session : public QObject
|
||||
|
||||
friend class SdlInputHandler;
|
||||
friend class DeferredSessionCleanupTask;
|
||||
friend class AsyncConnectionStartThread;
|
||||
|
||||
public:
|
||||
explicit Session(NvComputer* computer, NvApp& app, StreamingPreferences *preferences = nullptr);
|
||||
@@ -25,9 +26,8 @@ public:
|
||||
Q_INVOKABLE void exec(int displayOriginX, int displayOriginY);
|
||||
|
||||
static
|
||||
bool isHardwareDecodeAvailable(SDL_Window* window,
|
||||
StreamingPreferences::VideoDecoderSelection vds,
|
||||
int videoFormat, int width, int height, int frameRate);
|
||||
void getDecoderInfo(SDL_Window* window,
|
||||
bool& isHardwareAccelerated, bool& isFullScreenOnly, QSize& maxResolution);
|
||||
|
||||
static Session* get()
|
||||
{
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
signals:
|
||||
void stageStarting(QString stage);
|
||||
|
||||
void stageFailed(QString stage, long errorCode);
|
||||
void stageFailed(QString stage, int errorCode);
|
||||
|
||||
void connectionStarted();
|
||||
|
||||
@@ -52,11 +52,13 @@ signals:
|
||||
|
||||
void quitStarting();
|
||||
|
||||
void sessionFinished();
|
||||
void sessionFinished(int portTestResult);
|
||||
|
||||
private:
|
||||
bool initialize();
|
||||
|
||||
bool startConnectionAsync();
|
||||
|
||||
bool validateLaunch(SDL_Window* testWindow);
|
||||
|
||||
void emitLaunchWarning(QString text);
|
||||
@@ -78,6 +80,11 @@ private:
|
||||
|
||||
void updateOptimalWindowDisplayMode();
|
||||
|
||||
static
|
||||
bool isHardwareDecodeAvailable(SDL_Window* window,
|
||||
StreamingPreferences::VideoDecoderSelection vds,
|
||||
int videoFormat, int width, int height, int frameRate);
|
||||
|
||||
static
|
||||
bool chooseDecoder(StreamingPreferences::VideoDecoderSelection vds,
|
||||
SDL_Window* window, int videoFormat, int width, int height,
|
||||
@@ -89,10 +96,10 @@ private:
|
||||
void clStageStarting(int stage);
|
||||
|
||||
static
|
||||
void clStageFailed(int stage, long errorCode);
|
||||
void clStageFailed(int stage, int errorCode);
|
||||
|
||||
static
|
||||
void clConnectionTerminated(long errorCode);
|
||||
void clConnectionTerminated(int errorCode);
|
||||
|
||||
static
|
||||
void clLogMessage(const char* format, ...);
|
||||
@@ -143,6 +150,9 @@ private:
|
||||
SDL_SpinLock m_InputHandlerLock;
|
||||
int m_MouseEmulationRefCount;
|
||||
|
||||
bool m_AsyncConnectionSuccess;
|
||||
int m_PortTestResults;
|
||||
|
||||
int m_ActiveVideoFormat;
|
||||
int m_ActiveVideoWidth;
|
||||
int m_ActiveVideoHeight;
|
||||
|
||||
@@ -6,20 +6,27 @@
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#endif
|
||||
|
||||
Uint32 StreamUtils::getPlatformWindowFlags()
|
||||
{
|
||||
#ifdef Q_OS_DARWIN
|
||||
return SDL_WINDOW_METAL;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void StreamUtils::scaleSourceToDestinationSurface(SDL_Rect* src, SDL_Rect* dst)
|
||||
{
|
||||
int dstH = dst->w * src->h / src->w;
|
||||
int dstW = dst->h * src->w / src->h;
|
||||
|
||||
if (dstH > dst->h) {
|
||||
dst->y = 0;
|
||||
dst->x = (dst->w - dstW) / 2;
|
||||
dst->x += (dst->w - dstW) / 2;
|
||||
dst->w = dstW;
|
||||
SDL_assert(dst->w * src->h / src->w <= dst->h);
|
||||
}
|
||||
else {
|
||||
dst->x = 0;
|
||||
dst->y = (dst->h - dstH) / 2;
|
||||
dst->y += (dst->h - dstH) / 2;
|
||||
dst->h = dstH;
|
||||
SDL_assert(dst->h * src->w / src->h <= dst->w);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
class StreamUtils
|
||||
{
|
||||
public:
|
||||
static
|
||||
Uint32 getPlatformWindowFlags();
|
||||
|
||||
static
|
||||
void scaleSourceToDestinationSurface(SDL_Rect* src, SDL_Rect* dst);
|
||||
|
||||
|
||||
@@ -43,8 +43,10 @@ public:
|
||||
virtual ~IVideoDecoder() {}
|
||||
virtual bool initialize(PDECODER_PARAMETERS params) = 0;
|
||||
virtual bool isHardwareAccelerated() = 0;
|
||||
virtual bool isAlwaysFullScreen() = 0;
|
||||
virtual int getDecoderCapabilities() = 0;
|
||||
virtual int getDecoderColorspace() = 0;
|
||||
virtual QSize getDecoderMaxResolution() = 0;
|
||||
virtual int submitDecodeUnit(PDECODE_UNIT du) = 0;
|
||||
virtual void renderFrameOnMainThread() = 0;
|
||||
};
|
||||
|
||||
@@ -28,7 +28,7 @@ bool CUDARenderer::initialize(PDECODER_PARAMETERS)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CUDARenderer::prepareDecoderContext(AVCodecContext* context)
|
||||
bool CUDARenderer::prepareDecoderContext(AVCodecContext* context, AVDictionary**)
|
||||
{
|
||||
context->hw_device_ctx = av_buffer_ref(m_HwContext);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ public:
|
||||
CUDARenderer();
|
||||
virtual ~CUDARenderer() override;
|
||||
virtual bool initialize(PDECODER_PARAMETERS) override;
|
||||
virtual bool prepareDecoderContext(AVCodecContext* context) override;
|
||||
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary** options) override;
|
||||
virtual void renderFrame(AVFrame* frame) override;
|
||||
virtual bool needsTestFrame() override;
|
||||
virtual bool isDirectRenderingSupported() override;
|
||||
|
||||
@@ -33,7 +33,7 @@ DrmRenderer::~DrmRenderer()
|
||||
}
|
||||
}
|
||||
|
||||
bool DrmRenderer::prepareDecoderContext(AVCodecContext*)
|
||||
bool DrmRenderer::prepareDecoderContext(AVCodecContext*, AVDictionary**)
|
||||
{
|
||||
/* Nothing to do */
|
||||
|
||||
@@ -194,8 +194,19 @@ enum AVPixelFormat DrmRenderer::getPreferredPixelFormat(int)
|
||||
return AV_PIX_FMT_DRM_PRIME;
|
||||
}
|
||||
|
||||
int DrmRenderer::getRendererAttributes()
|
||||
{
|
||||
// This renderer can only draw in full-screen
|
||||
return RENDERER_ATTRIBUTE_FULLSCREEN_ONLY;
|
||||
}
|
||||
|
||||
void DrmRenderer::renderFrame(AVFrame* frame)
|
||||
{
|
||||
if (frame == nullptr) {
|
||||
// End of stream - nothing to do for us
|
||||
return;
|
||||
}
|
||||
|
||||
AVDRMFrameDescriptor* drmFrame = (AVDRMFrameDescriptor*)frame->data[0];
|
||||
int err;
|
||||
uint32_t primeHandle;
|
||||
|
||||
@@ -10,9 +10,10 @@ public:
|
||||
DrmRenderer();
|
||||
virtual ~DrmRenderer() override;
|
||||
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
||||
virtual bool prepareDecoderContext(AVCodecContext* context) override;
|
||||
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary** options) override;
|
||||
virtual void renderFrame(AVFrame* frame) override;
|
||||
virtual enum AVPixelFormat getPreferredPixelFormat(int videoFormat) override;
|
||||
virtual int getRendererAttributes() override;
|
||||
|
||||
private:
|
||||
int m_DrmFd;
|
||||
|
||||
@@ -80,7 +80,7 @@ AVBufferRef* DXVA2Renderer::ffPoolAlloc(void* opaque, int)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool DXVA2Renderer::prepareDecoderContext(AVCodecContext* context)
|
||||
bool DXVA2Renderer::prepareDecoderContext(AVCodecContext* context, AVDictionary**)
|
||||
{
|
||||
// m_DXVAContext.workaround and report_id already initialized elsewhere
|
||||
m_DXVAContext.decoder = m_Decoder;
|
||||
@@ -446,7 +446,7 @@ bool DXVA2Renderer::isDecoderBlacklisted()
|
||||
// https://www.intel.com/content/www/us/en/support/articles/000005654/graphics-drivers.html
|
||||
if (LOWORD(id.DriverVersion.LowPart) < 4836) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Intel driver version blacklisted for HEVC");
|
||||
"Detected buggy Intel GPU driver installed. Update your Intel GPU driver to enable HEVC!");
|
||||
result = (m_VideoFormat & VIDEO_FORMAT_MASK_H265) != 0;
|
||||
}
|
||||
else {
|
||||
@@ -546,14 +546,34 @@ bool DXVA2Renderer::initializeDevice(SDL_Window* window, bool enableVsync)
|
||||
d3dpp.hDeviceWindow = info.info.win.window;
|
||||
d3dpp.Flags = D3DPRESENTFLAG_VIDEO;
|
||||
|
||||
if (m_VideoFormat == VIDEO_FORMAT_H265_MAIN10) {
|
||||
// Verify 10-bit A2R10G10B10 color support. This is only available
|
||||
// as a display format in full-screen exclusive mode on DX9.
|
||||
hr = d3d9ex->CheckDeviceType(adapterIndex,
|
||||
D3DDEVTYPE_HAL,
|
||||
D3DFMT_A2R10G10B10,
|
||||
D3DFMT_A2R10G10B10,
|
||||
FALSE);
|
||||
if (FAILED(hr)) {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"GPU/driver doesn't support A2R10G10B10");
|
||||
d3d9ex->Release();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ((windowFlags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN) {
|
||||
d3dpp.Windowed = false;
|
||||
d3dpp.BackBufferWidth = currentMode.Width;
|
||||
d3dpp.BackBufferHeight = currentMode.Height;
|
||||
d3dpp.FullScreen_RefreshRateInHz = currentMode.RefreshRate;
|
||||
|
||||
// TODO: Need to select 10-bit color format for HDR
|
||||
d3dpp.BackBufferFormat = currentMode.Format;
|
||||
if (m_VideoFormat == VIDEO_FORMAT_H265_MAIN10) {
|
||||
d3dpp.BackBufferFormat = currentMode.Format = D3DFMT_A2R10G10B10;
|
||||
}
|
||||
else {
|
||||
d3dpp.BackBufferFormat = currentMode.Format;
|
||||
}
|
||||
}
|
||||
else {
|
||||
d3dpp.Windowed = true;
|
||||
@@ -792,6 +812,11 @@ int DXVA2Renderer::getDecoderColorspace()
|
||||
|
||||
void DXVA2Renderer::renderFrame(AVFrame *frame)
|
||||
{
|
||||
if (frame == nullptr) {
|
||||
// End of stream - nothing to do for us
|
||||
return;
|
||||
}
|
||||
|
||||
IDirect3DSurface9* surface = reinterpret_cast<IDirect3DSurface9*>(frame->data[3]);
|
||||
HRESULT hr;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
DXVA2Renderer();
|
||||
virtual ~DXVA2Renderer() override;
|
||||
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
||||
virtual bool prepareDecoderContext(AVCodecContext* context) override;
|
||||
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary** options) override;
|
||||
virtual void renderFrame(AVFrame* frame) override;
|
||||
virtual void notifyOverlayUpdated(Overlay::OverlayType) override;
|
||||
virtual int getDecoderColorspace() override;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// vim: noai:ts=4:sw=4:softtabstop=4:expandtab
|
||||
#include "renderer.h"
|
||||
|
||||
#include <SDL_egl.h>
|
||||
|
||||
static QStringList egl_get_extensions(EGLDisplay dpy) {
|
||||
const auto EGLExtensionsStr = eglQueryString(dpy, EGL_EXTENSIONS);
|
||||
if (!EGLExtensionsStr) {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "Unable to get EGL extensions");
|
||||
return QStringList();
|
||||
}
|
||||
return QString(EGLExtensionsStr).split(" ");
|
||||
}
|
||||
|
||||
EGLExtensions::EGLExtensions(EGLDisplay dpy) :
|
||||
m_Extensions(egl_get_extensions(dpy))
|
||||
{}
|
||||
|
||||
bool EGLExtensions::isSupported(const QString &extension) const {
|
||||
return m_Extensions.contains(extension);
|
||||
}
|
||||
@@ -0,0 +1,633 @@
|
||||
// vim: noai:ts=4:sw=4:softtabstop=4:expandtab
|
||||
#include "eglvid.h"
|
||||
|
||||
#include "path.h"
|
||||
#include "streaming/session.h"
|
||||
#include "streaming/streamutils.h"
|
||||
|
||||
#include <QDir>
|
||||
|
||||
#include <Limelight.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <SDL_egl.h>
|
||||
#include <SDL_opengles2.h>
|
||||
#include <SDL_render.h>
|
||||
#include <SDL_syswm.h>
|
||||
|
||||
#ifndef EGL_VERSION_1_5
|
||||
typedef intptr_t EGLAttrib;
|
||||
#endif
|
||||
|
||||
#if !defined(EGL_VERSION_1_5) || !defined(EGL_EGL_PROTOTYPES)
|
||||
typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYPROC) (EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
|
||||
#endif
|
||||
|
||||
#ifndef EGL_EXT_platform_base
|
||||
typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
|
||||
#endif
|
||||
|
||||
// These are EGL extensions, so some platform headers may not provide them
|
||||
#ifndef EGL_PLATFORM_WAYLAND_KHR
|
||||
#define EGL_PLATFORM_WAYLAND_KHR 0x31D8
|
||||
#endif
|
||||
#ifndef EGL_PLATFORM_X11_KHR
|
||||
#define EGL_PLATFORM_X11_KHR 0x31D5
|
||||
#endif
|
||||
|
||||
/* TODO:
|
||||
* - handle more pixel formats
|
||||
* - handle software decoding
|
||||
*/
|
||||
|
||||
/* DOC/misc:
|
||||
* - https://kernel-recipes.org/en/2016/talks/video-and-colorspaces/
|
||||
* - http://www.brucelindbloom.com/
|
||||
* - https://learnopengl.com/Getting-started/Shaders
|
||||
* - https://github.com/stunpix/yuvit
|
||||
* - https://en.wikipedia.org/wiki/YCbCr#ITU-R_BT.601_conversion
|
||||
* - https://www.renesas.com/eu/en/www/doc/application-note/an9717.pdf
|
||||
* - https://www.xilinx.com/support/documentation/application_notes/xapp283.pdf
|
||||
* - https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.709-6-201506-I!!PDF-E.pdf
|
||||
* - https://www.khronos.org/registry/OpenGL/extensions/OES/OES_EGL_image_external.txt
|
||||
* - https://gist.github.com/rexguo/6696123
|
||||
* - https://wiki.libsdl.org/CategoryVideo
|
||||
*/
|
||||
|
||||
#define EGL_LOG(Category, ...) SDL_Log ## Category(\
|
||||
SDL_LOG_CATEGORY_APPLICATION, \
|
||||
"EGLRenderer: " __VA_ARGS__)
|
||||
|
||||
SDL_Window* EGLRenderer::s_LastFailedWindow = nullptr;
|
||||
|
||||
EGLRenderer::EGLRenderer(IFFmpegRenderer *backendRenderer)
|
||||
:
|
||||
m_SwPixelFormat(AV_PIX_FMT_NONE),
|
||||
m_EGLDisplay(EGL_NO_DISPLAY),
|
||||
m_Textures{0},
|
||||
m_ShaderProgram(0),
|
||||
m_Context(0),
|
||||
m_Window(nullptr),
|
||||
m_Backend(backendRenderer),
|
||||
m_VAO(0),
|
||||
m_ColorSpace(AVCOL_SPC_NB),
|
||||
m_ColorFull(false),
|
||||
m_BlockingSwapBuffers(false),
|
||||
m_glEGLImageTargetTexture2DOES(nullptr),
|
||||
m_glGenVertexArraysOES(nullptr),
|
||||
m_glBindVertexArrayOES(nullptr),
|
||||
m_glDeleteVertexArraysOES(nullptr),
|
||||
m_DummyRenderer(nullptr)
|
||||
{
|
||||
SDL_assert(backendRenderer);
|
||||
SDL_assert(backendRenderer->canExportEGL());
|
||||
|
||||
// Save these global parameters so we can restore them in our destructor
|
||||
SDL_GL_GetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, &m_OldContextProfileMask);
|
||||
SDL_GL_GetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, &m_OldContextMajorVersion);
|
||||
SDL_GL_GetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, &m_OldContextMinorVersion);
|
||||
}
|
||||
|
||||
EGLRenderer::~EGLRenderer()
|
||||
{
|
||||
if (m_Context) {
|
||||
// Reattach the GL context to the main thread for destruction
|
||||
SDL_GL_MakeCurrent(m_Window, m_Context);
|
||||
if (m_ShaderProgram) {
|
||||
glDeleteProgram(m_ShaderProgram);
|
||||
}
|
||||
if (m_VAO) {
|
||||
SDL_assert(m_glDeleteVertexArraysOES != nullptr);
|
||||
m_glDeleteVertexArraysOES(1, &m_VAO);
|
||||
}
|
||||
SDL_GL_DeleteContext(m_Context);
|
||||
}
|
||||
|
||||
if (m_DummyRenderer) {
|
||||
SDL_DestroyRenderer(m_DummyRenderer);
|
||||
}
|
||||
|
||||
// Reset the global properties back to what they were before
|
||||
SDL_SetHint(SDL_HINT_OPENGL_ES_DRIVER, "0");
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, m_OldContextProfileMask);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, m_OldContextMajorVersion);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, m_OldContextMinorVersion);
|
||||
}
|
||||
|
||||
bool EGLRenderer::prepareDecoderContext(AVCodecContext*, AVDictionary**)
|
||||
{
|
||||
/* Nothing to do */
|
||||
|
||||
EGL_LOG(Info, "Using EGL renderer");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void EGLRenderer::notifyOverlayUpdated(Overlay::OverlayType)
|
||||
{
|
||||
// TODO: FIXME
|
||||
}
|
||||
|
||||
bool EGLRenderer::isPixelFormatSupported(int, AVPixelFormat pixelFormat)
|
||||
{
|
||||
// Remember to keep this in sync with EGLRenderer::renderFrame()!
|
||||
switch (pixelFormat)
|
||||
{
|
||||
case AV_PIX_FMT_NV12:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int EGLRenderer::loadAndBuildShader(int shaderType,
|
||||
const char *file) {
|
||||
GLuint shader = glCreateShader(shaderType);
|
||||
if (!shader || shader == GL_INVALID_ENUM) {
|
||||
EGL_LOG(Error, "Can't create shader: %d", glGetError());
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto sourceData = Path::readDataFile(file);
|
||||
GLint len = sourceData.size();
|
||||
const char *buf = sourceData.data();
|
||||
|
||||
glShaderSource(shader, 1, &buf, &len);
|
||||
glCompileShader(shader);
|
||||
GLint status;
|
||||
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
|
||||
if (!status) {
|
||||
char shaderLog[512];
|
||||
glGetShaderInfoLog(shader, sizeof (shaderLog), nullptr, shaderLog);
|
||||
EGL_LOG(Error, "Cannot load shader \"%s\": %s", file, shaderLog);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return shader;
|
||||
}
|
||||
|
||||
bool EGLRenderer::openDisplay(unsigned int platform, void* nativeDisplay)
|
||||
{
|
||||
PFNEGLGETPLATFORMDISPLAYPROC eglGetPlatformDisplayProc;
|
||||
PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXTProc;
|
||||
|
||||
m_EGLDisplay = EGL_NO_DISPLAY;
|
||||
|
||||
// NB: eglGetPlatformDisplay() and eglGetPlatformDisplayEXT() have slightly different definitions
|
||||
eglGetPlatformDisplayProc = (typeof(eglGetPlatformDisplayProc))eglGetProcAddress("eglGetPlatformDisplay");
|
||||
eglGetPlatformDisplayEXTProc = (typeof(eglGetPlatformDisplayEXTProc))eglGetProcAddress("eglGetPlatformDisplayEXT");
|
||||
|
||||
if (m_EGLDisplay == EGL_NO_DISPLAY) {
|
||||
// eglGetPlatformDisplay() is part of the EGL 1.5 core specification
|
||||
if (eglGetPlatformDisplayProc != nullptr) {
|
||||
m_EGLDisplay = eglGetPlatformDisplayProc(platform, nativeDisplay, nullptr);
|
||||
if (m_EGLDisplay == EGL_NO_DISPLAY) {
|
||||
EGL_LOG(Warn, "eglGetPlatformDisplay() failed: %d", eglGetError());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_EGLDisplay == EGL_NO_DISPLAY) {
|
||||
// eglGetPlatformDisplayEXT() is an extension for EGL 1.4
|
||||
const EGLExtensions eglExtensions(EGL_NO_DISPLAY);
|
||||
if (eglExtensions.isSupported("EGL_EXT_platform_base")) {
|
||||
if (eglGetPlatformDisplayEXTProc != nullptr) {
|
||||
m_EGLDisplay = eglGetPlatformDisplayEXTProc(platform, nativeDisplay, nullptr);
|
||||
if (m_EGLDisplay == EGL_NO_DISPLAY) {
|
||||
EGL_LOG(Warn, "eglGetPlatformDisplayEXT() failed: %d", eglGetError());
|
||||
}
|
||||
}
|
||||
else {
|
||||
EGL_LOG(Warn, "EGL_EXT_platform_base supported but no eglGetPlatformDisplayEXT() export!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_EGLDisplay == EGL_NO_DISPLAY) {
|
||||
// Finally, if all else fails, use eglGetDisplay()
|
||||
m_EGLDisplay = eglGetDisplay((EGLNativeDisplayType)nativeDisplay);
|
||||
if (m_EGLDisplay == EGL_NO_DISPLAY) {
|
||||
EGL_LOG(Error, "eglGetDisplay() failed: %d", eglGetError());
|
||||
}
|
||||
}
|
||||
|
||||
return m_EGLDisplay != EGL_NO_DISPLAY;
|
||||
}
|
||||
|
||||
bool EGLRenderer::compileShader() {
|
||||
SDL_assert(!m_ShaderProgram);
|
||||
SDL_assert(m_SwPixelFormat != AV_PIX_FMT_NONE);
|
||||
|
||||
// XXX: TODO: other formats
|
||||
SDL_assert(m_SwPixelFormat == AV_PIX_FMT_NV12);
|
||||
|
||||
bool ret = false;
|
||||
|
||||
GLuint vertexShader = loadAndBuildShader(GL_VERTEX_SHADER, "egl.vert");
|
||||
if (!vertexShader)
|
||||
return false;
|
||||
|
||||
GLuint fragmentShader = loadAndBuildShader(GL_FRAGMENT_SHADER, "egl.frag");
|
||||
if (!fragmentShader)
|
||||
goto fragError;
|
||||
|
||||
m_ShaderProgram = glCreateProgram();
|
||||
if (!m_ShaderProgram) {
|
||||
EGL_LOG(Error, "Cannot create shader program");
|
||||
goto progFailCreate;
|
||||
}
|
||||
|
||||
glAttachShader(m_ShaderProgram, vertexShader);
|
||||
glAttachShader(m_ShaderProgram, fragmentShader);
|
||||
glLinkProgram(m_ShaderProgram);
|
||||
int status;
|
||||
glGetProgramiv(m_ShaderProgram, GL_LINK_STATUS, &status);
|
||||
if (status) {
|
||||
ret = true;
|
||||
} else {
|
||||
char shader_log[512];
|
||||
glGetProgramInfoLog(m_ShaderProgram, sizeof (shader_log), nullptr, shader_log);
|
||||
EGL_LOG(Error, "Cannot link shader program: %s", shader_log);
|
||||
glDeleteProgram(m_ShaderProgram);
|
||||
m_ShaderProgram = 0;
|
||||
}
|
||||
|
||||
progFailCreate:
|
||||
glDeleteShader(fragmentShader);
|
||||
fragError:
|
||||
glDeleteShader(vertexShader);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool EGLRenderer::initialize(PDECODER_PARAMETERS params)
|
||||
{
|
||||
m_Window = params->window;
|
||||
|
||||
if (params->videoFormat == VIDEO_FORMAT_H265_MAIN10) {
|
||||
// EGL doesn't support rendering YUV 10-bit textures yet
|
||||
return false;
|
||||
}
|
||||
|
||||
// It's not safe to attempt to opportunistically create a GLES2
|
||||
// renderer prior to 2.0.10. If GLES2 isn't available, SDL will
|
||||
// attempt to dereference a null pointer and crash Moonlight.
|
||||
// https://bugzilla.libsdl.org/show_bug.cgi?id=4350
|
||||
// https://hg.libsdl.org/SDL/rev/84618d571795
|
||||
if (!SDL_VERSION_ATLEAST(2, 0, 10)) {
|
||||
EGL_LOG(Error, "Not supported until SDL 2.0.10");
|
||||
return false;
|
||||
}
|
||||
|
||||
// HACK: Work around bug where renderer will repeatedly fail with:
|
||||
// SDL_CreateRenderer() failed: Could not create GLES window surface
|
||||
if (m_Window == s_LastFailedWindow) {
|
||||
EGL_LOG(Error, "SDL_CreateRenderer() already failed on this window!");
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a dummy renderer in order to craft an accelerated SDL Window.
|
||||
* Request opengl ES 3.0 context, otherwise it will SIGSEGV
|
||||
* https://gitlab.freedesktop.org/mesa/mesa/issues/1011
|
||||
*/
|
||||
SDL_SetHint(SDL_HINT_OPENGL_ES_DRIVER, "1");
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
|
||||
|
||||
int renderIndex;
|
||||
int maxRenderers = SDL_GetNumRenderDrivers();
|
||||
SDL_assert(maxRenderers >= 0);
|
||||
|
||||
SDL_RendererInfo renderInfo;
|
||||
for (renderIndex = 0; renderIndex < maxRenderers; ++renderIndex) {
|
||||
if (SDL_GetRenderDriverInfo(renderIndex, &renderInfo))
|
||||
continue;
|
||||
if (!strcmp(renderInfo.name, "opengles2")) {
|
||||
SDL_assert(renderInfo.flags & SDL_RENDERER_ACCELERATED);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (renderIndex == maxRenderers) {
|
||||
EGL_LOG(Error, "Could not find a suitable SDL_Renderer");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(m_DummyRenderer = SDL_CreateRenderer(m_Window, renderIndex, SDL_RENDERER_ACCELERATED))) {
|
||||
EGL_LOG(Error, "SDL_CreateRenderer() failed: %s", SDL_GetError());
|
||||
s_LastFailedWindow = m_Window;
|
||||
return false;
|
||||
}
|
||||
|
||||
SDL_SysWMinfo info;
|
||||
SDL_VERSION(&info.version);
|
||||
if (!SDL_GetWindowWMInfo(params->window, &info)) {
|
||||
EGL_LOG(Error, "SDL_GetWindowWMInfo() failed: %s", SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
switch (info.subsystem) {
|
||||
#ifdef SDL_VIDEO_DRIVER_WAYLAND
|
||||
case SDL_SYSWM_WAYLAND:
|
||||
if (!openDisplay(EGL_PLATFORM_WAYLAND_KHR, info.info.wl.display)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef SDL_VIDEO_DRIVER_X11
|
||||
case SDL_SYSWM_X11:
|
||||
if (!openDisplay(EGL_PLATFORM_X11_KHR, info.info.x11.display)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
EGL_LOG(Error, "not compatible with SYSWM");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_EGLDisplay == EGL_NO_DISPLAY) {
|
||||
EGL_LOG(Error, "Cannot get EGL display: %d", eglGetError());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(m_Context = SDL_GL_CreateContext(params->window))) {
|
||||
EGL_LOG(Error, "Cannot create OpenGL context: %s", SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
if (SDL_GL_MakeCurrent(params->window, m_Context)) {
|
||||
EGL_LOG(Error, "Cannot use created EGL context: %s", SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
|
||||
const EGLExtensions eglExtensions(m_EGLDisplay);
|
||||
if (!eglExtensions.isSupported("EGL_KHR_image_base") &&
|
||||
!eglExtensions.isSupported("EGL_KHR_image")) {
|
||||
EGL_LOG(Error, "EGL_KHR_image unsupported");
|
||||
return false;
|
||||
}
|
||||
else if (!SDL_GL_ExtensionSupported("GL_OES_EGL_image")) {
|
||||
EGL_LOG(Error, "GL_OES_EGL_image unsupported");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_Backend->initializeEGL(m_EGLDisplay, eglExtensions))
|
||||
return false;
|
||||
|
||||
if (!(m_glEGLImageTargetTexture2DOES = (typeof(m_glEGLImageTargetTexture2DOES))eglGetProcAddress("glEGLImageTargetTexture2DOES"))) {
|
||||
EGL_LOG(Error,
|
||||
"EGL: cannot retrieve `glEGLImageTargetTexture2DOES` address");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Vertex arrays are an extension on OpenGL ES 2.0
|
||||
if (SDL_GL_ExtensionSupported("GL_OES_vertex_array_object")) {
|
||||
m_glGenVertexArraysOES = (typeof(m_glGenVertexArraysOES))eglGetProcAddress("glGenVertexArraysOES");
|
||||
m_glBindVertexArrayOES = (typeof(m_glBindVertexArrayOES))eglGetProcAddress("glBindVertexArrayOES");
|
||||
m_glDeleteVertexArraysOES = (typeof(m_glDeleteVertexArraysOES))eglGetProcAddress("glDeleteVertexArraysOES");
|
||||
}
|
||||
else {
|
||||
// They are included in OpenGL ES 3.0 as part of the standard
|
||||
m_glGenVertexArraysOES = (typeof(m_glGenVertexArraysOES))eglGetProcAddress("glGenVertexArrays");
|
||||
m_glBindVertexArrayOES = (typeof(m_glBindVertexArrayOES))eglGetProcAddress("glBindVertexArray");
|
||||
m_glDeleteVertexArraysOES = (typeof(m_glDeleteVertexArraysOES))eglGetProcAddress("glDeleteVertexArrays");
|
||||
}
|
||||
|
||||
if (!m_glGenVertexArraysOES || !m_glBindVertexArrayOES || !m_glDeleteVertexArraysOES) {
|
||||
EGL_LOG(Error, "Failed to find VAO functions");
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Compute the video region size in order to keep the aspect ratio of the
|
||||
* video stream.
|
||||
*/
|
||||
SDL_Rect src, dst;
|
||||
src.x = src.y = dst.x = dst.y = 0;
|
||||
src.w = params->width;
|
||||
src.h = params->height;
|
||||
SDL_GetWindowSize(m_Window, &dst.w, &dst.h);
|
||||
StreamUtils::scaleSourceToDestinationSurface(&src, &dst);
|
||||
|
||||
glViewport(dst.x, dst.y, dst.w, dst.h);
|
||||
|
||||
glClearColor(0, 0, 0, 1);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
if (params->enableVsync) {
|
||||
SDL_GL_SetSwapInterval(1);
|
||||
m_BlockingSwapBuffers = true;
|
||||
} else {
|
||||
SDL_GL_SetSwapInterval(0);
|
||||
}
|
||||
|
||||
SDL_GL_SwapWindow(params->window);
|
||||
|
||||
glGenTextures(EGL_MAX_PLANES, m_Textures);
|
||||
for (size_t i = 0; i < EGL_MAX_PLANES; ++i) {
|
||||
glBindTexture(GL_TEXTURE_EXTERNAL_OES, m_Textures[i]);
|
||||
glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
}
|
||||
|
||||
GLenum err = glGetError();
|
||||
if (err != GL_NO_ERROR)
|
||||
EGL_LOG(Error, "OpenGL error: %d", err);
|
||||
|
||||
// Detach the context from this thread, so the render thread can attach it
|
||||
SDL_GL_MakeCurrent(m_Window, nullptr);
|
||||
|
||||
return err == GL_NO_ERROR;
|
||||
}
|
||||
|
||||
const float *EGLRenderer::getColorMatrix() {
|
||||
/* The conversion matrices are shamelessly stolen from linux:
|
||||
* drivers/media/platform/imx-pxp.c:pxp_setup_csc
|
||||
*/
|
||||
static const float bt601Lim[] = {
|
||||
1.1644f, 1.1644f, 1.1644f,
|
||||
0.0f, -0.3917f, 2.0172f,
|
||||
1.5960f, -0.8129f, 0.0f
|
||||
};
|
||||
static const float bt601Full[] = {
|
||||
1.0f, 1.0f, 1.0f,
|
||||
0.0f, -0.3441f, 1.7720f,
|
||||
1.4020f, -0.7141f, 0.0f
|
||||
};
|
||||
static const float bt709Lim[] = {
|
||||
1.1644f, 1.1644f, 1.1644f,
|
||||
0.0f, -0.2132f, 2.1124f,
|
||||
1.7927f, -0.5329f, 0.0f
|
||||
};
|
||||
static const float bt709Full[] = {
|
||||
1.0f, 1.0f, 1.0f,
|
||||
0.0f, -0.1873f, 1.8556f,
|
||||
1.5748f, -0.4681f, 0.0f
|
||||
};
|
||||
static const float bt2020Lim[] = {
|
||||
1.1644f, 1.1644f, 1.1644f,
|
||||
0.0f, -0.1874f, 2.1418f,
|
||||
1.6781f, -0.6505f, 0.0f
|
||||
};
|
||||
static const float bt2020Full[] = {
|
||||
1.0f, 1.0f, 1.0f,
|
||||
0.0f, -0.1646f, 1.8814f,
|
||||
1.4746f, -0.5714f, 0.0f
|
||||
};
|
||||
|
||||
switch (m_ColorSpace) {
|
||||
case AVCOL_SPC_SMPTE170M:
|
||||
case AVCOL_SPC_BT470BG:
|
||||
EGL_LOG(Info, "BT-601 pixels");
|
||||
return m_ColorFull ? bt601Full : bt601Lim;
|
||||
case AVCOL_SPC_BT709:
|
||||
EGL_LOG(Info, "BT-709 pixels");
|
||||
return m_ColorFull ? bt709Full : bt709Lim;
|
||||
case AVCOL_SPC_BT2020_NCL:
|
||||
case AVCOL_SPC_BT2020_CL:
|
||||
EGL_LOG(Info, "BT-2020 pixels");
|
||||
return m_ColorFull ? bt2020Full : bt2020Lim;
|
||||
};
|
||||
EGL_LOG(Warn, "unknown color space: %d, falling back to BT-601",
|
||||
m_ColorSpace);
|
||||
return bt601Lim;
|
||||
}
|
||||
|
||||
bool EGLRenderer::specialize() {
|
||||
SDL_assert(!m_VAO);
|
||||
|
||||
// Attach our GL context to the render thread
|
||||
SDL_GL_MakeCurrent(m_Window, m_Context);
|
||||
|
||||
if (!compileShader())
|
||||
return false;
|
||||
|
||||
// The viewport should have the aspect ratio of the video stream
|
||||
static const float vertices[] = {
|
||||
// pos .... // tex coords
|
||||
1.0f, 1.0f, 1.0f, 0.0f,
|
||||
1.0f, -1.0f, 1.0f, 1.0f,
|
||||
-1.0f, -1.0f, 0.0f, 1.0f,
|
||||
-1.0f, 1.0f, 0.0f, 0.0f,
|
||||
|
||||
};
|
||||
static const unsigned int indices[] = {
|
||||
0, 1, 3,
|
||||
1, 2, 3,
|
||||
};
|
||||
|
||||
glUseProgram(m_ShaderProgram);
|
||||
|
||||
unsigned int VBO, EBO;
|
||||
m_glGenVertexArraysOES(1, &m_VAO);
|
||||
glGenBuffers(1, &VBO);
|
||||
glGenBuffers(1, &EBO);
|
||||
|
||||
m_glBindVertexArrayOES(m_VAO);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, VBO);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof (vertices), vertices, GL_STATIC_DRAW);
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof (indices), indices, GL_STATIC_DRAW);
|
||||
|
||||
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)0);
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)(2 * sizeof (float)));
|
||||
glEnableVertexAttribArray(1);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
m_glBindVertexArrayOES(0);
|
||||
|
||||
int yuvmatLocation = glGetUniformLocation(m_ShaderProgram, "yuvmat");
|
||||
glUniformMatrix3fv(yuvmatLocation, 1, GL_FALSE, getColorMatrix());
|
||||
|
||||
static const float limitedOffsets[] = { 16.0f / 255.0f, 128.0f / 255.0f, 128.0f / 255.0f };
|
||||
static const float fullOffsets[] = { 0.0f, 128.0f / 255.0f, 128.0f / 255.0f };
|
||||
|
||||
int offLocation = glGetUniformLocation(m_ShaderProgram, "offset");
|
||||
glUniform3fv(offLocation, 1, m_ColorFull ? fullOffsets : limitedOffsets);
|
||||
|
||||
int colorPlane = glGetUniformLocation(m_ShaderProgram, "plane1");
|
||||
glUniform1i(colorPlane, 0);
|
||||
colorPlane = glGetUniformLocation(m_ShaderProgram, "plane2");
|
||||
glUniform1i(colorPlane, 1);
|
||||
|
||||
glDeleteBuffers(1, &VBO);
|
||||
glDeleteBuffers(1, &EBO);
|
||||
|
||||
GLenum err = glGetError();
|
||||
if (err != GL_NO_ERROR) {
|
||||
EGL_LOG(Error, "OpenGL error: %d", err);
|
||||
}
|
||||
|
||||
return err == GL_NO_ERROR;
|
||||
}
|
||||
|
||||
void EGLRenderer::renderFrame(AVFrame* frame)
|
||||
{
|
||||
EGLImage imgs[EGL_MAX_PLANES];
|
||||
|
||||
if (frame == nullptr) {
|
||||
// End of stream - unbind the GL context
|
||||
SDL_GL_MakeCurrent(m_Window, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (frame->hw_frames_ctx != nullptr) {
|
||||
// Find the native read-back format and load the shader
|
||||
if (m_SwPixelFormat == AV_PIX_FMT_NONE) {
|
||||
auto hwFrameCtx = (AVHWFramesContext*)frame->hw_frames_ctx->data;
|
||||
|
||||
m_SwPixelFormat = hwFrameCtx->sw_format;
|
||||
SDL_assert(m_SwPixelFormat != AV_PIX_FMT_NONE);
|
||||
|
||||
EGL_LOG(Info, "Selected read-back format: %d", m_SwPixelFormat);
|
||||
|
||||
// XXX: TODO: Handle other pixel formats
|
||||
SDL_assert(m_SwPixelFormat == AV_PIX_FMT_NV12);
|
||||
m_ColorSpace = frame->colorspace;
|
||||
m_ColorFull = frame->color_range == AVCOL_RANGE_JPEG;
|
||||
|
||||
if (!specialize()) {
|
||||
m_SwPixelFormat = AV_PIX_FMT_NONE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ssize_t plane_count = m_Backend->exportEGLImages(frame, m_EGLDisplay, imgs);
|
||||
if (plane_count < 0)
|
||||
return;
|
||||
for (ssize_t i = 0; i < plane_count; ++i) {
|
||||
glActiveTexture(GL_TEXTURE0 + i);
|
||||
glBindTexture(GL_TEXTURE_EXTERNAL_OES, m_Textures[i]);
|
||||
m_glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, imgs[i]);
|
||||
}
|
||||
} else {
|
||||
// TODO: load texture for SW decoding ?
|
||||
EGL_LOG(Error, "EGL rendering only supports hw frames");
|
||||
return;
|
||||
}
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glUseProgram(m_ShaderProgram);
|
||||
m_glBindVertexArrayOES(m_VAO);
|
||||
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
|
||||
|
||||
SDL_GL_SwapWindow(m_Window);
|
||||
|
||||
if (m_BlockingSwapBuffers) {
|
||||
// This glClear() forces us to block until the buffer swap is
|
||||
// complete to continue rendering. Mesa won't actually wait
|
||||
// for the swap with just glFinish() alone. Waiting here keeps us
|
||||
// in lock step with the display refresh rate. If we don't wait
|
||||
// here, we'll stall on the first GL call next frame. Doing the
|
||||
// wait here instead allows more time for a newer frame to arrive
|
||||
// for next renderFrame() call.
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glFinish();
|
||||
}
|
||||
|
||||
if (frame->hw_frames_ctx != nullptr)
|
||||
m_Backend->freeEGLImages(m_EGLDisplay, imgs);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
|
||||
#include "renderer.h"
|
||||
|
||||
#include <SDL_opengles2.h>
|
||||
#include <SDL_opengles2_gl2ext.h>
|
||||
|
||||
class EGLRenderer : public IFFmpegRenderer {
|
||||
public:
|
||||
EGLRenderer(IFFmpegRenderer *backendRenderer);
|
||||
virtual ~EGLRenderer() override;
|
||||
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
||||
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary** options) override;
|
||||
virtual void renderFrame(AVFrame* frame) override;
|
||||
virtual void notifyOverlayUpdated(Overlay::OverlayType) override;
|
||||
virtual bool isPixelFormatSupported(int videoFormat, enum AVPixelFormat pixelFormat) override;
|
||||
|
||||
private:
|
||||
|
||||
bool compileShader();
|
||||
bool specialize();
|
||||
const float *getColorMatrix();
|
||||
static int loadAndBuildShader(int shaderType, const char *filename);
|
||||
bool openDisplay(unsigned int platform, void* nativeDisplay);
|
||||
|
||||
int m_SwPixelFormat;
|
||||
void *m_EGLDisplay;
|
||||
unsigned m_Textures[EGL_MAX_PLANES];
|
||||
unsigned m_ShaderProgram;
|
||||
SDL_GLContext m_Context;
|
||||
SDL_Window *m_Window;
|
||||
IFFmpegRenderer *m_Backend;
|
||||
unsigned int m_VAO;
|
||||
int m_ColorSpace;
|
||||
bool m_ColorFull;
|
||||
bool m_BlockingSwapBuffers;
|
||||
PFNGLEGLIMAGETARGETTEXTURE2DOESPROC m_glEGLImageTargetTexture2DOES;
|
||||
PFNGLGENVERTEXARRAYSOESPROC m_glGenVertexArraysOES;
|
||||
PFNGLBINDVERTEXARRAYOESPROC m_glBindVertexArrayOES;
|
||||
PFNGLDELETEVERTEXARRAYSOESPROC m_glDeleteVertexArraysOES;
|
||||
|
||||
int m_OldContextProfileMask;
|
||||
int m_OldContextMajorVersion;
|
||||
int m_OldContextMinorVersion;
|
||||
|
||||
SDL_Renderer *m_DummyRenderer;
|
||||
|
||||
// HACK: Work around bug where renderer will repeatedly fail with:
|
||||
// SDL_CreateRenderer() failed: Could not create GLES window surface
|
||||
static SDL_Window* s_LastFailedWindow;
|
||||
};
|
||||
@@ -22,9 +22,16 @@ MmalRenderer::~MmalRenderer()
|
||||
}
|
||||
}
|
||||
|
||||
bool MmalRenderer::prepareDecoderContext(AVCodecContext*)
|
||||
bool MmalRenderer::prepareDecoderContext(AVCodecContext* context, AVDictionary** options)
|
||||
{
|
||||
/* Nothing to do */
|
||||
// FFmpeg defaults this to 10 which is too large to fit in the default 64 MB VRAM split.
|
||||
// Reducing to 2 seems to work fine for our bitstreams (max of 1 buffered frame needed).
|
||||
av_dict_set_int(options, "extra_buffers", 2, 0);
|
||||
|
||||
// MMAL seems to dislike certain initial width and height values, but it seems okay
|
||||
// with getting zero for the width and height. We'll zero them all the time to be safe.
|
||||
context->width = 0;
|
||||
context->height = 0;
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Using MMAL renderer");
|
||||
@@ -82,7 +89,7 @@ bool MmalRenderer::initialize(PDECODER_PARAMETERS params)
|
||||
dr.alpha = 255;
|
||||
|
||||
dr.set |= MMAL_DISPLAY_SET_FULLSCREEN;
|
||||
dr.fullscreen = (SDL_GetWindowFlags(params->window) & SDL_WINDOW_FULLSCREEN) != 0;
|
||||
dr.fullscreen = true;
|
||||
|
||||
{
|
||||
SDL_Rect src, dst;
|
||||
@@ -125,6 +132,12 @@ enum AVPixelFormat MmalRenderer::getPreferredPixelFormat(int videoFormat)
|
||||
return AV_PIX_FMT_MMAL;
|
||||
}
|
||||
|
||||
int MmalRenderer::getRendererAttributes()
|
||||
{
|
||||
// This renderer can only draw in full-screen and maxes out at 1080p
|
||||
return RENDERER_ATTRIBUTE_FULLSCREEN_ONLY | RENDERER_ATTRIBUTE_1080P_MAX;
|
||||
}
|
||||
|
||||
bool MmalRenderer::needsTestFrame()
|
||||
{
|
||||
// We won't be able to decode if the GPU memory is 64 MB or lower,
|
||||
@@ -134,6 +147,11 @@ bool MmalRenderer::needsTestFrame()
|
||||
|
||||
void MmalRenderer::renderFrame(AVFrame* frame)
|
||||
{
|
||||
if (frame == nullptr) {
|
||||
// End of stream - nothing to do for us
|
||||
return;
|
||||
}
|
||||
|
||||
MMAL_BUFFER_HEADER_T* buffer = (MMAL_BUFFER_HEADER_T*)frame->data[3];
|
||||
MMAL_STATUS_T status;
|
||||
|
||||
|
||||
@@ -12,10 +12,11 @@ public:
|
||||
MmalRenderer();
|
||||
virtual ~MmalRenderer() override;
|
||||
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
||||
virtual bool prepareDecoderContext(AVCodecContext* context) override;
|
||||
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary** options) override;
|
||||
virtual void renderFrame(AVFrame* frame) override;
|
||||
virtual enum AVPixelFormat getPreferredPixelFormat(int videoFormat) override;
|
||||
virtual bool needsTestFrame() override;
|
||||
virtual int getRendererAttributes() override;
|
||||
|
||||
private:
|
||||
static void InputPortCallback(MMAL_PORT_T* port, MMAL_BUFFER_HEADER_T* buffer);
|
||||
|
||||
@@ -45,6 +45,10 @@ Pacer::~Pacer()
|
||||
m_RenderQueueNotEmpty.wakeAll();
|
||||
SDL_WaitThread(m_RenderThread, nullptr);
|
||||
}
|
||||
else {
|
||||
// Send a null AVFrame to indicate end of stream on the main thread
|
||||
m_VsyncRenderer->renderFrame(nullptr);
|
||||
}
|
||||
|
||||
// Delete any remaining unconsumed frames
|
||||
while (!m_RenderQueue.isEmpty()) {
|
||||
@@ -106,6 +110,9 @@ int Pacer::renderThread(void* context)
|
||||
me->renderLastFrameAndUnlock();
|
||||
}
|
||||
|
||||
// Send a null AVFrame to indicate end of stream on the render thread
|
||||
me->m_VsyncRenderer->renderFrame(nullptr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,16 +9,30 @@ extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
}
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
// SDL_egl.h have too many conflicts, we will do without
|
||||
typedef void *EGLDisplay;
|
||||
typedef void *EGLImage;
|
||||
#define EGL_MAX_PLANES 4
|
||||
|
||||
class EGLExtensions {
|
||||
public:
|
||||
EGLExtensions(EGLDisplay dpy);
|
||||
~EGLExtensions() {}
|
||||
bool isSupported(const QString &extension) const;
|
||||
private:
|
||||
const QStringList m_Extensions;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#define RENDERER_ATTRIBUTE_FULLSCREEN_ONLY 0x01
|
||||
#define RENDERER_ATTRIBUTE_1080P_MAX 0x02
|
||||
|
||||
class IFFmpegRenderer : public Overlay::IOverlayRenderer {
|
||||
public:
|
||||
enum FramePacingConstraint {
|
||||
PACING_FORCE_OFF,
|
||||
PACING_FORCE_ON,
|
||||
PACING_ANY
|
||||
};
|
||||
|
||||
virtual bool initialize(PDECODER_PARAMETERS params) = 0;
|
||||
virtual bool prepareDecoderContext(AVCodecContext* context) = 0;
|
||||
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary** options) = 0;
|
||||
virtual void renderFrame(AVFrame* frame) = 0;
|
||||
|
||||
virtual bool needsTestFrame() {
|
||||
@@ -31,16 +45,16 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual int getRendererAttributes() {
|
||||
// No special attributes by default
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual int getDecoderColorspace() {
|
||||
// Rec 601 is default
|
||||
return COLORSPACE_REC_601;
|
||||
}
|
||||
|
||||
virtual FramePacingConstraint getFramePacingConstraint() {
|
||||
// No pacing preference
|
||||
return PACING_ANY;
|
||||
}
|
||||
|
||||
virtual bool isRenderThreadSupported() {
|
||||
// Render thread is supported by default
|
||||
return true;
|
||||
@@ -62,8 +76,34 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool isPixelFormatSupported(int videoFormat, enum AVPixelFormat pixelFormat) {
|
||||
// By default, we only support the preferred pixel format
|
||||
return getPreferredPixelFormat(videoFormat) == pixelFormat;
|
||||
}
|
||||
|
||||
// IOverlayRenderer
|
||||
virtual void notifyOverlayUpdated(Overlay::OverlayType) override {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
// By default we can't do EGL
|
||||
virtual bool canExportEGL() {
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool initializeEGL(EGLDisplay,
|
||||
const EGLExtensions &) {
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual ssize_t exportEGLImages(AVFrame *,
|
||||
EGLDisplay,
|
||||
EGLImage[EGL_MAX_PLANES]) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Free the ressources allocated during the last `exportEGLImages` call
|
||||
virtual void freeEGLImages(EGLDisplay, EGLImage[EGL_MAX_PLANES]) {}
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "sdlvid.h"
|
||||
|
||||
#include "streaming/session.h"
|
||||
#include "streaming/streamutils.h"
|
||||
#include "path.h"
|
||||
|
||||
#include <QDir>
|
||||
@@ -58,7 +59,7 @@ SdlRenderer::~SdlRenderer()
|
||||
}
|
||||
}
|
||||
|
||||
bool SdlRenderer::prepareDecoderContext(AVCodecContext*)
|
||||
bool SdlRenderer::prepareDecoderContext(AVCodecContext*, AVDictionary**)
|
||||
{
|
||||
/* Nothing to do */
|
||||
|
||||
@@ -127,14 +128,19 @@ bool SdlRenderer::isRenderThreadSupported()
|
||||
return true;
|
||||
}
|
||||
|
||||
int SdlRenderer::getDecoderCapabilities()
|
||||
bool SdlRenderer::isPixelFormatSupported(int, AVPixelFormat pixelFormat)
|
||||
{
|
||||
// Slice up to 4 times for parallel decode, once slice per core
|
||||
int slices = qMin(MAX_SLICES, SDL_GetCPUCount());
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Encoder configured for %d slices per frame",
|
||||
slices);
|
||||
return CAPABILITY_SLICES_PER_FRAME(slices);
|
||||
// Remember to keep this in sync with SdlRenderer::renderFrame()!
|
||||
switch (pixelFormat)
|
||||
{
|
||||
case AV_PIX_FMT_YUV420P:
|
||||
case AV_PIX_FMT_NV12:
|
||||
case AV_PIX_FMT_NV21:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool SdlRenderer::initialize(PDECODER_PARAMETERS params)
|
||||
@@ -171,9 +177,26 @@ bool SdlRenderer::initialize(PDECODER_PARAMETERS params)
|
||||
return false;
|
||||
}
|
||||
|
||||
// The window may be smaller than the stream size, so ensure our
|
||||
// logical rendering surface size is equal to the stream size
|
||||
SDL_RenderSetLogicalSize(m_Renderer, params->width, params->height);
|
||||
// SDL_CreateRenderer() can end up having to recreate our window (SDL_RecreateWindow())
|
||||
// to ensure it's compatible with the renderer's OpenGL context. If that happens, we
|
||||
// can get spurious SDL_WINDOWEVENT events that will cause us to (again) recreate our
|
||||
// renderer. This can lead to an infinite to renderer recreation, so discard all
|
||||
// SDL_WINDOWEVENT events after SDL_CreateRenderer().
|
||||
SDL_PumpEvents();
|
||||
SDL_FlushEvent(SDL_WINDOWEVENT);
|
||||
|
||||
// Calculate the video region size, scaling to fill the output size while
|
||||
// preserving the aspect ratio of the video stream.
|
||||
SDL_Rect src, dst;
|
||||
src.x = src.y = 0;
|
||||
src.w = params->width;
|
||||
src.h = params->height;
|
||||
dst.x = dst.y = 0;
|
||||
SDL_GetRendererOutputSize(m_Renderer, &dst.w, &dst.h);
|
||||
StreamUtils::scaleSourceToDestinationSurface(&src, &dst);
|
||||
|
||||
// Ensure the viewport is set to the desired video region
|
||||
SDL_RenderSetViewport(m_Renderer, &dst);
|
||||
|
||||
// Draw a black frame until the video stream starts rendering
|
||||
SDL_SetRenderDrawColor(m_Renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
||||
@@ -206,10 +229,10 @@ void SdlRenderer::renderOverlay(Overlay::OverlayType type)
|
||||
|
||||
if (type == Overlay::OverlayStatusUpdate) {
|
||||
// Bottom Left
|
||||
int unused;
|
||||
SDL_RenderGetLogicalSize(m_Renderer, &unused, &m_OverlayRects[type].y);
|
||||
SDL_Rect viewportRect;
|
||||
SDL_RenderGetViewport(m_Renderer, &viewportRect);
|
||||
m_OverlayRects[type].x = 0;
|
||||
m_OverlayRects[type].y -= surface->h;
|
||||
m_OverlayRects[type].y = viewportRect.h - surface->h;
|
||||
}
|
||||
else if (type == Overlay::OverlayDebug) {
|
||||
// Top left
|
||||
@@ -236,6 +259,11 @@ void SdlRenderer::renderFrame(AVFrame* frame)
|
||||
int err;
|
||||
AVFrame* swFrame = nullptr;
|
||||
|
||||
if (frame == nullptr) {
|
||||
// End of stream - nothing to do for us
|
||||
return;
|
||||
}
|
||||
|
||||
if (frame->hw_frames_ctx != nullptr) {
|
||||
// If we are acting as the frontend for a hardware
|
||||
// accelerated decoder, we'll need to read the frame
|
||||
@@ -281,6 +309,7 @@ void SdlRenderer::renderFrame(AVFrame* frame)
|
||||
if (m_Texture == nullptr) {
|
||||
Uint32 sdlFormat;
|
||||
|
||||
// Remember to keep this in sync with SdlRenderer::isPixelFormatSupported()!
|
||||
switch (frame->format)
|
||||
{
|
||||
case AV_PIX_FMT_YUV420P:
|
||||
|
||||
@@ -9,11 +9,11 @@ public:
|
||||
SdlRenderer();
|
||||
virtual ~SdlRenderer() override;
|
||||
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
||||
virtual bool prepareDecoderContext(AVCodecContext* context) override;
|
||||
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary** options) override;
|
||||
virtual void renderFrame(AVFrame* frame) override;
|
||||
virtual void notifyOverlayUpdated(Overlay::OverlayType) override;
|
||||
virtual bool isRenderThreadSupported() override;
|
||||
virtual int getDecoderCapabilities() override;
|
||||
virtual bool isPixelFormatSupported(int videoFormat, enum AVPixelFormat pixelFormat) override;
|
||||
|
||||
private:
|
||||
void renderOverlay(Overlay::OverlayType type);
|
||||
|
||||
@@ -1,18 +1,27 @@
|
||||
#include <QString>
|
||||
|
||||
#include "vaapi.h"
|
||||
#include "utils.h"
|
||||
#include <streaming/streamutils.h>
|
||||
|
||||
#include <SDL_syswm.h>
|
||||
#ifdef HAVE_EGL
|
||||
#include <SDL_egl.h>
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
VAAPIRenderer::VAAPIRenderer()
|
||||
: m_HwContext(nullptr),
|
||||
m_DrmFd(-1)
|
||||
m_DrmFd(-1),
|
||||
m_BlacklistedForDirectRendering(false)
|
||||
{
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
m_PrimeDescriptor.num_layers = 0;
|
||||
m_PrimeDescriptor.num_objects = 0;
|
||||
m_EGLExtDmaBuf = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
VAAPIRenderer::~VAAPIRenderer()
|
||||
@@ -36,26 +45,106 @@ VAAPIRenderer::~VAAPIRenderer()
|
||||
}
|
||||
}
|
||||
|
||||
VADisplay
|
||||
VAAPIRenderer::openDisplay(SDL_Window* window)
|
||||
{
|
||||
SDL_SysWMinfo info;
|
||||
VADisplay display;
|
||||
|
||||
SDL_VERSION(&info.version);
|
||||
|
||||
if (!SDL_GetWindowWMInfo(window, &info)) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"SDL_GetWindowWMInfo() failed: %s",
|
||||
SDL_GetError());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
m_WindowSystem = info.subsystem;
|
||||
if (info.subsystem == SDL_SYSWM_X11) {
|
||||
m_XWindow = info.info.x11.window;
|
||||
#ifdef HAVE_LIBVA_X11
|
||||
display = vaGetDisplay(info.info.x11.display);
|
||||
if (display == nullptr) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Unable to open X11 display for VAAPI");
|
||||
return nullptr;
|
||||
}
|
||||
#else
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Moonlight not compiled with VAAPI X11 support!");
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
else if (info.subsystem == SDL_SYSWM_WAYLAND) {
|
||||
#ifdef HAVE_LIBVA_WAYLAND
|
||||
display = vaGetDisplayWl(info.info.wl.display);
|
||||
if (display == nullptr) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Unable to open Wayland display for VAAPI");
|
||||
return nullptr;
|
||||
}
|
||||
#else
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Moonlight not compiled with VAAPI Wayland support!");
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
// TODO: Upstream a better solution for SDL_GetWindowWMInfo on KMSDRM
|
||||
else if (strcmp(SDL_GetCurrentVideoDriver(), "KMSDRM") == 0) {
|
||||
#ifdef HAVE_LIBVA_DRM
|
||||
if (m_DrmFd < 0) {
|
||||
const char* device = SDL_getenv("DRM_DEV");
|
||||
|
||||
if (device == nullptr) {
|
||||
device = "/dev/dri/card0";
|
||||
}
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Opening DRM device: %s",
|
||||
device);
|
||||
|
||||
m_DrmFd = open(device, O_RDWR | O_CLOEXEC);
|
||||
if (m_DrmFd < 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Failed to open DRM device: %d",
|
||||
errno);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
display = vaGetDisplayDRM(m_DrmFd);
|
||||
if (display == nullptr) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Unable to open DRM display for VAAPI");
|
||||
return nullptr;
|
||||
}
|
||||
#else
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Moonlight not compiled with VAAPI DRM support!");
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Unsupported VAAPI rendering subsystem: %d",
|
||||
info.subsystem);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return display;
|
||||
}
|
||||
|
||||
bool
|
||||
VAAPIRenderer::initialize(PDECODER_PARAMETERS params)
|
||||
{
|
||||
int err;
|
||||
SDL_SysWMinfo info;
|
||||
|
||||
m_VideoWidth = params->width;
|
||||
m_VideoHeight = params->height;
|
||||
|
||||
SDL_GetWindowSize(params->window, &m_DisplayWidth, &m_DisplayHeight);
|
||||
|
||||
SDL_VERSION(&info.version);
|
||||
|
||||
if (!SDL_GetWindowWMInfo(params->window, &info)) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"SDL_GetWindowWMInfo() failed: %s",
|
||||
SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
|
||||
m_HwContext = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_VAAPI);
|
||||
if (!m_HwContext) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
@@ -66,79 +155,93 @@ VAAPIRenderer::initialize(PDECODER_PARAMETERS params)
|
||||
AVHWDeviceContext* deviceContext = (AVHWDeviceContext*)m_HwContext->data;
|
||||
AVVAAPIDeviceContext* vaDeviceContext = (AVVAAPIDeviceContext*)deviceContext->hwctx;
|
||||
|
||||
m_WindowSystem = info.subsystem;
|
||||
if (info.subsystem == SDL_SYSWM_X11) {
|
||||
#ifdef HAVE_LIBVA_X11
|
||||
m_XWindow = info.info.x11.window;
|
||||
vaDeviceContext->display = vaGetDisplay(info.info.x11.display);
|
||||
if (!vaDeviceContext->display) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Unable to open X11 display for VAAPI");
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Moonlight not compiled with VAAPI X11 support!");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
else if (info.subsystem == SDL_SYSWM_WAYLAND) {
|
||||
#ifdef HAVE_LIBVA_WAYLAND
|
||||
vaDeviceContext->display = vaGetDisplayWl(info.info.wl.display);
|
||||
if (!vaDeviceContext->display) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Unable to open Wayland display for VAAPI");
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Moonlight not compiled with VAAPI Wayland support!");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
// TODO: Upstream a better solution for SDL_GetWindowWMInfo on KMSDRM
|
||||
else if (strcmp(SDL_GetCurrentVideoDriver(), "KMSDRM") == 0) {
|
||||
#ifdef HAVE_LIBVA_DRM
|
||||
const char* device = SDL_getenv("DRM_DEV");
|
||||
|
||||
if (device == nullptr) {
|
||||
device = "/dev/dri/card0";
|
||||
}
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Opening DRM device: %s",
|
||||
device);
|
||||
|
||||
m_DrmFd = open(device, O_RDWR | O_CLOEXEC);
|
||||
if (m_DrmFd < 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Failed to open DRM device: %d",
|
||||
errno);
|
||||
return false;
|
||||
}
|
||||
|
||||
vaDeviceContext->display = vaGetDisplayDRM(m_DrmFd);
|
||||
if (!vaDeviceContext->display) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Unable to open DRM display for VAAPI");
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Moonlight not compiled with VAAPI DRM support!");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Unsupported VAAPI rendering subsystem: %d",
|
||||
info.subsystem);
|
||||
vaDeviceContext->display = openDisplay(params->window);
|
||||
if (vaDeviceContext->display == nullptr) {
|
||||
// openDisplay() logs the error
|
||||
return false;
|
||||
}
|
||||
|
||||
int major, minor;
|
||||
VAStatus status;
|
||||
status = vaInitialize(vaDeviceContext->display, &major, &minor);
|
||||
bool setPathVar = false;
|
||||
|
||||
for (;;) {
|
||||
status = vaInitialize(vaDeviceContext->display, &major, &minor);
|
||||
if (status != VA_STATUS_SUCCESS && qEnvironmentVariableIsEmpty("LIBVA_DRIVER_NAME")) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Trying fallback VAAPI driver names");
|
||||
|
||||
// It would be nice to use vaSetDriverName() here, but there's no way to unset
|
||||
// it and get back to the default driver selection logic once we've overridden
|
||||
// the driver name using that API. As a result, we must use LIBVA_DRIVER_NAME.
|
||||
|
||||
if (status != VA_STATUS_SUCCESS) {
|
||||
// The iHD driver supports newer hardware like Ice Lake and Comet Lake.
|
||||
// It should be picked by default on those platforms, but that doesn't
|
||||
// always seem to be the case for some reason.
|
||||
qputenv("LIBVA_DRIVER_NAME", "iHD");
|
||||
status = vaInitialize(vaDeviceContext->display, &major, &minor);
|
||||
}
|
||||
|
||||
if (status != VA_STATUS_SUCCESS) {
|
||||
// The Iris driver in Mesa 20.0 returns a bogus VA driver (iris_drv_video.so)
|
||||
// even though the correct driver is still i965. If we hit this path, we'll
|
||||
// explicitly try i965 to handle this case.
|
||||
qputenv("LIBVA_DRIVER_NAME", "i965");
|
||||
status = vaInitialize(vaDeviceContext->display, &major, &minor);
|
||||
}
|
||||
|
||||
if (status != VA_STATUS_SUCCESS) {
|
||||
// The RadeonSI driver is compatible with XWayland but can't be detected by libva
|
||||
// so try it too if all else fails.
|
||||
qputenv("LIBVA_DRIVER_NAME", "radeonsi");
|
||||
status = vaInitialize(vaDeviceContext->display, &major, &minor);
|
||||
}
|
||||
|
||||
if (status != VA_STATUS_SUCCESS) {
|
||||
// Unset LIBVA_DRIVER_NAME if none of the drivers we tried worked. This ensures
|
||||
// we will get a fresh start using the default driver selection behavior after
|
||||
// setting LIBVA_DRIVERS_PATH in the code below.
|
||||
qunsetenv("LIBVA_DRIVER_NAME");
|
||||
}
|
||||
}
|
||||
|
||||
if (status == VA_STATUS_SUCCESS) {
|
||||
// Success!
|
||||
break;
|
||||
}
|
||||
|
||||
if (qEnvironmentVariableIsEmpty("LIBVA_DRIVERS_PATH")) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Trying fallback VAAPI driver paths");
|
||||
|
||||
qputenv("LIBVA_DRIVERS_PATH",
|
||||
#if Q_PROCESSOR_WORDSIZE == 8
|
||||
"/usr/lib64/dri:" // Fedora x86_64
|
||||
"/usr/lib64/va/drivers:" // Gentoo x86_64
|
||||
#endif
|
||||
"/usr/lib/dri:" // Arch i386 & x86_64, Fedora i386
|
||||
"/usr/lib/va/drivers:" // Gentoo i386
|
||||
#if defined(Q_PROCESSOR_X86_64)
|
||||
"/usr/lib/x86_64-linux-gnu/dri:" // Ubuntu/Debian x86_64
|
||||
#elif defined(Q_PROCESSOR_X86_32)
|
||||
"/usr/lib/i386-linux-gnu/dri:" // Ubuntu/Debian i386
|
||||
#endif
|
||||
);
|
||||
setPathVar = true;
|
||||
}
|
||||
else {
|
||||
if (setPathVar) {
|
||||
// Unset LIBVA_DRIVERS_PATH if we set it ourselves
|
||||
// and we didn't find any working VAAPI drivers.
|
||||
qunsetenv("LIBVA_DRIVERS_PATH");
|
||||
}
|
||||
|
||||
// Give up
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (status != VA_STATUS_SUCCESS) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Failed to initialize VAAPI: %d",
|
||||
@@ -151,6 +254,7 @@ VAAPIRenderer::initialize(PDECODER_PARAMETERS params)
|
||||
major, minor);
|
||||
|
||||
const char* vendorString = vaQueryVendorString(vaDeviceContext->display);
|
||||
QString vendorStr(vendorString);
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Driver: %s",
|
||||
vendorString ? vendorString : "<unknown>");
|
||||
@@ -159,9 +263,8 @@ VAAPIRenderer::initialize(PDECODER_PARAMETERS params)
|
||||
// to be leaked for each submitted frame. The Flatpak runtime has a VDPAU
|
||||
// driver in place that works well, so use that instead on AMD systems. If
|
||||
// we're using Wayland, we have no choice but to use VAAPI because VDPAU
|
||||
// is only supported under X11.
|
||||
if (vendorString && qgetenv("FORCE_VAAPI") != "1" && m_WindowSystem == SDL_SYSWM_X11) {
|
||||
QString vendorStr(vendorString);
|
||||
// is only supported under X11 or XWayland.
|
||||
if (qgetenv("FORCE_VAAPI") != "1" && !WMUtils::isRunningWayland()) {
|
||||
if (vendorStr.contains("AMD", Qt::CaseInsensitive) ||
|
||||
vendorStr.contains("Radeon", Qt::CaseInsensitive)) {
|
||||
// Fail and let VDPAU pick this up
|
||||
@@ -171,6 +274,12 @@ VAAPIRenderer::initialize(PDECODER_PARAMETERS params)
|
||||
}
|
||||
}
|
||||
|
||||
if (WMUtils::isRunningWayland()) {
|
||||
// The iHD VAAPI driver can initialize on XWayland but it crashes in
|
||||
// vaPutSurface() so we must also not directly render on XWayland.
|
||||
m_BlacklistedForDirectRendering = vendorStr.contains("iHD");
|
||||
}
|
||||
|
||||
// This will populate the driver_quirks
|
||||
err = av_hwdevice_ctx_init(m_HwContext);
|
||||
if (err < 0) {
|
||||
@@ -192,7 +301,7 @@ VAAPIRenderer::initialize(PDECODER_PARAMETERS params)
|
||||
}
|
||||
|
||||
bool
|
||||
VAAPIRenderer::prepareDecoderContext(AVCodecContext* context)
|
||||
VAAPIRenderer::prepareDecoderContext(AVCodecContext* context, AVDictionary**)
|
||||
{
|
||||
context->hw_device_ctx = av_buffer_ref(m_HwContext);
|
||||
|
||||
@@ -214,9 +323,43 @@ VAAPIRenderer::needsTestFrame()
|
||||
bool
|
||||
VAAPIRenderer::isDirectRenderingSupported()
|
||||
{
|
||||
// Many Wayland renderers don't support YUV surfaces, so use
|
||||
// another frontend renderer to draw our frames.
|
||||
return m_WindowSystem == SDL_SYSWM_X11;
|
||||
if (qgetenv("VAAPI_FORCE_DIRECT") == "1") {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Using direct rendering due to environment variable");
|
||||
return true;
|
||||
}
|
||||
else if (qgetenv("VAAPI_FORCE_INDIRECT") == "1") {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Using indirect rendering due to environment variable");
|
||||
return false;
|
||||
}
|
||||
|
||||
// We only support direct rendering on X11 with VAEntrypointVideoProc support
|
||||
if (m_WindowSystem != SDL_SYSWM_X11 || m_BlacklistedForDirectRendering) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Using indirect rendering due to WM or blacklist");
|
||||
return false;
|
||||
}
|
||||
|
||||
AVHWDeviceContext* deviceContext = (AVHWDeviceContext*)m_HwContext->data;
|
||||
AVVAAPIDeviceContext* vaDeviceContext = (AVVAAPIDeviceContext*)deviceContext->hwctx;
|
||||
VAEntrypoint entrypoints[vaMaxNumEntrypoints(vaDeviceContext->display)];
|
||||
int entrypointCount;
|
||||
VAStatus status = vaQueryConfigEntrypoints(vaDeviceContext->display, VAProfileNone, entrypoints, &entrypointCount);
|
||||
if (status == VA_STATUS_SUCCESS) {
|
||||
for (int i = 0; i < entrypointCount; i++) {
|
||||
// Without VAEntrypointVideoProc support, the driver will crash inside vaPutSurface()
|
||||
if (entrypoints[i] == VAEntrypointVideoProc) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Using direct rendering with VAEntrypointVideoProc");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Using indirect rendering due to lack of VAEntrypointVideoProc");
|
||||
return false;
|
||||
}
|
||||
|
||||
int VAAPIRenderer::getDecoderColorspace()
|
||||
@@ -229,6 +372,11 @@ int VAAPIRenderer::getDecoderColorspace()
|
||||
void
|
||||
VAAPIRenderer::renderFrame(AVFrame* frame)
|
||||
{
|
||||
if (frame == nullptr) {
|
||||
// End of stream - nothing to do for us
|
||||
return;
|
||||
}
|
||||
|
||||
VASurfaceID surface = (VASurfaceID)(uintptr_t)frame->data[3];
|
||||
AVHWDeviceContext* deviceContext = (AVHWDeviceContext*)m_HwContext->data;
|
||||
AVVAAPIDeviceContext* vaDeviceContext = (AVVAAPIDeviceContext*)deviceContext->hwctx;
|
||||
@@ -287,3 +435,173 @@ VAAPIRenderer::renderFrame(AVFrame* frame)
|
||||
SDL_assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
|
||||
// Ensure that vaExportSurfaceHandle() is supported by the VA-API driver
|
||||
bool
|
||||
VAAPIRenderer::canExportEGL() {
|
||||
AVHWDeviceContext* deviceContext = (AVHWDeviceContext*)m_HwContext->data;
|
||||
AVVAAPIDeviceContext* vaDeviceContext = (AVVAAPIDeviceContext*)deviceContext->hwctx;
|
||||
VASurfaceID surfaceId;
|
||||
VAStatus st;
|
||||
VADRMPRIMESurfaceDescriptor descriptor;
|
||||
VASurfaceAttrib attrs[2];
|
||||
int attributeCount = 0;
|
||||
|
||||
if (qgetenv("VAAPI_FORCE_DIRECT") == "1") {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Using direct rendering due to environment variable");
|
||||
return false;
|
||||
}
|
||||
|
||||
// FFmpeg handles setting these quirk flags for us
|
||||
if (!(vaDeviceContext->driver_quirks & AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE)) {
|
||||
attrs[attributeCount].type = VASurfaceAttribMemoryType;
|
||||
attrs[attributeCount].flags = VA_SURFACE_ATTRIB_SETTABLE;
|
||||
attrs[attributeCount].value.type = VAGenericValueTypeInteger;
|
||||
attrs[attributeCount].value.value.i = VA_SURFACE_ATTRIB_MEM_TYPE_VA;
|
||||
attributeCount++;
|
||||
}
|
||||
|
||||
// These attributes are required for i965 to create a surface that can
|
||||
// be successfully exported via vaExportSurfaceHandle(). iHD doesn't
|
||||
// need these, but it doesn't seem to hurt either.
|
||||
attrs[attributeCount].type = VASurfaceAttribPixelFormat;
|
||||
attrs[attributeCount].flags = VA_SURFACE_ATTRIB_SETTABLE;
|
||||
attrs[attributeCount].value.type = VAGenericValueTypeInteger;
|
||||
attrs[attributeCount].value.value.i = VA_FOURCC_NV12;
|
||||
attributeCount++;
|
||||
|
||||
st = vaCreateSurfaces(vaDeviceContext->display,
|
||||
VA_RT_FORMAT_YUV420,
|
||||
1280,
|
||||
720,
|
||||
&surfaceId,
|
||||
1,
|
||||
attrs,
|
||||
attributeCount);
|
||||
if (st != VA_STATUS_SUCCESS) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"vaCreateSurfaces() failed: %d", st);
|
||||
return false;
|
||||
}
|
||||
|
||||
st = vaExportSurfaceHandle(vaDeviceContext->display,
|
||||
surfaceId,
|
||||
VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2,
|
||||
VA_EXPORT_SURFACE_READ_ONLY | VA_EXPORT_SURFACE_SEPARATE_LAYERS,
|
||||
&descriptor);
|
||||
|
||||
vaDestroySurfaces(vaDeviceContext->display, &surfaceId, 1);
|
||||
|
||||
if (st != VA_STATUS_SUCCESS) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"vaExportSurfaceHandle() failed: %d", st);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < descriptor.num_objects; ++i) {
|
||||
close(descriptor.objects[i].fd);
|
||||
}
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"VAAPI driver supports exporting DRM PRIME surface handles");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
VAAPIRenderer::initializeEGL(EGLDisplay,
|
||||
const EGLExtensions &ext) {
|
||||
if (!ext.isSupported("EGL_EXT_image_dma_buf_import")) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"VAAPI-EGL: DMABUF unsupported");
|
||||
return false;
|
||||
}
|
||||
m_EGLExtDmaBuf = ext.isSupported("EGL_EXT_image_dma_buf_import_modifiers");
|
||||
return true;
|
||||
}
|
||||
|
||||
ssize_t
|
||||
VAAPIRenderer::exportEGLImages(AVFrame *frame, EGLDisplay dpy,
|
||||
EGLImage images[EGL_MAX_PLANES]) {
|
||||
ssize_t count = 0;
|
||||
auto hwFrameCtx = (AVHWFramesContext*)frame->hw_frames_ctx->data;
|
||||
AVVAAPIDeviceContext* vaDeviceContext = (AVVAAPIDeviceContext*)hwFrameCtx->device_ctx->hwctx;
|
||||
|
||||
VASurfaceID surface_id = (VASurfaceID)(uintptr_t)frame->data[3];
|
||||
VAStatus st = vaExportSurfaceHandle(vaDeviceContext->display,
|
||||
surface_id,
|
||||
VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2,
|
||||
VA_EXPORT_SURFACE_READ_ONLY | VA_EXPORT_SURFACE_SEPARATE_LAYERS,
|
||||
&m_PrimeDescriptor);
|
||||
if (st != VA_STATUS_SUCCESS) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"vaExportSurfaceHandle failed: %d", st);
|
||||
return -1;
|
||||
}
|
||||
|
||||
SDL_assert(m_PrimeDescriptor.num_layers <= EGL_MAX_PLANES);
|
||||
|
||||
st = vaSyncSurface(vaDeviceContext->display, surface_id);
|
||||
if (st != VA_STATUS_SUCCESS) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"vaSyncSurface failed: %d", st);
|
||||
goto sync_fail;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < m_PrimeDescriptor.num_layers; ++i) {
|
||||
const auto &layer = m_PrimeDescriptor.layers[i];
|
||||
const auto &object = m_PrimeDescriptor.objects[layer.object_index[0]];
|
||||
|
||||
EGLAttrib attribs[17] = {
|
||||
EGL_LINUX_DRM_FOURCC_EXT, (EGLint)layer.drm_format,
|
||||
EGL_WIDTH, i == 0 ? frame->width : frame->width / 2,
|
||||
EGL_HEIGHT, i == 0 ? frame->height : frame->height / 2,
|
||||
EGL_DMA_BUF_PLANE0_FD_EXT, object.fd,
|
||||
EGL_DMA_BUF_PLANE0_OFFSET_EXT, (EGLint)layer.offset[0],
|
||||
EGL_DMA_BUF_PLANE0_PITCH_EXT, (EGLint)layer.pitch[0],
|
||||
EGL_NONE,
|
||||
};
|
||||
if (m_EGLExtDmaBuf) {
|
||||
const EGLAttrib extra[] = {
|
||||
EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT,
|
||||
(EGLint)object.drm_format_modifier,
|
||||
EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT,
|
||||
(EGLint)(object.drm_format_modifier >> 32),
|
||||
EGL_NONE,
|
||||
};
|
||||
memcpy((void *)(&attribs[12]), (void *)extra, sizeof (extra));
|
||||
}
|
||||
images[i] = eglCreateImage(dpy, EGL_NO_CONTEXT,
|
||||
EGL_LINUX_DMA_BUF_EXT,
|
||||
nullptr, attribs);
|
||||
if (!images[i]) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"eglCreateImage() Failed: %d", eglGetError());
|
||||
goto create_image_fail;
|
||||
}
|
||||
++count;
|
||||
}
|
||||
return count;
|
||||
|
||||
create_image_fail:
|
||||
m_PrimeDescriptor.num_layers = count;
|
||||
sync_fail:
|
||||
freeEGLImages(dpy, images);
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
VAAPIRenderer::freeEGLImages(EGLDisplay dpy, EGLImage images[EGL_MAX_PLANES]) {
|
||||
for (size_t i = 0; i < m_PrimeDescriptor.num_layers; ++i) {
|
||||
eglDestroyImage(dpy, images[i]);
|
||||
}
|
||||
for (size_t i = 0; i < m_PrimeDescriptor.num_objects; ++i) {
|
||||
close(m_PrimeDescriptor.objects[i].fd);
|
||||
}
|
||||
m_PrimeDescriptor.num_layers = 0;
|
||||
m_PrimeDescriptor.num_objects = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,6 +26,9 @@ extern "C" {
|
||||
#include <va/va_drm.h>
|
||||
#endif
|
||||
#include <libavutil/hwcontext_vaapi.h>
|
||||
#ifdef HAVE_EGL
|
||||
#include <va/va_drmcommon.h>
|
||||
#endif
|
||||
}
|
||||
|
||||
class VAAPIRenderer : public IFFmpegRenderer
|
||||
@@ -34,16 +37,25 @@ public:
|
||||
VAAPIRenderer();
|
||||
virtual ~VAAPIRenderer() override;
|
||||
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
||||
virtual bool prepareDecoderContext(AVCodecContext* context) override;
|
||||
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary** options) override;
|
||||
virtual void renderFrame(AVFrame* frame) override;
|
||||
virtual bool needsTestFrame() override;
|
||||
virtual bool isDirectRenderingSupported() override;
|
||||
virtual int getDecoderColorspace() override;
|
||||
#ifdef HAVE_EGL
|
||||
virtual bool canExportEGL() override;
|
||||
virtual bool initializeEGL(EGLDisplay dpy, const EGLExtensions &ext) override;
|
||||
virtual ssize_t exportEGLImages(AVFrame *frame, EGLDisplay dpy, EGLImage images[EGL_MAX_PLANES]) override;
|
||||
virtual void freeEGLImages(EGLDisplay dpy, EGLImage[EGL_MAX_PLANES]) override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
VADisplay openDisplay(SDL_Window* window);
|
||||
|
||||
int m_WindowSystem;
|
||||
AVBufferRef* m_HwContext;
|
||||
int m_DrmFd;
|
||||
bool m_BlacklistedForDirectRendering;
|
||||
|
||||
#ifdef HAVE_LIBVA_X11
|
||||
Window m_XWindow;
|
||||
@@ -53,4 +65,9 @@ private:
|
||||
int m_VideoHeight;
|
||||
int m_DisplayWidth;
|
||||
int m_DisplayHeight;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
VADRMPRIMESurfaceDescriptor m_PrimeDescriptor;
|
||||
bool m_EGLExtDmaBuf;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -64,6 +64,21 @@ bool VDPAURenderer::initialize(PDECODER_PARAMETERS params)
|
||||
int err;
|
||||
VdpStatus status;
|
||||
SDL_SysWMinfo info;
|
||||
static const char* driverPathsToTry[] = {
|
||||
#if Q_PROCESSOR_WORDSIZE == 8
|
||||
"/usr/lib64",
|
||||
"/usr/lib64/vdpau", // Fedora x86_64
|
||||
#endif
|
||||
"/usr/lib",
|
||||
"/usr/lib/vdpau", // Fedora i386
|
||||
#if defined(Q_PROCESSOR_X86_64)
|
||||
"/usr/lib/x86_64-linux-gnu",
|
||||
"/usr/lib/x86_64-linux-gnu/vdpau", // Ubuntu/Debian x86_64
|
||||
#elif defined(Q_PROCESSOR_X86_32)
|
||||
"/usr/lib/i386-linux-gnu",
|
||||
"/usr/lib/i386-linux-gnu/vdpau", // Ubuntu/Debian i386
|
||||
#endif
|
||||
};
|
||||
|
||||
m_VideoWidth = params->width;
|
||||
m_VideoHeight = params->height;
|
||||
@@ -71,6 +86,32 @@ bool VDPAURenderer::initialize(PDECODER_PARAMETERS params)
|
||||
err = av_hwdevice_ctx_create(&m_HwContext,
|
||||
AV_HWDEVICE_TYPE_VDPAU,
|
||||
nullptr, nullptr, 0);
|
||||
|
||||
if (err < 0 && qEnvironmentVariableIsEmpty("VDPAU_DRIVER_PATH")) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Trying fallback VDPAU driver paths");
|
||||
|
||||
// Unlike libva, libvdpau doesn't support multiple paths in
|
||||
// their VDPAU_DRIVER_PATH variable, so we must try them all
|
||||
// one at a time.
|
||||
for (auto& driverPath : driverPathsToTry) {
|
||||
qputenv("VDPAU_DRIVER_PATH", driverPath);
|
||||
err = av_hwdevice_ctx_create(&m_HwContext,
|
||||
AV_HWDEVICE_TYPE_VDPAU,
|
||||
nullptr, nullptr, 0);
|
||||
if (err == 0) {
|
||||
// Success!
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (err < 0) {
|
||||
// Unset VDPAU_DRIVER_PATH if we set it ourselves
|
||||
// and we didn't find any working VDPAU drivers.
|
||||
qunsetenv("VDPAU_DRIVER_PATH");
|
||||
}
|
||||
}
|
||||
|
||||
if (err < 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Failed to create VDPAU context: %d",
|
||||
@@ -225,7 +266,7 @@ bool VDPAURenderer::initialize(PDECODER_PARAMETERS params)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VDPAURenderer::prepareDecoderContext(AVCodecContext* context)
|
||||
bool VDPAURenderer::prepareDecoderContext(AVCodecContext* context, AVDictionary**)
|
||||
{
|
||||
context->hw_device_ctx = av_buffer_ref(m_HwContext);
|
||||
|
||||
@@ -261,6 +302,11 @@ int VDPAURenderer::getDecoderColorspace()
|
||||
|
||||
void VDPAURenderer::renderFrame(AVFrame* frame)
|
||||
{
|
||||
if (frame == nullptr) {
|
||||
// End of stream - nothing to do for us
|
||||
return;
|
||||
}
|
||||
|
||||
VdpStatus status;
|
||||
VdpVideoSurface videoSurface = (VdpVideoSurface)(uintptr_t)frame->data[3];
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public:
|
||||
VDPAURenderer();
|
||||
virtual ~VDPAURenderer() override;
|
||||
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
||||
virtual bool prepareDecoderContext(AVCodecContext* context) override;
|
||||
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary** options) override;
|
||||
virtual void renderFrame(AVFrame* frame) override;
|
||||
virtual bool needsTestFrame() override;
|
||||
virtual int getDecoderColorspace() override;
|
||||
|
||||
@@ -16,6 +16,19 @@
|
||||
#import <dispatch/dispatch.h>
|
||||
#import <Metal/Metal.h>
|
||||
|
||||
@interface VTView : NSView
|
||||
- (NSView *)hitTest:(NSPoint)point;
|
||||
@end
|
||||
|
||||
@implementation VTView
|
||||
|
||||
- (NSView *)hitTest:(NSPoint)point {
|
||||
Q_UNUSED(point);
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
class VTRenderer : public IFFmpegRenderer
|
||||
{
|
||||
public:
|
||||
@@ -25,6 +38,7 @@ public:
|
||||
m_FormatDesc(nullptr),
|
||||
m_StreamView(nullptr),
|
||||
m_DisplayLink(nullptr),
|
||||
m_ColorSpace(nullptr),
|
||||
m_VsyncMutex(nullptr),
|
||||
m_VsyncPassed(nullptr)
|
||||
{
|
||||
@@ -54,6 +68,10 @@ public:
|
||||
CFRelease(m_FormatDesc);
|
||||
}
|
||||
|
||||
if (m_ColorSpace != nullptr) {
|
||||
CGColorSpaceRelease(m_ColorSpace);
|
||||
}
|
||||
|
||||
for (int i = 0; i < Overlay::OverlayMax; i++) {
|
||||
if (m_OverlayTextFields[i] != nullptr) {
|
||||
[m_OverlayTextFields[i] removeFromSuperview];
|
||||
@@ -140,6 +158,11 @@ public:
|
||||
// Caller frees frame after we return
|
||||
virtual void renderFrame(AVFrame* frame) override
|
||||
{
|
||||
if (frame == nullptr) {
|
||||
// End of stream - nothing to do for us
|
||||
return;
|
||||
}
|
||||
|
||||
OSStatus status;
|
||||
CVPixelBufferRef pixBuf = reinterpret_cast<CVPixelBufferRef>(frame->data[3]);
|
||||
|
||||
@@ -154,6 +177,91 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
// Strip the attachments added by VT. They are likely wrong.
|
||||
CVBufferRemoveAllAttachments(pixBuf);
|
||||
|
||||
CVBufferSetAttachment(pixBuf,
|
||||
kCVImageBufferChromaSubsamplingKey,
|
||||
kCVImageBufferChromaSubsampling_420,
|
||||
kCVAttachmentMode_ShouldPropagate);
|
||||
|
||||
switch (frame->color_primaries) {
|
||||
case AVCOL_PRI_BT709:
|
||||
CVBufferSetAttachment(pixBuf,
|
||||
kCVImageBufferColorPrimariesKey,
|
||||
kCVImageBufferColorPrimaries_ITU_R_709_2,
|
||||
kCVAttachmentMode_ShouldPropagate);
|
||||
break;
|
||||
case AVCOL_PRI_SMPTE170M:
|
||||
CVBufferSetAttachment(pixBuf,
|
||||
kCVImageBufferColorPrimariesKey,
|
||||
kCVImageBufferColorPrimaries_SMPTE_C,
|
||||
kCVAttachmentMode_ShouldPropagate);
|
||||
break;
|
||||
case AVCOL_PRI_BT2020:
|
||||
CVBufferSetAttachment(pixBuf,
|
||||
kCVImageBufferColorPrimariesKey,
|
||||
kCVImageBufferColorPrimaries_ITU_R_2020,
|
||||
kCVAttachmentMode_ShouldPropagate);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (frame->color_trc) {
|
||||
case AVCOL_TRC_BT709:
|
||||
case AVCOL_TRC_SMPTE170M:
|
||||
CVBufferSetAttachment(pixBuf,
|
||||
kCVImageBufferTransferFunctionKey,
|
||||
kCVImageBufferTransferFunction_ITU_R_709_2,
|
||||
kCVAttachmentMode_ShouldPropagate);
|
||||
break;
|
||||
case AVCOL_TRC_BT2020_10:
|
||||
CVBufferSetAttachment(pixBuf,
|
||||
kCVImageBufferTransferFunctionKey,
|
||||
kCVImageBufferTransferFunction_ITU_R_2020,
|
||||
kCVAttachmentMode_ShouldPropagate);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (frame->colorspace) {
|
||||
case AVCOL_SPC_BT709:
|
||||
if (m_ColorSpace == nullptr) {
|
||||
m_ColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_709);
|
||||
}
|
||||
CVBufferSetAttachment(pixBuf,
|
||||
kCVImageBufferYCbCrMatrixKey,
|
||||
kCVImageBufferYCbCrMatrix_ITU_R_709_2,
|
||||
kCVAttachmentMode_ShouldPropagate);
|
||||
break;
|
||||
case AVCOL_SPC_BT2020_NCL:
|
||||
if (m_ColorSpace == nullptr) {
|
||||
m_ColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_2020);
|
||||
}
|
||||
CVBufferSetAttachment(pixBuf,
|
||||
kCVImageBufferYCbCrMatrixKey,
|
||||
kCVImageBufferYCbCrMatrix_ITU_R_2020,
|
||||
kCVAttachmentMode_ShouldPropagate);
|
||||
break;
|
||||
case AVCOL_SPC_SMPTE170M:
|
||||
if (m_ColorSpace == nullptr) {
|
||||
m_ColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
|
||||
}
|
||||
CVBufferSetAttachment(pixBuf,
|
||||
kCVImageBufferYCbCrMatrixKey,
|
||||
kCVImageBufferYCbCrMatrix_ITU_R_601_4,
|
||||
kCVAttachmentMode_ShouldPropagate);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_ColorSpace != nullptr) {
|
||||
CVBufferSetAttachment(pixBuf, kCVImageBufferCGColorSpaceKey, m_ColorSpace, kCVAttachmentMode_ShouldPropagate);
|
||||
}
|
||||
|
||||
// If the format has changed or doesn't exist yet, construct it with the
|
||||
// pixel buffer data
|
||||
if (!m_FormatDesc || !CMVideoFormatDescriptionMatchesImageBuffer(m_FormatDesc, pixBuf)) {
|
||||
@@ -174,7 +282,7 @@ public:
|
||||
CMSampleTimingInfo timingInfo = {
|
||||
.duration = kCMTimeInvalid,
|
||||
.decodeTimeStamp = kCMTimeInvalid,
|
||||
.presentationTimeStamp = CMTimeMake(mach_absolute_time(), 1000 * 1000 * 1000)
|
||||
.presentationTimeStamp = CMClockMakeHostTimeFromSystemUnits(mach_absolute_time())
|
||||
};
|
||||
|
||||
CMSampleBufferRef sampleBuffer;
|
||||
@@ -308,7 +416,7 @@ public:
|
||||
// SDL adds its own content view to listen for events.
|
||||
// We need to add a subview for our display layer.
|
||||
NSView* contentView = info.info.cocoa.window.contentView;
|
||||
m_StreamView = [[NSView alloc] initWithFrame:contentView.bounds];
|
||||
m_StreamView = [[VTView alloc] initWithFrame:contentView.bounds];
|
||||
|
||||
m_DisplayLayer = [[AVSampleBufferDisplayLayer alloc] init];
|
||||
m_DisplayLayer.bounds = m_StreamView.bounds;
|
||||
@@ -357,10 +465,10 @@ public:
|
||||
|
||||
switch (type) {
|
||||
case Overlay::OverlayDebug:
|
||||
[m_OverlayTextFields[type] setAlignment:NSLeftTextAlignment];
|
||||
[m_OverlayTextFields[type] setAlignment:NSTextAlignmentLeft];
|
||||
break;
|
||||
case Overlay::OverlayStatusUpdate:
|
||||
[m_OverlayTextFields[type] setAlignment:NSRightTextAlignment];
|
||||
[m_OverlayTextFields[type] setAlignment:NSTextAlignmentRight];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -410,7 +518,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool prepareDecoderContext(AVCodecContext* context) override
|
||||
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary**) override
|
||||
{
|
||||
context->hw_device_ctx = av_buffer_ref(m_HwContext);
|
||||
|
||||
@@ -429,6 +537,12 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
int getDecoderColorspace() override
|
||||
{
|
||||
// macOS seems to handle Rec 601 best
|
||||
return COLORSPACE_REC_601;
|
||||
}
|
||||
|
||||
private:
|
||||
AVBufferRef* m_HwContext;
|
||||
AVSampleBufferDisplayLayer* m_DisplayLayer;
|
||||
@@ -436,6 +550,7 @@ private:
|
||||
NSView* m_StreamView;
|
||||
NSTextField* m_OverlayTextFields[Overlay::OverlayMax];
|
||||
CVDisplayLinkRef m_DisplayLink;
|
||||
CGColorSpaceRef m_ColorSpace;
|
||||
SDL_mutex* m_VsyncMutex;
|
||||
SDL_cond* m_VsyncPassed;
|
||||
};
|
||||
|
||||
+243
-36
@@ -32,6 +32,10 @@
|
||||
#include "ffmpeg-renderers/drm.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
#include "ffmpeg-renderers/eglvid.h"
|
||||
#endif
|
||||
|
||||
// This is gross but it allows us to use sizeof()
|
||||
#include "ffmpeg_videosamples.cpp"
|
||||
|
||||
@@ -45,9 +49,25 @@ bool FFmpegVideoDecoder::isHardwareAccelerated()
|
||||
(m_VideoDecoderCtx->codec->capabilities & AV_CODEC_CAP_HARDWARE) != 0;
|
||||
}
|
||||
|
||||
bool FFmpegVideoDecoder::isAlwaysFullScreen()
|
||||
{
|
||||
return m_BackendRenderer->getRendererAttributes() & RENDERER_ATTRIBUTE_FULLSCREEN_ONLY;
|
||||
}
|
||||
|
||||
int FFmpegVideoDecoder::getDecoderCapabilities()
|
||||
{
|
||||
return m_BackendRenderer->getDecoderCapabilities();
|
||||
int capabilities = m_BackendRenderer->getDecoderCapabilities();
|
||||
|
||||
if (!isHardwareAccelerated()) {
|
||||
// Slice up to 4 times for parallel CPU decoding, once slice per core
|
||||
int slices = qMin(MAX_SLICES, SDL_GetCPUCount());
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Encoder configured for %d slices per frame",
|
||||
slices);
|
||||
capabilities |= CAPABILITY_SLICES_PER_FRAME(slices);
|
||||
}
|
||||
|
||||
return capabilities;
|
||||
}
|
||||
|
||||
int FFmpegVideoDecoder::getDecoderColorspace()
|
||||
@@ -55,6 +75,17 @@ int FFmpegVideoDecoder::getDecoderColorspace()
|
||||
return m_FrontendRenderer->getDecoderColorspace();
|
||||
}
|
||||
|
||||
QSize FFmpegVideoDecoder::getDecoderMaxResolution()
|
||||
{
|
||||
if (m_BackendRenderer->getRendererAttributes() & RENDERER_ATTRIBUTE_1080P_MAX) {
|
||||
return QSize(1920, 1080);
|
||||
}
|
||||
else {
|
||||
// No known maximum
|
||||
return QSize(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
enum AVPixelFormat FFmpegVideoDecoder::ffGetFormat(AVCodecContext* context,
|
||||
const enum AVPixelFormat* pixFmts)
|
||||
{
|
||||
@@ -62,7 +93,7 @@ enum AVPixelFormat FFmpegVideoDecoder::ffGetFormat(AVCodecContext* context,
|
||||
const enum AVPixelFormat *p;
|
||||
|
||||
for (p = pixFmts; *p != -1; p++) {
|
||||
// Only match our hardware decoding codec or SW pixel
|
||||
// Only match our hardware decoding codec or preferred SW pixel
|
||||
// format (if not using hardware decoding). It's crucial
|
||||
// to override the default get_format() which will try
|
||||
// to gracefully fall back to software decode and break us.
|
||||
@@ -73,6 +104,15 @@ enum AVPixelFormat FFmpegVideoDecoder::ffGetFormat(AVCodecContext* context,
|
||||
}
|
||||
}
|
||||
|
||||
// Failed to match the preferred pixel formats. Try non-preferred options for non-hwaccel decoders.
|
||||
if (decoder->m_HwDecodeCfg == nullptr) {
|
||||
for (p = pixFmts; *p != -1; p++) {
|
||||
if (decoder->m_FrontendRenderer->isPixelFormatSupported(decoder->m_VideoFormat, *p)) {
|
||||
return *p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return AV_PIX_FMT_NONE;
|
||||
}
|
||||
|
||||
@@ -84,8 +124,11 @@ FFmpegVideoDecoder::FFmpegVideoDecoder(bool testOnly)
|
||||
m_FrontendRenderer(nullptr),
|
||||
m_ConsecutiveFailedDecodes(0),
|
||||
m_Pacer(nullptr),
|
||||
m_FramesIn(0),
|
||||
m_FramesOut(0),
|
||||
m_LastFrameNumber(0),
|
||||
m_StreamFps(0),
|
||||
m_VideoFormat(0),
|
||||
m_NeedsSpsFixup(false),
|
||||
m_TestOnly(testOnly)
|
||||
{
|
||||
@@ -151,6 +194,16 @@ void FFmpegVideoDecoder::reset()
|
||||
|
||||
bool FFmpegVideoDecoder::createFrontendRenderer(PDECODER_PARAMETERS params)
|
||||
{
|
||||
#ifdef HAVE_EGL
|
||||
if (m_BackendRenderer->canExportEGL()) {
|
||||
m_FrontendRenderer = new EGLRenderer(m_BackendRenderer);
|
||||
if (m_FrontendRenderer->initialize(params)) {
|
||||
return true;
|
||||
}
|
||||
delete m_FrontendRenderer;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (m_BackendRenderer->isDirectRenderingSupported()) {
|
||||
// The backend renderer can render to the display
|
||||
m_FrontendRenderer = m_BackendRenderer;
|
||||
@@ -164,23 +217,6 @@ bool FFmpegVideoDecoder::createFrontendRenderer(PDECODER_PARAMETERS params)
|
||||
}
|
||||
}
|
||||
|
||||
// Determine whether the frontend renderer prefers frame pacing
|
||||
auto vsyncConstraint = m_FrontendRenderer->getFramePacingConstraint();
|
||||
if (vsyncConstraint == IFFmpegRenderer::PACING_FORCE_OFF && params->enableFramePacing) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Frame pacing is forcefully disabled by the frontend renderer");
|
||||
params->enableFramePacing = false;
|
||||
}
|
||||
else if (vsyncConstraint == IFFmpegRenderer::PACING_FORCE_ON && !params->enableFramePacing) {
|
||||
// FIXME: This duplicates logic in Session.cpp
|
||||
int displayHz = StreamUtils::getDisplayRefreshRate(params->window);
|
||||
if (displayHz + 5 >= params->frameRate) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Frame pacing is forcefully enabled by the frontend renderer");
|
||||
params->enableFramePacing = true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -195,6 +231,7 @@ bool FFmpegVideoDecoder::completeInitialization(AVCodec* decoder, PDECODER_PARAM
|
||||
}
|
||||
|
||||
m_StreamFps = params->frameRate;
|
||||
m_VideoFormat = params->videoFormat;
|
||||
|
||||
// Don't bother initializing Pacer if we're not actually going to render
|
||||
if (!testFrame) {
|
||||
@@ -243,8 +280,10 @@ bool FFmpegVideoDecoder::completeInitialization(AVCodec* decoder, PDECODER_PARAM
|
||||
m_VideoDecoderCtx->pix_fmt = m_FrontendRenderer->getPreferredPixelFormat(params->videoFormat);
|
||||
m_VideoDecoderCtx->get_format = ffGetFormat;
|
||||
|
||||
AVDictionary* options = nullptr;
|
||||
|
||||
// Allow the backend renderer to attach data to this decoder
|
||||
if (!m_BackendRenderer->prepareDecoderContext(m_VideoDecoderCtx)) {
|
||||
if (!m_BackendRenderer->prepareDecoderContext(m_VideoDecoderCtx, &options)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -255,7 +294,8 @@ bool FFmpegVideoDecoder::completeInitialization(AVCodec* decoder, PDECODER_PARAM
|
||||
SDL_assert(m_VideoDecoderCtx->opaque == nullptr);
|
||||
m_VideoDecoderCtx->opaque = this;
|
||||
|
||||
int err = avcodec_open2(m_VideoDecoderCtx, decoder, nullptr);
|
||||
int err = avcodec_open2(m_VideoDecoderCtx, decoder, &options);
|
||||
av_dict_free(&options);
|
||||
if (err < 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Unable to open decoder for format: %x",
|
||||
@@ -289,7 +329,42 @@ bool FFmpegVideoDecoder::completeInitialization(AVCodec* decoder, PDECODER_PARAM
|
||||
return false;
|
||||
}
|
||||
|
||||
err = avcodec_send_packet(m_VideoDecoderCtx, &m_Pkt);
|
||||
AVFrame* frame = av_frame_alloc();
|
||||
if (!frame) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Failed to allocate frame");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Some decoders won't output on the first frame, so we'll submit
|
||||
// a few test frames if we get an EAGAIN error.
|
||||
for (int retries = 0; retries < 5; retries++) {
|
||||
// Most FFmpeg decoders process input using a "push" model.
|
||||
// We'll see those fail here if the format is not supported.
|
||||
err = avcodec_send_packet(m_VideoDecoderCtx, &m_Pkt);
|
||||
if (err < 0) {
|
||||
av_frame_free(&frame);
|
||||
char errorstring[512];
|
||||
av_strerror(err, errorstring, sizeof(errorstring));
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Test decode failed: %s", errorstring);
|
||||
return false;
|
||||
}
|
||||
|
||||
// A few FFmpeg decoders (h264_mmal) process here using a "pull" model.
|
||||
// Those decoders will fail here if the format is not supported.
|
||||
err = avcodec_receive_frame(m_VideoDecoderCtx, frame);
|
||||
if (err == AVERROR(EAGAIN)) {
|
||||
// Wait a little while to let the hardware work
|
||||
SDL_Delay(100);
|
||||
}
|
||||
else {
|
||||
// Done!
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
av_frame_free(&frame);
|
||||
if (err < 0) {
|
||||
char errorstring[512];
|
||||
av_strerror(err, errorstring, sizeof(errorstring));
|
||||
@@ -348,17 +423,45 @@ void FFmpegVideoDecoder::addVideoStats(VIDEO_STATS& src, VIDEO_STATS& dst)
|
||||
void FFmpegVideoDecoder::stringifyVideoStats(VIDEO_STATS& stats, char* output)
|
||||
{
|
||||
int offset = 0;
|
||||
const char* codecString;
|
||||
|
||||
// Start with an empty string
|
||||
output[offset] = 0;
|
||||
|
||||
switch (m_VideoFormat)
|
||||
{
|
||||
case VIDEO_FORMAT_H264:
|
||||
codecString = "H.264";
|
||||
break;
|
||||
|
||||
case VIDEO_FORMAT_H265:
|
||||
codecString = "HEVC";
|
||||
break;
|
||||
|
||||
case VIDEO_FORMAT_H265_MAIN10:
|
||||
codecString = "HEVC Main 10";
|
||||
break;
|
||||
|
||||
default:
|
||||
SDL_assert(false);
|
||||
codecString = "UNKNOWN";
|
||||
break;
|
||||
}
|
||||
|
||||
if (stats.receivedFps > 0) {
|
||||
if (m_VideoDecoderCtx != nullptr) {
|
||||
offset += sprintf(&output[offset],
|
||||
"Video stream: %dx%d %.2f FPS (Codec: %s)\n",
|
||||
m_VideoDecoderCtx->width,
|
||||
m_VideoDecoderCtx->height,
|
||||
stats.totalFps,
|
||||
codecString);
|
||||
}
|
||||
|
||||
offset += sprintf(&output[offset],
|
||||
"Estimated host PC frame rate: %.2f FPS\n"
|
||||
"Incoming frame rate from network: %.2f FPS\n"
|
||||
"Decoding frame rate: %.2f FPS\n"
|
||||
"Rendering frame rate: %.2f FPS\n",
|
||||
stats.totalFps,
|
||||
stats.receivedFps,
|
||||
stats.decodedFps,
|
||||
stats.renderedFps);
|
||||
@@ -488,11 +591,61 @@ bool FFmpegVideoDecoder::tryInitializeRenderer(AVCodec* decoder,
|
||||
|
||||
bool FFmpegVideoDecoder::initialize(PDECODER_PARAMETERS params)
|
||||
{
|
||||
AVCodec* decoder;
|
||||
|
||||
// Increase log level until the first frame is decoded
|
||||
av_log_set_level(AV_LOG_DEBUG);
|
||||
|
||||
// First try decoders that the user has manually specified via environment variables.
|
||||
// These must output surfaces in one of the formats that the SDL renderer supports,
|
||||
// which is currently:
|
||||
// - AV_PIX_FMT_YUV420P (preferred)
|
||||
// - AV_PIX_FMT_NV12
|
||||
// - AV_PIX_FMT_NV21
|
||||
// These formats should cover most/all decoders that output in a standard YUV format.
|
||||
{
|
||||
QString h264DecoderHint = qgetenv("H264_DECODER_HINT");
|
||||
if (!h264DecoderHint.isEmpty() && (params->videoFormat & VIDEO_FORMAT_MASK_H264)) {
|
||||
QByteArray decoderString = h264DecoderHint.toLocal8Bit();
|
||||
AVCodec* customAvcDecoder = avcodec_find_decoder_by_name(decoderString.constData());
|
||||
|
||||
if (customAvcDecoder != nullptr &&
|
||||
tryInitializeRenderer(customAvcDecoder, params, nullptr,
|
||||
[]() -> IFFmpegRenderer* { return new SdlRenderer(); })) {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Using custom H.264 decoder (H264_DECODER_HINT): %s",
|
||||
decoderString.constData());
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Custom H.264 decoder (H264_DECODER_HINT) failed to load: %s",
|
||||
decoderString.constData());
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
QString hevcDecoderHint = qgetenv("HEVC_DECODER_HINT");
|
||||
if (!hevcDecoderHint.isEmpty() && (params->videoFormat & VIDEO_FORMAT_MASK_H265)) {
|
||||
QByteArray decoderString = hevcDecoderHint.toLocal8Bit();
|
||||
AVCodec* customHevcDecoder = avcodec_find_decoder_by_name(decoderString.constData());
|
||||
|
||||
if (customHevcDecoder != nullptr &&
|
||||
tryInitializeRenderer(customHevcDecoder, params, nullptr,
|
||||
[]() -> IFFmpegRenderer* { return new SdlRenderer(); })) {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Using custom HEVC decoder (HEVC_DECODER_HINT): %s",
|
||||
decoderString.constData());
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Custom HEVC decoder (HEVC_DECODER_HINT) failed to load: %s",
|
||||
decoderString.constData());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AVCodec* decoder;
|
||||
|
||||
if (params->videoFormat & VIDEO_FORMAT_MASK_H264) {
|
||||
decoder = avcodec_find_decoder(AV_CODEC_ID_H264);
|
||||
}
|
||||
@@ -543,20 +696,58 @@ bool FFmpegVideoDecoder::initialize(PDECODER_PARAMETERS params)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DRM
|
||||
// RKMPP is a hardware accelerated decoder that outputs DRI PRIME buffers
|
||||
AVCodec* rkmppDecoder;
|
||||
{
|
||||
// RKMPP is a hardware accelerated decoder that outputs DRI PRIME buffers
|
||||
AVCodec* rkmppDecoder;
|
||||
|
||||
if (params->videoFormat & VIDEO_FORMAT_MASK_H264) {
|
||||
rkmppDecoder = avcodec_find_decoder_by_name("h264_rkmpp");
|
||||
if (params->videoFormat & VIDEO_FORMAT_MASK_H264) {
|
||||
rkmppDecoder = avcodec_find_decoder_by_name("h264_rkmpp");
|
||||
}
|
||||
else {
|
||||
rkmppDecoder = avcodec_find_decoder_by_name("hevc_rkmpp");
|
||||
}
|
||||
|
||||
if (rkmppDecoder != nullptr &&
|
||||
tryInitializeRenderer(rkmppDecoder, params, nullptr,
|
||||
[]() -> IFFmpegRenderer* { return new DrmRenderer(); })) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
rkmppDecoder = avcodec_find_decoder_by_name("hevc_rkmpp");
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
{
|
||||
AVCodec* nvmpiDecoder;
|
||||
|
||||
if (params->videoFormat & VIDEO_FORMAT_MASK_H264) {
|
||||
nvmpiDecoder = avcodec_find_decoder_by_name("h264_nvmpi");
|
||||
}
|
||||
else {
|
||||
nvmpiDecoder = avcodec_find_decoder_by_name("hevc_nvmpi");
|
||||
}
|
||||
|
||||
if (nvmpiDecoder != nullptr &&
|
||||
tryInitializeRenderer(nvmpiDecoder, params, nullptr,
|
||||
[]() -> IFFmpegRenderer* { return new SdlRenderer(); })) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (rkmppDecoder != nullptr &&
|
||||
tryInitializeRenderer(rkmppDecoder, params, nullptr,
|
||||
[]() -> IFFmpegRenderer* { return new DrmRenderer(); })) {
|
||||
return true;
|
||||
{
|
||||
AVCodec* v4l2Decoder;
|
||||
|
||||
if (params->videoFormat & VIDEO_FORMAT_MASK_H264) {
|
||||
v4l2Decoder = avcodec_find_decoder_by_name("h264_v4l2m2m");
|
||||
}
|
||||
else {
|
||||
v4l2Decoder = avcodec_find_decoder_by_name("hevc_v4l2m2m");
|
||||
}
|
||||
|
||||
if (v4l2Decoder != nullptr &&
|
||||
tryInitializeRenderer(v4l2Decoder, params, nullptr,
|
||||
[]() -> IFFmpegRenderer* { return new SdlRenderer(); })) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -693,6 +884,13 @@ int FFmpegVideoDecoder::submitDecodeUnit(PDECODE_UNIT du)
|
||||
m_Pkt.data = reinterpret_cast<uint8_t*>(m_DecodeBuffer.data());
|
||||
m_Pkt.size = offset;
|
||||
|
||||
if (du->frameType == FRAME_TYPE_IDR) {
|
||||
m_Pkt.flags = AV_PKT_FLAG_KEY;
|
||||
}
|
||||
else {
|
||||
m_Pkt.flags = 0;
|
||||
}
|
||||
|
||||
m_ActiveWndVideoStats.totalReassemblyTime += LiGetMillis() - du->receiveTimeMs;
|
||||
|
||||
Uint32 beforeDecode = SDL_GetTicks();
|
||||
@@ -719,6 +917,8 @@ int FFmpegVideoDecoder::submitDecodeUnit(PDECODE_UNIT du)
|
||||
return DR_NEED_IDR;
|
||||
}
|
||||
|
||||
m_FramesIn++;
|
||||
|
||||
AVFrame* frame = av_frame_alloc();
|
||||
if (!frame) {
|
||||
// Failed to allocate a frame but we did submit,
|
||||
@@ -730,6 +930,8 @@ int FFmpegVideoDecoder::submitDecodeUnit(PDECODE_UNIT du)
|
||||
|
||||
err = avcodec_receive_frame(m_VideoDecoderCtx, frame);
|
||||
if (err == 0) {
|
||||
m_FramesOut++;
|
||||
|
||||
// Reset failed decodes count if we reached this far
|
||||
m_ConsecutiveFailedDecodes = 0;
|
||||
|
||||
@@ -745,6 +947,11 @@ int FFmpegVideoDecoder::submitDecodeUnit(PDECODE_UNIT du)
|
||||
// Count time in avcodec_send_packet() and avcodec_receive_frame()
|
||||
// as time spent decoding
|
||||
m_ActiveWndVideoStats.totalDecodeTime += SDL_GetTicks() - beforeDecode;
|
||||
|
||||
// Also count the frame-to-frame delay if the decoder is delaying frames
|
||||
// until a subsequent frame is submitted.
|
||||
m_ActiveWndVideoStats.totalDecodeTime += (m_FramesIn - m_FramesOut) * (1000 / m_StreamFps);
|
||||
|
||||
m_ActiveWndVideoStats.decodedFrames++;
|
||||
|
||||
// Queue the frame for rendering (or render now if pacer is disabled)
|
||||
|
||||
@@ -16,8 +16,10 @@ public:
|
||||
virtual ~FFmpegVideoDecoder() override;
|
||||
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
||||
virtual bool isHardwareAccelerated() override;
|
||||
virtual bool isAlwaysFullScreen() override;
|
||||
virtual int getDecoderCapabilities() override;
|
||||
virtual int getDecoderColorspace() override;
|
||||
virtual QSize getDecoderMaxResolution() override;
|
||||
virtual int submitDecodeUnit(PDECODE_UNIT du) override;
|
||||
virtual void renderFrameOnMainThread() override;
|
||||
|
||||
@@ -61,8 +63,12 @@ private:
|
||||
VIDEO_STATS m_LastWndVideoStats;
|
||||
VIDEO_STATS m_GlobalVideoStats;
|
||||
|
||||
int m_FramesIn;
|
||||
int m_FramesOut;
|
||||
|
||||
int m_LastFrameNumber;
|
||||
int m_StreamFps;
|
||||
int m_VideoFormat;
|
||||
bool m_NeedsSpsFixup;
|
||||
bool m_TestOnly;
|
||||
|
||||
|
||||
@@ -25,6 +25,11 @@ SLVideoDecoder::isHardwareAccelerated()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SLVideoDecoder::isAlwaysFullScreen()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
SLVideoDecoder::getDecoderCapabilities()
|
||||
{
|
||||
@@ -37,6 +42,11 @@ SLVideoDecoder::getDecoderColorspace()
|
||||
return COLORSPACE_REC_709;
|
||||
}
|
||||
|
||||
QSize SLVideoDecoder::getDecoderMaxResolution()
|
||||
{
|
||||
return QSize(1920, 1080);
|
||||
}
|
||||
|
||||
bool
|
||||
SLVideoDecoder::initialize(PDECODER_PARAMETERS params)
|
||||
{
|
||||
|
||||
@@ -11,8 +11,10 @@ public:
|
||||
virtual ~SLVideoDecoder();
|
||||
virtual bool initialize(PDECODER_PARAMETERS params);
|
||||
virtual bool isHardwareAccelerated();
|
||||
virtual bool isAlwaysFullScreen();
|
||||
virtual int getDecoderCapabilities();
|
||||
virtual int getDecoderColorspace();
|
||||
virtual QSize getDecoderMaxResolution();
|
||||
virtual int submitDecodeUnit(PDECODE_UNIT du);
|
||||
|
||||
// Unused since rendering is done directly from the decode thread
|
||||
|
||||
@@ -3,3 +3,8 @@
|
||||
#define THROW_BAD_ALLOC_IF_NULL(x) \
|
||||
if ((x) == nullptr) throw std::bad_alloc()
|
||||
|
||||
namespace WMUtils {
|
||||
bool isRunningX11();
|
||||
bool isRunningWayland();
|
||||
bool isRunningWindowManager();
|
||||
}
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
1.2.0
|
||||
2.2.0
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
#include <QtGlobal>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
#ifdef HAS_X11
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAS_WAYLAND
|
||||
#include <wayland-client.h>
|
||||
#endif
|
||||
|
||||
bool WMUtils::isRunningX11()
|
||||
{
|
||||
#ifdef HAS_X11
|
||||
Display* display = XOpenDisplay(nullptr);
|
||||
if (display != nullptr) {
|
||||
XCloseDisplay(display);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WMUtils::isRunningWayland()
|
||||
{
|
||||
#ifdef HAS_WAYLAND
|
||||
struct wl_display* display = wl_display_connect(nullptr);
|
||||
if (display != nullptr) {
|
||||
wl_display_disconnect(display);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WMUtils::isRunningWindowManager()
|
||||
{
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_DARWIN)
|
||||
// Windows and macOS are always running a window manager
|
||||
return true;
|
||||
#else
|
||||
// On Unix OSes, look for Wayland or X
|
||||
return WMUtils::isRunningWayland() || WMUtils::isRunningX11();
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
version: 0.0.0.{build}
|
||||
|
||||
clone_depth: 1
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
QTDIR: C:\Qt\5.15\msvc2019_64
|
||||
ARCH: x64
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: macOS
|
||||
BUILD_TARGET: macos
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
QTDIR: C:\Qt\5.15\msvc2019
|
||||
ARCH: x86
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu1604
|
||||
BUILD_TARGET: steamlink
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu1604
|
||||
BUILD_TARGET: linux
|
||||
FFMPEG_CONFIGURE_ARGS: --enable-pic --disable-static --enable-shared --disable-all --enable-avcodec --enable-decoder=h264 --enable-decoder=hevc --enable-nvdec --enable-hwaccel=h264_nvdec --enable-hwaccel=hevc_nvdec --enable-hwaccel=h264_vaapi --enable-hwaccel=hevc_vaapi --enable-hwaccel=h264_vdpau --enable-hwaccel=hevc_vdpau
|
||||
|
||||
install:
|
||||
- sh: '[ "$BUILD_TARGET" != macos ] || nvm use node'
|
||||
- sh: '[ "$BUILD_TARGET" != macos ] || npm install --global create-dmg'
|
||||
- sh: '[ "$BUILD_TARGET" != macos ] || brew install qt'
|
||||
- sh: '[ "$BUILD_TARGET" != macos ] || brew link --force qt'
|
||||
- sh: '[ "$BUILD_TARGET" != steamlink ] || sudo apt install -y libc6:i386 libstdc++6:i386'
|
||||
- sh: '[ "$BUILD_TARGET" != steamlink ] || git clone --depth=1 https://github.com/ValveSoftware/steamlink-sdk.git $HOME/steamlink-sdk'
|
||||
- sh: '[ "$BUILD_TARGET" != linux ] || sudo add-apt-repository ppa:beineri/opt-qt-5.14.2-xenial'
|
||||
- sh: '[ "$BUILD_TARGET" != linux ] || sudo apt update'
|
||||
- sh: '[ "$BUILD_TARGET" != linux ] || sudo apt install -y qt514base qt514quickcontrols2 qt514svg qt514wayland nasm libgbm-dev libdrm-dev libfreetype6-dev libasound2-dev libdbus-1-dev libegl1-mesa-dev libgl1-mesa-dev libgles2-mesa-dev libglu1-mesa-dev libibus-1.0-dev libpulse-dev libudev-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxkbcommon-dev libxrandr-dev libxss-dev libxt-dev libxv-dev libxxf86vm-dev wayland-protocols libopus-dev libvdpau-dev'
|
||||
- sh: 'if [[ "$BUILD_TARGET" = linux ]]; then export SDL2_VER=2.0.12 && wget https://www.libsdl.org/release/SDL2-$SDL2_VER.tar.gz && tar -xvf SDL2-$SDL2_VER.tar.gz && cd SDL2-$SDL2_VER && ./configure && make -j$(nproc) && sudo make install && cd ..; fi'
|
||||
- sh: 'if [[ "$BUILD_TARGET" = linux ]]; then export SDL2_TTF_VER=2.0.15 && wget https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-$SDL2_TTF_VER.tar.gz && tar -xvf SDL2_ttf-$SDL2_TTF_VER.tar.gz && cd SDL2_ttf-$SDL2_TTF_VER && ./configure && make -j$(nproc) && sudo make install && cd ..; fi'
|
||||
- sh: 'if [[ "$BUILD_TARGET" = linux ]]; then export LIBVA_VER=2.8.0 && wget https://github.com/intel/libva/releases/download/$LIBVA_VER/libva-$LIBVA_VER.tar.bz2 && tar -xvf libva-$LIBVA_VER.tar.bz2 && cd libva-$LIBVA_VER && ./configure && make -j$(nproc) && sudo make install && cd ..; fi'
|
||||
- sh: 'if [[ "$BUILD_TARGET" = linux ]]; then export NVHDR_VER=8.1.24.11 && wget https://github.com/FFmpeg/nv-codec-headers/releases/download/n$NVHDR_VER/nv-codec-headers-$NVHDR_VER.tar.gz && tar -xvf nv-codec-headers-$NVHDR_VER.tar.gz && cd nv-codec-headers-$NVHDR_VER && sudo make install && cd ..; fi'
|
||||
- sh: 'if [[ "$BUILD_TARGET" = linux ]]; then export FFMPEG_VER=4.3.1 && wget https://ffmpeg.org/releases/ffmpeg-$FFMPEG_VER.tar.bz2 && tar -xvf ffmpeg-$FFMPEG_VER.tar.bz2 && cd ffmpeg-$FFMPEG_VER && ./configure $FFMPEG_CONFIGURE_ARGS && make -j$(nproc) && sudo make install && sudo ldconfig && cd ..; fi'
|
||||
- sh: 'if [[ "$BUILD_TARGET" = linux ]]; then mkdir $HOME/bin && wget -O $HOME/bin/linuxdeployqt https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage && chmod a+x $HOME/bin/linuxdeployqt; fi'
|
||||
|
||||
before_build:
|
||||
- 'git submodule update --init --recursive'
|
||||
- cmd: 'set PATH=%PATH%;%QTDIR%\bin;%ProgramFiles(x86)%\WiX Toolset v3.11\bin'
|
||||
- cmd: 'set /p VERSION=<app\version.txt'
|
||||
- sh: 'export VERSION=`cat app/version.txt`'
|
||||
|
||||
build_script:
|
||||
- cmd: 'scripts\generate-installers.bat Debug %ARCH%'
|
||||
- cmd: 'scripts\generate-installers.bat Release %ARCH%'
|
||||
- sh: '[ "$BUILD_TARGET" != linux ] || source /opt/qt514/bin/qt514-env.sh'
|
||||
- sh: '[ "$BUILD_TARGET" != linux ] || PATH=$PATH:$HOME/bin scripts/build-appimage.sh'
|
||||
- sh: '[ "$BUILD_TARGET" != macos ] || scripts/generate-dmg.sh Release'
|
||||
- sh: '[ "$BUILD_TARGET" != steamlink ] || STEAMLINK_SDK_PATH=$HOME/steamlink-sdk scripts/build-steamlink-app.sh'
|
||||
|
||||
after_build:
|
||||
- cmd: 'appveyor PushArtifact build\installer-%ARCH%-Release\MoonlightPortable-%ARCH%-%VERSION%.zip -FileName MoonlightPortable-%ARCH%-r%APPVEYOR_BUILD_NUMBER%.zip'
|
||||
- cmd: 'appveyor PushArtifact build\symbols-%ARCH%-Release\MoonlightDebuggingSymbols-%ARCH%-%VERSION%.zip -FileName MoonlightDebuggingSymbols-%ARCH%-r%APPVEYOR_BUILD_NUMBER%.zip'
|
||||
- sh: '[ "$BUILD_TARGET" != steamlink ] || appveyor PushArtifact build/installer-release/Moonlight-SteamLink-$VERSION.zip -FileName Moonlight-SteamLink-r$APPVEYOR_BUILD_NUMBER.zip'
|
||||
- sh: '[ "$BUILD_TARGET" != macos ] || appveyor PushArtifact build/installer-Release/Moonlight-$VERSION.dmg -FileName Moonlight-r$APPVEYOR_BUILD_NUMBER.dmg'
|
||||
- sh: '[ "$BUILD_TARGET" != linux ] || appveyor PushArtifact build/installer-release/Moonlight-$VERSION-x86_64.AppImage -FileName Moonlight-r$APPVEYOR_BUILD_NUMBER-x86_64.AppImage'
|
||||
|
||||
deploy: off
|
||||
@@ -0,0 +1,13 @@
|
||||
SOURCES = main.cpp
|
||||
|
||||
CONFIG += link_pkgconfig
|
||||
|
||||
# This adds /opt/vc/include to the include path which
|
||||
# pulls in the BRCM GLES and EGL libraries. If we don't
|
||||
# add this, we'll get the system's headers which expose
|
||||
# functionality the runtime GL implementation won't have.
|
||||
packagesExist(mmal) {
|
||||
PKGCONFIG += mmal
|
||||
}
|
||||
|
||||
PKGCONFIG += sdl2 egl libavcodec libavutil
|
||||
@@ -0,0 +1,14 @@
|
||||
#include <SDL_egl.h>
|
||||
#include <SDL_opengles2.h>
|
||||
|
||||
#ifndef EGL_VERSION_1_4
|
||||
#error EGLRenderer requires EGL 1.4
|
||||
#endif
|
||||
|
||||
#ifndef GL_ES_VERSION_2_0
|
||||
#error EGLRenderer requires OpenGL ES 2.0
|
||||
#endif
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
+7
-2
@@ -9,5 +9,10 @@ CONFIG(release, debug|release) {
|
||||
DEFINES += NDEBUG
|
||||
}
|
||||
|
||||
# Enable ASan if desired
|
||||
#CONFIG += sanitizer sanitize_address
|
||||
# Enable ASan for Linux or macOS
|
||||
#CONFIG += sanitizer sanitize_address
|
||||
|
||||
# Enable ASan for Windows
|
||||
#QMAKE_CFLAGS += -fsanitize=address
|
||||
#QMAKE_CXXFLAGS += -fsanitize=address
|
||||
#QMAKE_LFLAGS += -incremental:no -wholearchive:clang_rt.asan_dynamic-x86_64.lib -wholearchive:clang_rt.asan_dynamic_runtime_thunk-x86_64.lib
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
Versions/Current/Resources
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
|
||||
HIDAPI Authors:
|
||||
|
||||
Alan Ott <[email protected]>:
|
||||
Original Author and Maintainer
|
||||
Linux, Windows, and Mac implementations
|
||||
|
||||
Ludovic Rousseau <[email protected]>:
|
||||
Formatting for Doxygen documentation
|
||||
Bug fixes
|
||||
Correctness fixes
|
||||
|
||||
|
||||
For a comprehensive list of contributions, see the commit list at github:
|
||||
https://github.com/libusb/hidapi/commits/master
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>19G2021</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>hidapi</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.libsdl.hidapi</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>hidapi</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
<array>
|
||||
<string>MacOSX</string>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>11E801a</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>19G68</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.15</string>
|
||||
<key>DTXcode</key>
|
||||
<string>1170</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>11E801a</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.6</string>
|
||||
</dict>
|
||||
</plist>
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
Copyright (c) 2010, Alan Ott, Signal 11 Software
|
||||
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 Signal 11 Software 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 HOLDER 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.
|
||||
+674
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
HIDAPI - Multi-Platform library for
|
||||
communication with HID devices.
|
||||
|
||||
Copyright 2009, Alan Ott, Signal 11 Software.
|
||||
All Rights Reserved.
|
||||
|
||||
This software may be used by anyone for any reason so
|
||||
long as the copyright notice in the source files
|
||||
remains intact.
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
HIDAPI can be used under one of three licenses.
|
||||
|
||||
1. The GNU General Public License, version 3.0, in LICENSE-gpl3.txt
|
||||
2. A BSD-Style License, in LICENSE-bsd.txt.
|
||||
3. The more liberal original HIDAPI license. LICENSE-orig.txt
|
||||
|
||||
The license chosen is at the discretion of the user of HIDAPI. For example:
|
||||
1. An author of GPL software would likely use HIDAPI under the terms of the
|
||||
GPL.
|
||||
|
||||
2. An author of commercial closed-source software would likely use HIDAPI
|
||||
under the terms of the BSD-style license or the original HIDAPI license.
|
||||
|
||||
+218
@@ -0,0 +1,218 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>files</key>
|
||||
<dict>
|
||||
<key>Resources/AUTHORS.txt</key>
|
||||
<data>
|
||||
MKG+c/Ng8ZXbj7p1G5WReTJm06Y=
|
||||
</data>
|
||||
<key>Resources/Info.plist</key>
|
||||
<data>
|
||||
k9vWJij3RA8s13h/WkHnqVv977U=
|
||||
</data>
|
||||
<key>Resources/LICENSE-bsd.txt</key>
|
||||
<data>
|
||||
fd5CtMb9r65yLY0HVWttnbpNKWM=
|
||||
</data>
|
||||
<key>Resources/LICENSE-gpl3.txt</key>
|
||||
<data>
|
||||
hiS82uVbru8AzRHV38+mD2hxCgI=
|
||||
</data>
|
||||
<key>Resources/LICENSE-orig.txt</key>
|
||||
<data>
|
||||
ZgR9vPP9aJyZRyJm9a0UHFPW8sY=
|
||||
</data>
|
||||
<key>Resources/LICENSE.txt</key>
|
||||
<data>
|
||||
9VS7iq5RUyXd9/XSbbwcYpQMum4=
|
||||
</data>
|
||||
</dict>
|
||||
<key>files2</key>
|
||||
<dict>
|
||||
<key>Headers/hidapi.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
k64XAQ+3r97nmyIHwE8OT8womds=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
lVEZqQL+xakdQRDnxHo2VwkisMieptRP2Im3DPsMMAs=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/AUTHORS.txt</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
MKG+c/Ng8ZXbj7p1G5WReTJm06Y=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
syens6RZflkCVW7D6EB8vdHiiKvUYjt7S1bRTUnoTss=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/Info.plist</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
k9vWJij3RA8s13h/WkHnqVv977U=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
WME8EBqUAByTxhCypUOOYXVJiElcUNSkBXR1bxH3n5Q=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/LICENSE-bsd.txt</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
fd5CtMb9r65yLY0HVWttnbpNKWM=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
MOsb7ym0b4unq4tBYDXb2TywNKRUgd2XgVuUQoRYLNI=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/LICENSE-gpl3.txt</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
hiS82uVbru8AzRHV38+mD2hxCgI=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/LICENSE-orig.txt</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
ZgR9vPP9aJyZRyJm9a0UHFPW8sY=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
+1Q2qmPRtxqN+/dOyvGltOHsTff4AHTRH+yZKE9pyl8=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/LICENSE.txt</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
9VS7iq5RUyXd9/XSbbwcYpQMum4=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
fTsIfDTzXU1TjjvN3R/49m6S+e8zaIGZlIKADd+ECRM=
|
||||
</data>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>rules</key>
|
||||
<dict>
|
||||
<key>^Resources/</key>
|
||||
<true/>
|
||||
<key>^Resources/.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^Resources/Base\.lproj/</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>1010</real>
|
||||
</dict>
|
||||
<key>^version.plist$</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>rules2</key>
|
||||
<dict>
|
||||
<key>.*\.dSYM($|/)</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>11</real>
|
||||
</dict>
|
||||
<key>^(.*/)?\.DS_Store$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>2000</real>
|
||||
</dict>
|
||||
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
|
||||
<dict>
|
||||
<key>nested</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>10</real>
|
||||
</dict>
|
||||
<key>^.*</key>
|
||||
<true/>
|
||||
<key>^Info\.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^PkgInfo$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^Resources/</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^Resources/.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^Resources/Base\.lproj/</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>1010</real>
|
||||
</dict>
|
||||
<key>^[^/]+$</key>
|
||||
<dict>
|
||||
<key>nested</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>10</real>
|
||||
</dict>
|
||||
<key>^embedded\.provisionprofile$</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^version\.plist$</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
Executable
BIN
Binary file not shown.
+1
@@ -0,0 +1 @@
|
||||
A
|
||||
+1
@@ -0,0 +1 @@
|
||||
Versions/Current/hidapi
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "SDL_loadso.h"
|
||||
#include "SDL_log.h"
|
||||
#include "SDL_messagebox.h"
|
||||
#include "SDL_metal.h"
|
||||
#include "SDL_mutex.h"
|
||||
#include "SDL_power.h"
|
||||
#include "SDL_render.h"
|
||||
@@ -58,6 +59,7 @@
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_version.h"
|
||||
#include "SDL_video.h"
|
||||
#include "SDL_locale.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -53,6 +53,8 @@ assert can have unique static variables associated with it.
|
||||
#define SDL_TriggerBreakpoint() __debugbreak()
|
||||
#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) )
|
||||
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
|
||||
#elif ( defined(__APPLE__) && defined(__arm64__) ) /* this might work on other ARM targets, but this is a known quantity... */
|
||||
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #22\n\t" )
|
||||
#elif defined(__386__) && defined(__WATCOMC__)
|
||||
#define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
|
||||
#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -50,6 +50,9 @@ typedef enum
|
||||
SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate
|
||||
dstRGB = srcRGB * dstRGB
|
||||
dstA = dstA */
|
||||
SDL_BLENDMODE_MUL = 0x00000008, /**< color multiply
|
||||
dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA))
|
||||
dstA = (srcA * dstA) + (dstA * (1-srcA)) */
|
||||
SDL_BLENDMODE_INVALID = 0x7FFFFFFF
|
||||
|
||||
/* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -74,6 +74,7 @@
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
#define HAVE_STRTOK_R 1
|
||||
#define HAVE_STRTOL 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE_STRTOLL 1
|
||||
@@ -130,14 +131,17 @@
|
||||
#define HAVE_SYSCONF 1
|
||||
#define HAVE_SYSCTLBYNAME 1
|
||||
|
||||
#define HAVE_GCC_ATOMICS 1
|
||||
|
||||
/* Enable various audio drivers */
|
||||
#define SDL_AUDIO_DRIVER_COREAUDIO 1
|
||||
#define SDL_AUDIO_DRIVER_DISK 1
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
|
||||
/* Enable various input drivers */
|
||||
#define SDL_JOYSTICK_HIDAPI 1
|
||||
#define SDL_JOYSTICK_IOKIT 1
|
||||
#define SDL_JOYSTICK_HIDAPI 1
|
||||
#define SDL_JOYSTICK_VIRTUAL 1
|
||||
#define SDL_HAPTIC_IOKIT 1
|
||||
|
||||
/* Enable the dummy sensor driver */
|
||||
@@ -157,13 +161,13 @@
|
||||
#define SDL_VIDEO_DRIVER_COCOA 1
|
||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||
#undef SDL_VIDEO_DRIVER_X11
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/usr/X11R6/lib/libXi.6.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/opt/X11/lib/libX11.6.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/opt/X11/lib/libXext.6.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/opt/X11/lib/libXinerama.1.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/opt/X11/lib/libXi.6.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/opt/X11/lib/libXrandr.2.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/opt/X11/lib/libXss.1.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/opt/X11/lib/libXxf86vm.1.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_XDBE 1
|
||||
#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
|
||||
#define SDL_VIDEO_DRIVER_X11_XRANDR 1
|
||||
@@ -191,9 +195,15 @@
|
||||
#define SDL_VIDEO_RENDER_OGL_ES2 1
|
||||
#endif
|
||||
|
||||
#ifndef SDL_VIDEO_RENDER_METAL
|
||||
/* Metal only supported on 64-bit architectures with 10.11+ */
|
||||
#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
|
||||
#define SDL_PLATFORM_SUPPORTS_METAL 1
|
||||
#else
|
||||
#define SDL_PLATFORM_SUPPORTS_METAL 0
|
||||
#endif
|
||||
|
||||
#ifndef SDL_VIDEO_RENDER_METAL
|
||||
#if SDL_PLATFORM_SUPPORTS_METAL
|
||||
#define SDL_VIDEO_RENDER_METAL 1
|
||||
#else
|
||||
#define SDL_VIDEO_RENDER_METAL 0
|
||||
@@ -217,13 +227,22 @@
|
||||
#define SDL_VIDEO_OPENGL_GLX 1
|
||||
#endif
|
||||
|
||||
/* Enable Vulkan support */
|
||||
/* Metal/Vulkan Portability only supported on 64-bit architectures with 10.11+ */
|
||||
#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
|
||||
/* Enable Vulkan and Metal support */
|
||||
#ifndef SDL_VIDEO_VULKAN
|
||||
#if SDL_PLATFORM_SUPPORTS_METAL
|
||||
#define SDL_VIDEO_VULKAN 1
|
||||
#else
|
||||
#define SDL_VIDEO_VULKAN 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SDL_VIDEO_METAL
|
||||
#if SDL_PLATFORM_SUPPORTS_METAL
|
||||
#define SDL_VIDEO_METAL 1
|
||||
#else
|
||||
#define SDL_VIDEO_METAL 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Enable system power support */
|
||||
#define SDL_POWER_MACOSX 1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -73,8 +73,8 @@
|
||||
# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
|
||||
# endif
|
||||
# if defined (_M_ARM64)
|
||||
# include <armintr.h>
|
||||
# include <arm_neon.h>
|
||||
# include <arm64intr.h>
|
||||
# include <arm64_neon.h>
|
||||
# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
|
||||
# endif
|
||||
# endif
|
||||
@@ -186,6 +186,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void);
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void);
|
||||
|
||||
/**
|
||||
* This function returns true if the CPU has ARM SIMD (ARMv6) features.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasARMSIMD(void);
|
||||
|
||||
/**
|
||||
* This function returns true if the CPU has NEON (ARM SIMD) features.
|
||||
*/
|
||||
@@ -241,10 +246,33 @@ extern DECLSPEC size_t SDLCALL SDL_SIMDGetAlignment(void);
|
||||
* \return Pointer to newly-allocated block, NULL if out of memory.
|
||||
*
|
||||
* \sa SDL_SIMDAlignment
|
||||
* \sa SDL_SIMDRealloc
|
||||
* \sa SDL_SIMDFree
|
||||
*/
|
||||
extern DECLSPEC void * SDLCALL SDL_SIMDAlloc(const size_t len);
|
||||
|
||||
/**
|
||||
* \brief Reallocate memory obtained from SDL_SIMDAlloc
|
||||
*
|
||||
* It is not valid to use this function on a pointer from anything but
|
||||
* SDL_SIMDAlloc(). It can't be used on pointers from malloc, realloc,
|
||||
* SDL_malloc, memalign, new[], etc.
|
||||
*
|
||||
* \param mem The pointer obtained from SDL_SIMDAlloc. This function also
|
||||
* accepts NULL, at which point this function is the same as
|
||||
* calling SDL_realloc with a NULL pointer.
|
||||
* \param len The length, in bytes, of the block to allocated. The actual
|
||||
* allocated block might be larger due to padding, etc. Passing 0
|
||||
* will return a non-NULL pointer, assuming the system isn't out of
|
||||
* memory.
|
||||
* \return Pointer to newly-reallocated block, NULL if out of memory.
|
||||
*
|
||||
* \sa SDL_SIMDAlignment
|
||||
* \sa SDL_SIMDAlloc
|
||||
* \sa SDL_SIMDFree
|
||||
*/
|
||||
extern DECLSPEC void * SDLCALL SDL_SIMDRealloc(void *mem, size_t len);
|
||||
|
||||
/**
|
||||
* \brief Deallocate memory obtained from SDL_SIMDAlloc
|
||||
*
|
||||
@@ -255,6 +283,7 @@ extern DECLSPEC void * SDLCALL SDL_SIMDAlloc(const size_t len);
|
||||
* However, SDL_SIMDFree(NULL) is a legal no-op.
|
||||
*
|
||||
* \sa SDL_SIMDAlloc
|
||||
* \sa SDL_SIMDRealloc
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SIMDFree(void *ptr);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -42,10 +42,13 @@
|
||||
#ifdef __linux__
|
||||
#include <endian.h>
|
||||
#define SDL_BYTEORDER __BYTE_ORDER
|
||||
#else /* __linux__ */
|
||||
#elif defined(__OpenBSD__)
|
||||
#include <endian.h>
|
||||
#define SDL_BYTEORDER BYTE_ORDER
|
||||
#else
|
||||
#if defined(__hppa__) || \
|
||||
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
|
||||
(defined(__MIPS__) && defined(__MISPEB__)) || \
|
||||
(defined(__MIPS__) && defined(__MIPSEB__)) || \
|
||||
defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
|
||||
defined(__sparc__)
|
||||
#define SDL_BYTEORDER SDL_BIG_ENDIAN
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -37,9 +37,45 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Public functions */
|
||||
/* SDL_SetError() unconditionally returns -1. */
|
||||
|
||||
|
||||
/**
|
||||
* \brief Set the error message for the current thread
|
||||
*
|
||||
* \return -1, there is no error handling for this function
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
|
||||
|
||||
/**
|
||||
* \brief Get the last error message that was set
|
||||
*
|
||||
* SDL API functions may set error messages and then succeed, so you should
|
||||
* only use the error value if a function fails.
|
||||
*
|
||||
* This returns a pointer to a static buffer for convenience and should not
|
||||
* be called by multiple threads simultaneously.
|
||||
*
|
||||
* \return a pointer to the last error message that was set
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_GetError(void);
|
||||
|
||||
/**
|
||||
* \brief Get the last error message that was set for the current thread
|
||||
*
|
||||
* SDL API functions may set error messages and then succeed, so you should
|
||||
* only use the error value if a function fails.
|
||||
*
|
||||
* \param errstr A buffer to fill with the last error message that was set
|
||||
* for the current thread
|
||||
* \param maxlen The size of the buffer pointed to by the errstr parameter
|
||||
*
|
||||
* \return errstr
|
||||
*/
|
||||
extern DECLSPEC char * SDLCALL SDL_GetErrorMsg(char *errstr, int maxlen);
|
||||
|
||||
/**
|
||||
* \brief Clear the error message for the current thread
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_ClearError(void);
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -85,6 +85,8 @@ typedef enum
|
||||
Called on Android in onResume()
|
||||
*/
|
||||
|
||||
SDL_LOCALECHANGED, /**< The user's locale preferences have changed. */
|
||||
|
||||
/* Display events */
|
||||
SDL_DISPLAYEVENT = 0x150, /**< Display state change */
|
||||
|
||||
@@ -442,6 +444,7 @@ typedef struct SDL_TouchFingerEvent
|
||||
float dx; /**< Normalized in the range -1...1 */
|
||||
float dy; /**< Normalized in the range -1...1 */
|
||||
float pressure; /**< Normalized in the range 0...1 */
|
||||
Uint32 windowID; /**< The window underneath the finger, if any */
|
||||
} SDL_TouchFingerEvent;
|
||||
|
||||
|
||||
@@ -558,7 +561,7 @@ typedef union SDL_Event
|
||||
{
|
||||
Uint32 type; /**< Event type, shared with all events */
|
||||
SDL_CommonEvent common; /**< Common event data */
|
||||
SDL_DisplayEvent display; /**< Window event data */
|
||||
SDL_DisplayEvent display; /**< Display event data */
|
||||
SDL_WindowEvent window; /**< Window event data */
|
||||
SDL_KeyboardEvent key; /**< Keyboard event data */
|
||||
SDL_TextEditingEvent edit; /**< Text editing event data */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -57,6 +57,16 @@ extern "C" {
|
||||
struct _SDL_GameController;
|
||||
typedef struct _SDL_GameController SDL_GameController;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SDL_CONTROLLER_TYPE_UNKNOWN = 0,
|
||||
SDL_CONTROLLER_TYPE_XBOX360,
|
||||
SDL_CONTROLLER_TYPE_XBOXONE,
|
||||
SDL_CONTROLLER_TYPE_PS3,
|
||||
SDL_CONTROLLER_TYPE_PS4,
|
||||
SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO,
|
||||
SDL_CONTROLLER_TYPE_VIRTUAL
|
||||
} SDL_GameControllerType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@@ -175,6 +185,12 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index);
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
|
||||
|
||||
/**
|
||||
* Get the type of a game controller.
|
||||
* This can be called before any controllers are opened.
|
||||
*/
|
||||
extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerTypeForIndex(int joystick_index);
|
||||
|
||||
/**
|
||||
* Get the mapping of a game controller.
|
||||
* This can be called before any controllers are opened.
|
||||
@@ -199,11 +215,21 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_
|
||||
*/
|
||||
extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid);
|
||||
|
||||
/**
|
||||
* Return the SDL_GameController associated with a player index.
|
||||
*/
|
||||
extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromPlayerIndex(int player_index);
|
||||
|
||||
/**
|
||||
* Return the name for this currently opened controller
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
|
||||
|
||||
/**
|
||||
* Return the type of this currently opened controller
|
||||
*/
|
||||
extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerGetType(SDL_GameController *gamecontroller);
|
||||
|
||||
/**
|
||||
* Get the player index of an opened game controller, or -1 if it's not available
|
||||
*
|
||||
@@ -211,6 +237,11 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *g
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller);
|
||||
|
||||
/**
|
||||
* Set the player index of an opened game controller
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int player_index);
|
||||
|
||||
/**
|
||||
* Get the USB vendor ID of an opened controller, if available.
|
||||
* If the vendor ID isn't available this function returns 0.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -336,6 +336,14 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
||||
*/
|
||||
#define SDL_HAPTIC_SPHERICAL 2
|
||||
|
||||
/**
|
||||
* \brief Use this value to play an effect on the steering wheel axis. This
|
||||
* provides better compatibility across platforms and devices as SDL will guess
|
||||
* the correct axis.
|
||||
* \sa SDL_HapticDirection
|
||||
*/
|
||||
#define SDL_HAPTIC_STEERING_AXIS 3
|
||||
|
||||
/* @} *//* Direction encodings */
|
||||
|
||||
/* @} *//* Haptic features */
|
||||
@@ -444,6 +452,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
||||
* \sa SDL_HAPTIC_POLAR
|
||||
* \sa SDL_HAPTIC_CARTESIAN
|
||||
* \sa SDL_HAPTIC_SPHERICAL
|
||||
* \sa SDL_HAPTIC_STEERING_AXIS
|
||||
* \sa SDL_HapticEffect
|
||||
* \sa SDL_HapticNumAxes
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -164,6 +164,21 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER "SDL_VIDEO_ALLOW_SCREENSAVER"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether the graphics context is externally managed.
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - SDL will manage graphics contexts that are attached to windows.
|
||||
* "1" - Disable graphics context management on windows.
|
||||
*
|
||||
* By default SDL will manage OpenGL contexts in certain situations. For example, on Android the
|
||||
* context will be automatically saved and restored when pausing the application. Additionally, some
|
||||
* platforms will assume usage of OpenGL if Vulkan isn't used. Setting this to "1" will prevent this
|
||||
* behavior, which is desireable when the application manages the graphics context, such as
|
||||
* an externally managed OpenGL context or attaching a Vulkan surface to the window.
|
||||
*/
|
||||
#define SDL_HINT_VIDEO_EXTERNAL_CONTEXT "SDL_VIDEO_EXTERNAL_CONTEXT"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether the X11 VidMode extension should be used.
|
||||
*
|
||||
@@ -197,6 +212,12 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR"
|
||||
|
||||
/**
|
||||
* \brief A variable forcing the visual ID chosen for new X11 windows
|
||||
*
|
||||
*/
|
||||
#define SDL_HINT_VIDEO_X11_WINDOW_VISUALID "SDL_VIDEO_X11_WINDOW_VISUALID"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether the X11 _NET_WM_PING protocol should be supported.
|
||||
*
|
||||
@@ -223,6 +244,17 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether X11 should use GLX or EGL by default
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - Use GLX
|
||||
* "1" - Use EGL
|
||||
*
|
||||
* By default SDL will use GLX when both are present.
|
||||
*/
|
||||
#define SDL_HINT_VIDEO_X11_FORCE_EGL "SDL_VIDEO_X11_FORCE_EGL"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden
|
||||
*
|
||||
@@ -282,6 +314,17 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE "SDL_MOUSE_RELATIVE_SPEED_SCALE"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether relative mouse motion is affected by renderer scaling
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - Relative motion is unaffected by DPI or renderer's logical size
|
||||
* "1" - Relative motion is scaled according to DPI scaling and logical size
|
||||
*
|
||||
* By default relative mouse deltas are affected by DPI and renderer scaling
|
||||
*/
|
||||
#define SDL_HINT_MOUSE_RELATIVE_SCALING "SDL_MOUSE_RELATIVE_SCALING"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether relative mouse mode is implemented using mouse warping
|
||||
*
|
||||
@@ -326,7 +369,9 @@ extern "C" {
|
||||
#define SDL_HINT_MOUSE_TOUCH_EVENTS "SDL_MOUSE_TOUCH_EVENTS"
|
||||
|
||||
/**
|
||||
* \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true.
|
||||
* \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to false.
|
||||
* \warning Before SDL 2.0.14, this defaulted to true! In 2.0.14, we're
|
||||
* seeing if "true" causes more problems than it solves in modern times.
|
||||
*
|
||||
*/
|
||||
#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS"
|
||||
@@ -436,6 +481,24 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING"
|
||||
|
||||
/**
|
||||
* \brief A variable that overrides the automatic controller type detection
|
||||
*
|
||||
* The variable should be comma separated entries, in the form: VID/PID=type
|
||||
*
|
||||
* The VID and PID should be hexadecimal with exactly 4 digits, e.g. 0x00fd
|
||||
*
|
||||
* The type should be one of:
|
||||
* Xbox360
|
||||
* XboxOne
|
||||
* PS3
|
||||
* PS4
|
||||
* SwitchPro
|
||||
*
|
||||
* This hint affects what driver is used, and must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER)
|
||||
*/
|
||||
#define SDL_HINT_GAMECONTROLLERTYPE "SDL_GAMECONTROLLERTYPE"
|
||||
|
||||
/**
|
||||
* \brief A variable that lets you manually hint extra gamecontroller db entries.
|
||||
*
|
||||
@@ -482,6 +545,29 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"
|
||||
|
||||
/**
|
||||
* \brief If set, game controller face buttons report their values according to their labels instead of their positional layout.
|
||||
*
|
||||
* For example, on Nintendo Switch controllers, normally you'd get:
|
||||
*
|
||||
* (Y)
|
||||
* (X) (B)
|
||||
* (A)
|
||||
*
|
||||
* but if this hint is set, you'll get:
|
||||
*
|
||||
* (X)
|
||||
* (Y) (A)
|
||||
* (B)
|
||||
*
|
||||
* The variable can be set to the following values:
|
||||
* "0" - Report the face buttons by position, as though they were on an Xbox controller.
|
||||
* "1" - Report the face buttons by label instead of position
|
||||
*
|
||||
* The default value is "1". This hint may be set at any time.
|
||||
*/
|
||||
#define SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS "SDL_GAMECONTROLLER_USE_BUTTON_LABELS"
|
||||
|
||||
/**
|
||||
* \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
|
||||
*
|
||||
@@ -561,10 +647,34 @@ extern "C" {
|
||||
* "0" - HIDAPI driver is not used
|
||||
* "1" - HIDAPI driver is used
|
||||
*
|
||||
* The default is the value of SDL_HINT_JOYSTICK_HIDAPI
|
||||
* The default is "0" on Windows, otherwise the value of SDL_HINT_JOYSTICK_HIDAPI
|
||||
*/
|
||||
#define SDL_HINT_JOYSTICK_HIDAPI_XBOX "SDL_JOYSTICK_HIDAPI_XBOX"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether the HIDAPI driver for XBox controllers on Windows should pull correlated
|
||||
* data from XInput.
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - HIDAPI Xbox driver will only use HIDAPI data
|
||||
* "1" - HIDAPI Xbox driver will also pull data from XInput, providing better trigger axes, guide button
|
||||
* presses, and rumble support
|
||||
*
|
||||
* The default is "1". This hint applies to any joysticks opened after setting the hint.
|
||||
*/
|
||||
#define SDL_HINT_JOYSTICK_HIDAPI_CORRELATE_XINPUT "SDL_JOYSTICK_HIDAPI_CORRELATE_XINPUT"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether the HIDAPI driver for Nintendo GameCube controllers should be used.
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - HIDAPI driver is not used
|
||||
* "1" - HIDAPI driver is used
|
||||
*
|
||||
* The default is the value of SDL_HINT_JOYSTICK_HIDAPI
|
||||
*/
|
||||
#define SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE "SDL_JOYSTICK_HIDAPI_GAMECUBE"
|
||||
|
||||
/**
|
||||
* \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs
|
||||
*
|
||||
@@ -576,6 +686,27 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_HINT_ENABLE_STEAM_CONTROLLERS "SDL_ENABLE_STEAM_CONTROLLERS"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether the RAWINPUT joystick drivers should be used for better handling XInput-capable devices.
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - RAWINPUT drivers are not used
|
||||
* "1" - RAWINPUT drivers are used (the default)
|
||||
*
|
||||
*/
|
||||
#define SDL_HINT_JOYSTICK_RAWINPUT "SDL_JOYSTICK_RAWINPUT"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether Linux joysticks adhere their HID-defined deadzones or return unfiltered values.
|
||||
* This is useful for Wine which implements its own deadzone handler if requested by games, also it enables xinput
|
||||
* games to receive unfiltered values as required from the API.
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - Linux deadzones are not used by SDL
|
||||
* "1" - Linux deadzones are used by SDL (the default)
|
||||
*
|
||||
*/
|
||||
#define SDL_HINT_LINUX_JOYSTICK_DEADZONES "SDL_LINUX_JOYSTICK_DEADZONES"
|
||||
|
||||
/**
|
||||
* \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it.
|
||||
@@ -646,6 +777,19 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_HINT_THREAD_STACK_SIZE "SDL_THREAD_STACK_SIZE"
|
||||
|
||||
/**
|
||||
* \brief A string specifying additional information to use with SDL_SetThreadPriority.
|
||||
*
|
||||
* By default SDL_SetThreadPriority will make appropriate system changes in order to
|
||||
* apply a thread priority. For example on systems using pthreads the scheduler policy
|
||||
* is changed automatically to a policy that works well with a given priority.
|
||||
* Code which has specific requirements can override SDL's default behavior with this hint.
|
||||
*
|
||||
* pthread hint values are "current", "other", "fifo" and "rr".
|
||||
* Currently no other platform hint values are defined but may be in the future.
|
||||
*/
|
||||
#define SDL_HINT_THREAD_PRIORITY_POLICY "SDL_THREAD_PRIORITY_POLICY"
|
||||
|
||||
/**
|
||||
* \brief If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and iOS)
|
||||
*/
|
||||
@@ -910,10 +1054,26 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT"
|
||||
|
||||
/**
|
||||
* \brief Disable giving back control to the browser automatically
|
||||
* when running with asyncify
|
||||
*
|
||||
* With -s ASYNCIFY, SDL2 calls emscripten_sleep during operations
|
||||
* such as refreshing the screen or polling events.
|
||||
*
|
||||
* This hint only applies to the emscripten platform
|
||||
*
|
||||
* The variable can be set to the following values:
|
||||
* "0" - Disable emscripten_sleep calls (if you give back browser control manually or use asyncify for other purposes)
|
||||
* "1" - Enable emscripten_sleep calls (the default)
|
||||
*/
|
||||
#define SDL_HINT_EMSCRIPTEN_ASYNCIFY "SDL_EMSCRIPTEN_ASYNCIFY"
|
||||
|
||||
/**
|
||||
* \brief Tell SDL not to catch the SIGINT or SIGTERM signals.
|
||||
*
|
||||
* This hint only applies to Unix-like platforms.
|
||||
* This hint only applies to Unix-like platforms, and should set before
|
||||
* any calls to SDL_Init()
|
||||
*
|
||||
* The variable can be set to the following values:
|
||||
* "0" - SDL will install a SIGINT and SIGTERM handler, and when it
|
||||
@@ -1174,6 +1334,77 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_HINT_WAVE_FACT_CHUNK "SDL_WAVE_FACT_CHUNK"
|
||||
|
||||
/**
|
||||
* \brief Override for SDL_GetDisplayUsableBounds()
|
||||
*
|
||||
* If set, this hint will override the expected results for
|
||||
* SDL_GetDisplayUsableBounds() for display index 0. Generally you don't want
|
||||
* to do this, but this allows an embedded system to request that some of the
|
||||
* screen be reserved for other uses when paired with a well-behaved
|
||||
* application.
|
||||
*
|
||||
* The contents of this hint must be 4 comma-separated integers, the first
|
||||
* is the bounds x, then y, width and height, in that order.
|
||||
*/
|
||||
#define SDL_HINT_DISPLAY_USABLE_BOUNDS "SDL_DISPLAY_USABLE_BOUNDS"
|
||||
|
||||
/**
|
||||
* \brief Specify an application name for an audio device.
|
||||
*
|
||||
* Some audio backends (such as PulseAudio) allow you to describe your audio
|
||||
* stream. Among other things, this description might show up in a system
|
||||
* control panel that lets the user adjust the volume on specific audio
|
||||
* streams instead of using one giant master volume slider.
|
||||
*
|
||||
* This hints lets you transmit that information to the OS. The contents of
|
||||
* this hint are used while opening an audio device. You should use a string
|
||||
* that describes your program ("My Game 2: The Revenge")
|
||||
*
|
||||
* Setting this to "" or leaving it unset will have SDL use a reasonable
|
||||
* default: probably the application's name or "SDL Application" if SDL
|
||||
* doesn't have any better information.
|
||||
*
|
||||
* On targets where this is not supported, this hint does nothing.
|
||||
*/
|
||||
#define SDL_HINT_AUDIO_DEVICE_APP_NAME "SDL_AUDIO_DEVICE_APP_NAME"
|
||||
|
||||
/**
|
||||
* \brief Specify an application name for an audio device.
|
||||
*
|
||||
* Some audio backends (such as PulseAudio) allow you to describe your audio
|
||||
* stream. Among other things, this description might show up in a system
|
||||
* control panel that lets the user adjust the volume on specific audio
|
||||
* streams instead of using one giant master volume slider.
|
||||
*
|
||||
* This hints lets you transmit that information to the OS. The contents of
|
||||
* this hint are used while opening an audio device. You should use a string
|
||||
* that describes your what your program is playing ("audio stream" is
|
||||
* probably sufficient in many cases, but this could be useful for something
|
||||
* like "team chat" if you have a headset playing VoIP audio separately).
|
||||
*
|
||||
* Setting this to "" or leaving it unset will have SDL use a reasonable
|
||||
* default: "audio stream" or something similar.
|
||||
*
|
||||
* On targets where this is not supported, this hint does nothing.
|
||||
*/
|
||||
#define SDL_HINT_AUDIO_DEVICE_STREAM_NAME "SDL_AUDIO_DEVICE_STREAM_NAME"
|
||||
|
||||
|
||||
/**
|
||||
* \brief Override for SDL_GetPreferredLocales()
|
||||
*
|
||||
* If set, this will be favored over anything the OS might report for the
|
||||
* user's preferred locales. Changing this hint at runtime will not generate
|
||||
* a SDL_LOCALECHANGED event (but if you can change the hint, you can push
|
||||
* your own event, if you want).
|
||||
*
|
||||
* The format of this hint is a comma-separated list of language and locale,
|
||||
* combined with an underscore, as is a common format: "en_GB". Locale is
|
||||
* optional: "en". So you might have a list like this: "en_GB,jp,es_PT"
|
||||
*/
|
||||
#define SDL_HINT_PREFERRED_LOCALES "SDL_PREFERRED_LOCALES"
|
||||
|
||||
|
||||
/**
|
||||
* \brief An enumeration of hint priorities
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -105,6 +105,7 @@ typedef enum
|
||||
SDL_JOYSTICK_POWER_MAX
|
||||
} SDL_JoystickPowerLevel;
|
||||
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/**
|
||||
@@ -192,7 +193,46 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index);
|
||||
/**
|
||||
* Return the SDL_Joystick associated with an instance id.
|
||||
*/
|
||||
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID joyid);
|
||||
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID instance_id);
|
||||
|
||||
/**
|
||||
* Return the SDL_Joystick associated with a player index.
|
||||
*/
|
||||
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromPlayerIndex(int player_index);
|
||||
|
||||
/**
|
||||
* Attaches a new virtual joystick.
|
||||
* Returns the joystick's device index, or -1 if an error occurred.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type,
|
||||
int naxes,
|
||||
int nbuttons,
|
||||
int nhats);
|
||||
|
||||
/**
|
||||
* Detaches a virtual joystick
|
||||
* Returns 0 on success, or -1 if an error occurred.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickDetachVirtual(int device_index);
|
||||
|
||||
/**
|
||||
* Indicates whether or not a virtual-joystick is at a given device index.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickIsVirtual(int device_index);
|
||||
|
||||
/**
|
||||
* Set values on an opened, virtual-joystick's controls.
|
||||
* Please note that values set here will not be applied until the next
|
||||
* call to SDL_JoystickUpdate, which can either be called directly,
|
||||
* or can be called indirectly through various other SDL APIS,
|
||||
* including, but not limited to the following: SDL_PollEvent,
|
||||
* SDL_PumpEvents, SDL_WaitEventTimeout, SDL_WaitEvent.
|
||||
*
|
||||
* Returns 0 on success, -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualAxis(SDL_Joystick * joystick, int axis, Sint16 value);
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualButton(SDL_Joystick * joystick, int button, Uint8 value);
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualHat(SDL_Joystick * joystick, int hat, Uint8 value);
|
||||
|
||||
/**
|
||||
* Return the name for this currently opened joystick.
|
||||
@@ -207,6 +247,11 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick);
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick);
|
||||
|
||||
/**
|
||||
* Set the player index of an opened joystick
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_JoystickSetPlayerIndex(SDL_Joystick * joystick, int player_index);
|
||||
|
||||
/**
|
||||
* Return the GUID for this opened joystick
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -47,7 +47,7 @@ typedef Sint32 SDL_Keycode;
|
||||
#define SDLK_SCANCODE_MASK (1<<30)
|
||||
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
|
||||
|
||||
enum
|
||||
typedef enum
|
||||
{
|
||||
SDLK_UNKNOWN = 0,
|
||||
|
||||
@@ -317,7 +317,7 @@ enum
|
||||
|
||||
SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND),
|
||||
SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD)
|
||||
};
|
||||
} SDL_KeyCode;
|
||||
|
||||
/**
|
||||
* \brief Enumeration of valid key mods (possibly OR'd together).
|
||||
@@ -336,13 +336,13 @@ typedef enum
|
||||
KMOD_NUM = 0x1000,
|
||||
KMOD_CAPS = 0x2000,
|
||||
KMOD_MODE = 0x4000,
|
||||
KMOD_RESERVED = 0x8000
|
||||
} SDL_Keymod;
|
||||
KMOD_RESERVED = 0x8000,
|
||||
|
||||
#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
|
||||
#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
|
||||
#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
|
||||
#define KMOD_GUI (KMOD_LGUI|KMOD_RGUI)
|
||||
KMOD_CTRL = KMOD_LCTRL | KMOD_RCTRL,
|
||||
KMOD_SHIFT = KMOD_LSHIFT | KMOD_RSHIFT,
|
||||
KMOD_ALT = KMOD_LALT | KMOD_RALT,
|
||||
KMOD_GUI = KMOD_LGUI | KMOD_RGUI,
|
||||
} SDL_Keymod;
|
||||
|
||||
#endif /* SDL_keycode_h_ */
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_locale.h
|
||||
*
|
||||
* Include file for SDL locale services
|
||||
*/
|
||||
|
||||
#ifndef _SDL_locale_h
|
||||
#define _SDL_locale_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct SDL_Locale
|
||||
{
|
||||
const char *language; /**< A language name, like "en" for English. */
|
||||
const char *country; /**< A country, like "US" for America. Can be NULL. */
|
||||
} SDL_Locale;
|
||||
|
||||
/**
|
||||
* \brief Report the user's preferred locale.
|
||||
*
|
||||
* This returns an array of SDL_Locale structs, the final item zeroed out.
|
||||
* When the caller is done with this array, it should call SDL_free() on
|
||||
* the returned value; all the memory involved is allocated in a single
|
||||
* block, so a single SDL_free() will suffice.
|
||||
*
|
||||
* Returned language strings are in the format xx, where 'xx' is an ISO-639
|
||||
* language specifier (such as "en" for English, "de" for German, etc).
|
||||
* Country strings are in the format YY, where "YY" is an ISO-3166 country
|
||||
* code (such as "US" for the United States, "CA" for Canada, etc). Country
|
||||
* might be NULL if there's no specific guidance on them (so you might get
|
||||
* { "en", "US" } for American English, but { "en", NULL } means "English
|
||||
* language, generically"). Language strings are never NULL, except to
|
||||
* terminate the array.
|
||||
*
|
||||
* Please note that not all of these strings are 2 characters; some are
|
||||
* three or more.
|
||||
*
|
||||
* The returned list of locales are in the order of the user's preference.
|
||||
* For example, a German citizen that is fluent in US English and knows
|
||||
* enough Japanese to navigate around Tokyo might have a list like:
|
||||
* { "de", "en_US", "jp", NULL }. Someone from England might prefer British
|
||||
* English (where "color" is spelled "colour", etc), but will settle for
|
||||
* anything like it: { "en_GB", "en", NULL }.
|
||||
*
|
||||
* This function returns NULL on error, including when the platform does not
|
||||
* supply this information at all.
|
||||
*
|
||||
* This might be a "slow" call that has to query the operating system. It's
|
||||
* best to ask for this once and save the results. However, this list can
|
||||
* change, usually because the user has changed a system preference outside
|
||||
* of your program; SDL will send an SDL_LOCALECHANGED event in this case,
|
||||
* if possible, and you can call this function again to get an updated copy
|
||||
* of preferred locales.
|
||||
*
|
||||
* \return array of locales, terminated with a locale with a NULL language
|
||||
* field. Will return NULL on error.
|
||||
*/
|
||||
extern DECLSPEC SDL_Locale * SDLCALL SDL_GetPreferredLocales(void);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_locale_h */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -61,7 +61,7 @@ extern "C" {
|
||||
* at the VERBOSE level and all other categories are enabled at the
|
||||
* CRITICAL level.
|
||||
*/
|
||||
enum
|
||||
typedef enum
|
||||
{
|
||||
SDL_LOG_CATEGORY_APPLICATION,
|
||||
SDL_LOG_CATEGORY_ERROR,
|
||||
@@ -94,7 +94,7 @@ enum
|
||||
};
|
||||
*/
|
||||
SDL_LOG_CATEGORY_CUSTOM
|
||||
};
|
||||
} SDL_LogCategory;
|
||||
|
||||
/**
|
||||
* \brief The predefined log priorities
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -36,9 +36,11 @@ extern "C" {
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */
|
||||
SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */
|
||||
SDL_MESSAGEBOX_INFORMATION = 0x00000040 /**< informational dialog */
|
||||
SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */
|
||||
SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */
|
||||
SDL_MESSAGEBOX_INFORMATION = 0x00000040, /**< informational dialog */
|
||||
SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = 0x00000080, /**< buttons placed left to right */
|
||||
SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = 0x00000100 /**< buttons placed right to left */
|
||||
} SDL_MessageBoxFlags;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_metal.h
|
||||
*
|
||||
* Header file for functions to creating Metal layers and views on SDL windows.
|
||||
*/
|
||||
|
||||
#ifndef SDL_metal_h_
|
||||
#define SDL_metal_h_
|
||||
|
||||
#include "SDL_video.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS).
|
||||
*
|
||||
* \note This can be cast directly to an NSView or UIView.
|
||||
*/
|
||||
typedef void *SDL_MetalView;
|
||||
|
||||
/**
|
||||
* \name Metal support functions
|
||||
*/
|
||||
/* @{ */
|
||||
|
||||
/**
|
||||
* \brief Create a CAMetalLayer-backed NSView/UIView and attach it to the
|
||||
* specified window.
|
||||
*
|
||||
* On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on its
|
||||
* own. It is up to user code to do that.
|
||||
*
|
||||
* The returned handle can be casted directly to a NSView or UIView.
|
||||
* To access the backing CAMetalLayer, call SDL_Metal_GetLayer().
|
||||
*
|
||||
* \note \a window must be created with the SDL_WINDOW_METAL flag.
|
||||
*
|
||||
* \sa SDL_Metal_DestroyView
|
||||
* \sa SDL_Metal_GetLayer
|
||||
*/
|
||||
extern DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window * window);
|
||||
|
||||
/**
|
||||
* \brief Destroy an existing SDL_MetalView object.
|
||||
*
|
||||
* This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was
|
||||
* called after SDL_CreateWindow.
|
||||
*
|
||||
* \sa SDL_Metal_CreateView
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view);
|
||||
|
||||
/**
|
||||
* \brief Get a pointer to the backing CAMetalLayer for the given view.
|
||||
*
|
||||
* \sa SDL_MetalCreateView
|
||||
*/
|
||||
extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view);
|
||||
|
||||
/**
|
||||
* \brief Get the size of a window's underlying drawable in pixels (for use
|
||||
* with setting viewport, scissor & etc).
|
||||
*
|
||||
* \param window SDL_Window from which the drawable size should be queried
|
||||
* \param w Pointer to variable for storing the width in pixels,
|
||||
* may be NULL
|
||||
* \param h Pointer to variable for storing the height in pixels,
|
||||
* may be NULL
|
||||
*
|
||||
* This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
|
||||
* drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a
|
||||
* platform with high-DPI support (Apple calls this "Retina"), and not disabled
|
||||
* by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.
|
||||
*
|
||||
* \note On macOS high-DPI support must be enabled for an application by
|
||||
* setting NSHighResolutionCapable to true in its Info.plist.
|
||||
*
|
||||
* \sa SDL_GetWindowSize()
|
||||
* \sa SDL_CreateWindow()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_Metal_GetDrawableSize(SDL_Window* window, int *w,
|
||||
int *h);
|
||||
|
||||
/* @} *//* Metal support functions */
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* SDL_metal_h_ */
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -40,6 +40,9 @@ extern "C" {
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#endif
|
||||
#ifndef NOMINMAX /* don't define min() and max(). */
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -48,7 +48,7 @@ extern "C" {
|
||||
/* @} */
|
||||
|
||||
/** Pixel type. */
|
||||
enum
|
||||
typedef enum
|
||||
{
|
||||
SDL_PIXELTYPE_UNKNOWN,
|
||||
SDL_PIXELTYPE_INDEX1,
|
||||
@@ -62,18 +62,18 @@ enum
|
||||
SDL_PIXELTYPE_ARRAYU32,
|
||||
SDL_PIXELTYPE_ARRAYF16,
|
||||
SDL_PIXELTYPE_ARRAYF32
|
||||
};
|
||||
} SDL_PixelType;
|
||||
|
||||
/** Bitmap pixel order, high bit -> low bit. */
|
||||
enum
|
||||
typedef enum
|
||||
{
|
||||
SDL_BITMAPORDER_NONE,
|
||||
SDL_BITMAPORDER_4321,
|
||||
SDL_BITMAPORDER_1234
|
||||
};
|
||||
} SDL_BitmapOrder;
|
||||
|
||||
/** Packed component order, high bit -> low bit. */
|
||||
enum
|
||||
typedef enum
|
||||
{
|
||||
SDL_PACKEDORDER_NONE,
|
||||
SDL_PACKEDORDER_XRGB,
|
||||
@@ -84,12 +84,12 @@ enum
|
||||
SDL_PACKEDORDER_BGRX,
|
||||
SDL_PACKEDORDER_ABGR,
|
||||
SDL_PACKEDORDER_BGRA
|
||||
};
|
||||
} SDL_PackedOrder;
|
||||
|
||||
/** Array component order, low byte -> high byte. */
|
||||
/* !!! FIXME: in 2.1, make these not overlap differently with
|
||||
!!! FIXME: SDL_PACKEDORDER_*, so we can simplify SDL_ISPIXELFORMAT_ALPHA */
|
||||
enum
|
||||
typedef enum
|
||||
{
|
||||
SDL_ARRAYORDER_NONE,
|
||||
SDL_ARRAYORDER_RGB,
|
||||
@@ -98,10 +98,10 @@ enum
|
||||
SDL_ARRAYORDER_BGR,
|
||||
SDL_ARRAYORDER_BGRA,
|
||||
SDL_ARRAYORDER_ABGR
|
||||
};
|
||||
} SDL_ArrayOrder;
|
||||
|
||||
/** Packed component layout. */
|
||||
enum
|
||||
typedef enum
|
||||
{
|
||||
SDL_PACKEDLAYOUT_NONE,
|
||||
SDL_PACKEDLAYOUT_332,
|
||||
@@ -112,7 +112,7 @@ enum
|
||||
SDL_PACKEDLAYOUT_8888,
|
||||
SDL_PACKEDLAYOUT_2101010,
|
||||
SDL_PACKEDLAYOUT_1010102
|
||||
};
|
||||
} SDL_PackedLayout;
|
||||
|
||||
#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
|
||||
|
||||
@@ -188,15 +188,22 @@ typedef enum
|
||||
SDL_PIXELFORMAT_RGB332 =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED8, SDL_PACKEDORDER_XRGB,
|
||||
SDL_PACKEDLAYOUT_332, 8, 1),
|
||||
SDL_PIXELFORMAT_RGB444 =
|
||||
SDL_PIXELFORMAT_XRGB4444 =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
|
||||
SDL_PACKEDLAYOUT_4444, 12, 2),
|
||||
SDL_PIXELFORMAT_RGB555 =
|
||||
SDL_PIXELFORMAT_RGB444 = SDL_PIXELFORMAT_XRGB4444,
|
||||
SDL_PIXELFORMAT_XBGR4444 =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
|
||||
SDL_PACKEDLAYOUT_4444, 12, 2),
|
||||
SDL_PIXELFORMAT_BGR444 = SDL_PIXELFORMAT_XBGR4444,
|
||||
SDL_PIXELFORMAT_XRGB1555 =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
|
||||
SDL_PACKEDLAYOUT_1555, 15, 2),
|
||||
SDL_PIXELFORMAT_BGR555 =
|
||||
SDL_PIXELFORMAT_RGB555 = SDL_PIXELFORMAT_XRGB1555,
|
||||
SDL_PIXELFORMAT_XBGR1555 =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
|
||||
SDL_PACKEDLAYOUT_1555, 15, 2),
|
||||
SDL_PIXELFORMAT_BGR555 = SDL_PIXELFORMAT_XBGR1555,
|
||||
SDL_PIXELFORMAT_ARGB4444 =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB,
|
||||
SDL_PACKEDLAYOUT_4444, 16, 2),
|
||||
@@ -233,15 +240,17 @@ typedef enum
|
||||
SDL_PIXELFORMAT_BGR24 =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_BGR, 0,
|
||||
24, 3),
|
||||
SDL_PIXELFORMAT_RGB888 =
|
||||
SDL_PIXELFORMAT_XRGB8888 =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB,
|
||||
SDL_PACKEDLAYOUT_8888, 24, 4),
|
||||
SDL_PIXELFORMAT_RGB888 = SDL_PIXELFORMAT_XRGB8888,
|
||||
SDL_PIXELFORMAT_RGBX8888 =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBX,
|
||||
SDL_PACKEDLAYOUT_8888, 24, 4),
|
||||
SDL_PIXELFORMAT_BGR888 =
|
||||
SDL_PIXELFORMAT_XBGR8888 =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR,
|
||||
SDL_PACKEDLAYOUT_8888, 24, 4),
|
||||
SDL_PIXELFORMAT_BGR888 = SDL_PIXELFORMAT_XBGR8888,
|
||||
SDL_PIXELFORMAT_BGRX8888 =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRX,
|
||||
SDL_PACKEDLAYOUT_8888, 24, 4),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -85,6 +85,16 @@ typedef struct SDL_RendererInfo
|
||||
int max_texture_height; /**< The maximum texture height */
|
||||
} SDL_RendererInfo;
|
||||
|
||||
/**
|
||||
* \brief The scaling mode for a texture.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_ScaleModeNearest, /**< nearest pixel sampling */
|
||||
SDL_ScaleModeLinear, /**< linear filtering */
|
||||
SDL_ScaleModeBest /**< anisotropic filtering */
|
||||
} SDL_ScaleMode;
|
||||
|
||||
/**
|
||||
* \brief The access pattern allowed for a texture.
|
||||
*/
|
||||
@@ -366,6 +376,35 @@ extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
|
||||
extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
|
||||
SDL_BlendMode *blendMode);
|
||||
|
||||
/**
|
||||
* \brief Set the scale mode used for texture scale operations.
|
||||
*
|
||||
* \param texture The texture to update.
|
||||
* \param scaleMode ::SDL_ScaleMode to use for texture scaling.
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid.
|
||||
*
|
||||
* \note If the scale mode is not supported, the closest supported mode is
|
||||
* chosen.
|
||||
*
|
||||
* \sa SDL_GetTextureScaleMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture * texture,
|
||||
SDL_ScaleMode scaleMode);
|
||||
|
||||
/**
|
||||
* \brief Get the scale mode used for texture scale operations.
|
||||
*
|
||||
* \param texture The texture to query.
|
||||
* \param scaleMode A pointer filled in with the current scale mode.
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid.
|
||||
*
|
||||
* \sa SDL_SetTextureScaleMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture * texture,
|
||||
SDL_ScaleMode *scaleMode);
|
||||
|
||||
/**
|
||||
* \brief Update the given texture rectangle with new pixel data.
|
||||
*
|
||||
@@ -430,10 +469,31 @@ extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
|
||||
const SDL_Rect * rect,
|
||||
void **pixels, int *pitch);
|
||||
|
||||
/**
|
||||
* \brief Lock a portion of the texture for write-only pixel access.
|
||||
* Expose it as a SDL surface.
|
||||
*
|
||||
* \param texture The texture to lock for access, which was created with
|
||||
* ::SDL_TEXTUREACCESS_STREAMING.
|
||||
* \param rect A pointer to the rectangle to lock for access. If the rect
|
||||
* is NULL, the entire texture will be locked.
|
||||
* \param surface This is filled in with a SDL surface representing the locked area
|
||||
* Surface is freed internally after calling SDL_UnlockTexture or SDL_DestroyTexture.
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
|
||||
*
|
||||
* \sa SDL_UnlockTexture()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture,
|
||||
const SDL_Rect *rect,
|
||||
SDL_Surface **surface);
|
||||
|
||||
/**
|
||||
* \brief Unlock a texture, uploading the changes to video memory, if needed.
|
||||
* If SDL_LockTextureToSurface() was called for locking, the SDL surface is freed.
|
||||
*
|
||||
* \sa SDL_LockTexture()
|
||||
* \sa SDL_LockTextureToSurface()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
|
||||
|
||||
@@ -558,8 +618,8 @@ extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer,
|
||||
* \brief Set the clip rectangle for the current target.
|
||||
*
|
||||
* \param renderer The renderer for which clip rectangle should be set.
|
||||
* \param rect A pointer to the rectangle to set as the clip rectangle, or
|
||||
* NULL to disable clipping.
|
||||
* \param rect A pointer to the rectangle to set as the clip rectangle,
|
||||
* relative to the viewport, or NULL to disable clipping.
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
#define SDL_REVISION "hg-12952:bc90ce38f1e2"
|
||||
#define SDL_REVISION_NUMBER 12952
|
||||
#define SDL_REVISION "hg-0:aaaaaaaaaaah"
|
||||
#define SDL_REVISION_NUMBER 0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -96,15 +96,7 @@ typedef struct SDL_RWops
|
||||
#if defined(__ANDROID__)
|
||||
struct
|
||||
{
|
||||
void *fileNameRef;
|
||||
void *inputStreamRef;
|
||||
void *readableByteChannelRef;
|
||||
void *readMethod;
|
||||
void *assetFileDescriptorRef;
|
||||
long position;
|
||||
long size;
|
||||
long offset;
|
||||
int fd;
|
||||
void *asset;
|
||||
} androidio;
|
||||
#elif defined(__WIN32__)
|
||||
struct
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -121,6 +121,19 @@ typedef enum
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/**
|
||||
* Locking for multi-threaded access to the sensor API
|
||||
*
|
||||
* If you are using the sensor API or handling events from multiple threads
|
||||
* you should use these locking functions to protect access to the sensors.
|
||||
*
|
||||
* In particular, you are guaranteed that the sensor list won't change, so
|
||||
* the API functions that take a sensor index will be valid, and sensor
|
||||
* events will not be delivered.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LockSensors(void);
|
||||
extern DECLSPEC void SDLCALL SDL_UnlockSensors(void);
|
||||
|
||||
/**
|
||||
* \brief Count the number of sensors attached to the system right now
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -408,6 +408,8 @@ extern DECLSPEC int SDLCALL SDL_abs(int x);
|
||||
|
||||
extern DECLSPEC int SDLCALL SDL_isdigit(int x);
|
||||
extern DECLSPEC int SDLCALL SDL_isspace(int x);
|
||||
extern DECLSPEC int SDLCALL SDL_isupper(int x);
|
||||
extern DECLSPEC int SDLCALL SDL_islower(int x);
|
||||
extern DECLSPEC int SDLCALL SDL_toupper(int x);
|
||||
extern DECLSPEC int SDLCALL SDL_tolower(int x);
|
||||
|
||||
@@ -415,11 +417,14 @@ extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c,
|
||||
|
||||
#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
|
||||
#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
|
||||
#define SDL_zeroa(x) SDL_memset((x), 0, sizeof((x)))
|
||||
|
||||
/* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */
|
||||
SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
|
||||
{
|
||||
#if defined(__GNUC__) && defined(i386)
|
||||
#ifdef __APPLE__
|
||||
memset_pattern4(dst, &val, dwords * 4);
|
||||
#elif defined(__GNUC__) && defined(i386)
|
||||
int u0, u1, u2;
|
||||
__asm__ __volatile__ (
|
||||
"cld \n\t"
|
||||
@@ -450,11 +455,14 @@ extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_
|
||||
extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
|
||||
extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
|
||||
|
||||
extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr);
|
||||
extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
|
||||
extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
|
||||
extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
|
||||
extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr);
|
||||
extern DECLSPEC wchar_t *SDLCALL SDL_wcsstr(const wchar_t *haystack, const wchar_t *needle);
|
||||
|
||||
extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2);
|
||||
extern DECLSPEC int SDLCALL SDL_wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen);
|
||||
|
||||
extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
|
||||
extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
|
||||
@@ -467,6 +475,7 @@ extern DECLSPEC char *SDLCALL SDL_strlwr(char *str);
|
||||
extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
|
||||
extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
|
||||
extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
|
||||
extern DECLSPEC char *SDLCALL SDL_strtokr(char *s1, const char *s2, char **saveptr);
|
||||
extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str);
|
||||
|
||||
extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
|
||||
@@ -520,6 +529,8 @@ extern DECLSPEC double SDLCALL SDL_fabs(double x);
|
||||
extern DECLSPEC float SDLCALL SDL_fabsf(float x);
|
||||
extern DECLSPEC double SDLCALL SDL_floor(double x);
|
||||
extern DECLSPEC float SDLCALL SDL_floorf(float x);
|
||||
extern DECLSPEC double SDLCALL SDL_trunc(double x);
|
||||
extern DECLSPEC float SDLCALL SDL_truncf(float x);
|
||||
extern DECLSPEC double SDLCALL SDL_fmod(double x, double y);
|
||||
extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y);
|
||||
extern DECLSPEC double SDLCALL SDL_log(double x);
|
||||
@@ -566,6 +577,17 @@ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
|
||||
/* force builds using Clang's static analysis tools to use literal C runtime
|
||||
here, since there are possibly tests that are ineffective otherwise. */
|
||||
#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS)
|
||||
|
||||
/* The analyzer knows about strlcpy even when the system doesn't provide it */
|
||||
#ifndef HAVE_STRLCPY
|
||||
size_t strlcpy(char* dst, const char* src, size_t size);
|
||||
#endif
|
||||
|
||||
/* The analyzer knows about strlcat even when the system doesn't provide it */
|
||||
#ifndef HAVE_STRLCAT
|
||||
size_t strlcat(char* dst, const char* src, size_t size);
|
||||
#endif
|
||||
|
||||
#define SDL_malloc malloc
|
||||
#define SDL_calloc calloc
|
||||
#define SDL_realloc realloc
|
||||
@@ -574,15 +596,23 @@ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
|
||||
#define SDL_memcpy memcpy
|
||||
#define SDL_memmove memmove
|
||||
#define SDL_memcmp memcmp
|
||||
#define SDL_strlen strlen
|
||||
#define SDL_strlcpy strlcpy
|
||||
#define SDL_strlcat strlcat
|
||||
#define SDL_strlen strlen
|
||||
#define SDL_wcslen wcslen
|
||||
#define SDL_wcslcpy wcslcpy
|
||||
#define SDL_wcslcat wcslcat
|
||||
#define SDL_strdup strdup
|
||||
#define SDL_wcsdup wcsdup
|
||||
#define SDL_strchr strchr
|
||||
#define SDL_strrchr strrchr
|
||||
#define SDL_strstr strstr
|
||||
#define SDL_wcsstr wcsstr
|
||||
#define SDL_strtokr strtok_r
|
||||
#define SDL_strcmp strcmp
|
||||
#define SDL_wcscmp wcscmp
|
||||
#define SDL_strncmp strncmp
|
||||
#define SDL_wcsncmp wcsncmp
|
||||
#define SDL_strcasecmp strcasecmp
|
||||
#define SDL_strncasecmp strncasecmp
|
||||
#define SDL_sscanf sscanf
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -89,7 +89,7 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int prio
|
||||
#endif /* __LINUX__ */
|
||||
|
||||
/* Platform specific functions for iOS */
|
||||
#if defined(__IPHONEOS__) && __IPHONEOS__
|
||||
#ifdef __IPHONEOS__
|
||||
|
||||
#define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam)
|
||||
extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
|
||||
@@ -101,7 +101,7 @@ extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
|
||||
|
||||
|
||||
/* Platform specific functions for Android */
|
||||
#if defined(__ANDROID__) && __ANDROID__
|
||||
#ifdef __ANDROID__
|
||||
|
||||
/**
|
||||
\brief Get the JNI environment for the current thread
|
||||
@@ -120,6 +120,32 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void);
|
||||
*/
|
||||
extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void);
|
||||
|
||||
/**
|
||||
\brief Return API level of the current device
|
||||
|
||||
API level 29: Android 10
|
||||
API level 28: Android 9
|
||||
API level 27: Android 8.1
|
||||
API level 26: Android 8.0
|
||||
API level 25: Android 7.1
|
||||
API level 24: Android 7.0
|
||||
API level 23: Android 6.0
|
||||
API level 22: Android 5.1
|
||||
API level 21: Android 5.0
|
||||
API level 20: Android 4.4W
|
||||
API level 19: Android 4.4
|
||||
API level 18: Android 4.3
|
||||
API level 17: Android 4.2
|
||||
API level 16: Android 4.1
|
||||
API level 15: Android 4.0.3
|
||||
API level 14: Android 4.0
|
||||
API level 13: Android 3.2
|
||||
API level 12: Android 3.1
|
||||
API level 11: Android 3.0
|
||||
API level 10: Android 2.3.3
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetAndroidSDKVersion(void);
|
||||
|
||||
/**
|
||||
\brief Return true if the application is running on Android TV
|
||||
*/
|
||||
@@ -172,10 +198,18 @@ extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void);
|
||||
*/
|
||||
extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void);
|
||||
|
||||
/**
|
||||
\brief Request permissions at runtime.
|
||||
|
||||
This blocks the calling thread until the permission is granted or
|
||||
denied. Returns SDL_TRUE if the permission was granted.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_AndroidRequestPermission(const char *permission);
|
||||
|
||||
#endif /* __ANDROID__ */
|
||||
|
||||
/* Platform specific functions for WinRT */
|
||||
#if defined(__WINRT__) && __WINRT__
|
||||
#ifdef __WINRT__
|
||||
|
||||
/**
|
||||
* \brief WinRT / Windows Phone path types
|
||||
@@ -268,6 +302,17 @@ extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily();
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void);
|
||||
|
||||
/* Functions used by iOS application delegates to notify SDL about state changes */
|
||||
extern DECLSPEC void SDLCALL SDL_OnApplicationWillTerminate(void);
|
||||
extern DECLSPEC void SDLCALL SDL_OnApplicationDidReceiveMemoryWarning(void);
|
||||
extern DECLSPEC void SDLCALL SDL_OnApplicationWillResignActive(void);
|
||||
extern DECLSPEC void SDLCALL SDL_OnApplicationDidEnterBackground(void);
|
||||
extern DECLSPEC void SDLCALL SDL_OnApplicationWillEnterForeground(void);
|
||||
extern DECLSPEC void SDLCALL SDL_OnApplicationDidBecomeActive(void);
|
||||
#ifdef __IPHONEOS__
|
||||
extern DECLSPEC void SDLCALL SDL_OnApplicationDidChangeStatusBarOrientation(void);
|
||||
#endif
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -49,6 +49,9 @@ struct SDL_SysWMinfo;
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#ifndef NOMINMAX /* don't define min() and max(). */
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
@@ -129,7 +132,8 @@ typedef enum
|
||||
SDL_SYSWM_WINRT,
|
||||
SDL_SYSWM_ANDROID,
|
||||
SDL_SYSWM_VIVANTE,
|
||||
SDL_SYSWM_OS2
|
||||
SDL_SYSWM_OS2,
|
||||
SDL_SYSWM_HAIKU
|
||||
} SDL_SYSWM_TYPE;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -54,6 +54,11 @@ typedef unsigned int SDL_TLSID;
|
||||
/**
|
||||
* The SDL thread priority.
|
||||
*
|
||||
* SDL will make system changes as necessary in order to apply the thread priority.
|
||||
* Code which attempts to control thread state related to priority should be aware
|
||||
* that calling SDL_SetThreadPriority may alter such state.
|
||||
* SDL_HINT_THREAD_PRIORITY_POLICY can be used to control aspects of this behavior.
|
||||
*
|
||||
* \note On many systems you require special privileges to set high or time critical priority.
|
||||
*/
|
||||
typedef enum {
|
||||
@@ -69,7 +74,7 @@ typedef enum {
|
||||
*/
|
||||
typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
|
||||
|
||||
#if defined(__WIN32__) && !defined(HAVE_LIBC)
|
||||
#if defined(__WIN32__)
|
||||
/**
|
||||
* \file SDL_thread.h
|
||||
*
|
||||
@@ -93,11 +98,18 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
|
||||
#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
|
||||
#include <process.h> /* _beginthreadex() and _endthreadex() */
|
||||
|
||||
typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread)
|
||||
typedef uintptr_t (__cdecl * pfnSDL_CurrentBeginThread)
|
||||
(void *, unsigned, unsigned (__stdcall *func)(void *),
|
||||
void * /*arg*/, unsigned, unsigned * /* threadID */);
|
||||
typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
|
||||
|
||||
#ifndef SDL_beginthread
|
||||
#define SDL_beginthread _beginthreadex
|
||||
#endif
|
||||
#ifndef SDL_endthread
|
||||
#define SDL_endthread _endthreadex
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Create a thread.
|
||||
*/
|
||||
@@ -118,12 +130,12 @@ SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *),
|
||||
*/
|
||||
#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
|
||||
#undef SDL_CreateThread
|
||||
#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
|
||||
#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#undef SDL_CreateThreadWithStackSize
|
||||
#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
|
||||
#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#else
|
||||
#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
|
||||
#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
|
||||
#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#endif
|
||||
|
||||
#elif defined(__OS2__)
|
||||
@@ -132,13 +144,23 @@ SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *),
|
||||
* into a dll with Watcom's runtime statically linked.
|
||||
*/
|
||||
#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
|
||||
|
||||
#ifndef __EMX__
|
||||
#include <process.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void * /*arg*/);
|
||||
typedef void (*pfnSDL_CurrentEndThread)(void);
|
||||
|
||||
#ifndef SDL_beginthread
|
||||
#define SDL_beginthread _beginthread
|
||||
#endif
|
||||
#ifndef SDL_endthread
|
||||
#define SDL_endthread _endthread
|
||||
#endif
|
||||
|
||||
extern DECLSPEC SDL_Thread *SDLCALL
|
||||
SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
|
||||
pfnSDL_CurrentBeginThread pfnBeginThread,
|
||||
@@ -147,14 +169,15 @@ extern DECLSPEC SDL_Thread *SDLCALL
|
||||
SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data,
|
||||
pfnSDL_CurrentBeginThread pfnBeginThread,
|
||||
pfnSDL_CurrentEndThread pfnEndThread);
|
||||
|
||||
#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
|
||||
#undef SDL_CreateThread
|
||||
#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
|
||||
#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#undef SDL_CreateThreadWithStackSize
|
||||
#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
|
||||
#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#else
|
||||
#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
|
||||
#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
|
||||
#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -59,7 +59,7 @@ typedef struct SDL_version
|
||||
*/
|
||||
#define SDL_MAJOR_VERSION 2
|
||||
#define SDL_MINOR_VERSION 0
|
||||
#define SDL_PATCHLEVEL 10
|
||||
#define SDL_PATCHLEVEL 13
|
||||
|
||||
/**
|
||||
* \brief Macro to determine SDL version program was compiled against.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -96,7 +96,6 @@ typedef struct SDL_Window SDL_Window;
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
/* !!! FIXME: change this to name = (1<<x). */
|
||||
SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window */
|
||||
SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */
|
||||
SDL_WINDOW_SHOWN = 0x00000004, /**< window is visible */
|
||||
@@ -119,7 +118,8 @@ typedef enum
|
||||
SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */
|
||||
SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */
|
||||
SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */
|
||||
SDL_WINDOW_VULKAN = 0x10000000 /**< window usable for Vulkan surface */
|
||||
SDL_WINDOW_VULKAN = 0x10000000, /**< window usable for Vulkan surface */
|
||||
SDL_WINDOW_METAL = 0x20000000 /**< window usable for Metal view */
|
||||
} SDL_WindowFlags;
|
||||
|
||||
/**
|
||||
@@ -485,7 +485,8 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
|
||||
* ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS,
|
||||
* ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED,
|
||||
* ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED,
|
||||
* ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN.
|
||||
* ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN
|
||||
* ::SDL_WINDOW_METAL.
|
||||
*
|
||||
* \return The created window, or NULL if window creation failed.
|
||||
*
|
||||
@@ -504,6 +505,9 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
|
||||
* If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver,
|
||||
* SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail.
|
||||
*
|
||||
* If SDL_WINDOW_METAL is specified on an OS that does not support Metal,
|
||||
* SDL_CreateWindow() will fail.
|
||||
*
|
||||
* \note On non-Apple devices, SDL requires you to either not link to the
|
||||
* Vulkan loader or link to a dynamic library version. This limitation
|
||||
* may be removed in a future version of SDL.
|
||||
|
||||
@@ -204,10 +204,9 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
|
||||
*
|
||||
* \sa SDL_Vulkan_CreateSurface()
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(
|
||||
SDL_Window *window,
|
||||
unsigned int *pCount,
|
||||
const char **pNames);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(SDL_Window *window,
|
||||
unsigned int *pCount,
|
||||
const char **pNames);
|
||||
|
||||
/**
|
||||
* \brief Create a Vulkan rendering surface for a window.
|
||||
@@ -238,10 +237,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(
|
||||
*
|
||||
* \sa SDL_Vulkan_GetInstanceExtensions()
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface(
|
||||
SDL_Window *window,
|
||||
VkInstance instance,
|
||||
VkSurfaceKHR* surface);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface(SDL_Window *window,
|
||||
VkInstance instance,
|
||||
VkSurfaceKHR* surface);
|
||||
|
||||
/**
|
||||
* \brief Get the size of a window's underlying drawable in pixels (for use
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>18D109</string>
|
||||
<string>19G2021</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
@@ -19,7 +19,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.0.10</string>
|
||||
<string>2.0.13</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>SDLX</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
@@ -27,20 +27,22 @@
|
||||
<string>MacOSX</string>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.0.10</string>
|
||||
<string>2.0.13</string>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>10E1001</string>
|
||||
<string>11E801a</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>18E219</string>
|
||||
<string>19G68</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.14</string>
|
||||
<string>macosx10.15</string>
|
||||
<key>DTXcode</key>
|
||||
<string>1020</string>
|
||||
<string>1170</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>10E1001</string>
|
||||
<string>11E801a</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.6</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <[email protected]>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
@@ -0,0 +1,32 @@
|
||||
The Simple DirectMedia Layer (SDL for short) is a cross-platform
|
||||
library designed to make it easy to write multi-media software,
|
||||
such as games and emulators.
|
||||
|
||||
The Simple DirectMedia Layer library source code is available from:
|
||||
http://www.libsdl.org/
|
||||
|
||||
This library is distributed under the terms of the zlib license:
|
||||
http://zlib.net/zlib_license.html
|
||||
|
||||
|
||||
This packages contains the SDL framework for OS X.
|
||||
Conforming with Apple guidelines, this framework
|
||||
contains both the SDL runtime component and development header files.
|
||||
|
||||
|
||||
To Install:
|
||||
Copy the SDL2.framework to /Library/Frameworks
|
||||
|
||||
You may alternatively install it in <Your home directory>/Library/Frameworks
|
||||
if your access privileges are not high enough.
|
||||
|
||||
|
||||
Additional References:
|
||||
|
||||
- Screencast tutorials for getting started with OpenSceneGraph/Mac OS X are
|
||||
available at:
|
||||
http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/MacOSXTips
|
||||
Though these are OpenSceneGraph centric, the same exact concepts apply to
|
||||
SDL, thus the videos are recommended for everybody getting started with
|
||||
developing on Mac OS X. (You can skim over the PlugIns stuff since SDL
|
||||
doesn't have any PlugIns to worry about.)
|
||||
Binary file not shown.
Binary file not shown.
@@ -6,372 +6,415 @@
|
||||
<dict>
|
||||
<key>Resources/Info.plist</key>
|
||||
<data>
|
||||
K7JUofWxGZV+MoLec+znWL//Eew=
|
||||
sh0oOLkdzcvMFVtkzp3NXS7VQh4=
|
||||
</data>
|
||||
<key>Resources/License.txt</key>
|
||||
<data>
|
||||
VILsZtXQ+SRYtfG2XJ8ZtkKItSU=
|
||||
</data>
|
||||
<key>Resources/ReadMe.txt</key>
|
||||
<data>
|
||||
JbxWZUxpvG/D7Yb/DvLh6Aunla0=
|
||||
</data>
|
||||
<key>Resources/default.metallib</key>
|
||||
<data>
|
||||
awST523PmC36+lehlmfUr/pwZko=
|
||||
</data>
|
||||
</dict>
|
||||
<key>files2</key>
|
||||
<dict>
|
||||
<key>Frameworks/hidapi.framework</key>
|
||||
<dict>
|
||||
<key>cdhash</key>
|
||||
<data>
|
||||
pFEaabK4ZTzSRMngHXqK2k/a6tE=
|
||||
</data>
|
||||
<key>requirement</key>
|
||||
<string>cdhash H"41e662828193db1f141e133758d4455d73697c3d" or cdhash H"a4511a69b2b8653cd244c9e01d7a8ada4fdaead1"</string>
|
||||
</dict>
|
||||
<key>Headers/SDL.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
ZdbdIQwu9O76Dgd2jt/oyNmnIg0=
|
||||
o3KVp4++KuUyoa+pJDOXTKG80xY=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
HQb5XxQjcmcgu6Lop08Z62PzfPg7rI2I96dPjB1CB8s=
|
||||
CLsLV07G2/+c6GGLTVZh91FNYojAHOsuglk/oCKmlso=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_assert.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
zSdyqeJFhwSSxW7J+zPjhnOqFXI=
|
||||
FwT1P3mJzGKC9r+NdzApvnBKWB0=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
4LN3cMaLbAvZc00PQtUPkPF3hgpmwXoHOyT2CkEnxOA=
|
||||
P97E6oE7Pm/2Rd/sQI2lfnboN3OaLWfA4fzXc4lHSW0=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_atomic.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
X3xsGy7tYfY0KGYCJF1kPy8K4k0=
|
||||
xg9uJj7yxzB0CHUbyIfNK4JgOG4=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
IzaELyJIMDJ+B8rAEnHSflOwUNyeqQbhPwIuzOGX0ps=
|
||||
lYvP/2EdhC7kjjRlo7kLG7btc5QtYqWur256yKWVYCU=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_audio.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
wu0/tddl4vLnhUPjZeb1d4T7uDM=
|
||||
aSxl2+H6VdE8YRAfGhz3dXb/Wmo=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
Kxuhp8ub2Hp/Z70Xc5E6ZKslGtqZy3cuhkAuKNljzsA=
|
||||
EH4GR2fTWbVznhnA5B3DrdtpJNuecn04NhFBPZdQX5k=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_bits.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
00YFfg2cWwtRJ5Ds5gZqCBVVuB8=
|
||||
Xo7exLIRlSdYj/wvSlyfFGXwXDk=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
CxoSBgnrIcnpyVnNBDD6eKwB0PrGVYLtk2JLS0iI9to=
|
||||
pODn3AX+7bv13P3nR9JlEImNPJwU7SK0QhZNhsiBJt4=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_blendmode.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
LRgmOWdJnYmmsHJ7JdvfkADOw54=
|
||||
rJ9tuMnozMU9aTmGJnsDSJ4ZzU0=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
lytKe5manzmUJsXVkz2f7Ru+jXGQtqUQSoMd/13h+v4=
|
||||
o6acxbxesubS5z44EyaKTxLt4sF97j0+oh9u7w4vpNA=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_clipboard.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
FZ6uga56W5B8c+3VvK3K630egsY=
|
||||
BC8o5wIDU6TJgon7DW56dJzPZHM=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
LpkAeAHk1fl1g+jEh+/8v+GhvbSzNxU7EZj7GKsNoHE=
|
||||
c8onvqLDjpS32kJX/mqT/CZFrT3brIsyB2s6+J6kPlo=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_config.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
BiFZtrDFy2fSJ72smnhk/xX2vOM=
|
||||
ac64eFUYNav6YKQI6909+2GYwJE=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
Gg9NJpIEx9tBrfXyjdXZKY8eZCrvc81dMc8nV9BS7N0=
|
||||
VNhjVpUWoI5GH6azDen2EpTF5cwj+amMTh/gcnBH8Y8=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_config_macosx.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
0SoDDMtzf17+QHz2sy6d2WBImW4=
|
||||
QtH3ik0NSNRHpmhEF9UXp74BkIE=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
UaSnyX9qJPiJGsTA3n8rd89F4byXob+MUojHwdKH9pM=
|
||||
ArsQ8ObexbULYFUntU/oRXI56JRbBzO5Ipma8ia5IME=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_copying.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
C62NBTBnDNGfFFSXd4zGfjO4RJU=
|
||||
epQfEI5S75N7Ud6AwDj4EA6Fk/o=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
XvlF/XC1olqbcm8yNxgEqTcPWo4jlAb7ILUYXPBPs/M=
|
||||
Bb6ECGs8VYAHejft7V2hUyDK+41Hk79bcCspf6rQgQw=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_cpuinfo.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
xbDTQkNoUE7r2/g3QchsqhHCIJY=
|
||||
YjRdjce9KUBEQg0r9+V22aY6/tU=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
oeNN13Dm5+MBSxbMI8m3nylyvhehubfQ0IJpWhQHjlM=
|
||||
rOaeQwxwi97aliYs+g6rDQlSNO8BjTDD9tnx/2CcyjI=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_endian.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
WnRVp2tYXkNHTJo2lYUvUxmaRBo=
|
||||
ZxBOxnSY6LRuAEcRxNn0003XbZA=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
BnA6TE4wV1m4HysOJUQFQ+tF0ny38sghJfcIj/tNkTw=
|
||||
1y+wM8domWXFDot0zzCmjHb34vlqO8Y7v93DamI4Tmg=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_error.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
1S/GAK9ebtkbSQ0MmStwySLlKb8=
|
||||
pVWfxt+odr3djRqt8D/U421+dQo=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
igVYqa9pjpLUL4KFJDRti4j5/dfm3p7ORFqQLhFC4jU=
|
||||
YKlzVmZ1dgucRXZyWU9kvIjT9QZBohKxz49iLQ/PPQE=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_events.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
DZ9ziTGQepRxb/iTlkQqceblYKo=
|
||||
06e1jUIsAc9O803iXrh2jmdbXuM=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
lglKkIEjpBKKWj9KWvA1Cu7gckutFPGmEAR5j3i9qyc=
|
||||
6pGmPxZapBntgteeWW4BRZnhLf1R4CvlFsk60Xd3BPs=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_filesystem.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
Le59wleiHLWEGHWbLrDma5DSZkc=
|
||||
fr9s5fRVIompjAwprvpPpiuqZ+g=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
TE5jKDqHkqyMLRZhSCpMTLW9yHzE/ZeXbmHFqDXkcFY=
|
||||
fehLvZBPQCdmMT+FlzK0FArqkV14XjJHcVzBii5BdSQ=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_gamecontroller.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
nx1SDQVB8k9aHXVfGToR/xhm2uo=
|
||||
0HJHyRm5mXiBXHHSOwS3ml3dBiw=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
j+3SFxwr3ibI/hbqFvpa7aav1U3vd6b2FkhyRLbM40s=
|
||||
ja5kK2zDvXkL3qllya6MfUZVQFnXs9bedZ6iFU1iXQc=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_gesture.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
fF74yx7VTgDAieAE/D0XyONFjY4=
|
||||
k6FmKGDCb8MxvktlmwuxDXu2jlM=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
yD3HMyRreSXBWYHkAMmd22eNcsdV9VhJ4FxTUEiWQvI=
|
||||
5H4fhbnWDvSKccD4QtHcQtYhsrgtktyFTyq9jghKZDI=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_haptic.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
ycHZ4l3vmjoS7jBZJBOSBlhLO4g=
|
||||
M0Oo9dh3zLva6qpGJhBbgAxAIuY=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
52X1YGOz0xLrX18Waufe5+WjkHtXbNyniKy9fHURGSg=
|
||||
Nef5r8Bidx1FeTffn9+uzNZMlwxu1J37V4LOzOibxx4=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_hints.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
U7J9j+/eBGfjk21YSfyeH+K+cpI=
|
||||
/SzqZQDEmBA9aPLBuEQJLeHNGv4=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
3NlYRFeJRPTGdcFhTdPEp2rP3/B6Sp3SIQKObx8GEzU=
|
||||
17+Nv9lXJBOkimhfhtzZJcBqVKWf8z5tK/KQrvvU9xE=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_joystick.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
TTMR54AQZs40QRYs1W782JU+pgw=
|
||||
+ypndKqqtIYkbkypVDCI+M9Ijo0=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
yzV0egqWQfkvC6A2CLBNIpkRPptTPkev26ElG27sY4k=
|
||||
foGA4Afxic1PHZfAmJcEZeuXYgDEo0jmSmoLQbNvmDo=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_keyboard.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
Nj8t0jUZXlMkItHDVlWjcw4o6CU=
|
||||
zL/3QsZ9Q5lXfEVxiD71vhoLXws=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
YHCinInDkXh1AzlpQDn/ZRioHFIffFUpPrYOmNW5RaY=
|
||||
HAzHtkjb1ZGuIJUpevIc93rNjwcGGcjqO0FWfkWuaJk=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_keycode.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
VKMYjZRw9r7kpQ/YgpvKEMaFACY=
|
||||
Fwnbxg/6DtHaQufmjH9Sx/zbF+A=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
tfj5XwKmKGZ0t3eBcKB2tzDgpiWFGnWKU09OTPVq9No=
|
||||
m69IH60aX73QRefpJOur+rWzKRZJH9RF7P4LNUxti+g=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_loadso.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
CTkUCqmoy2bo8e6nbQKTm5CwjxI=
|
||||
2Aj/SejsqXO6a/ErCW5p18yDKbQ=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
n3gGxtTXqa1Vh4Ac+AGTUIefz/44y4VMTcQjKawz8Pk=
|
||||
bpcu/Ms5CE5EHVV1zXIfWghw8JM8qB2114xfsIUBPeE=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_locale.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
JCF6SSXRcv6uAPICgwmTq+WsVZs=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
SYFN/L2S2pKTNZQe4dGUKTPTFXbqXZlZ3Vyl4y5wZ8s=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_log.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
av0s6nKZfP/zuo69K5qS/DkqKT8=
|
||||
7SpCGEq3X7Q0HIVvx2AaEwJ2TpQ=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
rARea0ssP3PWH9hW3GTK54TRajsCVIhOCG3zw6ySDFI=
|
||||
KQMlKJvr9iwGv4SPxdxqTy1N2qD8PdXpJRDzqeWfyik=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_main.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
5YETmzv9nb8mZJFlT560TlSePFg=
|
||||
EnOp5HYGYds7F5I/uLqUgy7fF/c=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
7yHNFldAJql7/7cAoEGlMB34sPKKWfyrOT9ifG82q48=
|
||||
QaqVThHGxV6PsKTDebiZJDpgbADmloGsTbWTvQjR0j0=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_messagebox.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
dn9u1yI/5fNacHdloG1LrU5mh9Y=
|
||||
zn/jOYBCkj2DIH6U4XfR8yzrLmU=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
qxzQ6Ex2HN9vuG+50udOIy1Y/eEVcH46WiW7Nf2EzXw=
|
||||
ckM8GPWpWflcu8Er5c+UaRSJaeVNPkCq5lkL628knWQ=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_metal.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
S2Es8N4Cya7az5FTs0mqtd840zA=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
9AgZbEiRMt0j2ui++nJaH+EXz9UF6LtVeljtZkAvvtY=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_mouse.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
ZJhHiglu6xyXlIcPichq+/0Zuyk=
|
||||
w5/iufa+EFt/CwnlQDBNfY0EIOM=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
MRwS5MXSVj8ik1SdFYclXUqfQctjSgf/a6uwvnXKcr4=
|
||||
oSyXWJ0Tl+F1vjTvW7NO51L/FkPz0EPwKhWfeU85RDc=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_mutex.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
WsSNspEm5IlyJ4QCEupe9ru6mbs=
|
||||
uYPmGnAuhf8aS0WK/wsz5zuFgq8=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
qfLKc8oERtGbKR9aADvAk08vuIwdVpXT5LXDjkh30pc=
|
||||
TbQaD92P0h+3sNEpeYHg9W1DSj3Cu1rn3HIIgeeRDC4=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_name.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
QNIDAjTuNO/ygj4XUbTm7Xs083k=
|
||||
o7IHLzBFJi6YI0JUKSqBf3tXnFk=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
OMk89kJXQu2SU/zq6Ppy58jT8ksykcvtO09/Gg+G/wg=
|
||||
OUT91iX17l3wqihn+MBCgwnTINkJP1hKZXwoY7STx2A=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_opengl.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
tao3928+v++g3ksVro2TztU0o2Y=
|
||||
9EY0oD4XWAhLVuOBPHzoHFqI06s=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
zAS4WUuGGdXWu9IDkSSsfi40tyvzu9NvdYeqKzzowAo=
|
||||
I8ujmRRVkgcMwRAKoeQNtFJH1jfXFbc4Xw5dTUmTu4Q=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_opengl_glext.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
nqPX1ObCVYyVzW3VbD3C/1vaTRE=
|
||||
R1nHUIy7DpXf2BZyzO+VT33j3bE=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
IULBL/m+rBc3UQPqu68w6FDM/Mda58oybFnlyn3OkjE=
|
||||
RwZcYEr740srGsvbe4jQhHYTTNwp+e05VGDjqyNkYr4=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_opengles.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
5yI9Ohyz/YeMMIDg907ulQgb64Y=
|
||||
tuFf0llJglK6NhT0uKRFga7kpwI=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
8QecWd6HIgUhSKIaC3OHjL0fChHRb0bz3Pcm31iWNKo=
|
||||
T2Mxj7pRFzOEhQjRBEuRriOkBLZyUR3RxH2+tr3pfw8=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_opengles2.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
TzziT6uivSTIOqwzpwvCga0WbT4=
|
||||
bKjKixGHZdD/ZbxhZ/bf0HYSr4Q=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
GVonW5KJHQy8P8dyN9jtnsEkw+dB14I0BkJ2kyzDWAI=
|
||||
RwQUrJUoPnyXZL7ipQaO/msfXWsJl6oz4nEXqYxIDaQ=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_opengles2_gl2.h</key>
|
||||
@@ -422,275 +465,308 @@
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
a07hNtLEEXOI9JowlmxGrMafaX0=
|
||||
dk4R8c81l+WVpQ9ueWDS2SGuXkA=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
j6M3vN4k05iSK3Uy9ffsTy+BWOSXENibkaY7ePLBKPg=
|
||||
AQ9Th5IdVLO2XfkpMUuZAqxtYQXaQiiiHQVjTJyRq2g=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_platform.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
AzfeyBVMo7b+r3ooLaPCjMwm/Ek=
|
||||
F1dKHn7mrS1LHL5EWvDceH88BlQ=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
lMHrLGnuplRAoQYf5FmDF3IposXEg6rVK176gDoU334=
|
||||
pQWvI8MCgM9jQgib1xGFIRcG5Ow4LFXw0cm72TVsZLU=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_power.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
fSuuKCG0N/bA859vMETqDJcGmxw=
|
||||
F7x/fhC0JjgEzuGHL3HUd6lmjgo=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
MsMC1rgs5LfpJ7MJfFldXATr3RekMHWIPlLFCTVHsFE=
|
||||
mLELHEwrJOA0akrTAaWD+eYTQr30qgCz6J8K79sPDfk=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_quit.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
bSgXjsgzzeSQ8/+gAeHQncKGP48=
|
||||
xnaczdwiGUtrE7DfF/Ww0eExnHI=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
ZgtHbb41+UtLyVm6AP9lZXaJ8Fp/QJunojzyJyMFJXk=
|
||||
GdP8zK33YvNM/YlKy87Xgnx5JXBLr0H3nW1h6JvXvVc=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_rect.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
4xBsyR5cytlXoENRmY8aOe+QBpA=
|
||||
zulgqf81zT/r1TnfjE4Bblnw8es=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
uBZss8y9+JCKbsbxfu+uef8m9VPtLs0NgeZYqQj52rg=
|
||||
r6T7NWbhl80Tz3Yhs4IjFY8ab68HQznrre/CjD58tsg=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_render.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
SeyflsB8DGAS7KvPh8x2oK8PH0A=
|
||||
PBsbXo13t7jqkHvTTeU5Sjnl13o=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
Z84tjQTFYLNznHJq/8giJPorVPCDTP2bHIYmSc7ZLvA=
|
||||
Rj56ND7YXV/1h1RH6X2Ho0fJ0ijPDTms6+Na43F0ueQ=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_revision.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
PGSSQVK3jtbqU9+3bHhpAtBlYWQ=
|
||||
ixjPDg2DQUEDn7ID2l4wMHDUvDk=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
UiWA4q+Hw/4HJRqxv5vK3LvqWFrJc5FnShxo2QJH+Iw=
|
||||
LUUZKxelLmuZXjHwFWFSYH8HA96Px1JVmtuv79n+gYY=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_rwops.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
BUGupr2coKPXRSCJ3FN6KuPvLc4=
|
||||
FWcGz9/xlaBkrR1vdvYvDibFPhg=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
g/bWwIrUo1mqK7g4vLXyYHpRh+XSjZLLT6TNnC3yJVA=
|
||||
OWI95ONgZvdn/FBJfMHV1BQWKQjx5LBN7MYuXwAadgg=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_scancode.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
A29dZAsRi3ZD3FXMYTURpihTsIc=
|
||||
p3l6Zx+1hXIgPI1IK/TbyP+NvBE=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
puwtAtPFfkjydl8SWmSe/SCvZFMczwq04xCod0DOjZU=
|
||||
G+s/NXp1k6oacd5/WI6M5X2nyu7jiladTDBozZHXHiU=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_sensor.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
kCrdfHdJI14S1IvCO0q1ikSQ8Xo=
|
||||
zpUXcUDXo2KHtsqmAJ/EcqjkrtI=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
V+LHKc4UpsUT+tXFMwojgNTESr+CvSXE0ygvjgSfTt4=
|
||||
ihuAgJMoPj8J+z59LgqWXlOP/L+/WHkpw0Lwr/0VKT4=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_shape.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
A36EHUyzqEf/tKShU18L2iMCW2I=
|
||||
eWRcGWTs+v8d8uWHf5qeCwiChk8=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
Ud8Mqn1abe+Y/PChCGi3IsT06VDpE+6P79ZJjODnmkc=
|
||||
RA86cs8Rlb7iFmYOgJ8dOHibudj6rQvHG3t4H8AGmmg=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_stdinc.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
G6xZCxCCLS2Mg6uKkSpFCkgd46M=
|
||||
q9VYwFS+f9MaSiVwltDDrBpP8+o=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
ie6yM34yeMP4HazsW2Uz11wFfyo6gx7S+h/2+426J68=
|
||||
hfUwgCUrzO8oRZglsZlgHLqCVGo4tlorFxvRjh+d/A8=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_surface.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
KmHGqv7b4tswXf8ycUgNZ/+vK/A=
|
||||
NSvhegMe7ESmcxEgC8EuZ0sCyFU=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
AiIkcUK3qz5MMYzKNHcAl5GXlOARaP+HMmeOTPhCEpQ=
|
||||
hdB72Dx/gaTq5sKpPDO+vN3gXHXsE7YxL8z2CoykY8o=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_system.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
0qO9sBVkTL08UhLrqBelJJhBSsE=
|
||||
iiUlVUMHJLVYtZYy8fesmrBw71U=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
6w1i3t2dswaTQw9584NuLNKx+9iWmo3ROcLjoaYDMMw=
|
||||
SmI4OODh0gdcy0WduqkDD+AGZI66vpEOgPEXc7JY3sM=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_syswm.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
GRnaqOVa/3qcFveLJRDGNmyYYMA=
|
||||
erik9ElULmnUObLiWoB7Acm7yxA=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
HDjiEgukOBzpbKn7mQymmfeUbuFivyBSlaLKZoaRmsM=
|
||||
ibGK7TlbnYmiziw5PqTjpt2BBso8MswXLRDpkK5z6l0=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_thread.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
Y5XPCuL4lqd9SCsdoXZpE39weBc=
|
||||
bN9PvUNyNE5PSLQzjdF4b38bzRY=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
qLvle+Ar3yGNkRzhIrScRbek/Hmco7obDK8/oCT33bw=
|
||||
MymOftu/SUBMl4mrBetXv06hTmexfmEwWFuvGoMdmT8=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_timer.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
8kuhmd1/ENq/dqoq9nvN+88+LPA=
|
||||
icT/5cwWcFOj43A1wkVVExHmQio=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
gIMhzHTwdr/bEzBAvZJkKf5xDAsT/JArngXvaVw5z3o=
|
||||
poSD+yuRd2GrSWDAUNErEclgiBH9EiZOZDh6ZfG/jcc=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_touch.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
exldcx+h41MdM/84k5iaO2MOgkk=
|
||||
vx/YxEp5RxhYVy9QzBys9OsXNYw=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
ceYjziGStnm+rvr3ae/RvGPf/LiSE80YgVaj7ooZCfQ=
|
||||
iZIc5xFKqFoIgFGx9P4jSSPNv75xIqEY5YhajqP3NHI=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_types.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
xpionXfbvYAQSbnBNqG6Cju0b0M=
|
||||
wjAH9bIpA3v8KF3Z4fAg+gxHVN0=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
dOjFOKib7+LNGpNOGgztUkUpP17CM/ZVjbX2L4EkvSQ=
|
||||
RHTRCiH25ASWePbdj2mbF0veuawIuAx9acJiEyEMwbw=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_version.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
5QRd22Sj0DHS9tvyzAlW9Zl0iyY=
|
||||
ydLaUjwmNbF0S0NRtGXglrG9zX4=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
uuOY3mOYoId2CXEFqF89pKDQcBQ7AEQbtbgOfxS2keE=
|
||||
OCqFkdoQNDv9puqvFib4mqoO1VwnzsQzA+5uv9vq8os=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_video.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
rhqJJNgt/txwqknDJNiQ4gPimpc=
|
||||
nVLRJIS/TH5qs8ZXy37QrPf0bHk=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
UtnpjniKS76crjAmXa8i8wczgLQDUxiQoYu0y76BSNE=
|
||||
oR7PhH0ZoBVhpjvjVBxVU2zuyb9UsGg2CnARIJvBHt4=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/SDL_vulkan.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
0R0iBIIZHeiqfvyj+3+sbtepfwo=
|
||||
Hd6qVU8OT67v88A0rMVhZpceGQg=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
ZUl2Z6rj4rI2+mitJQB2d+4hTIuTIzVf0fr7KM9hgKw=
|
||||
rD48rqfdCs8UEGgpQilcPwZo50sH0NXKds0uYKXnkc8=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/begin_code.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
T9a4EEcpi6NKfH4l/BsFqT6BS5o=
|
||||
X5W7FQnJRFgap/lN9Nfhm9SNYRE=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
VS34Wm8jXZyzq5vTgdyLBC1qzmlio11OjEG6jfiLeqg=
|
||||
hW/el0zmgHMXlKjkKTyoRPhoPu8ZQvpsljXvK9tXzPg=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Headers/close_code.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
HgkA2N1cLNy8wpE/MO+dVUjnY5k=
|
||||
LZ9uO15BxDjNqjfxTGMOU163pcc=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
291SEvMjO/iklrWgfi+oH6DBTOoABR4OXa8JofDEWoc=
|
||||
M7NAn877XVWs3eoezHmczklsolWIdXMneHoIHE9owzE=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/Info.plist</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
K7JUofWxGZV+MoLec+znWL//Eew=
|
||||
sh0oOLkdzcvMFVtkzp3NXS7VQh4=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
0/+jwfcLCE7Vwm3+K0aEsipIl7s+bTZ+XXPfcim1dEs=
|
||||
RWZqKrfBsPmghlDP7CT9Jf6NcUep+mHS5mvZnMIuieY=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/License.txt</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
VILsZtXQ+SRYtfG2XJ8ZtkKItSU=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
Y68o5ttLrQEravu8qDEelhBjWJJDm9cuZ33qP6cPjB4=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/ReadMe.txt</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
JbxWZUxpvG/D7Yb/DvLh6Aunla0=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
pOpMHiFjj3pIWQqZ5KDvYNyp0twU7vCZmLwAQJLVkT4=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/default.metallib</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
awST523PmC36+lehlmfUr/pwZko=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
+Foetj5EZqEAqjfkJcaUPc5XEgo/kcNG4bP0vzWuVHA=
|
||||
</data>
|
||||
</dict>
|
||||
</dict>
|
||||
|
||||
@@ -452,6 +452,11 @@ enum AVCodecID {
|
||||
AV_CODEC_ID_MWSC,
|
||||
AV_CODEC_ID_WCMV,
|
||||
AV_CODEC_ID_RASC,
|
||||
AV_CODEC_ID_HYMT,
|
||||
AV_CODEC_ID_ARBC,
|
||||
AV_CODEC_ID_AGM,
|
||||
AV_CODEC_ID_LSCR,
|
||||
AV_CODEC_ID_VP4,
|
||||
|
||||
/* various PCM "codecs" */
|
||||
AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
|
||||
@@ -536,6 +541,7 @@ enum AVCodecID {
|
||||
AV_CODEC_ID_ADPCM_AICA,
|
||||
AV_CODEC_ID_ADPCM_IMA_DAT4,
|
||||
AV_CODEC_ID_ADPCM_MTAF,
|
||||
AV_CODEC_ID_ADPCM_AGM,
|
||||
|
||||
/* AMR */
|
||||
AV_CODEC_ID_AMR_NB = 0x12000,
|
||||
@@ -645,6 +651,7 @@ enum AVCodecID {
|
||||
AV_CODEC_ID_APTX_HD,
|
||||
AV_CODEC_ID_SBC,
|
||||
AV_CODEC_ID_ATRAC9,
|
||||
AV_CODEC_ID_HCOM,
|
||||
|
||||
/* subtitle codecs */
|
||||
AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
|
||||
@@ -674,6 +681,7 @@ enum AVCodecID {
|
||||
AV_CODEC_ID_ASS,
|
||||
AV_CODEC_ID_HDMV_TEXT_SUBTITLE,
|
||||
AV_CODEC_ID_TTML,
|
||||
AV_CODEC_ID_ARIB_CAPTION,
|
||||
|
||||
/* other specific kind of codecs (generally used for attachments) */
|
||||
AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
|
||||
@@ -852,6 +860,11 @@ typedef struct RcOverride{
|
||||
* Use qpel MC.
|
||||
*/
|
||||
#define AV_CODEC_FLAG_QPEL (1 << 4)
|
||||
/**
|
||||
* Don't output frames whose parameters differ from first
|
||||
* decoded frame in stream.
|
||||
*/
|
||||
#define AV_CODEC_FLAG_DROPCHANGED (1 << 5)
|
||||
/**
|
||||
* Use internal 2pass ratecontrol in first pass mode.
|
||||
*/
|
||||
@@ -1071,6 +1084,13 @@ typedef struct RcOverride{
|
||||
*/
|
||||
#define AV_CODEC_CAP_HYBRID (1 << 19)
|
||||
|
||||
/**
|
||||
* This codec takes the reordered_opaque field from input AVFrames
|
||||
* and returns it in the corresponding field in AVCodecContext after
|
||||
* encoding.
|
||||
*/
|
||||
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE (1 << 20)
|
||||
|
||||
/**
|
||||
* Pan Scan area.
|
||||
* This specifies the area which should be displayed.
|
||||
@@ -1110,17 +1130,29 @@ typedef struct AVCPBProperties {
|
||||
* Maximum bitrate of the stream, in bits per second.
|
||||
* Zero if unknown or unspecified.
|
||||
*/
|
||||
#if FF_API_UNSANITIZED_BITRATES
|
||||
int max_bitrate;
|
||||
#else
|
||||
int64_t max_bitrate;
|
||||
#endif
|
||||
/**
|
||||
* Minimum bitrate of the stream, in bits per second.
|
||||
* Zero if unknown or unspecified.
|
||||
*/
|
||||
#if FF_API_UNSANITIZED_BITRATES
|
||||
int min_bitrate;
|
||||
#else
|
||||
int64_t min_bitrate;
|
||||
#endif
|
||||
/**
|
||||
* Average bitrate of the stream, in bits per second.
|
||||
* Zero if unknown or unspecified.
|
||||
*/
|
||||
#if FF_API_UNSANITIZED_BITRATES
|
||||
int avg_bitrate;
|
||||
#else
|
||||
int64_t avg_bitrate;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The size of the buffer to which the ratecontrol is applied, in bits.
|
||||
@@ -1321,7 +1353,7 @@ enum AVPacketSideDataType {
|
||||
AV_PKT_DATA_METADATA_UPDATE,
|
||||
|
||||
/**
|
||||
* MPEGTS stream ID, this is required to pass the stream ID
|
||||
* MPEGTS stream ID as uint8_t, this is required to pass the stream ID
|
||||
* information from the demuxer to the corresponding muxer.
|
||||
*/
|
||||
AV_PKT_DATA_MPEGTS_STREAM_ID,
|
||||
@@ -2025,15 +2057,19 @@ typedef struct AVCodecContext {
|
||||
|
||||
/**
|
||||
* custom intra quantization matrix
|
||||
* - encoding: Set by user, can be NULL.
|
||||
* - decoding: Set by libavcodec.
|
||||
* Must be allocated with the av_malloc() family of functions, and will be freed in
|
||||
* avcodec_free_context().
|
||||
* - encoding: Set/allocated by user, freed by libavcodec. Can be NULL.
|
||||
* - decoding: Set/allocated/freed by libavcodec.
|
||||
*/
|
||||
uint16_t *intra_matrix;
|
||||
|
||||
/**
|
||||
* custom inter quantization matrix
|
||||
* - encoding: Set by user, can be NULL.
|
||||
* - decoding: Set by libavcodec.
|
||||
* Must be allocated with the av_malloc() family of functions, and will be freed in
|
||||
* avcodec_free_context().
|
||||
* - encoding: Set/allocated by user, freed by libavcodec. Can be NULL.
|
||||
* - decoding: Set/allocated/freed by libavcodec.
|
||||
*/
|
||||
uint16_t *inter_matrix;
|
||||
|
||||
@@ -2677,7 +2713,10 @@ typedef struct AVCodecContext {
|
||||
/**
|
||||
* opaque 64-bit number (generally a PTS) that will be reordered and
|
||||
* output in AVFrame.reordered_opaque
|
||||
* - encoding: unused
|
||||
* - encoding: Set by libavcodec to the reordered_opaque of the input
|
||||
* frame corresponding to the last returned packet. Only
|
||||
* supported by encoders with the
|
||||
* AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE capability.
|
||||
* - decoding: Set by user.
|
||||
*/
|
||||
int64_t reordered_opaque;
|
||||
@@ -2961,6 +3000,16 @@ typedef struct AVCodecContext {
|
||||
|
||||
#define FF_PROFILE_SBC_MSBC 1
|
||||
|
||||
#define FF_PROFILE_PRORES_PROXY 0
|
||||
#define FF_PROFILE_PRORES_LT 1
|
||||
#define FF_PROFILE_PRORES_STANDARD 2
|
||||
#define FF_PROFILE_PRORES_HQ 3
|
||||
#define FF_PROFILE_PRORES_4444 4
|
||||
#define FF_PROFILE_PRORES_XQ 5
|
||||
|
||||
#define FF_PROFILE_ARIB_PROFILE_A 0
|
||||
#define FF_PROFILE_ARIB_PROFILE_C 1
|
||||
|
||||
/**
|
||||
* level
|
||||
* - encoding: Set by user.
|
||||
@@ -3313,6 +3362,14 @@ typedef struct AVCodecContext {
|
||||
* used as reference pictures).
|
||||
*/
|
||||
int extra_hw_frames;
|
||||
|
||||
/**
|
||||
* The percentage of damaged samples to discard a frame.
|
||||
*
|
||||
* - decoding: set by user
|
||||
* - encoding: unused
|
||||
*/
|
||||
int discard_damaged_percentage;
|
||||
} AVCodecContext;
|
||||
|
||||
#if FF_API_CODEC_GET_SET
|
||||
@@ -4365,7 +4422,7 @@ int av_grow_packet(AVPacket *pkt, int grow_by);
|
||||
* Initialize a reference-counted packet from av_malloc()ed data.
|
||||
*
|
||||
* @param pkt packet to be initialized. This function will set the data, size,
|
||||
* buf and destruct fields, all others are left untouched.
|
||||
* and buf fields, all others are left untouched.
|
||||
* @param data Data allocated by av_malloc() to be used as packet data. If this
|
||||
* function returns successfully, the data is owned by the underlying AVBuffer.
|
||||
* The caller may not access the data through other means.
|
||||
@@ -4871,6 +4928,9 @@ int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt);
|
||||
* AVERROR_EOF: the decoder has been fully flushed, and there will be
|
||||
* no more output frames
|
||||
* AVERROR(EINVAL): codec not opened, or it is an encoder
|
||||
* AVERROR_INPUT_CHANGED: current decoded frame has changed parameters
|
||||
* with respect to first decoded frame. Applicable
|
||||
* when flag AV_CODEC_FLAG_DROPCHANGED is set.
|
||||
* other negative values: legitimate decoding errors
|
||||
*/
|
||||
int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame);
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "libavutil/version.h"
|
||||
|
||||
#define LIBAVCODEC_VERSION_MAJOR 58
|
||||
#define LIBAVCODEC_VERSION_MINOR 35
|
||||
#define LIBAVCODEC_VERSION_MINOR 54
|
||||
#define LIBAVCODEC_VERSION_MICRO 100
|
||||
|
||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||
@@ -132,6 +132,9 @@
|
||||
#ifndef FF_API_NEXT
|
||||
#define FF_API_NEXT (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_UNSANITIZED_BITRATES
|
||||
#define FF_API_UNSANITIZED_BITRATES (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* AVCODEC_VERSION_H */
|
||||
|
||||
@@ -400,6 +400,12 @@ int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end,
|
||||
*/
|
||||
int av_match_list(const char *name, const char *list, char separator);
|
||||
|
||||
/**
|
||||
* See libc sscanf manual for more information.
|
||||
* Locale-independent sscanf implementation.
|
||||
*/
|
||||
int av_sscanf(const char *string, const char *format, ...);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Automatically generated by version.sh, do not manually edit! */
|
||||
#ifndef AVUTIL_FFVERSION_H
|
||||
#define AVUTIL_FFVERSION_H
|
||||
#define FFMPEG_VERSION "4.1"
|
||||
#define FFMPEG_VERSION "4.2.1"
|
||||
#endif /* AVUTIL_FFVERSION_H */
|
||||
|
||||
@@ -166,6 +166,19 @@ enum AVFrameSideDataType {
|
||||
* function in libavutil/timecode.c.
|
||||
*/
|
||||
AV_FRAME_DATA_S12M_TIMECODE,
|
||||
|
||||
/**
|
||||
* HDR dynamic metadata associated with a video frame. The payload is
|
||||
* an AVDynamicHDRPlus type and contains information for color
|
||||
* volume transform - application 4 of SMPTE 2094-40:2016 standard.
|
||||
*/
|
||||
AV_FRAME_DATA_DYNAMIC_HDR_PLUS,
|
||||
|
||||
/**
|
||||
* Regions Of Interest, the data is an array of AVRegionOfInterest type, the number of
|
||||
* array element is implied by AVFrameSideData.size / AVRegionOfInterest.self_size.
|
||||
*/
|
||||
AV_FRAME_DATA_REGIONS_OF_INTEREST,
|
||||
};
|
||||
|
||||
enum AVActiveFormatDescription {
|
||||
@@ -193,6 +206,62 @@ typedef struct AVFrameSideData {
|
||||
AVBufferRef *buf;
|
||||
} AVFrameSideData;
|
||||
|
||||
/**
|
||||
* Structure describing a single Region Of Interest.
|
||||
*
|
||||
* When multiple regions are defined in a single side-data block, they
|
||||
* should be ordered from most to least important - some encoders are only
|
||||
* capable of supporting a limited number of distinct regions, so will have
|
||||
* to truncate the list.
|
||||
*
|
||||
* When overlapping regions are defined, the first region containing a given
|
||||
* area of the frame applies.
|
||||
*/
|
||||
typedef struct AVRegionOfInterest {
|
||||
/**
|
||||
* Must be set to the size of this data structure (that is,
|
||||
* sizeof(AVRegionOfInterest)).
|
||||
*/
|
||||
uint32_t self_size;
|
||||
/**
|
||||
* Distance in pixels from the top edge of the frame to the top and
|
||||
* bottom edges and from the left edge of the frame to the left and
|
||||
* right edges of the rectangle defining this region of interest.
|
||||
*
|
||||
* The constraints on a region are encoder dependent, so the region
|
||||
* actually affected may be slightly larger for alignment or other
|
||||
* reasons.
|
||||
*/
|
||||
int top;
|
||||
int bottom;
|
||||
int left;
|
||||
int right;
|
||||
/**
|
||||
* Quantisation offset.
|
||||
*
|
||||
* Must be in the range -1 to +1. A value of zero indicates no quality
|
||||
* change. A negative value asks for better quality (less quantisation),
|
||||
* while a positive value asks for worse quality (greater quantisation).
|
||||
*
|
||||
* The range is calibrated so that the extreme values indicate the
|
||||
* largest possible offset - if the rest of the frame is encoded with the
|
||||
* worst possible quality, an offset of -1 indicates that this region
|
||||
* should be encoded with the best possible quality anyway. Intermediate
|
||||
* values are then interpolated in some codec-dependent way.
|
||||
*
|
||||
* For example, in 10-bit H.264 the quantisation parameter varies between
|
||||
* -12 and 51. A typical qoffset value of -1/10 therefore indicates that
|
||||
* this region should be encoded with a QP around one-tenth of the full
|
||||
* range better than the rest of the frame. So, if most of the frame
|
||||
* were to be encoded with a QP of around 30, this region would get a QP
|
||||
* of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
|
||||
* An extreme value of -1 would indicate that this region should be
|
||||
* encoded with the best possible quality regardless of the treatment of
|
||||
* the rest of the frame - that is, should be encoded at a QP of -12.
|
||||
*/
|
||||
AVRational qoffset;
|
||||
} AVRegionOfInterest;
|
||||
|
||||
/**
|
||||
* This structure describes decoded (raw) audio or video data.
|
||||
*
|
||||
@@ -389,7 +458,6 @@ typedef struct AVFrame {
|
||||
* that time,
|
||||
* the decoder reorders values as needed and sets AVFrame.reordered_opaque
|
||||
* to exactly one of the values provided by the user through AVCodecContext.reordered_opaque
|
||||
* @deprecated in favor of pkt_pts
|
||||
*/
|
||||
int64_t reordered_opaque;
|
||||
|
||||
@@ -522,6 +590,8 @@ typedef struct AVFrame {
|
||||
int decode_error_flags;
|
||||
#define FF_DECODE_ERROR_INVALID_BITSTREAM 1
|
||||
#define FF_DECODE_ERROR_MISSING_REFERENCE 2
|
||||
#define FF_DECODE_ERROR_CONCEALMENT_ACTIVE 4
|
||||
#define FF_DECODE_ERROR_DECODE_SLICES 8
|
||||
|
||||
/**
|
||||
* number of audio channels, only used for audio.
|
||||
|
||||
@@ -0,0 +1,343 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Mohammad Izadi <moh.izadi at gmail.com>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_HDR_DYNAMIC_METADATA_H
|
||||
#define AVUTIL_HDR_DYNAMIC_METADATA_H
|
||||
|
||||
#include "frame.h"
|
||||
#include "rational.h"
|
||||
|
||||
/**
|
||||
* Option for overlapping elliptical pixel selectors in an image.
|
||||
*/
|
||||
enum AVHDRPlusOverlapProcessOption {
|
||||
AV_HDR_PLUS_OVERLAP_PROCESS_WEIGHTED_AVERAGING = 0,
|
||||
AV_HDR_PLUS_OVERLAP_PROCESS_LAYERING = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
* Represents the percentile at a specific percentage in
|
||||
* a distribution.
|
||||
*/
|
||||
typedef struct AVHDRPlusPercentile {
|
||||
/**
|
||||
* The percentage value corresponding to a specific percentile linearized
|
||||
* RGB value in the processing window in the scene. The value shall be in
|
||||
* the range of 0 to100, inclusive.
|
||||
*/
|
||||
uint8_t percentage;
|
||||
|
||||
/**
|
||||
* The linearized maxRGB value at a specific percentile in the processing
|
||||
* window in the scene. The value shall be in the range of 0 to 1, inclusive
|
||||
* and in multiples of 0.00001.
|
||||
*/
|
||||
AVRational percentile;
|
||||
} AVHDRPlusPercentile;
|
||||
|
||||
/**
|
||||
* Color transform parameters at a processing window in a dynamic metadata for
|
||||
* SMPTE 2094-40.
|
||||
*/
|
||||
typedef struct AVHDRPlusColorTransformParams {
|
||||
/**
|
||||
* The relative x coordinate of the top left pixel of the processing
|
||||
* window. The value shall be in the range of 0 and 1, inclusive and
|
||||
* in multiples of 1/(width of Picture - 1). The value 1 corresponds
|
||||
* to the absolute coordinate of width of Picture - 1. The value for
|
||||
* first processing window shall be 0.
|
||||
*/
|
||||
AVRational window_upper_left_corner_x;
|
||||
|
||||
/**
|
||||
* The relative y coordinate of the top left pixel of the processing
|
||||
* window. The value shall be in the range of 0 and 1, inclusive and
|
||||
* in multiples of 1/(height of Picture - 1). The value 1 corresponds
|
||||
* to the absolute coordinate of height of Picture - 1. The value for
|
||||
* first processing window shall be 0.
|
||||
*/
|
||||
AVRational window_upper_left_corner_y;
|
||||
|
||||
/**
|
||||
* The relative x coordinate of the bottom right pixel of the processing
|
||||
* window. The value shall be in the range of 0 and 1, inclusive and
|
||||
* in multiples of 1/(width of Picture - 1). The value 1 corresponds
|
||||
* to the absolute coordinate of width of Picture - 1. The value for
|
||||
* first processing window shall be 1.
|
||||
*/
|
||||
AVRational window_lower_right_corner_x;
|
||||
|
||||
/**
|
||||
* The relative y coordinate of the bottom right pixel of the processing
|
||||
* window. The value shall be in the range of 0 and 1, inclusive and
|
||||
* in multiples of 1/(height of Picture - 1). The value 1 corresponds
|
||||
* to the absolute coordinate of height of Picture - 1. The value for
|
||||
* first processing window shall be 1.
|
||||
*/
|
||||
AVRational window_lower_right_corner_y;
|
||||
|
||||
/**
|
||||
* The x coordinate of the center position of the concentric internal and
|
||||
* external ellipses of the elliptical pixel selector in the processing
|
||||
* window. The value shall be in the range of 0 to (width of Picture - 1),
|
||||
* inclusive and in multiples of 1 pixel.
|
||||
*/
|
||||
uint16_t center_of_ellipse_x;
|
||||
|
||||
/**
|
||||
* The y coordinate of the center position of the concentric internal and
|
||||
* external ellipses of the elliptical pixel selector in the processing
|
||||
* window. The value shall be in the range of 0 to (height of Picture - 1),
|
||||
* inclusive and in multiples of 1 pixel.
|
||||
*/
|
||||
uint16_t center_of_ellipse_y;
|
||||
|
||||
/**
|
||||
* The clockwise rotation angle in degree of arc with respect to the
|
||||
* positive direction of the x-axis of the concentric internal and external
|
||||
* ellipses of the elliptical pixel selector in the processing window. The
|
||||
* value shall be in the range of 0 to 180, inclusive and in multiples of 1.
|
||||
*/
|
||||
uint8_t rotation_angle;
|
||||
|
||||
/**
|
||||
* The semi-major axis value of the internal ellipse of the elliptical pixel
|
||||
* selector in amount of pixels in the processing window. The value shall be
|
||||
* in the range of 1 to 65535, inclusive and in multiples of 1 pixel.
|
||||
*/
|
||||
uint16_t semimajor_axis_internal_ellipse;
|
||||
|
||||
/**
|
||||
* The semi-major axis value of the external ellipse of the elliptical pixel
|
||||
* selector in amount of pixels in the processing window. The value
|
||||
* shall not be less than semimajor_axis_internal_ellipse of the current
|
||||
* processing window. The value shall be in the range of 1 to 65535,
|
||||
* inclusive and in multiples of 1 pixel.
|
||||
*/
|
||||
uint16_t semimajor_axis_external_ellipse;
|
||||
|
||||
/**
|
||||
* The semi-minor axis value of the external ellipse of the elliptical pixel
|
||||
* selector in amount of pixels in the processing window. The value shall be
|
||||
* in the range of 1 to 65535, inclusive and in multiples of 1 pixel.
|
||||
*/
|
||||
uint16_t semiminor_axis_external_ellipse;
|
||||
|
||||
/**
|
||||
* Overlap process option indicates one of the two methods of combining
|
||||
* rendered pixels in the processing window in an image with at least one
|
||||
* elliptical pixel selector. For overlapping elliptical pixel selectors
|
||||
* in an image, overlap_process_option shall have the same value.
|
||||
*/
|
||||
enum AVHDRPlusOverlapProcessOption overlap_process_option;
|
||||
|
||||
/**
|
||||
* The maximum of the color components of linearized RGB values in the
|
||||
* processing window in the scene. The values should be in the range of 0 to
|
||||
* 1, inclusive and in multiples of 0.00001. maxscl[ 0 ], maxscl[ 1 ], and
|
||||
* maxscl[ 2 ] are corresponding to R, G, B color components respectively.
|
||||
*/
|
||||
AVRational maxscl[3];
|
||||
|
||||
/**
|
||||
* The average of linearized maxRGB values in the processing window in the
|
||||
* scene. The value should be in the range of 0 to 1, inclusive and in
|
||||
* multiples of 0.00001.
|
||||
*/
|
||||
AVRational average_maxrgb;
|
||||
|
||||
/**
|
||||
* The number of linearized maxRGB values at given percentiles in the
|
||||
* processing window in the scene. The maximum value shall be 15.
|
||||
*/
|
||||
uint8_t num_distribution_maxrgb_percentiles;
|
||||
|
||||
/**
|
||||
* The linearized maxRGB values at given percentiles in the
|
||||
* processing window in the scene.
|
||||
*/
|
||||
AVHDRPlusPercentile distribution_maxrgb[15];
|
||||
|
||||
/**
|
||||
* The fraction of selected pixels in the image that contains the brightest
|
||||
* pixel in the scene. The value shall be in the range of 0 to 1, inclusive
|
||||
* and in multiples of 0.001.
|
||||
*/
|
||||
AVRational fraction_bright_pixels;
|
||||
|
||||
/**
|
||||
* This flag indicates that the metadata for the tone mapping function in
|
||||
* the processing window is present (for value of 1).
|
||||
*/
|
||||
uint8_t tone_mapping_flag;
|
||||
|
||||
/**
|
||||
* The x coordinate of the separation point between the linear part and the
|
||||
* curved part of the tone mapping function. The value shall be in the range
|
||||
* of 0 to 1, excluding 0 and in multiples of 1/4095.
|
||||
*/
|
||||
AVRational knee_point_x;
|
||||
|
||||
/**
|
||||
* The y coordinate of the separation point between the linear part and the
|
||||
* curved part of the tone mapping function. The value shall be in the range
|
||||
* of 0 to 1, excluding 0 and in multiples of 1/4095.
|
||||
*/
|
||||
AVRational knee_point_y;
|
||||
|
||||
/**
|
||||
* The number of the intermediate anchor parameters of the tone mapping
|
||||
* function in the processing window. The maximum value shall be 15.
|
||||
*/
|
||||
uint8_t num_bezier_curve_anchors;
|
||||
|
||||
/**
|
||||
* The intermediate anchor parameters of the tone mapping function in the
|
||||
* processing window in the scene. The values should be in the range of 0
|
||||
* to 1, inclusive and in multiples of 1/1023.
|
||||
*/
|
||||
AVRational bezier_curve_anchors[15];
|
||||
|
||||
/**
|
||||
* This flag shall be equal to 0 in bitstreams conforming to this version of
|
||||
* this Specification. Other values are reserved for future use.
|
||||
*/
|
||||
uint8_t color_saturation_mapping_flag;
|
||||
|
||||
/**
|
||||
* The color saturation gain in the processing window in the scene. The
|
||||
* value shall be in the range of 0 to 63/8, inclusive and in multiples of
|
||||
* 1/8. The default value shall be 1.
|
||||
*/
|
||||
AVRational color_saturation_weight;
|
||||
} AVHDRPlusColorTransformParams;
|
||||
|
||||
/**
|
||||
* This struct represents dynamic metadata for color volume transform -
|
||||
* application 4 of SMPTE 2094-40:2016 standard.
|
||||
*
|
||||
* To be used as payload of a AVFrameSideData or AVPacketSideData with the
|
||||
* appropriate type.
|
||||
*
|
||||
* @note The struct should be allocated with
|
||||
* av_dynamic_hdr_plus_alloc() and its size is not a part of
|
||||
* the public ABI.
|
||||
*/
|
||||
typedef struct AVDynamicHDRPlus {
|
||||
/**
|
||||
* Country code by Rec. ITU-T T.35 Annex A. The value shall be 0xB5.
|
||||
*/
|
||||
uint8_t itu_t_t35_country_code;
|
||||
|
||||
/**
|
||||
* Application version in the application defining document in ST-2094
|
||||
* suite. The value shall be set to 0.
|
||||
*/
|
||||
uint8_t application_version;
|
||||
|
||||
/**
|
||||
* The number of processing windows. The value shall be in the range
|
||||
* of 1 to 3, inclusive.
|
||||
*/
|
||||
uint8_t num_windows;
|
||||
|
||||
/**
|
||||
* The color transform parameters for every processing window.
|
||||
*/
|
||||
AVHDRPlusColorTransformParams params[3];
|
||||
|
||||
/**
|
||||
* The nominal maximum display luminance of the targeted system display,
|
||||
* in units of 0.0001 candelas per square metre. The value shall be in
|
||||
* the range of 0 to 10000, inclusive.
|
||||
*/
|
||||
AVRational targeted_system_display_maximum_luminance;
|
||||
|
||||
/**
|
||||
* This flag shall be equal to 0 in bit streams conforming to this version
|
||||
* of this Specification. The value 1 is reserved for future use.
|
||||
*/
|
||||
uint8_t targeted_system_display_actual_peak_luminance_flag;
|
||||
|
||||
/**
|
||||
* The number of rows in the targeted system_display_actual_peak_luminance
|
||||
* array. The value shall be in the range of 2 to 25, inclusive.
|
||||
*/
|
||||
uint8_t num_rows_targeted_system_display_actual_peak_luminance;
|
||||
|
||||
/**
|
||||
* The number of columns in the
|
||||
* targeted_system_display_actual_peak_luminance array. The value shall be
|
||||
* in the range of 2 to 25, inclusive.
|
||||
*/
|
||||
uint8_t num_cols_targeted_system_display_actual_peak_luminance;
|
||||
|
||||
/**
|
||||
* The normalized actual peak luminance of the targeted system display. The
|
||||
* values should be in the range of 0 to 1, inclusive and in multiples of
|
||||
* 1/15.
|
||||
*/
|
||||
AVRational targeted_system_display_actual_peak_luminance[25][25];
|
||||
|
||||
/**
|
||||
* This flag shall be equal to 0 in bitstreams conforming to this version of
|
||||
* this Specification. The value 1 is reserved for future use.
|
||||
*/
|
||||
uint8_t mastering_display_actual_peak_luminance_flag;
|
||||
|
||||
/**
|
||||
* The number of rows in the mastering_display_actual_peak_luminance array.
|
||||
* The value shall be in the range of 2 to 25, inclusive.
|
||||
*/
|
||||
uint8_t num_rows_mastering_display_actual_peak_luminance;
|
||||
|
||||
/**
|
||||
* The number of columns in the mastering_display_actual_peak_luminance
|
||||
* array. The value shall be in the range of 2 to 25, inclusive.
|
||||
*/
|
||||
uint8_t num_cols_mastering_display_actual_peak_luminance;
|
||||
|
||||
/**
|
||||
* The normalized actual peak luminance of the mastering display used for
|
||||
* mastering the image essence. The values should be in the range of 0 to 1,
|
||||
* inclusive and in multiples of 1/15.
|
||||
*/
|
||||
AVRational mastering_display_actual_peak_luminance[25][25];
|
||||
} AVDynamicHDRPlus;
|
||||
|
||||
/**
|
||||
* Allocate an AVDynamicHDRPlus structure and set its fields to
|
||||
* default values. The resulting struct can be freed using av_freep().
|
||||
*
|
||||
* @return An AVDynamicHDRPlus filled with default values or NULL
|
||||
* on failure.
|
||||
*/
|
||||
AVDynamicHDRPlus *av_dynamic_hdr_plus_alloc(size_t *size);
|
||||
|
||||
/**
|
||||
* Allocate a complete AVDynamicHDRPlus and add it to the frame.
|
||||
* @param frame The frame which side data is added to.
|
||||
*
|
||||
* @return The AVDynamicHDRPlus structure to be filled by caller or NULL
|
||||
* on failure.
|
||||
*/
|
||||
AVDynamicHDRPlus *av_dynamic_hdr_plus_create_side_data(AVFrame *frame);
|
||||
|
||||
#endif /* AVUTIL_HDR_DYNAMIC_METADATA_H */
|
||||
@@ -542,6 +542,21 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
|
||||
# define AV_WN64A(p, v) AV_WNA(64, p, v)
|
||||
#endif
|
||||
|
||||
#if AV_HAVE_BIGENDIAN
|
||||
# define AV_RLA(s, p) av_bswap##s(AV_RN##s##A(p))
|
||||
# define AV_WLA(s, p, v) AV_WN##s##A(p, av_bswap##s(v))
|
||||
#else
|
||||
# define AV_RLA(s, p) AV_RN##s##A(p)
|
||||
# define AV_WLA(s, p, v) AV_WN##s##A(p, v)
|
||||
#endif
|
||||
|
||||
#ifndef AV_RL64A
|
||||
# define AV_RL64A(p) AV_RLA(64, p)
|
||||
#endif
|
||||
#ifndef AV_WL64A
|
||||
# define AV_WL64A(p, v) AV_WLA(64, p, v)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The AV_COPYxxU macros are suitable for copying data to/from unaligned
|
||||
* memory locations.
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* LZO 1x decompression
|
||||
* copyright (c) 2006 Reimar Doeffinger
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_LZO_H
|
||||
#define AVUTIL_LZO_H
|
||||
|
||||
/**
|
||||
* @defgroup lavu_lzo LZO
|
||||
* @ingroup lavu_crypto
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/** @name Error flags returned by av_lzo1x_decode
|
||||
* @{ */
|
||||
/// end of the input buffer reached before decoding finished
|
||||
#define AV_LZO_INPUT_DEPLETED 1
|
||||
/// decoded data did not fit into output buffer
|
||||
#define AV_LZO_OUTPUT_FULL 2
|
||||
/// a reference to previously decoded data was wrong
|
||||
#define AV_LZO_INVALID_BACKPTR 4
|
||||
/// a non-specific error in the compressed bitstream
|
||||
#define AV_LZO_ERROR 8
|
||||
/** @} */
|
||||
|
||||
#define AV_LZO_INPUT_PADDING 8
|
||||
#define AV_LZO_OUTPUT_PADDING 12
|
||||
|
||||
/**
|
||||
* @brief Decodes LZO 1x compressed data.
|
||||
* @param out output buffer
|
||||
* @param outlen size of output buffer, number of bytes left are returned here
|
||||
* @param in input buffer
|
||||
* @param inlen size of input buffer, number of bytes left are returned here
|
||||
* @return 0 on success, otherwise a combination of the error flags above
|
||||
*
|
||||
* Make sure all buffers are appropriately padded, in must provide
|
||||
* AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes.
|
||||
*/
|
||||
int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVUTIL_LZO_H */
|
||||
@@ -339,7 +339,7 @@ av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
|
||||
* @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
|
||||
* correctly aligned.
|
||||
*/
|
||||
av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
|
||||
int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
|
||||
|
||||
/**
|
||||
* Reallocate the given buffer if it is not large enough, otherwise do nothing.
|
||||
@@ -363,10 +363,10 @@ av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
|
||||
* @endcode
|
||||
*
|
||||
* @param[in,out] ptr Already allocated buffer, or `NULL`
|
||||
* @param[in,out] size Pointer to current size of buffer `ptr`. `*size` is
|
||||
* changed to `min_size` in case of success or 0 in
|
||||
* case of failure
|
||||
* @param[in] min_size New size of buffer `ptr`
|
||||
* @param[in,out] size Pointer to the size of buffer `ptr`. `*size` is
|
||||
* updated to the new allocated size, in particular 0
|
||||
* in case of failure.
|
||||
* @param[in] min_size Desired minimal size of buffer `ptr`
|
||||
* @return `ptr` if the buffer is large enough, a pointer to newly reallocated
|
||||
* buffer if the buffer was not large enough, or `NULL` in case of
|
||||
* error
|
||||
@@ -397,10 +397,10 @@ void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
|
||||
* @param[in,out] ptr Pointer to pointer to an already allocated buffer.
|
||||
* `*ptr` will be overwritten with pointer to new
|
||||
* buffer on success or `NULL` on failure
|
||||
* @param[in,out] size Pointer to current size of buffer `*ptr`. `*size` is
|
||||
* changed to `min_size` in case of success or 0 in
|
||||
* case of failure
|
||||
* @param[in] min_size New size of buffer `*ptr`
|
||||
* @param[in,out] size Pointer to the size of buffer `*ptr`. `*size` is
|
||||
* updated to the new allocated size, in particular 0
|
||||
* in case of failure.
|
||||
* @param[in] min_size Desired minimal size of buffer `*ptr`
|
||||
* @see av_realloc()
|
||||
* @see av_fast_mallocz()
|
||||
*/
|
||||
@@ -418,10 +418,10 @@ void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
|
||||
* @param[in,out] ptr Pointer to pointer to an already allocated buffer.
|
||||
* `*ptr` will be overwritten with pointer to new
|
||||
* buffer on success or `NULL` on failure
|
||||
* @param[in,out] size Pointer to current size of buffer `*ptr`. `*size` is
|
||||
* changed to `min_size` in case of success or 0 in
|
||||
* case of failure
|
||||
* @param[in] min_size New size of buffer `*ptr`
|
||||
* @param[in,out] size Pointer to the size of buffer `*ptr`. `*size` is
|
||||
* updated to the new allocated size, in particular 0
|
||||
* in case of failure.
|
||||
* @param[in] min_size Desired minimal size of buffer `*ptr`
|
||||
* @see av_fast_malloc()
|
||||
*/
|
||||
void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size);
|
||||
|
||||
@@ -340,6 +340,14 @@ enum AVPixelFormat {
|
||||
AV_PIX_FMT_GRAYF32BE, ///< IEEE-754 single precision Y, 32bpp, big-endian
|
||||
AV_PIX_FMT_GRAYF32LE, ///< IEEE-754 single precision Y, 32bpp, little-endian
|
||||
|
||||
AV_PIX_FMT_YUVA422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, big-endian
|
||||
AV_PIX_FMT_YUVA422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, little-endian
|
||||
AV_PIX_FMT_YUVA444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, big-endian
|
||||
AV_PIX_FMT_YUVA444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, little-endian
|
||||
|
||||
AV_PIX_FMT_NV24, ///< planar YUV 4:4:4, 24bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
|
||||
AV_PIX_FMT_NV42, ///< as above, but U and V bytes are swapped
|
||||
|
||||
AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
|
||||
};
|
||||
|
||||
@@ -416,6 +424,8 @@ enum AVPixelFormat {
|
||||
#define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE)
|
||||
#define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE)
|
||||
#define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE)
|
||||
#define AV_PIX_FMT_YUVA422P12 AV_PIX_FMT_NE(YUVA422P12BE, YUVA422P12LE)
|
||||
#define AV_PIX_FMT_YUVA444P12 AV_PIX_FMT_NE(YUVA444P12BE, YUVA444P12LE)
|
||||
#define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE)
|
||||
#define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE)
|
||||
#define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE)
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_TX_H
|
||||
#define AVUTIL_TX_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct AVTXContext AVTXContext;
|
||||
|
||||
typedef struct AVComplexFloat {
|
||||
float re, im;
|
||||
} AVComplexFloat;
|
||||
|
||||
enum AVTXType {
|
||||
/**
|
||||
* Standard complex to complex FFT with sample data type AVComplexFloat.
|
||||
* Scaling currently unsupported
|
||||
*/
|
||||
AV_TX_FLOAT_FFT = 0,
|
||||
/**
|
||||
* Standard MDCT with sample data type of float and a scale type of
|
||||
* float. Length is the frame size, not the window size (which is 2x frame)
|
||||
*/
|
||||
AV_TX_FLOAT_MDCT = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
* Function pointer to a function to perform the transform.
|
||||
*
|
||||
* @note Using a different context than the one allocated during av_tx_init()
|
||||
* is not allowed.
|
||||
*
|
||||
* @param s the transform context
|
||||
* @param out the output array
|
||||
* @param in the input array
|
||||
* @param stride the input or output stride (depending on transform direction)
|
||||
* in bytes, currently implemented for all MDCT transforms
|
||||
*/
|
||||
typedef void (*av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride);
|
||||
|
||||
/**
|
||||
* Initialize a transform context with the given configuration
|
||||
* Currently power of two lengths from 4 to 131072 are supported, along with
|
||||
* any length decomposable to a power of two and either 3, 5 or 15.
|
||||
*
|
||||
* @param ctx the context to allocate, will be NULL on error
|
||||
* @param tx pointer to the transform function pointer to set
|
||||
* @param type type the type of transform
|
||||
* @param inv whether to do an inverse or a forward transform
|
||||
* @param len the size of the transform in samples
|
||||
* @param scale pointer to the value to scale the output if supported by type
|
||||
* @param flags currently unused
|
||||
*
|
||||
* @return 0 on success, negative error code on failure
|
||||
*/
|
||||
int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type,
|
||||
int inv, int len, const void *scale, uint64_t flags);
|
||||
|
||||
/**
|
||||
* Frees a context and sets ctx to NULL, does nothing when ctx == NULL
|
||||
*/
|
||||
void av_tx_uninit(AVTXContext **ctx);
|
||||
|
||||
#endif /* AVUTIL_TX_H */
|
||||
@@ -79,7 +79,7 @@
|
||||
*/
|
||||
|
||||
#define LIBAVUTIL_VERSION_MAJOR 56
|
||||
#define LIBAVUTIL_VERSION_MINOR 22
|
||||
#define LIBAVUTIL_VERSION_MINOR 31
|
||||
#define LIBAVUTIL_VERSION_MICRO 100
|
||||
|
||||
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "SDL_loadso.h"
|
||||
#include "SDL_log.h"
|
||||
#include "SDL_messagebox.h"
|
||||
#include "SDL_metal.h"
|
||||
#include "SDL_mutex.h"
|
||||
#include "SDL_power.h"
|
||||
#include "SDL_render.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -50,6 +50,9 @@ typedef enum
|
||||
SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate
|
||||
dstRGB = srcRGB * dstRGB
|
||||
dstA = dstA */
|
||||
SDL_BLENDMODE_MUL = 0x00000008, /**< color multiply
|
||||
dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA))
|
||||
dstA = (srcA * dstA) + (dstA * (1-srcA)) */
|
||||
SDL_BLENDMODE_INVALID = 0x7FFFFFFF
|
||||
|
||||
/* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -19,239 +19,37 @@
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef SDL_config_windows_h_
|
||||
#define SDL_config_windows_h_
|
||||
#ifndef SDL_config_h_
|
||||
#define SDL_config_h_
|
||||
|
||||
#include "SDL_platform.h"
|
||||
|
||||
/* This is a set of defines to configure the SDL features */
|
||||
/**
|
||||
* \file SDL_config.h
|
||||
*/
|
||||
|
||||
#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
|
||||
#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
|
||||
#define HAVE_STDINT_H 1
|
||||
#elif defined(_MSC_VER)
|
||||
typedef signed __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef signed __int16 int16_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef signed __int32 int32_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef signed __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#ifndef _UINTPTR_T_DEFINED
|
||||
#ifdef _WIN64
|
||||
typedef unsigned __int64 uintptr_t;
|
||||
/* Add any platform that doesn't build using the configure system. */
|
||||
#if defined(__WIN32__)
|
||||
#include "SDL_config_windows.h"
|
||||
#elif defined(__WINRT__)
|
||||
#include "SDL_config_winrt.h"
|
||||
#elif defined(__MACOSX__)
|
||||
#include "SDL_config_macosx.h"
|
||||
#elif defined(__IPHONEOS__)
|
||||
#include "SDL_config_iphoneos.h"
|
||||
#elif defined(__ANDROID__)
|
||||
#include "SDL_config_android.h"
|
||||
#elif defined(__PSP__)
|
||||
#include "SDL_config_psp.h"
|
||||
#elif defined(__OS2__)
|
||||
#include "SDL_config_os2.h"
|
||||
#else
|
||||
typedef unsigned int uintptr_t;
|
||||
#endif
|
||||
#define _UINTPTR_T_DEFINED
|
||||
#endif
|
||||
/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
|
||||
#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
|
||||
#define DWORD_PTR DWORD
|
||||
#endif
|
||||
#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
|
||||
#define LONG_PTR LONG
|
||||
#endif
|
||||
#else /* !__GNUC__ && !_MSC_VER */
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed short int16_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef signed long long int64_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
#ifndef _SIZE_T_DEFINED_
|
||||
#define _SIZE_T_DEFINED_
|
||||
typedef unsigned int size_t;
|
||||
#endif
|
||||
typedef unsigned int uintptr_t;
|
||||
#endif /* __GNUC__ || _MSC_VER */
|
||||
#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
|
||||
/* This is a minimal configuration just to get SDL running on new platforms. */
|
||||
#include "SDL_config_minimal.h"
|
||||
#endif /* platform config */
|
||||
|
||||
#ifdef _WIN64
|
||||
# define SIZEOF_VOIDP 8
|
||||
#else
|
||||
# define SIZEOF_VOIDP 4
|
||||
#ifdef USING_GENERATED_CONFIG_H
|
||||
#error Wrong SDL_config.h, check your include path?
|
||||
#endif
|
||||
|
||||
#define HAVE_DDRAW_H 1
|
||||
#define HAVE_DINPUT_H 1
|
||||
#define HAVE_DSOUND_H 1
|
||||
#define HAVE_DXGI_H 1
|
||||
#define HAVE_XINPUT_H 1
|
||||
#define HAVE_MMDEVICEAPI_H 1
|
||||
#define HAVE_AUDIOCLIENT_H 1
|
||||
#define HAVE_ENDPOINTVOLUME_H 1
|
||||
|
||||
/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
|
||||
#ifdef HAVE_LIBC
|
||||
/* Useful headers */
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_FLOAT_H 1
|
||||
#define HAVE_LIMITS_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* C library functions */
|
||||
#define HAVE_MALLOC 1
|
||||
#define HAVE_CALLOC 1
|
||||
#define HAVE_REALLOC 1
|
||||
#define HAVE_FREE 1
|
||||
#define HAVE_ALLOCA 1
|
||||
#define HAVE_QSORT 1
|
||||
#define HAVE_ABS 1
|
||||
#define HAVE_MEMSET 1
|
||||
#define HAVE_MEMCPY 1
|
||||
#define HAVE_MEMMOVE 1
|
||||
#define HAVE_MEMCMP 1
|
||||
#define HAVE_STRLEN 1
|
||||
#define HAVE__STRREV 1
|
||||
/* These functions have security warnings, so we won't use them */
|
||||
/* #undef HAVE__STRUPR */
|
||||
/* #undef HAVE__STRLWR */
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
/* These functions have security warnings, so we won't use them */
|
||||
/* #undef HAVE__LTOA */
|
||||
/* #undef HAVE__ULTOA */
|
||||
#define HAVE_STRTOL 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE_STRTOD 1
|
||||
#define HAVE_ATOI 1
|
||||
#define HAVE_ATOF 1
|
||||
#define HAVE_STRCMP 1
|
||||
#define HAVE_STRNCMP 1
|
||||
#define HAVE__STRICMP 1
|
||||
#define HAVE__STRNICMP 1
|
||||
#define HAVE_ACOS 1
|
||||
#define HAVE_ACOSF 1
|
||||
#define HAVE_ASIN 1
|
||||
#define HAVE_ASINF 1
|
||||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATANF 1
|
||||
#define HAVE_ATAN2 1
|
||||
#define HAVE_ATAN2F 1
|
||||
#define HAVE_CEILF 1
|
||||
#define HAVE__COPYSIGN 1
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_EXP 1
|
||||
#define HAVE_EXPF 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FABSF 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_FLOORF 1
|
||||
#define HAVE_FMOD 1
|
||||
#define HAVE_FMODF 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_LOGF 1
|
||||
#define HAVE_LOG10 1
|
||||
#define HAVE_LOG10F 1
|
||||
#define HAVE_POW 1
|
||||
#define HAVE_POWF 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
#define HAVE_SQRTF 1
|
||||
#define HAVE_TAN 1
|
||||
#define HAVE_TANF 1
|
||||
#if defined(_MSC_VER)
|
||||
/* These functions were added with the VC++ 2013 C runtime library */
|
||||
#if _MSC_VER >= 1800
|
||||
#define HAVE_STRTOLL 1
|
||||
#define HAVE_VSSCANF 1
|
||||
#define HAVE_SCALBN 1
|
||||
#define HAVE_SCALBNF 1
|
||||
#endif
|
||||
/* This function is available with at least the VC++ 2008 C runtime library */
|
||||
#if _MSC_VER >= 1400
|
||||
#define HAVE__FSEEKI64 1
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES)
|
||||
#define HAVE_M_PI 1
|
||||
#endif
|
||||
#else
|
||||
#define HAVE_STDARG_H 1
|
||||
#define HAVE_STDDEF_H 1
|
||||
#endif
|
||||
|
||||
/* Enable various audio drivers */
|
||||
#define SDL_AUDIO_DRIVER_WASAPI 1
|
||||
#define SDL_AUDIO_DRIVER_DSOUND 1
|
||||
#define SDL_AUDIO_DRIVER_WINMM 1
|
||||
#define SDL_AUDIO_DRIVER_DISK 1
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
|
||||
/* Enable various input drivers */
|
||||
#define SDL_JOYSTICK_DINPUT 1
|
||||
#define SDL_JOYSTICK_XINPUT 1
|
||||
#define SDL_JOYSTICK_HIDAPI 1
|
||||
#define SDL_HAPTIC_DINPUT 1
|
||||
#define SDL_HAPTIC_XINPUT 1
|
||||
|
||||
/* Enable the dummy sensor driver */
|
||||
#define SDL_SENSOR_DUMMY 1
|
||||
|
||||
/* Enable various shared object loading systems */
|
||||
#define SDL_LOADSO_WINDOWS 1
|
||||
|
||||
/* Enable various threading systems */
|
||||
#define SDL_THREAD_WINDOWS 1
|
||||
|
||||
/* Enable various timer systems */
|
||||
#define SDL_TIMER_WINDOWS 1
|
||||
|
||||
/* Enable various video drivers */
|
||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||
#define SDL_VIDEO_DRIVER_WINDOWS 1
|
||||
|
||||
#ifndef SDL_VIDEO_RENDER_D3D
|
||||
#define SDL_VIDEO_RENDER_D3D 1
|
||||
#endif
|
||||
#ifndef SDL_VIDEO_RENDER_D3D11
|
||||
#define SDL_VIDEO_RENDER_D3D11 0
|
||||
#endif
|
||||
|
||||
/* Enable OpenGL support */
|
||||
#ifndef SDL_VIDEO_OPENGL
|
||||
#define SDL_VIDEO_OPENGL 1
|
||||
#endif
|
||||
#ifndef SDL_VIDEO_OPENGL_WGL
|
||||
#define SDL_VIDEO_OPENGL_WGL 1
|
||||
#endif
|
||||
#ifndef SDL_VIDEO_RENDER_OGL
|
||||
#define SDL_VIDEO_RENDER_OGL 1
|
||||
#endif
|
||||
#ifndef SDL_VIDEO_RENDER_OGL_ES2
|
||||
#define SDL_VIDEO_RENDER_OGL_ES2 1
|
||||
#endif
|
||||
#ifndef SDL_VIDEO_OPENGL_ES2
|
||||
#define SDL_VIDEO_OPENGL_ES2 1
|
||||
#endif
|
||||
#ifndef SDL_VIDEO_OPENGL_EGL
|
||||
#define SDL_VIDEO_OPENGL_EGL 1
|
||||
#endif
|
||||
|
||||
/* Enable Vulkan support */
|
||||
#define SDL_VIDEO_VULKAN 1
|
||||
|
||||
/* Enable system power support */
|
||||
#define SDL_POWER_WINDOWS 1
|
||||
|
||||
/* Enable filesystem support */
|
||||
#define SDL_FILESYSTEM_WINDOWS 1
|
||||
|
||||
/* Enable assembly routines (Win64 doesn't have inline asm) */
|
||||
#ifndef _WIN64
|
||||
#define SDL_ASSEMBLY_ROUTINES 1
|
||||
#endif
|
||||
|
||||
#endif /* SDL_config_windows_h_ */
|
||||
#endif /* SDL_config_h_ */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -35,16 +35,17 @@
|
||||
|
||||
#define HAVE_GCC_ATOMICS 1
|
||||
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_LIMITS_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* C library functions */
|
||||
#define HAVE_MALLOC 1
|
||||
@@ -67,10 +68,10 @@
|
||||
#define HAVE_STRLEN 1
|
||||
#define HAVE_STRLCPY 1
|
||||
#define HAVE_STRLCAT 1
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
#define HAVE_STRTOK_R 1
|
||||
#define HAVE_STRTOL 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE_STRTOLL 1
|
||||
@@ -84,20 +85,36 @@
|
||||
#define HAVE_STRNCASECMP 1
|
||||
#define HAVE_VSSCANF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_M_PI 1
|
||||
#define HAVE_ACOS 1
|
||||
#define HAVE_ACOSF 1
|
||||
#define HAVE_ASIN 1
|
||||
#define HAVE_ASINF 1
|
||||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATANF 1
|
||||
#define HAVE_ATAN2 1
|
||||
#define HAVE_ACOS 1
|
||||
#define HAVE_ASIN 1
|
||||
#define HAVE_ATAN2F 1
|
||||
#define HAVE_CEIL 1
|
||||
#define HAVE_CEILF 1
|
||||
#define HAVE_COPYSIGN 1
|
||||
#define HAVE_COPYSIGNF 1
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_EXP 1
|
||||
#define HAVE_EXPF 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FABSF 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_FLOORF 1
|
||||
#define HAVE_FMOD 1
|
||||
#define HAVE_FMODF 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_LOGF 1
|
||||
#define HAVE_LOG10 1
|
||||
#define HAVE_LOG10F 1
|
||||
#define HAVE_POW 1
|
||||
#define HAVE_POWF 1
|
||||
#define HAVE_SCALBN 1
|
||||
#define HAVE_SCALBNF 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
@@ -108,17 +125,23 @@
|
||||
#define HAVE_SETJMP 1
|
||||
#define HAVE_NANOSLEEP 1
|
||||
#define HAVE_SYSCONF 1
|
||||
#define HAVE_CLOCK_GETTIME 1
|
||||
#define HAVE_CLOCK_GETTIME 1
|
||||
|
||||
#define SIZEOF_VOIDP 4
|
||||
|
||||
/* Enable various audio drivers */
|
||||
#define SDL_AUDIO_DRIVER_ANDROID 1
|
||||
#define SDL_AUDIO_DRIVER_OPENSLES 1
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
|
||||
/* Enable various input drivers */
|
||||
#define SDL_JOYSTICK_ANDROID 1
|
||||
#define SDL_HAPTIC_ANDROID 1
|
||||
#define SDL_JOYSTICK_HIDAPI 1
|
||||
#define SDL_JOYSTICK_VIRTUAL 1
|
||||
#define SDL_HAPTIC_ANDROID 1
|
||||
|
||||
/* Enable sensor driver */
|
||||
#define SDL_SENSOR_ANDROID 1
|
||||
|
||||
/* Enable various shared object loading systems */
|
||||
#define SDL_LOADSO_DLOPEN 1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -33,16 +33,19 @@
|
||||
|
||||
#define HAVE_GCC_ATOMICS 1
|
||||
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_LIMITS_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
/* The libunwind functions are only available on x86 */
|
||||
/* #undef HAVE_LIBUNWIND_H */
|
||||
|
||||
/* C library functions */
|
||||
#define HAVE_MALLOC 1
|
||||
@@ -65,10 +68,10 @@
|
||||
#define HAVE_STRLEN 1
|
||||
#define HAVE_STRLCPY 1
|
||||
#define HAVE_STRLCAT 1
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
#define HAVE_STRTOK_R 1
|
||||
#define HAVE_STRTOL 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE_STRTOLL 1
|
||||
@@ -83,19 +86,36 @@
|
||||
#define HAVE_VSSCANF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_M_PI 1
|
||||
#define HAVE_ACOS 1
|
||||
#define HAVE_ACOSF 1
|
||||
#define HAVE_ASIN 1
|
||||
#define HAVE_ASINF 1
|
||||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATANF 1
|
||||
#define HAVE_ATAN2 1
|
||||
#define HAVE_ACOS 1
|
||||
#define HAVE_ASIN 1
|
||||
#define HAVE_ATAN2F 1
|
||||
#define HAVE_CEIL 1
|
||||
#define HAVE_CEILF 1
|
||||
#define HAVE_COPYSIGN 1
|
||||
#define HAVE_COPYSIGNF 1
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_EXP 1
|
||||
#define HAVE_EXPF 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FABSF 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_FLOORF 1
|
||||
#define HAVE_FMOD 1
|
||||
#define HAVE_FMODF 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_LOGF 1
|
||||
#define HAVE_LOG10 1
|
||||
#define HAVE_LOG10F 1
|
||||
#define HAVE_POW 1
|
||||
#define HAVE_POWF 1
|
||||
#define HAVE_SCALBN 1
|
||||
#define HAVE_SCALBNF 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
@@ -117,7 +137,16 @@
|
||||
#define SDL_HAPTIC_DUMMY 1
|
||||
|
||||
/* Enable MFi joystick support */
|
||||
/*#define SDL_JOYSTICK_HIDAPI 1*/
|
||||
#define SDL_JOYSTICK_MFI 1
|
||||
#define SDL_JOYSTICK_VIRTUAL 1
|
||||
|
||||
#ifdef __TVOS__
|
||||
#define SDL_SENSOR_DUMMY 1
|
||||
#else
|
||||
/* Enable the CoreMotion sensor driver */
|
||||
#define SDL_SENSOR_COREMOTION 1
|
||||
#endif
|
||||
|
||||
/* Enable Unix style SO loading */
|
||||
#define SDL_LOADSO_DLOPEN 1
|
||||
@@ -133,17 +162,29 @@
|
||||
#define SDL_VIDEO_DRIVER_UIKIT 1
|
||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||
|
||||
/* enable OpenGL ES */
|
||||
/* Enable OpenGL ES */
|
||||
#define SDL_VIDEO_OPENGL_ES2 1
|
||||
#define SDL_VIDEO_OPENGL_ES 1
|
||||
#define SDL_VIDEO_RENDER_OGL_ES 1
|
||||
#define SDL_VIDEO_RENDER_OGL_ES2 1
|
||||
|
||||
/* Enable Vulkan support */
|
||||
#if !TARGET_OS_SIMULATOR && !TARGET_CPU_ARM // Only 64-bit devices have Metal
|
||||
#define SDL_VIDEO_VULKAN 1
|
||||
/* Metal supported on 64-bit devices running iOS 8.0 and tvOS 9.0 and newer */
|
||||
#if !TARGET_OS_SIMULATOR && !TARGET_CPU_ARM && ((__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 90000))
|
||||
#define SDL_PLATFORM_SUPPORTS_METAL 1
|
||||
#else
|
||||
#define SDL_VIDEO_VULKAN 0
|
||||
#define SDL_PLATFORM_SUPPORTS_METAL 0
|
||||
#endif
|
||||
|
||||
#if SDL_PLATFORM_SUPPORTS_METAL
|
||||
#define SDL_VIDEO_RENDER_METAL 1
|
||||
#endif
|
||||
|
||||
#if SDL_PLATFORM_SUPPORTS_METAL
|
||||
#define SDL_VIDEO_VULKAN 1
|
||||
#endif
|
||||
|
||||
#if SDL_PLATFORM_SUPPORTS_METAL
|
||||
#define SDL_VIDEO_METAL 1
|
||||
#endif
|
||||
|
||||
/* Enable system power support */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -37,16 +37,19 @@
|
||||
#endif
|
||||
|
||||
/* Useful headers */
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_FLOAT_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_LIMITS_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_LIBUNWIND_H 1
|
||||
|
||||
/* C library functions */
|
||||
#define HAVE_MALLOC 1
|
||||
@@ -68,10 +71,10 @@
|
||||
#define HAVE_STRLEN 1
|
||||
#define HAVE_STRLCPY 1
|
||||
#define HAVE_STRLCAT 1
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
#define HAVE_STRTOK_R 1
|
||||
#define HAVE_STRTOL 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE_STRTOLL 1
|
||||
@@ -85,15 +88,37 @@
|
||||
#define HAVE_STRNCASECMP 1
|
||||
#define HAVE_VSSCANF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_M_PI 1
|
||||
#define HAVE_ACOS 1
|
||||
#define HAVE_ACOSF 1
|
||||
#define HAVE_ASIN 1
|
||||
#define HAVE_ASINF 1
|
||||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATANF 1
|
||||
#define HAVE_ATAN2 1
|
||||
#define HAVE_ATAN2F 1
|
||||
#define HAVE_CEIL 1
|
||||
#define HAVE_CEILF 1
|
||||
#define HAVE_COPYSIGN 1
|
||||
#define HAVE_COPYSIGNF 1
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_EXP 1
|
||||
#define HAVE_EXPF 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FABSF 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_FLOORF 1
|
||||
#define HAVE_FMOD 1
|
||||
#define HAVE_FMODF 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_LOGF 1
|
||||
#define HAVE_LOG10 1
|
||||
#define HAVE_LOG10F 1
|
||||
#define HAVE_POW 1
|
||||
#define HAVE_POWF 1
|
||||
#define HAVE_SCALBN 1
|
||||
#define HAVE_SCALBNF 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
@@ -105,10 +130,8 @@
|
||||
#define HAVE_NANOSLEEP 1
|
||||
#define HAVE_SYSCONF 1
|
||||
#define HAVE_SYSCTLBYNAME 1
|
||||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATAN2 1
|
||||
#define HAVE_ACOS 1
|
||||
#define HAVE_ASIN 1
|
||||
|
||||
#define HAVE_GCC_ATOMICS 1
|
||||
|
||||
/* Enable various audio drivers */
|
||||
#define SDL_AUDIO_DRIVER_COREAUDIO 1
|
||||
@@ -116,9 +139,14 @@
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
|
||||
/* Enable various input drivers */
|
||||
#define SDL_JOYSTICK_HIDAPI 1
|
||||
#define SDL_JOYSTICK_IOKIT 1
|
||||
#define SDL_JOYSTICK_VIRTUAL 1
|
||||
#define SDL_HAPTIC_IOKIT 1
|
||||
|
||||
/* Enable the dummy sensor driver */
|
||||
#define SDL_SENSOR_DUMMY 1
|
||||
|
||||
/* Enable various shared object loading systems */
|
||||
#define SDL_LOADSO_DLOPEN 1
|
||||
|
||||
@@ -133,13 +161,13 @@
|
||||
#define SDL_VIDEO_DRIVER_COCOA 1
|
||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||
#undef SDL_VIDEO_DRIVER_X11
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/usr/X11R6/lib/libXi.6.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/opt/X11/lib/libX11.6.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/opt/X11/lib/libXext.6.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/opt/X11/lib/libXinerama.1.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/opt/X11/lib/libXi.6.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/opt/X11/lib/libXrandr.2.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/opt/X11/lib/libXss.1.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/opt/X11/lib/libXxf86vm.1.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_XDBE 1
|
||||
#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
|
||||
#define SDL_VIDEO_DRIVER_X11_XRANDR 1
|
||||
@@ -163,10 +191,35 @@
|
||||
#define SDL_VIDEO_RENDER_OGL 1
|
||||
#endif
|
||||
|
||||
#ifndef SDL_VIDEO_RENDER_OGL_ES2
|
||||
#define SDL_VIDEO_RENDER_OGL_ES2 1
|
||||
#endif
|
||||
|
||||
/* Metal only supported on 64-bit architectures with 10.11+ */
|
||||
#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
|
||||
#define SDL_PLATFORM_SUPPORTS_METAL 1
|
||||
#else
|
||||
#define SDL_PLATFORM_SUPPORTS_METAL 0
|
||||
#endif
|
||||
|
||||
#ifndef SDL_VIDEO_RENDER_METAL
|
||||
#if SDL_PLATFORM_SUPPORTS_METAL
|
||||
#define SDL_VIDEO_RENDER_METAL 1
|
||||
#else
|
||||
#define SDL_VIDEO_RENDER_METAL 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Enable OpenGL support */
|
||||
#ifndef SDL_VIDEO_OPENGL
|
||||
#define SDL_VIDEO_OPENGL 1
|
||||
#endif
|
||||
#ifndef SDL_VIDEO_OPENGL_ES2
|
||||
#define SDL_VIDEO_OPENGL_ES2 1
|
||||
#endif
|
||||
#ifndef SDL_VIDEO_OPENGL_EGL
|
||||
#define SDL_VIDEO_OPENGL_EGL 1
|
||||
#endif
|
||||
#ifndef SDL_VIDEO_OPENGL_CGL
|
||||
#define SDL_VIDEO_OPENGL_CGL 1
|
||||
#endif
|
||||
@@ -174,12 +227,21 @@
|
||||
#define SDL_VIDEO_OPENGL_GLX 1
|
||||
#endif
|
||||
|
||||
/* Enable Vulkan support */
|
||||
/* Metal/MoltenVK/Vulkan only supported on 64-bit architectures with 10.11+ */
|
||||
#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
|
||||
/* Enable Vulkan and Metal support */
|
||||
#ifndef SDL_VIDEO_VULKAN
|
||||
#if SDL_PLATFORM_SUPPORTS_METAL
|
||||
#define SDL_VIDEO_VULKAN 1
|
||||
#else
|
||||
#define SDL_VIDEO_VULKAN 0
|
||||
#define SDL_VIDEO_VULKAN 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SDL_VIDEO_METAL
|
||||
#if SDL_PLATFORM_SUPPORTS_METAL
|
||||
#define SDL_VIDEO_METAL 1
|
||||
#else
|
||||
#define SDL_VIDEO_METAL 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Enable system power support */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -64,6 +64,9 @@ typedef unsigned long uintptr_t;
|
||||
/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
|
||||
#define SDL_HAPTIC_DISABLED 1
|
||||
|
||||
/* Enable the stub sensor driver (src/sensor/dummy/\*.c) */
|
||||
#define SDL_SENSOR_DISABLED 1
|
||||
|
||||
/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
|
||||
#define SDL_LOADSO_DISABLED 1
|
||||
|
||||
|
||||
@@ -1,170 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef SDL_config_os2_h_
|
||||
#define SDL_config_os2_h_
|
||||
#define SDL_config_h_
|
||||
|
||||
#include "SDL_platform.h"
|
||||
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
#define SDL_AUDIO_DRIVER_DISK 1
|
||||
|
||||
#define SDL_POWER_DISABLED 1
|
||||
#define SDL_JOYSTICK_DISABLED 1
|
||||
#define SDL_HAPTIC_DISABLED 1
|
||||
/*#undef SDL_JOYSTICK_HIDAPI */
|
||||
|
||||
#define SDL_SENSOR_DUMMY 1
|
||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||
|
||||
/* Enable OpenGL support */
|
||||
/* #undef SDL_VIDEO_OPENGL */
|
||||
|
||||
/* Enable Vulkan support */
|
||||
/* #undef SDL_VIDEO_VULKAN */
|
||||
|
||||
#define SDL_LOADSO_DISABLED 1
|
||||
#define SDL_THREADS_DISABLED 1
|
||||
#define SDL_TIMERS_DISABLED 1
|
||||
#define SDL_FILESYSTEM_DUMMY 1
|
||||
|
||||
/* Enable assembly routines */
|
||||
#define SDL_ASSEMBLY_ROUTINES 1
|
||||
|
||||
/* #undef HAVE_LIBSAMPLERATE_H */
|
||||
|
||||
/* Enable dynamic libsamplerate support */
|
||||
/* #undef SDL_LIBSAMPLERATE_DYNAMIC */
|
||||
|
||||
#define HAVE_LIBC 1
|
||||
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_STDLIB_H 1
|
||||
#define HAVE_STDARG_H 1
|
||||
#define HAVE_STDDEF_H 1
|
||||
#define HAVE_MALLOC_H 1
|
||||
#define HAVE_MEMORY_H 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_STRINGS_H 1
|
||||
#define HAVE_WCHAR_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_LIMITS_H 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_FLOAT_H 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
|
||||
#define HAVE_MALLOC 1
|
||||
#define HAVE_CALLOC 1
|
||||
#define HAVE_REALLOC 1
|
||||
#define HAVE_FREE 1
|
||||
#if defined(__WATCOMC__)
|
||||
#define HAVE__FSEEKI64 1
|
||||
#define HAVE__FTELLI64 1
|
||||
#endif
|
||||
#define HAVE_ALLOCA 1
|
||||
#define HAVE_GETENV 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_PUTENV 1
|
||||
#define HAVE_QSORT 1
|
||||
#define HAVE_ABS 1
|
||||
#define HAVE_BCOPY 1
|
||||
#define HAVE_MEMSET 1
|
||||
#define HAVE_MEMCPY 1
|
||||
#define HAVE_MEMMOVE 1
|
||||
#define HAVE_MEMCMP 1
|
||||
#define HAVE_WCSLEN 1
|
||||
#define HAVE_WCSLCPY 1
|
||||
#define HAVE_WCSLCAT 1
|
||||
#define HAVE_WCSCMP 1
|
||||
#define HAVE_STRLEN 1
|
||||
#define HAVE_STRLCPY 1
|
||||
#define HAVE_STRLCAT 1
|
||||
#define HAVE__STRREV 1
|
||||
#define HAVE__STRUPR 1
|
||||
#define HAVE__STRLWR 1
|
||||
#define HAVE_INDEX 1
|
||||
#define HAVE_RINDEX 1
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
#define HAVE_ITOA 1
|
||||
#define HAVE__LTOA 1
|
||||
#define HAVE__ULTOA 1
|
||||
#define HAVE_STRTOL 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE__I64TOA 1
|
||||
#define HAVE__UI64TOA 1
|
||||
#define HAVE_STRTOLL 1
|
||||
#define HAVE_STRTOULL 1
|
||||
#define HAVE_STRTOD 1
|
||||
#define HAVE_ATOI 1
|
||||
#define HAVE_ATOF 1
|
||||
#define HAVE_STRCMP 1
|
||||
#define HAVE_STRNCMP 1
|
||||
#define HAVE_STRICMP 1
|
||||
#define HAVE_STRCASECMP 1
|
||||
#define HAVE_STRNCASECMP 1
|
||||
#define HAVE_SSCANF 1
|
||||
#define HAVE_SNPRINTF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_SETJMP 1
|
||||
#define HAVE_ACOS 1
|
||||
/* #undef HAVE_ACOSF */
|
||||
#define HAVE_ASIN 1
|
||||
/* #undef HAVE_ASINF */
|
||||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATAN2 1
|
||||
/* #undef HAVE_ATAN2F */
|
||||
#define HAVE_CEIL 1
|
||||
/* #undef HAVE_CEILF */
|
||||
/* #undef HAVE_COPYSIGN */
|
||||
/* #undef HAVE_COPYSIGNF */
|
||||
#define HAVE_COS 1
|
||||
/* #undef HAVE_COSF */
|
||||
#define HAVE_EXP 1
|
||||
/* #undef HAVE_EXPF */
|
||||
#define HAVE_FABS 1
|
||||
/* #undef HAVE_FABSF */
|
||||
#define HAVE_FLOOR 1
|
||||
/* #undef HAVE_FLOORF */
|
||||
#define HAVE_FMOD 1
|
||||
/* #undef HAVE_FMODF */
|
||||
#define HAVE_LOG 1
|
||||
/* #undef HAVE_LOGF */
|
||||
#define HAVE_LOG10 1
|
||||
/* #undef HAVE_LOG10F */
|
||||
#define HAVE_POW 1
|
||||
/* #undef HAVE_POWF */
|
||||
#define HAVE_SIN 1
|
||||
/* #undef HAVE_SINF */
|
||||
/* #undef HAVE_SCALBN */
|
||||
/* #undef HAVE_SCALBNF */
|
||||
#define HAVE_SQRT 1
|
||||
/* #undef HAVE_SQRTF */
|
||||
#define HAVE_TAN 1
|
||||
/* #undef HAVE_TANF */
|
||||
|
||||
#endif /* SDL_config_os2_h_ */
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -36,22 +36,24 @@
|
||||
|
||||
#define SDL_BYTEORDER 1234
|
||||
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_STDLIB_H 1
|
||||
#define HAVE_STDARG_H 1
|
||||
#define HAVE_MALLOC_H 1
|
||||
#define HAVE_MEMORY_H 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_STRINGS_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_ICONV_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_LIMITS_H 1
|
||||
#define HAVE_MALLOC_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_MEMORY_H 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
#define HAVE_STDARG_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define HAVE_STDLIB_H 1
|
||||
#define HAVE_STRINGS_H 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
#define HAVE_MALLOC 1
|
||||
#define HAVE_CALLOC 1
|
||||
#define HAVE_REALLOC 1
|
||||
@@ -68,7 +70,6 @@
|
||||
#define HAVE_MEMCPY 1
|
||||
#define HAVE_MEMMOVE 1
|
||||
#define HAVE_STRLEN 1
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
@@ -89,9 +90,11 @@
|
||||
#define HAVE_COPYSIGN 1
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_EXP 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_LOG10 1
|
||||
#define HAVE_SCALBN 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
@@ -109,8 +112,11 @@
|
||||
#define SDL_INPUT_LINUXEV 1
|
||||
#define SDL_INPUT_TSLIB 1
|
||||
#define SDL_JOYSTICK_LINUX 1
|
||||
#define SDL_JOYSTICK_VIRTUAL 1
|
||||
#define SDL_HAPTIC_LINUX 1
|
||||
|
||||
#define SDL_SENSOR_DUMMY 1
|
||||
|
||||
#define SDL_LOADSO_DLOPEN 1
|
||||
|
||||
#define SDL_THREAD_PTHREAD 1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -33,16 +33,17 @@
|
||||
|
||||
#define HAVE_GCC_ATOMICS 1
|
||||
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_LIMITS_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* C library functions */
|
||||
#define HAVE_MALLOC 1
|
||||
@@ -65,7 +66,6 @@
|
||||
#define HAVE_STRLEN 1
|
||||
#define HAVE_STRLCPY 1
|
||||
#define HAVE_STRLCAT 1
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
@@ -83,19 +83,36 @@
|
||||
#define HAVE_VSSCANF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_M_PI 1
|
||||
#define HAVE_ACOS 1
|
||||
#define HAVE_ACOSF 1
|
||||
#define HAVE_ASIN 1
|
||||
#define HAVE_ASINF 1
|
||||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATANF 1
|
||||
#define HAVE_ATAN2 1
|
||||
#define HAVE_ACOS 1
|
||||
#define HAVE_ASIN 1
|
||||
#define HAVE_ATAN2F 1
|
||||
#define HAVE_CEIL 1
|
||||
#define HAVE_CEILF 1
|
||||
#define HAVE_COPYSIGN 1
|
||||
#define HAVE_COPYSIGNF 1
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_EXP 1
|
||||
#define HAVE_EXPF 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FABSF 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_FLOORF 1
|
||||
#define HAVE_FMOD 1
|
||||
#define HAVE_FMODF 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_LOGF 1
|
||||
#define HAVE_LOG10 1
|
||||
#define HAVE_LOG10F 1
|
||||
#define HAVE_POW 1
|
||||
#define HAVE_POWF 1
|
||||
#define HAVE_SCALBN 1
|
||||
#define HAVE_SCALBNF 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
@@ -111,22 +128,26 @@
|
||||
/* PSP isn't that sophisticated */
|
||||
#define LACKS_SYS_MMAN_H 1
|
||||
|
||||
/* Enable the stub thread support (src/thread/psp/\*.c) */
|
||||
/* Enable the PSP thread support (src/thread/psp/\*.c) */
|
||||
#define SDL_THREAD_PSP 1
|
||||
|
||||
/* Enable the stub timer support (src/timer/psp/\*.c) */
|
||||
/* Enable the PSP timer support (src/timer/psp/\*.c) */
|
||||
#define SDL_TIMERS_PSP 1
|
||||
|
||||
/* Enable the stub joystick driver (src/joystick/psp/\*.c) */
|
||||
/* Enable the PSP joystick driver (src/joystick/psp/\*.c) */
|
||||
#define SDL_JOYSTICK_PSP 1
|
||||
#define SDL_JOYSTICK_VIRTUAL 1
|
||||
|
||||
/* Enable the stub audio driver (src/audio/psp/\*.c) */
|
||||
/* Enable the dummy sensor driver */
|
||||
#define SDL_SENSOR_DUMMY 1
|
||||
|
||||
/* Enable the PSP audio driver (src/audio/psp/\*.c) */
|
||||
#define SDL_AUDIO_DRIVER_PSP 1
|
||||
|
||||
/* PSP video dirver */
|
||||
/* PSP video driver */
|
||||
#define SDL_VIDEO_DRIVER_PSP 1
|
||||
|
||||
/* PSP render dirver */
|
||||
/* PSP render driver */
|
||||
#define SDL_VIDEO_RENDER_PSP 1
|
||||
|
||||
#define SDL_POWER_PSP 1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -82,16 +82,20 @@ typedef unsigned int uintptr_t;
|
||||
#define HAVE_DSOUND_H 1
|
||||
#define HAVE_DXGI_H 1
|
||||
#define HAVE_XINPUT_H 1
|
||||
#define HAVE_MMDEVICEAPI_H 1
|
||||
#define HAVE_AUDIOCLIENT_H 1
|
||||
|
||||
/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
|
||||
#ifdef HAVE_LIBC
|
||||
/* Useful headers */
|
||||
#define HAVE_STDIO_H 1
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_FLOAT_H 1
|
||||
#define HAVE_LIMITS_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* C library functions */
|
||||
#define HAVE_MALLOC 1
|
||||
@@ -107,13 +111,19 @@ typedef unsigned int uintptr_t;
|
||||
#define HAVE_MEMCMP 1
|
||||
#define HAVE_STRLEN 1
|
||||
#define HAVE__STRREV 1
|
||||
#define HAVE__STRUPR 1
|
||||
#define HAVE__STRLWR 1
|
||||
/* These functions have security warnings, so we won't use them */
|
||||
/* #undef HAVE__STRUPR */
|
||||
/* #undef HAVE__STRLWR */
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
#define HAVE__LTOA 1
|
||||
#define HAVE__ULTOA 1
|
||||
/* #undef HAVE_STRTOK_R */
|
||||
#if defined(_MSC_VER)
|
||||
#define HAVE_STRTOK_S 1
|
||||
#endif
|
||||
/* These functions have security warnings, so we won't use them */
|
||||
/* #undef HAVE__LTOA */
|
||||
/* #undef HAVE__ULTOA */
|
||||
#define HAVE_STRTOL 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE_STRTOD 1
|
||||
@@ -123,28 +133,50 @@ typedef unsigned int uintptr_t;
|
||||
#define HAVE_STRNCMP 1
|
||||
#define HAVE__STRICMP 1
|
||||
#define HAVE__STRNICMP 1
|
||||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATAN2 1
|
||||
#define HAVE_ACOS 1
|
||||
#define HAVE_ASIN 1
|
||||
#define HAVE_CEIL 1
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_POW 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
#define HAVE_SQRTF 1
|
||||
#define HAVE_TAN 1
|
||||
#define HAVE_TANF 1
|
||||
#define HAVE_ACOS 1
|
||||
#define HAVE_ACOSF 1
|
||||
#define HAVE_ASIN 1
|
||||
#define HAVE_ASINF 1
|
||||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATANF 1
|
||||
#define HAVE_ATAN2 1
|
||||
#define HAVE_ATAN2F 1
|
||||
#define HAVE_CEILF 1
|
||||
#define HAVE__COPYSIGN 1
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_EXP 1
|
||||
#define HAVE_EXPF 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FABSF 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_FLOORF 1
|
||||
#define HAVE_FMOD 1
|
||||
#define HAVE_FMODF 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_LOGF 1
|
||||
#define HAVE_LOG10 1
|
||||
#define HAVE_LOG10F 1
|
||||
#define HAVE_POW 1
|
||||
#define HAVE_POWF 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
#define HAVE_SQRTF 1
|
||||
#define HAVE_TAN 1
|
||||
#define HAVE_TANF 1
|
||||
#if defined(_MSC_VER)
|
||||
/* These functions were added with the VC++ 2013 C runtime library */
|
||||
#if _MSC_VER >= 1800
|
||||
#define HAVE_STRTOLL 1
|
||||
#define HAVE_VSSCANF 1
|
||||
#define HAVE_COPYSIGN 1
|
||||
#define HAVE_SCALBN 1
|
||||
#define HAVE_SCALBNF 1
|
||||
#endif
|
||||
/* This function is available with at least the VC++ 2008 C runtime library */
|
||||
#if _MSC_VER >= 1400
|
||||
#define HAVE__FSEEKI64 1
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES)
|
||||
#define HAVE_M_PI 1
|
||||
@@ -157,17 +189,25 @@ typedef unsigned int uintptr_t;
|
||||
/* Enable various audio drivers */
|
||||
#define SDL_AUDIO_DRIVER_WASAPI 1
|
||||
#define SDL_AUDIO_DRIVER_DSOUND 1
|
||||
#define SDL_AUDIO_DRIVER_XAUDIO2 0
|
||||
#define SDL_AUDIO_DRIVER_WINMM 1
|
||||
#define SDL_AUDIO_DRIVER_DISK 1
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
|
||||
/* Enable various input drivers */
|
||||
#define SDL_JOYSTICK_DINPUT 1
|
||||
#define SDL_JOYSTICK_HIDAPI 1
|
||||
//#define SDL_JOYSTICK_RAWINPUT 1
|
||||
#define SDL_JOYSTICK_VIRTUAL 1
|
||||
#if _MSC_VER >= 1911
|
||||
//#define SDL_JOYSTICK_WGI 1 /* This requires Windows SDK 10.0.16299.0 or newer */
|
||||
#endif
|
||||
#define SDL_JOYSTICK_XINPUT 1
|
||||
#define SDL_HAPTIC_DINPUT 1
|
||||
#define SDL_HAPTIC_XINPUT 1
|
||||
|
||||
/* Enable the sensor driver */
|
||||
#define SDL_SENSOR_WINDOWS 1
|
||||
|
||||
/* Enable various shared object loading systems */
|
||||
#define SDL_LOADSO_WINDOWS 1
|
||||
|
||||
@@ -184,8 +224,8 @@ typedef unsigned int uintptr_t;
|
||||
#ifndef SDL_VIDEO_RENDER_D3D
|
||||
#define SDL_VIDEO_RENDER_D3D 1
|
||||
#endif
|
||||
#ifndef SDL_VIDEO_RENDER_D3D11
|
||||
#define SDL_VIDEO_RENDER_D3D11 0
|
||||
#if _MSC_VER >= 1911
|
||||
#define SDL_VIDEO_RENDER_D3D11 1
|
||||
#endif
|
||||
|
||||
/* Enable OpenGL support */
|
||||
@@ -223,3 +263,5 @@ typedef unsigned int uintptr_t;
|
||||
#endif
|
||||
|
||||
#endif /* SDL_config_windows_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
|
||||
#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#elif defined(_MSC_VER)
|
||||
typedef signed __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
@@ -97,14 +97,19 @@ typedef unsigned int uintptr_t;
|
||||
#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
|
||||
#define HAVE_XINPUT_H 1
|
||||
#endif
|
||||
|
||||
#define HAVE_MMDEVICEAPI_H 1
|
||||
#define HAVE_AUDIOCLIENT_H 1
|
||||
|
||||
#define HAVE_LIBC 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_FLOAT_H 1
|
||||
#define HAVE_LIMITS_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* C library functions */
|
||||
#define HAVE_MALLOC 1
|
||||
@@ -121,13 +126,14 @@ typedef unsigned int uintptr_t;
|
||||
#define HAVE_STRLEN 1
|
||||
#define HAVE__STRREV 1
|
||||
#define HAVE__STRUPR 1
|
||||
//#define HAVE__STRLWR 1 // TODO, WinRT: consider using _strlwr_s instead
|
||||
//#define HAVE__STRLWR 1 // TODO, WinRT: consider using _strlwr_s instead
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
#define HAVE_STRTOK_S 1
|
||||
//#define HAVE_ITOA 1 // TODO, WinRT: consider using _itoa_s instead
|
||||
//#define HAVE__LTOA 1 // TODO, WinRT: consider using _ltoa_s instead
|
||||
//#define HAVE__ULTOA 1 // TODO, WinRT: consider using _ultoa_s instead
|
||||
//#define HAVE__LTOA 1 // TODO, WinRT: consider using _ltoa_s instead
|
||||
//#define HAVE__ULTOA 1 // TODO, WinRT: consider using _ultoa_s instead
|
||||
#define HAVE_STRTOL 1
|
||||
#define HAVE_STRTOUL 1
|
||||
//#define HAVE_STRTOLL 1
|
||||
@@ -139,44 +145,64 @@ typedef unsigned int uintptr_t;
|
||||
#define HAVE__STRICMP 1
|
||||
#define HAVE__STRNICMP 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
//#define HAVE_SSCANF 1 // TODO, WinRT: consider using sscanf_s instead
|
||||
//#define HAVE_SSCANF 1 // TODO, WinRT: consider using sscanf_s instead
|
||||
#define HAVE_M_PI 1
|
||||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATAN2 1
|
||||
#define HAVE_CEIL 1
|
||||
#define HAVE_ACOS 1
|
||||
#define HAVE_ACOSF 1
|
||||
#define HAVE_ASIN 1
|
||||
#define HAVE_ASINF 1
|
||||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATANF 1
|
||||
#define HAVE_ATAN2 1
|
||||
#define HAVE_ATAN2F 1
|
||||
#define HAVE_CEIL 1
|
||||
#define HAVE_CEILF 1
|
||||
#define HAVE__COPYSIGN 1
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_POW 1
|
||||
//#define HAVE_SCALBN 1
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_EXP 1
|
||||
#define HAVE_EXPF 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FABSF 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_FLOORF 1
|
||||
#define HAVE_FMOD 1
|
||||
#define HAVE_FMODF 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_LOGF 1
|
||||
#define HAVE_LOG10 1
|
||||
#define HAVE_LOG10F 1
|
||||
#define HAVE_POW 1
|
||||
#define HAVE_POWF 1
|
||||
#define HAVE__SCALB 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
#define HAVE_SQRTF 1
|
||||
#define HAVE_TAN 1
|
||||
#define HAVE_TANF 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
#define HAVE_SQRTF 1
|
||||
#define HAVE_TAN 1
|
||||
#define HAVE_TANF 1
|
||||
#define HAVE__FSEEKI64 1
|
||||
|
||||
/* Enable various audio drivers */
|
||||
#define SDL_AUDIO_DRIVER_XAUDIO2 1
|
||||
#define SDL_AUDIO_DRIVER_DISK 1
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
#define SDL_AUDIO_DRIVER_WASAPI 1
|
||||
#define SDL_AUDIO_DRIVER_DISK 1
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
|
||||
/* Enable various input drivers */
|
||||
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
|
||||
#define SDL_JOYSTICK_DISABLED 1
|
||||
#define SDL_HAPTIC_DISABLED 1
|
||||
#define SDL_HAPTIC_DISABLED 1
|
||||
#else
|
||||
#define SDL_JOYSTICK_VIRTUAL 1
|
||||
#define SDL_JOYSTICK_XINPUT 1
|
||||
#define SDL_HAPTIC_XINPUT 1
|
||||
#endif
|
||||
|
||||
/* Enable the dummy sensor driver */
|
||||
#define SDL_SENSOR_DUMMY 1
|
||||
|
||||
/* Enable various shared object loading systems */
|
||||
#define SDL_LOADSO_WINDOWS 1
|
||||
#define SDL_LOADSO_WINDOWS 1
|
||||
|
||||
/* Enable various threading systems */
|
||||
#if (NTDDI_VERSION >= NTDDI_WINBLUE)
|
||||
@@ -187,10 +213,10 @@ typedef unsigned int uintptr_t;
|
||||
#endif
|
||||
|
||||
/* Enable various timer systems */
|
||||
#define SDL_TIMER_WINDOWS 1
|
||||
#define SDL_TIMER_WINDOWS 1
|
||||
|
||||
/* Enable various video drivers */
|
||||
#define SDL_VIDEO_DRIVER_WINRT 1
|
||||
#define SDL_VIDEO_DRIVER_WINRT 1
|
||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||
|
||||
/* Enable OpenGL ES 2.0 (via a modified ANGLE library) */
|
||||
@@ -209,7 +235,7 @@ typedef unsigned int uintptr_t;
|
||||
|
||||
/* Enable assembly routines (Win64 doesn't have inline asm) */
|
||||
#ifndef _WIN64
|
||||
#define SDL_ASSEMBLY_ROUTINES 1
|
||||
#define SDL_ASSEMBLY_ROUTINES 1
|
||||
#endif
|
||||
|
||||
#endif /* SDL_config_winrt_h_ */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -30,22 +30,24 @@
|
||||
|
||||
#define SDL_BYTEORDER 1234
|
||||
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_STDLIB_H 1
|
||||
#define HAVE_STDARG_H 1
|
||||
#define HAVE_MALLOC_H 1
|
||||
#define HAVE_MEMORY_H 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_STRINGS_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_ICONV_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_LIMITS_H 1
|
||||
#define HAVE_MALLOC_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_MEMORY_H 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
#define HAVE_STDARG_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define HAVE_STDLIB_H 1
|
||||
#define HAVE_STRINGS_H 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
#define HAVE_MALLOC 1
|
||||
#define HAVE_CALLOC 1
|
||||
#define HAVE_REALLOC 1
|
||||
@@ -62,10 +64,10 @@
|
||||
#define HAVE_MEMCPY 1
|
||||
#define HAVE_MEMMOVE 1
|
||||
#define HAVE_STRLEN 1
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
#define HAVE_STRTOK_R 1
|
||||
#define HAVE_STRTOL 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE_STRTOLL 1
|
||||
@@ -79,20 +81,42 @@
|
||||
#define HAVE_VSSCANF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_M_PI 1
|
||||
#define HAVE_CEIL 1
|
||||
#define HAVE_COPYSIGN 1
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_ACOS 1
|
||||
#define HAVE_ACOSF 1
|
||||
#define HAVE_ASIN 1
|
||||
#define HAVE_ASINF 1
|
||||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATANF 1
|
||||
#define HAVE_ATAN2 1
|
||||
#define HAVE_ATAN2F 1
|
||||
#define HAVE_CEIL 1
|
||||
#define HAVE_CEILF 1
|
||||
#define HAVE_COPYSIGN 1
|
||||
#define HAVE_COPYSIGNF 1
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_EXP 1
|
||||
#define HAVE_EXPF 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FABSF 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_FLOORF 1
|
||||
#define HAVE_FMOD 1
|
||||
#define HAVE_FMODF 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_LOGF 1
|
||||
#define HAVE_LOG10 1
|
||||
#define HAVE_LOG10F 1
|
||||
#define HAVE_POW 1
|
||||
#define HAVE_POWF 1
|
||||
#define HAVE_SCALBN 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
#define HAVE_SQRTF 1
|
||||
#define HAVE_TAN 1
|
||||
#define HAVE_TANF 1
|
||||
#define HAVE_SCALBNF 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
#define HAVE_SQRTF 1
|
||||
#define HAVE_TAN 1
|
||||
#define HAVE_TANF 1
|
||||
#define HAVE_SIGACTION 1
|
||||
#define HAVE_SETJMP 1
|
||||
#define HAVE_NANOSLEEP 1
|
||||
@@ -104,8 +128,11 @@
|
||||
#define SDL_INPUT_LINUXEV 1
|
||||
#define SDL_INPUT_TSLIB 1
|
||||
#define SDL_JOYSTICK_LINUX 1
|
||||
#define SDL_JOYSTICK_VIRTUAL 1
|
||||
#define SDL_HAPTIC_LINUX 1
|
||||
|
||||
#define SDL_SENSOR_DUMMY 1
|
||||
|
||||
#define SDL_LOADSO_DLOPEN 1
|
||||
|
||||
#define SDL_THREAD_PTHREAD 1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -73,8 +73,8 @@
|
||||
# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
|
||||
# endif
|
||||
# if defined (_M_ARM64)
|
||||
# include <armintr.h>
|
||||
# include <arm_neon.h>
|
||||
# include <arm64intr.h>
|
||||
# include <arm64_neon.h>
|
||||
# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
|
||||
# endif
|
||||
# endif
|
||||
@@ -186,6 +186,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void);
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void);
|
||||
|
||||
/**
|
||||
* This function returns true if the CPU has ARM SIMD (ARMv6) features.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasARMSIMD(void);
|
||||
|
||||
/**
|
||||
* This function returns true if the CPU has NEON (ARM SIMD) features.
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -390,6 +390,9 @@ typedef enum {
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#endif
|
||||
#ifndef NOMINMAX /* don't define min() and max(). */
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <windows.h>
|
||||
|
||||
#if __WINRT__
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -42,10 +42,13 @@
|
||||
#ifdef __linux__
|
||||
#include <endian.h>
|
||||
#define SDL_BYTEORDER __BYTE_ORDER
|
||||
#else /* __linux__ */
|
||||
#elif defined(__OpenBSD__)
|
||||
#include <endian.h>
|
||||
#define SDL_BYTEORDER BYTE_ORDER
|
||||
#else
|
||||
#if defined(__hppa__) || \
|
||||
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
|
||||
(defined(__MIPS__) && defined(__MISPEB__)) || \
|
||||
(defined(__MIPS__) && defined(__MIPSEB__)) || \
|
||||
defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
|
||||
defined(__sparc__)
|
||||
#define SDL_BYTEORDER SDL_BIG_ENDIAN
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -37,9 +37,45 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Public functions */
|
||||
/* SDL_SetError() unconditionally returns -1. */
|
||||
|
||||
|
||||
/**
|
||||
* \brief Set the error message for the current thread
|
||||
*
|
||||
* \return -1, there is no error handling for this function
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
|
||||
|
||||
/**
|
||||
* \brief Get the last error message that was set
|
||||
*
|
||||
* SDL API functions may set error messages and then succeed, so you should
|
||||
* only use the error value if a function fails.
|
||||
*
|
||||
* This returns a pointer to a static buffer for convenience and should not
|
||||
* be called by multiple threads simultaneously.
|
||||
*
|
||||
* \return a pointer to the last error message that was set
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_GetError(void);
|
||||
|
||||
/**
|
||||
* \brief Get the last error message that was set for the current thread
|
||||
*
|
||||
* SDL API functions may set error messages and then succeed, so you should
|
||||
* only use the error value if a function fails.
|
||||
*
|
||||
* \param errstr A buffer to fill with the last error message that was set
|
||||
* for the current thread
|
||||
* \param maxlen The size of the buffer pointed to by the errstr parameter
|
||||
*
|
||||
* \return errstr
|
||||
*/
|
||||
extern DECLSPEC char * SDLCALL SDL_GetErrorMsg(char *errstr, int maxlen);
|
||||
|
||||
/**
|
||||
* \brief Clear the error message for the current thread
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_ClearError(void);
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -442,6 +442,7 @@ typedef struct SDL_TouchFingerEvent
|
||||
float dx; /**< Normalized in the range -1...1 */
|
||||
float dy; /**< Normalized in the range -1...1 */
|
||||
float pressure; /**< Normalized in the range 0...1 */
|
||||
Uint32 windowID; /**< The window underneath the finger, if any */
|
||||
} SDL_TouchFingerEvent;
|
||||
|
||||
|
||||
@@ -558,7 +559,7 @@ typedef union SDL_Event
|
||||
{
|
||||
Uint32 type; /**< Event type, shared with all events */
|
||||
SDL_CommonEvent common; /**< Common event data */
|
||||
SDL_DisplayEvent display; /**< Window event data */
|
||||
SDL_DisplayEvent display; /**< Display event data */
|
||||
SDL_WindowEvent window; /**< Window event data */
|
||||
SDL_KeyboardEvent key; /**< Keyboard event data */
|
||||
SDL_TextEditingEvent edit; /**< Text editing event data */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -57,6 +57,16 @@ extern "C" {
|
||||
struct _SDL_GameController;
|
||||
typedef struct _SDL_GameController SDL_GameController;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SDL_CONTROLLER_TYPE_UNKNOWN = 0,
|
||||
SDL_CONTROLLER_TYPE_XBOX360,
|
||||
SDL_CONTROLLER_TYPE_XBOXONE,
|
||||
SDL_CONTROLLER_TYPE_PS3,
|
||||
SDL_CONTROLLER_TYPE_PS4,
|
||||
SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO,
|
||||
SDL_CONTROLLER_TYPE_VIRTUAL
|
||||
} SDL_GameControllerType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@@ -175,6 +185,12 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index);
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
|
||||
|
||||
/**
|
||||
* Get the type of a game controller.
|
||||
* This can be called before any controllers are opened.
|
||||
*/
|
||||
extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerTypeForIndex(int joystick_index);
|
||||
|
||||
/**
|
||||
* Get the mapping of a game controller.
|
||||
* This can be called before any controllers are opened.
|
||||
@@ -199,11 +215,21 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_
|
||||
*/
|
||||
extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid);
|
||||
|
||||
/**
|
||||
* Return the SDL_GameController associated with a player index.
|
||||
*/
|
||||
extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromPlayerIndex(int player_index);
|
||||
|
||||
/**
|
||||
* Return the name for this currently opened controller
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
|
||||
|
||||
/**
|
||||
* Return the type of this currently opened controller
|
||||
*/
|
||||
extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerGetType(SDL_GameController *gamecontroller);
|
||||
|
||||
/**
|
||||
* Get the player index of an opened game controller, or -1 if it's not available
|
||||
*
|
||||
@@ -211,6 +237,11 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *g
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller);
|
||||
|
||||
/**
|
||||
* Set the player index of an opened game controller
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int player_index);
|
||||
|
||||
/**
|
||||
* Get the USB vendor ID of an opened controller, if available.
|
||||
* If the vendor ID isn't available this function returns 0.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -336,6 +336,23 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
||||
*/
|
||||
#define SDL_HAPTIC_SPHERICAL 2
|
||||
|
||||
/**
|
||||
* \brief Uses first axis only.
|
||||
* For some device with only one axis (steering wheel,...),
|
||||
* SDL_HAPTIC_CARTESIAN does not work. SDL_HAPTIC_FIRST_AXIS can be used in
|
||||
* this case.
|
||||
* Using SDL_HAPTIC_FIRST_AXIS is equivalent to :
|
||||
* \code
|
||||
* SDL_HapticDirection direction;
|
||||
* direction.type = SDL_HAPTIC_CARTESIAN;
|
||||
* direction.dir[0] = 1;
|
||||
* direction.dir[1] = 0;
|
||||
* direction.dir[2] = 0;
|
||||
* \endcode
|
||||
* \sa SDL_HapticDirection
|
||||
*/
|
||||
#define SDL_HAPTIC_FIRST_AXIS 3
|
||||
|
||||
/* @} *//* Direction encodings */
|
||||
|
||||
/* @} *//* Haptic features */
|
||||
@@ -444,6 +461,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
||||
* \sa SDL_HAPTIC_POLAR
|
||||
* \sa SDL_HAPTIC_CARTESIAN
|
||||
* \sa SDL_HAPTIC_SPHERICAL
|
||||
* \sa SDL_HAPTIC_FIRST_AXIS
|
||||
* \sa SDL_HapticEffect
|
||||
* \sa SDL_HapticNumAxes
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -164,6 +164,21 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER "SDL_VIDEO_ALLOW_SCREENSAVER"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether the graphics context is externally managed.
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - SDL will manage graphics contexts that are attached to windows.
|
||||
* "1" - Disable graphics context management on windows.
|
||||
*
|
||||
* By default SDL will manage OpenGL contexts in certain situations. For example, on Android the
|
||||
* context will be automatically saved and restored when pausing the application. Additionally, some
|
||||
* platforms will assume usage of OpenGL if Vulkan isn't used. Setting this to "1" will prevent this
|
||||
* behavior, which is desireable when the application manages the graphics context, such as
|
||||
* an externally managed OpenGL context or attaching a Vulkan surface to the window.
|
||||
*/
|
||||
#define SDL_HINT_VIDEO_EXTERNAL_CONTEXT "SDL_VIDEO_EXTERNAL_CONTEXT"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether the X11 VidMode extension should be used.
|
||||
*
|
||||
@@ -197,6 +212,12 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR"
|
||||
|
||||
/**
|
||||
* \brief A variable forcing the visual ID chosen for new X11 windows
|
||||
*
|
||||
*/
|
||||
#define SDL_HINT_VIDEO_X11_WINDOW_VISUALID "SDL_VIDEO_X11_WINDOW_VISUALID"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether the X11 _NET_WM_PING protocol should be supported.
|
||||
*
|
||||
@@ -223,6 +244,17 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether X11 should use GLX or EGL by default
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - Use GLX
|
||||
* "1" - Use EGL
|
||||
*
|
||||
* By default SDL will use GLX when both are present.
|
||||
*/
|
||||
#define SDL_HINT_VIDEO_X11_FORCE_EGL "SDL_VIDEO_X11_FORCE_EGL"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden
|
||||
*
|
||||
@@ -282,6 +314,17 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE "SDL_MOUSE_RELATIVE_SPEED_SCALE"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether relative mouse motion is affected by renderer scaling
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - Relative motion is unaffected by DPI or renderer's logical size
|
||||
* "1" - Relative motion is scaled according to DPI scaling and logical size
|
||||
*
|
||||
* By default relative mouse deltas are affected by DPI and renderer scaling
|
||||
*/
|
||||
#define SDL_HINT_MOUSE_RELATIVE_SCALING "SDL_MOUSE_RELATIVE_SCALING"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether relative mouse mode is implemented using mouse warping
|
||||
*
|
||||
@@ -436,6 +479,24 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING"
|
||||
|
||||
/**
|
||||
* \brief A variable that overrides the automatic controller type detection
|
||||
*
|
||||
* The variable should be comma separated entries, in the form: VID/PID=type
|
||||
*
|
||||
* The VID and PID should be hexadecimal with exactly 4 digits, e.g. 0x00fd
|
||||
*
|
||||
* The type should be one of:
|
||||
* Xbox360
|
||||
* XboxOne
|
||||
* PS3
|
||||
* PS4
|
||||
* SwitchPro
|
||||
*
|
||||
* This hint affects what driver is used, and must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER)
|
||||
*/
|
||||
#define SDL_HINT_GAMECONTROLLERTYPE "SDL_GAMECONTROLLERTYPE"
|
||||
|
||||
/**
|
||||
* \brief A variable that lets you manually hint extra gamecontroller db entries.
|
||||
*
|
||||
@@ -482,6 +543,29 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"
|
||||
|
||||
/**
|
||||
* \brief If set, game controller face buttons report their values according to their labels instead of their positional layout.
|
||||
*
|
||||
* For example, on Nintendo Switch controllers, normally you'd get:
|
||||
*
|
||||
* (Y)
|
||||
* (X) (B)
|
||||
* (A)
|
||||
*
|
||||
* but if this hint is set, you'll get:
|
||||
*
|
||||
* (X)
|
||||
* (Y) (A)
|
||||
* (B)
|
||||
*
|
||||
* The variable can be set to the following values:
|
||||
* "0" - Report the face buttons by position, as though they were on an Xbox controller.
|
||||
* "1" - Report the face buttons by label instead of position
|
||||
*
|
||||
* The default value is "1". This hint may be set at any time.
|
||||
*/
|
||||
#define SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS "SDL_GAMECONTROLLER_USE_BUTTON_LABELS"
|
||||
|
||||
/**
|
||||
* \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
|
||||
*
|
||||
@@ -561,10 +645,34 @@ extern "C" {
|
||||
* "0" - HIDAPI driver is not used
|
||||
* "1" - HIDAPI driver is used
|
||||
*
|
||||
* The default is the value of SDL_HINT_JOYSTICK_HIDAPI
|
||||
* The default is "0" on Windows, otherwise the value of SDL_HINT_JOYSTICK_HIDAPI
|
||||
*/
|
||||
#define SDL_HINT_JOYSTICK_HIDAPI_XBOX "SDL_JOYSTICK_HIDAPI_XBOX"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether the HIDAPI driver for XBox controllers on Windows should pull correlated
|
||||
* data from XInput.
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - HIDAPI Xbox driver will only use HIDAPI data
|
||||
* "1" - HIDAPI Xbox driver will also pull data from XInput, providing better trigger axes, guide button
|
||||
* presses, and rumble support
|
||||
*
|
||||
* The default is "1". This hint applies to any joysticks opened after setting the hint.
|
||||
*/
|
||||
#define SDL_HINT_JOYSTICK_HIDAPI_CORRELATE_XINPUT "SDL_JOYSTICK_HIDAPI_CORRELATE_XINPUT"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether the HIDAPI driver for Nintendo GameCube controllers should be used.
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - HIDAPI driver is not used
|
||||
* "1" - HIDAPI driver is used
|
||||
*
|
||||
* The default is the value of SDL_HINT_JOYSTICK_HIDAPI
|
||||
*/
|
||||
#define SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE "SDL_JOYSTICK_HIDAPI_GAMECUBE"
|
||||
|
||||
/**
|
||||
* \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs
|
||||
*
|
||||
@@ -576,6 +684,15 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_HINT_ENABLE_STEAM_CONTROLLERS "SDL_ENABLE_STEAM_CONTROLLERS"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether the RAWINPUT joystick drivers should be used for better handling XInput-capable devices.
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - RAWINPUT drivers are not used
|
||||
* "1" - RAWINPUT drivers are used (the default)
|
||||
*
|
||||
*/
|
||||
#define SDL_HINT_JOYSTICK_RAWINPUT "SDL_JOYSTICK_RAWINPUT"
|
||||
|
||||
/**
|
||||
* \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it.
|
||||
@@ -913,7 +1030,8 @@ extern "C" {
|
||||
/**
|
||||
* \brief Tell SDL not to catch the SIGINT or SIGTERM signals.
|
||||
*
|
||||
* This hint only applies to Unix-like platforms.
|
||||
* This hint only applies to Unix-like platforms, and should set before
|
||||
* any calls to SDL_Init()
|
||||
*
|
||||
* The variable can be set to the following values:
|
||||
* "0" - SDL will install a SIGINT and SIGTERM handler, and when it
|
||||
@@ -1174,6 +1292,20 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_HINT_WAVE_FACT_CHUNK "SDL_WAVE_FACT_CHUNK"
|
||||
|
||||
/*
|
||||
* \brief Override for SDL_GetDisplayUsableBounds()
|
||||
*
|
||||
* If set, this hint will override the expected results for
|
||||
* SDL_GetDisplayUsableBounds() for display index 0. Generally you don't want
|
||||
* to do this, but this allows an embedded system to request that some of the
|
||||
* screen be reserved for other uses when paired with a well-behaved
|
||||
* application.
|
||||
*
|
||||
* The contents of this hint must be 4 comma-separated integers, the first
|
||||
* is the bounds x, then y, width and height, in that order.
|
||||
*/
|
||||
#define SDL_HINT_DISPLAY_USABLE_BOUNDS "SDL_DISPLAY_USABLE_BOUNDS"
|
||||
|
||||
/**
|
||||
* \brief An enumeration of hint priorities
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -105,6 +105,7 @@ typedef enum
|
||||
SDL_JOYSTICK_POWER_MAX
|
||||
} SDL_JoystickPowerLevel;
|
||||
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/**
|
||||
@@ -192,7 +193,46 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index);
|
||||
/**
|
||||
* Return the SDL_Joystick associated with an instance id.
|
||||
*/
|
||||
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID joyid);
|
||||
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID instance_id);
|
||||
|
||||
/**
|
||||
* Return the SDL_Joystick associated with a player index.
|
||||
*/
|
||||
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromPlayerIndex(int player_index);
|
||||
|
||||
/**
|
||||
* Attaches a new virtual joystick.
|
||||
* Returns the joystick's device index, or -1 if an error occurred.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type,
|
||||
int naxes,
|
||||
int nbuttons,
|
||||
int nhats);
|
||||
|
||||
/**
|
||||
* Detaches a virtual joystick
|
||||
* Returns 0 on success, or -1 if an error occurred.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickDetachVirtual(int device_index);
|
||||
|
||||
/**
|
||||
* Indicates whether or not a virtual-joystick is at a given device index.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickIsVirtual(int device_index);
|
||||
|
||||
/**
|
||||
* Set values on an opened, virtual-joystick's controls.
|
||||
* Please note that values set here will not be applied until the next
|
||||
* call to SDL_JoystickUpdate, which can either be called directly,
|
||||
* or can be called indirectly through various other SDL APIS,
|
||||
* including, but not limited to the following: SDL_PollEvent,
|
||||
* SDL_PumpEvents, SDL_WaitEventTimeout, SDL_WaitEvent.
|
||||
*
|
||||
* Returns 0 on success, -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualAxis(SDL_Joystick * joystick, int axis, Sint16 value);
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualButton(SDL_Joystick * joystick, int button, Uint8 value);
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualHat(SDL_Joystick * joystick, int hat, Uint8 value);
|
||||
|
||||
/**
|
||||
* Return the name for this currently opened joystick.
|
||||
@@ -207,6 +247,11 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick);
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick);
|
||||
|
||||
/**
|
||||
* Set the player index of an opened joystick
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_JoystickSetPlayerIndex(SDL_Joystick * joystick, int player_index);
|
||||
|
||||
/**
|
||||
* Return the GUID for this opened joystick
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -47,7 +47,7 @@ typedef Sint32 SDL_Keycode;
|
||||
#define SDLK_SCANCODE_MASK (1<<30)
|
||||
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
|
||||
|
||||
enum
|
||||
typedef enum
|
||||
{
|
||||
SDLK_UNKNOWN = 0,
|
||||
|
||||
@@ -317,7 +317,7 @@ enum
|
||||
|
||||
SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND),
|
||||
SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD)
|
||||
};
|
||||
} SDL_KeyCode;
|
||||
|
||||
/**
|
||||
* \brief Enumeration of valid key mods (possibly OR'd together).
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -61,7 +61,7 @@ extern "C" {
|
||||
* at the VERBOSE level and all other categories are enabled at the
|
||||
* CRITICAL level.
|
||||
*/
|
||||
enum
|
||||
typedef enum
|
||||
{
|
||||
SDL_LOG_CATEGORY_APPLICATION,
|
||||
SDL_LOG_CATEGORY_ERROR,
|
||||
@@ -94,7 +94,7 @@ enum
|
||||
};
|
||||
*/
|
||||
SDL_LOG_CATEGORY_CUSTOM
|
||||
};
|
||||
} SDL_LogCategory;
|
||||
|
||||
/**
|
||||
* \brief The predefined log priorities
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -36,9 +36,11 @@ extern "C" {
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */
|
||||
SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */
|
||||
SDL_MESSAGEBOX_INFORMATION = 0x00000040 /**< informational dialog */
|
||||
SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */
|
||||
SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */
|
||||
SDL_MESSAGEBOX_INFORMATION = 0x00000040, /**< informational dialog */
|
||||
SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = 0x00000080, /**< buttons placed left to right */
|
||||
SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = 0x00000100 /**< buttons placed right to left */
|
||||
} SDL_MessageBoxFlags;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_metal.h
|
||||
*
|
||||
* Header file for functions to creating Metal layers and views on SDL windows.
|
||||
*/
|
||||
|
||||
#ifndef SDL_metal_h_
|
||||
#define SDL_metal_h_
|
||||
|
||||
#include "SDL_video.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS).
|
||||
*
|
||||
* \note This can be cast directly to an NSView or UIView.
|
||||
*/
|
||||
typedef void *SDL_MetalView;
|
||||
|
||||
/**
|
||||
* \name Metal support functions
|
||||
*/
|
||||
/* @{ */
|
||||
|
||||
/**
|
||||
* \brief Create a CAMetalLayer-backed NSView/UIView and attach it to the
|
||||
* specified window.
|
||||
*
|
||||
* On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on its
|
||||
* own. It is up to user code to do that.
|
||||
*
|
||||
* The returned handle can be casted directly to a NSView or UIView.
|
||||
* To access the backing CAMetalLayer, call SDL_Metal_GetLayer().
|
||||
*
|
||||
* \note \a window must be created with the SDL_WINDOW_METAL flag.
|
||||
*
|
||||
* \sa SDL_Metal_DestroyView
|
||||
* \sa SDL_Metal_GetLayer
|
||||
*/
|
||||
extern DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window * window);
|
||||
|
||||
/**
|
||||
* \brief Destroy an existing SDL_MetalView object.
|
||||
*
|
||||
* This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was
|
||||
* called after SDL_CreateWindow.
|
||||
*
|
||||
* \sa SDL_Metal_CreateView
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view);
|
||||
|
||||
/**
|
||||
* \brief Get a pointer to the backing CAMetalLayer for the given view.
|
||||
*
|
||||
* \sa SDL_MetalCreateView
|
||||
*/
|
||||
extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view);
|
||||
|
||||
/**
|
||||
* \brief Get the size of a window's underlying drawable in pixels (for use
|
||||
* with setting viewport, scissor & etc).
|
||||
*
|
||||
* \param window SDL_Window from which the drawable size should be queried
|
||||
* \param w Pointer to variable for storing the width in pixels,
|
||||
* may be NULL
|
||||
* \param h Pointer to variable for storing the height in pixels,
|
||||
* may be NULL
|
||||
*
|
||||
* This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
|
||||
* drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a
|
||||
* platform with high-DPI support (Apple calls this "Retina"), and not disabled
|
||||
* by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.
|
||||
*
|
||||
* \note On macOS high-DPI support must be enabled for an application by
|
||||
* setting NSHighResolutionCapable to true in its Info.plist.
|
||||
*
|
||||
* \sa SDL_GetWindowSize()
|
||||
* \sa SDL_CreateWindow()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_Metal_GetDrawableSize(SDL_Window* window, int *w,
|
||||
int *h);
|
||||
|
||||
/* @} *//* Metal support functions */
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* SDL_metal_h_ */
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -40,6 +40,9 @@ extern "C" {
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#endif
|
||||
#ifndef NOMINMAX /* don't define min() and max(). */
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -48,7 +48,7 @@ extern "C" {
|
||||
/* @} */
|
||||
|
||||
/** Pixel type. */
|
||||
enum
|
||||
typedef enum
|
||||
{
|
||||
SDL_PIXELTYPE_UNKNOWN,
|
||||
SDL_PIXELTYPE_INDEX1,
|
||||
@@ -62,18 +62,18 @@ enum
|
||||
SDL_PIXELTYPE_ARRAYU32,
|
||||
SDL_PIXELTYPE_ARRAYF16,
|
||||
SDL_PIXELTYPE_ARRAYF32
|
||||
};
|
||||
} SDL_PixelType;
|
||||
|
||||
/** Bitmap pixel order, high bit -> low bit. */
|
||||
enum
|
||||
typedef enum
|
||||
{
|
||||
SDL_BITMAPORDER_NONE,
|
||||
SDL_BITMAPORDER_4321,
|
||||
SDL_BITMAPORDER_1234
|
||||
};
|
||||
} SDL_BitmapOrder;
|
||||
|
||||
/** Packed component order, high bit -> low bit. */
|
||||
enum
|
||||
typedef enum
|
||||
{
|
||||
SDL_PACKEDORDER_NONE,
|
||||
SDL_PACKEDORDER_XRGB,
|
||||
@@ -84,12 +84,12 @@ enum
|
||||
SDL_PACKEDORDER_BGRX,
|
||||
SDL_PACKEDORDER_ABGR,
|
||||
SDL_PACKEDORDER_BGRA
|
||||
};
|
||||
} SDL_PackedOrder;
|
||||
|
||||
/** Array component order, low byte -> high byte. */
|
||||
/* !!! FIXME: in 2.1, make these not overlap differently with
|
||||
!!! FIXME: SDL_PACKEDORDER_*, so we can simplify SDL_ISPIXELFORMAT_ALPHA */
|
||||
enum
|
||||
typedef enum
|
||||
{
|
||||
SDL_ARRAYORDER_NONE,
|
||||
SDL_ARRAYORDER_RGB,
|
||||
@@ -98,10 +98,10 @@ enum
|
||||
SDL_ARRAYORDER_BGR,
|
||||
SDL_ARRAYORDER_BGRA,
|
||||
SDL_ARRAYORDER_ABGR
|
||||
};
|
||||
} SDL_ArrayOrder;
|
||||
|
||||
/** Packed component layout. */
|
||||
enum
|
||||
typedef enum
|
||||
{
|
||||
SDL_PACKEDLAYOUT_NONE,
|
||||
SDL_PACKEDLAYOUT_332,
|
||||
@@ -112,7 +112,7 @@ enum
|
||||
SDL_PACKEDLAYOUT_8888,
|
||||
SDL_PACKEDLAYOUT_2101010,
|
||||
SDL_PACKEDLAYOUT_1010102
|
||||
};
|
||||
} SDL_PackedLayout;
|
||||
|
||||
#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
|
||||
|
||||
@@ -191,6 +191,9 @@ typedef enum
|
||||
SDL_PIXELFORMAT_RGB444 =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
|
||||
SDL_PACKEDLAYOUT_4444, 12, 2),
|
||||
SDL_PIXELFORMAT_BGR444 =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
|
||||
SDL_PACKEDLAYOUT_4444, 12, 2),
|
||||
SDL_PIXELFORMAT_RGB555 =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
|
||||
SDL_PACKEDLAYOUT_1555, 15, 2),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -85,6 +85,16 @@ typedef struct SDL_RendererInfo
|
||||
int max_texture_height; /**< The maximum texture height */
|
||||
} SDL_RendererInfo;
|
||||
|
||||
/**
|
||||
* \brief The scaling mode for a texture.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_ScaleModeNearest, /**< nearest pixel sampling */
|
||||
SDL_ScaleModeLinear, /**< linear filtering */
|
||||
SDL_ScaleModeBest /**< anisotropic filtering */
|
||||
} SDL_ScaleMode;
|
||||
|
||||
/**
|
||||
* \brief The access pattern allowed for a texture.
|
||||
*/
|
||||
@@ -366,6 +376,35 @@ extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
|
||||
extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
|
||||
SDL_BlendMode *blendMode);
|
||||
|
||||
/**
|
||||
* \brief Set the scale mode used for texture scale operations.
|
||||
*
|
||||
* \param texture The texture to update.
|
||||
* \param scaleMode ::SDL_ScaleMode to use for texture scaling.
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid.
|
||||
*
|
||||
* \note If the scale mode is not supported, the closest supported mode is
|
||||
* chosen.
|
||||
*
|
||||
* \sa SDL_GetTextureScaleMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture * texture,
|
||||
SDL_ScaleMode scaleMode);
|
||||
|
||||
/**
|
||||
* \brief Get the scale mode used for texture scale operations.
|
||||
*
|
||||
* \param texture The texture to query.
|
||||
* \param scaleMode A pointer filled in with the current scale mode.
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid.
|
||||
*
|
||||
* \sa SDL_SetTextureScaleMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture * texture,
|
||||
SDL_ScaleMode *scaleMode);
|
||||
|
||||
/**
|
||||
* \brief Update the given texture rectangle with new pixel data.
|
||||
*
|
||||
@@ -430,10 +469,31 @@ extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
|
||||
const SDL_Rect * rect,
|
||||
void **pixels, int *pitch);
|
||||
|
||||
/**
|
||||
* \brief Lock a portion of the texture for write-only pixel access.
|
||||
* Expose it as a SDL surface.
|
||||
*
|
||||
* \param texture The texture to lock for access, which was created with
|
||||
* ::SDL_TEXTUREACCESS_STREAMING.
|
||||
* \param rect A pointer to the rectangle to lock for access. If the rect
|
||||
* is NULL, the entire texture will be locked.
|
||||
* \param surface This is filled in with a SDL surface representing the locked area
|
||||
* Surface is freed internally after calling SDL_UnlockTexture or SDL_DestroyTexture.
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
|
||||
*
|
||||
* \sa SDL_UnlockTexture()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture,
|
||||
const SDL_Rect *rect,
|
||||
SDL_Surface **surface);
|
||||
|
||||
/**
|
||||
* \brief Unlock a texture, uploading the changes to video memory, if needed.
|
||||
* If SDL_LockTextureToSurface() was called for locking, the SDL surface is freed.
|
||||
*
|
||||
* \sa SDL_LockTexture()
|
||||
* \sa SDL_LockTextureToSurface()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
|
||||
|
||||
@@ -558,8 +618,8 @@ extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer,
|
||||
* \brief Set the clip rectangle for the current target.
|
||||
*
|
||||
* \param renderer The renderer for which clip rectangle should be set.
|
||||
* \param rect A pointer to the rectangle to set as the clip rectangle, or
|
||||
* NULL to disable clipping.
|
||||
* \param rect A pointer to the rectangle to set as the clip rectangle,
|
||||
* relative to the viewport, or NULL to disable clipping.
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
#define SDL_REVISION "hg-12952:bc90ce38f1e2"
|
||||
#define SDL_REVISION_NUMBER 12952
|
||||
#define SDL_REVISION "hg-0:aaaaaaaaaaah"
|
||||
#define SDL_REVISION_NUMBER 0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -121,6 +121,19 @@ typedef enum
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/**
|
||||
* Locking for multi-threaded access to the sensor API
|
||||
*
|
||||
* If you are using the sensor API or handling events from multiple threads
|
||||
* you should use these locking functions to protect access to the sensors.
|
||||
*
|
||||
* In particular, you are guaranteed that the sensor list won't change, so
|
||||
* the API functions that take a sensor index will be valid, and sensor
|
||||
* events will not be delivered.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LockSensors(void);
|
||||
extern DECLSPEC void SDLCALL SDL_UnlockSensors(void);
|
||||
|
||||
/**
|
||||
* \brief Count the number of sensors attached to the system right now
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -408,6 +408,8 @@ extern DECLSPEC int SDLCALL SDL_abs(int x);
|
||||
|
||||
extern DECLSPEC int SDLCALL SDL_isdigit(int x);
|
||||
extern DECLSPEC int SDLCALL SDL_isspace(int x);
|
||||
extern DECLSPEC int SDLCALL SDL_isupper(int x);
|
||||
extern DECLSPEC int SDLCALL SDL_islower(int x);
|
||||
extern DECLSPEC int SDLCALL SDL_toupper(int x);
|
||||
extern DECLSPEC int SDLCALL SDL_tolower(int x);
|
||||
|
||||
@@ -415,11 +417,14 @@ extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c,
|
||||
|
||||
#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
|
||||
#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
|
||||
#define SDL_zeroa(x) SDL_memset((x), 0, sizeof((x)))
|
||||
|
||||
/* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */
|
||||
SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
|
||||
{
|
||||
#if defined(__GNUC__) && defined(i386)
|
||||
#ifdef __APPLE__
|
||||
memset_pattern4(dst, &val, dwords * 4);
|
||||
#elif defined(__GNUC__) && defined(i386)
|
||||
int u0, u1, u2;
|
||||
__asm__ __volatile__ (
|
||||
"cld \n\t"
|
||||
@@ -450,11 +455,14 @@ extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_
|
||||
extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
|
||||
extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
|
||||
|
||||
extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr);
|
||||
extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
|
||||
extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
|
||||
extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
|
||||
extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr);
|
||||
extern DECLSPEC wchar_t *SDLCALL SDL_wcsstr(const wchar_t *haystack, const wchar_t *needle);
|
||||
|
||||
extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2);
|
||||
extern DECLSPEC int SDLCALL SDL_wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen);
|
||||
|
||||
extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
|
||||
extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
|
||||
@@ -467,6 +475,7 @@ extern DECLSPEC char *SDLCALL SDL_strlwr(char *str);
|
||||
extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
|
||||
extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
|
||||
extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
|
||||
extern DECLSPEC char *SDLCALL SDL_strtokr(char *s1, const char *s2, char **saveptr);
|
||||
extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str);
|
||||
|
||||
extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
|
||||
@@ -520,6 +529,8 @@ extern DECLSPEC double SDLCALL SDL_fabs(double x);
|
||||
extern DECLSPEC float SDLCALL SDL_fabsf(float x);
|
||||
extern DECLSPEC double SDLCALL SDL_floor(double x);
|
||||
extern DECLSPEC float SDLCALL SDL_floorf(float x);
|
||||
extern DECLSPEC double SDLCALL SDL_trunc(double x);
|
||||
extern DECLSPEC float SDLCALL SDL_truncf(float x);
|
||||
extern DECLSPEC double SDLCALL SDL_fmod(double x, double y);
|
||||
extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y);
|
||||
extern DECLSPEC double SDLCALL SDL_log(double x);
|
||||
@@ -581,6 +592,7 @@ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
|
||||
#define SDL_strchr strchr
|
||||
#define SDL_strrchr strrchr
|
||||
#define SDL_strstr strstr
|
||||
#define SDL_strtokr strtok_r
|
||||
#define SDL_strcmp strcmp
|
||||
#define SDL_strncmp strncmp
|
||||
#define SDL_strcasecmp strcasecmp
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -89,7 +89,7 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int prio
|
||||
#endif /* __LINUX__ */
|
||||
|
||||
/* Platform specific functions for iOS */
|
||||
#if defined(__IPHONEOS__) && __IPHONEOS__
|
||||
#ifdef __IPHONEOS__
|
||||
|
||||
#define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam)
|
||||
extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
|
||||
@@ -101,7 +101,7 @@ extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
|
||||
|
||||
|
||||
/* Platform specific functions for Android */
|
||||
#if defined(__ANDROID__) && __ANDROID__
|
||||
#ifdef __ANDROID__
|
||||
|
||||
/**
|
||||
\brief Get the JNI environment for the current thread
|
||||
@@ -120,6 +120,32 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void);
|
||||
*/
|
||||
extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void);
|
||||
|
||||
/**
|
||||
\brief Return API level of the current device
|
||||
|
||||
API level 29: Android 10
|
||||
API level 28: Android 9
|
||||
API level 27: Android 8.1
|
||||
API level 26: Android 8.0
|
||||
API level 25: Android 7.1
|
||||
API level 24: Android 7.0
|
||||
API level 23: Android 6.0
|
||||
API level 22: Android 5.1
|
||||
API level 21: Android 5.0
|
||||
API level 20: Android 4.4W
|
||||
API level 19: Android 4.4
|
||||
API level 18: Android 4.3
|
||||
API level 17: Android 4.2
|
||||
API level 16: Android 4.1
|
||||
API level 15: Android 4.0.3
|
||||
API level 14: Android 4.0
|
||||
API level 13: Android 3.2
|
||||
API level 12: Android 3.1
|
||||
API level 11: Android 3.0
|
||||
API level 10: Android 2.3.3
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetAndroidSDKVersion(void);
|
||||
|
||||
/**
|
||||
\brief Return true if the application is running on Android TV
|
||||
*/
|
||||
@@ -175,7 +201,7 @@ extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void);
|
||||
#endif /* __ANDROID__ */
|
||||
|
||||
/* Platform specific functions for WinRT */
|
||||
#if defined(__WINRT__) && __WINRT__
|
||||
#ifdef __WINRT__
|
||||
|
||||
/**
|
||||
* \brief WinRT / Windows Phone path types
|
||||
@@ -268,6 +294,17 @@ extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily();
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void);
|
||||
|
||||
/* Functions used by iOS application delegates to notify SDL about state changes */
|
||||
extern DECLSPEC void SDLCALL SDL_OnApplicationWillTerminate(void);
|
||||
extern DECLSPEC void SDLCALL SDL_OnApplicationDidReceiveMemoryWarning(void);
|
||||
extern DECLSPEC void SDLCALL SDL_OnApplicationWillResignActive(void);
|
||||
extern DECLSPEC void SDLCALL SDL_OnApplicationDidEnterBackground(void);
|
||||
extern DECLSPEC void SDLCALL SDL_OnApplicationWillEnterForeground(void);
|
||||
extern DECLSPEC void SDLCALL SDL_OnApplicationDidBecomeActive(void);
|
||||
#ifdef __IPHONEOS__
|
||||
extern DECLSPEC void SDLCALL SDL_OnApplicationDidChangeStatusBarOrientation(void);
|
||||
#endif
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -49,6 +49,9 @@ struct SDL_SysWMinfo;
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#ifndef NOMINMAX /* don't define min() and max(). */
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
@@ -129,7 +132,8 @@ typedef enum
|
||||
SDL_SYSWM_WINRT,
|
||||
SDL_SYSWM_ANDROID,
|
||||
SDL_SYSWM_VIVANTE,
|
||||
SDL_SYSWM_OS2
|
||||
SDL_SYSWM_OS2,
|
||||
SDL_SYSWM_HAIKU
|
||||
} SDL_SYSWM_TYPE;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -155,6 +155,19 @@ int SDLTest_CommonArg(SDLTest_CommonState * state, int index);
|
||||
*/
|
||||
void SDLTest_CommonLogUsage(SDLTest_CommonState * state, const char *argv0, const char **options);
|
||||
|
||||
/**
|
||||
* \brief Returns common usage information
|
||||
*
|
||||
* You should (probably) be using SDLTest_CommonLogUsage() instead, but this
|
||||
* function remains for binary compatibility. Strings returned from this
|
||||
* function are valid until SDLTest_CommonQuit() is called, in which case
|
||||
* those strings' memory is freed and can no longer be used.
|
||||
*
|
||||
* \param state The common state describing the test window to create.
|
||||
* \returns String with usage information
|
||||
*/
|
||||
const char *SDLTest_CommonUsage(SDLTest_CommonState * state);
|
||||
|
||||
/**
|
||||
* \brief Open test window.
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -69,7 +69,7 @@ typedef enum {
|
||||
*/
|
||||
typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
|
||||
|
||||
#if defined(__WIN32__) && !defined(HAVE_LIBC)
|
||||
#if defined(__WIN32__)
|
||||
/**
|
||||
* \file SDL_thread.h
|
||||
*
|
||||
@@ -93,11 +93,18 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
|
||||
#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
|
||||
#include <process.h> /* _beginthreadex() and _endthreadex() */
|
||||
|
||||
typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread)
|
||||
typedef uintptr_t (__cdecl * pfnSDL_CurrentBeginThread)
|
||||
(void *, unsigned, unsigned (__stdcall *func)(void *),
|
||||
void * /*arg*/, unsigned, unsigned * /* threadID */);
|
||||
typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
|
||||
|
||||
#ifndef SDL_beginthread
|
||||
#define SDL_beginthread _beginthreadex
|
||||
#endif
|
||||
#ifndef SDL_endthread
|
||||
#define SDL_endthread _endthreadex
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Create a thread.
|
||||
*/
|
||||
@@ -118,12 +125,12 @@ SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *),
|
||||
*/
|
||||
#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
|
||||
#undef SDL_CreateThread
|
||||
#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
|
||||
#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#undef SDL_CreateThreadWithStackSize
|
||||
#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
|
||||
#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#else
|
||||
#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
|
||||
#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
|
||||
#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#endif
|
||||
|
||||
#elif defined(__OS2__)
|
||||
@@ -132,13 +139,23 @@ SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *),
|
||||
* into a dll with Watcom's runtime statically linked.
|
||||
*/
|
||||
#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
|
||||
|
||||
#ifndef __EMX__
|
||||
#include <process.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void * /*arg*/);
|
||||
typedef void (*pfnSDL_CurrentEndThread)(void);
|
||||
|
||||
#ifndef SDL_beginthread
|
||||
#define SDL_beginthread _beginthread
|
||||
#endif
|
||||
#ifndef SDL_endthread
|
||||
#define SDL_endthread _endthread
|
||||
#endif
|
||||
|
||||
extern DECLSPEC SDL_Thread *SDLCALL
|
||||
SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
|
||||
pfnSDL_CurrentBeginThread pfnBeginThread,
|
||||
@@ -147,14 +164,15 @@ extern DECLSPEC SDL_Thread *SDLCALL
|
||||
SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data,
|
||||
pfnSDL_CurrentBeginThread pfnBeginThread,
|
||||
pfnSDL_CurrentEndThread pfnEndThread);
|
||||
|
||||
#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
|
||||
#undef SDL_CreateThread
|
||||
#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
|
||||
#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#undef SDL_CreateThreadWithStackSize
|
||||
#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
|
||||
#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#else
|
||||
#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
|
||||
#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
|
||||
#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -59,7 +59,7 @@ typedef struct SDL_version
|
||||
*/
|
||||
#define SDL_MAJOR_VERSION 2
|
||||
#define SDL_MINOR_VERSION 0
|
||||
#define SDL_PATCHLEVEL 10
|
||||
#define SDL_PATCHLEVEL 13
|
||||
|
||||
/**
|
||||
* \brief Macro to determine SDL version program was compiled against.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -96,7 +96,6 @@ typedef struct SDL_Window SDL_Window;
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
/* !!! FIXME: change this to name = (1<<x). */
|
||||
SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window */
|
||||
SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */
|
||||
SDL_WINDOW_SHOWN = 0x00000004, /**< window is visible */
|
||||
@@ -119,7 +118,8 @@ typedef enum
|
||||
SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */
|
||||
SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */
|
||||
SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */
|
||||
SDL_WINDOW_VULKAN = 0x10000000 /**< window usable for Vulkan surface */
|
||||
SDL_WINDOW_VULKAN = 0x10000000, /**< window usable for Vulkan surface */
|
||||
SDL_WINDOW_METAL = 0x20000000 /**< window usable for Metal view */
|
||||
} SDL_WindowFlags;
|
||||
|
||||
/**
|
||||
@@ -485,7 +485,8 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
|
||||
* ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS,
|
||||
* ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED,
|
||||
* ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED,
|
||||
* ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN.
|
||||
* ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN
|
||||
* ::SDL_WINDOW_METAL.
|
||||
*
|
||||
* \return The created window, or NULL if window creation failed.
|
||||
*
|
||||
@@ -504,6 +505,9 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
|
||||
* If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver,
|
||||
* SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail.
|
||||
*
|
||||
* If SDL_WINDOW_METAL is specified on an OS that does not support Metal,
|
||||
* SDL_CreateWindow() will fail.
|
||||
*
|
||||
* \note On non-Apple devices, SDL requires you to either not link to the
|
||||
* Vulkan loader or link to a dynamic library version. This limitation
|
||||
* may be removed in a future version of SDL.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -452,6 +452,11 @@ enum AVCodecID {
|
||||
AV_CODEC_ID_MWSC,
|
||||
AV_CODEC_ID_WCMV,
|
||||
AV_CODEC_ID_RASC,
|
||||
AV_CODEC_ID_HYMT,
|
||||
AV_CODEC_ID_ARBC,
|
||||
AV_CODEC_ID_AGM,
|
||||
AV_CODEC_ID_LSCR,
|
||||
AV_CODEC_ID_VP4,
|
||||
|
||||
/* various PCM "codecs" */
|
||||
AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
|
||||
@@ -536,6 +541,7 @@ enum AVCodecID {
|
||||
AV_CODEC_ID_ADPCM_AICA,
|
||||
AV_CODEC_ID_ADPCM_IMA_DAT4,
|
||||
AV_CODEC_ID_ADPCM_MTAF,
|
||||
AV_CODEC_ID_ADPCM_AGM,
|
||||
|
||||
/* AMR */
|
||||
AV_CODEC_ID_AMR_NB = 0x12000,
|
||||
@@ -645,6 +651,7 @@ enum AVCodecID {
|
||||
AV_CODEC_ID_APTX_HD,
|
||||
AV_CODEC_ID_SBC,
|
||||
AV_CODEC_ID_ATRAC9,
|
||||
AV_CODEC_ID_HCOM,
|
||||
|
||||
/* subtitle codecs */
|
||||
AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
|
||||
@@ -674,6 +681,7 @@ enum AVCodecID {
|
||||
AV_CODEC_ID_ASS,
|
||||
AV_CODEC_ID_HDMV_TEXT_SUBTITLE,
|
||||
AV_CODEC_ID_TTML,
|
||||
AV_CODEC_ID_ARIB_CAPTION,
|
||||
|
||||
/* other specific kind of codecs (generally used for attachments) */
|
||||
AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
|
||||
@@ -852,6 +860,11 @@ typedef struct RcOverride{
|
||||
* Use qpel MC.
|
||||
*/
|
||||
#define AV_CODEC_FLAG_QPEL (1 << 4)
|
||||
/**
|
||||
* Don't output frames whose parameters differ from first
|
||||
* decoded frame in stream.
|
||||
*/
|
||||
#define AV_CODEC_FLAG_DROPCHANGED (1 << 5)
|
||||
/**
|
||||
* Use internal 2pass ratecontrol in first pass mode.
|
||||
*/
|
||||
@@ -1071,6 +1084,13 @@ typedef struct RcOverride{
|
||||
*/
|
||||
#define AV_CODEC_CAP_HYBRID (1 << 19)
|
||||
|
||||
/**
|
||||
* This codec takes the reordered_opaque field from input AVFrames
|
||||
* and returns it in the corresponding field in AVCodecContext after
|
||||
* encoding.
|
||||
*/
|
||||
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE (1 << 20)
|
||||
|
||||
/**
|
||||
* Pan Scan area.
|
||||
* This specifies the area which should be displayed.
|
||||
@@ -1110,17 +1130,29 @@ typedef struct AVCPBProperties {
|
||||
* Maximum bitrate of the stream, in bits per second.
|
||||
* Zero if unknown or unspecified.
|
||||
*/
|
||||
#if FF_API_UNSANITIZED_BITRATES
|
||||
int max_bitrate;
|
||||
#else
|
||||
int64_t max_bitrate;
|
||||
#endif
|
||||
/**
|
||||
* Minimum bitrate of the stream, in bits per second.
|
||||
* Zero if unknown or unspecified.
|
||||
*/
|
||||
#if FF_API_UNSANITIZED_BITRATES
|
||||
int min_bitrate;
|
||||
#else
|
||||
int64_t min_bitrate;
|
||||
#endif
|
||||
/**
|
||||
* Average bitrate of the stream, in bits per second.
|
||||
* Zero if unknown or unspecified.
|
||||
*/
|
||||
#if FF_API_UNSANITIZED_BITRATES
|
||||
int avg_bitrate;
|
||||
#else
|
||||
int64_t avg_bitrate;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The size of the buffer to which the ratecontrol is applied, in bits.
|
||||
@@ -1321,7 +1353,7 @@ enum AVPacketSideDataType {
|
||||
AV_PKT_DATA_METADATA_UPDATE,
|
||||
|
||||
/**
|
||||
* MPEGTS stream ID, this is required to pass the stream ID
|
||||
* MPEGTS stream ID as uint8_t, this is required to pass the stream ID
|
||||
* information from the demuxer to the corresponding muxer.
|
||||
*/
|
||||
AV_PKT_DATA_MPEGTS_STREAM_ID,
|
||||
@@ -2025,15 +2057,19 @@ typedef struct AVCodecContext {
|
||||
|
||||
/**
|
||||
* custom intra quantization matrix
|
||||
* - encoding: Set by user, can be NULL.
|
||||
* - decoding: Set by libavcodec.
|
||||
* Must be allocated with the av_malloc() family of functions, and will be freed in
|
||||
* avcodec_free_context().
|
||||
* - encoding: Set/allocated by user, freed by libavcodec. Can be NULL.
|
||||
* - decoding: Set/allocated/freed by libavcodec.
|
||||
*/
|
||||
uint16_t *intra_matrix;
|
||||
|
||||
/**
|
||||
* custom inter quantization matrix
|
||||
* - encoding: Set by user, can be NULL.
|
||||
* - decoding: Set by libavcodec.
|
||||
* Must be allocated with the av_malloc() family of functions, and will be freed in
|
||||
* avcodec_free_context().
|
||||
* - encoding: Set/allocated by user, freed by libavcodec. Can be NULL.
|
||||
* - decoding: Set/allocated/freed by libavcodec.
|
||||
*/
|
||||
uint16_t *inter_matrix;
|
||||
|
||||
@@ -2677,7 +2713,10 @@ typedef struct AVCodecContext {
|
||||
/**
|
||||
* opaque 64-bit number (generally a PTS) that will be reordered and
|
||||
* output in AVFrame.reordered_opaque
|
||||
* - encoding: unused
|
||||
* - encoding: Set by libavcodec to the reordered_opaque of the input
|
||||
* frame corresponding to the last returned packet. Only
|
||||
* supported by encoders with the
|
||||
* AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE capability.
|
||||
* - decoding: Set by user.
|
||||
*/
|
||||
int64_t reordered_opaque;
|
||||
@@ -2961,6 +3000,16 @@ typedef struct AVCodecContext {
|
||||
|
||||
#define FF_PROFILE_SBC_MSBC 1
|
||||
|
||||
#define FF_PROFILE_PRORES_PROXY 0
|
||||
#define FF_PROFILE_PRORES_LT 1
|
||||
#define FF_PROFILE_PRORES_STANDARD 2
|
||||
#define FF_PROFILE_PRORES_HQ 3
|
||||
#define FF_PROFILE_PRORES_4444 4
|
||||
#define FF_PROFILE_PRORES_XQ 5
|
||||
|
||||
#define FF_PROFILE_ARIB_PROFILE_A 0
|
||||
#define FF_PROFILE_ARIB_PROFILE_C 1
|
||||
|
||||
/**
|
||||
* level
|
||||
* - encoding: Set by user.
|
||||
@@ -3313,6 +3362,14 @@ typedef struct AVCodecContext {
|
||||
* used as reference pictures).
|
||||
*/
|
||||
int extra_hw_frames;
|
||||
|
||||
/**
|
||||
* The percentage of damaged samples to discard a frame.
|
||||
*
|
||||
* - decoding: set by user
|
||||
* - encoding: unused
|
||||
*/
|
||||
int discard_damaged_percentage;
|
||||
} AVCodecContext;
|
||||
|
||||
#if FF_API_CODEC_GET_SET
|
||||
@@ -4365,7 +4422,7 @@ int av_grow_packet(AVPacket *pkt, int grow_by);
|
||||
* Initialize a reference-counted packet from av_malloc()ed data.
|
||||
*
|
||||
* @param pkt packet to be initialized. This function will set the data, size,
|
||||
* buf and destruct fields, all others are left untouched.
|
||||
* and buf fields, all others are left untouched.
|
||||
* @param data Data allocated by av_malloc() to be used as packet data. If this
|
||||
* function returns successfully, the data is owned by the underlying AVBuffer.
|
||||
* The caller may not access the data through other means.
|
||||
@@ -4871,6 +4928,9 @@ int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt);
|
||||
* AVERROR_EOF: the decoder has been fully flushed, and there will be
|
||||
* no more output frames
|
||||
* AVERROR(EINVAL): codec not opened, or it is an encoder
|
||||
* AVERROR_INPUT_CHANGED: current decoded frame has changed parameters
|
||||
* with respect to first decoded frame. Applicable
|
||||
* when flag AV_CODEC_FLAG_DROPCHANGED is set.
|
||||
* other negative values: legitimate decoding errors
|
||||
*/
|
||||
int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame);
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "libavutil/version.h"
|
||||
|
||||
#define LIBAVCODEC_VERSION_MAJOR 58
|
||||
#define LIBAVCODEC_VERSION_MINOR 35
|
||||
#define LIBAVCODEC_VERSION_MINOR 54
|
||||
#define LIBAVCODEC_VERSION_MICRO 100
|
||||
|
||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||
@@ -132,6 +132,9 @@
|
||||
#ifndef FF_API_NEXT
|
||||
#define FF_API_NEXT (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_UNSANITIZED_BITRATES
|
||||
#define FF_API_UNSANITIZED_BITRATES (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* AVCODEC_VERSION_H */
|
||||
|
||||
@@ -400,6 +400,12 @@ int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end,
|
||||
*/
|
||||
int av_match_list(const char *name, const char *list, char separator);
|
||||
|
||||
/**
|
||||
* See libc sscanf manual for more information.
|
||||
* Locale-independent sscanf implementation.
|
||||
*/
|
||||
int av_sscanf(const char *string, const char *format, ...);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Automatically generated by version.sh, do not manually edit! */
|
||||
#ifndef AVUTIL_FFVERSION_H
|
||||
#define AVUTIL_FFVERSION_H
|
||||
#define FFMPEG_VERSION "4.1"
|
||||
#define FFMPEG_VERSION "4.2.1"
|
||||
#endif /* AVUTIL_FFVERSION_H */
|
||||
|
||||
@@ -166,6 +166,19 @@ enum AVFrameSideDataType {
|
||||
* function in libavutil/timecode.c.
|
||||
*/
|
||||
AV_FRAME_DATA_S12M_TIMECODE,
|
||||
|
||||
/**
|
||||
* HDR dynamic metadata associated with a video frame. The payload is
|
||||
* an AVDynamicHDRPlus type and contains information for color
|
||||
* volume transform - application 4 of SMPTE 2094-40:2016 standard.
|
||||
*/
|
||||
AV_FRAME_DATA_DYNAMIC_HDR_PLUS,
|
||||
|
||||
/**
|
||||
* Regions Of Interest, the data is an array of AVRegionOfInterest type, the number of
|
||||
* array element is implied by AVFrameSideData.size / AVRegionOfInterest.self_size.
|
||||
*/
|
||||
AV_FRAME_DATA_REGIONS_OF_INTEREST,
|
||||
};
|
||||
|
||||
enum AVActiveFormatDescription {
|
||||
@@ -193,6 +206,62 @@ typedef struct AVFrameSideData {
|
||||
AVBufferRef *buf;
|
||||
} AVFrameSideData;
|
||||
|
||||
/**
|
||||
* Structure describing a single Region Of Interest.
|
||||
*
|
||||
* When multiple regions are defined in a single side-data block, they
|
||||
* should be ordered from most to least important - some encoders are only
|
||||
* capable of supporting a limited number of distinct regions, so will have
|
||||
* to truncate the list.
|
||||
*
|
||||
* When overlapping regions are defined, the first region containing a given
|
||||
* area of the frame applies.
|
||||
*/
|
||||
typedef struct AVRegionOfInterest {
|
||||
/**
|
||||
* Must be set to the size of this data structure (that is,
|
||||
* sizeof(AVRegionOfInterest)).
|
||||
*/
|
||||
uint32_t self_size;
|
||||
/**
|
||||
* Distance in pixels from the top edge of the frame to the top and
|
||||
* bottom edges and from the left edge of the frame to the left and
|
||||
* right edges of the rectangle defining this region of interest.
|
||||
*
|
||||
* The constraints on a region are encoder dependent, so the region
|
||||
* actually affected may be slightly larger for alignment or other
|
||||
* reasons.
|
||||
*/
|
||||
int top;
|
||||
int bottom;
|
||||
int left;
|
||||
int right;
|
||||
/**
|
||||
* Quantisation offset.
|
||||
*
|
||||
* Must be in the range -1 to +1. A value of zero indicates no quality
|
||||
* change. A negative value asks for better quality (less quantisation),
|
||||
* while a positive value asks for worse quality (greater quantisation).
|
||||
*
|
||||
* The range is calibrated so that the extreme values indicate the
|
||||
* largest possible offset - if the rest of the frame is encoded with the
|
||||
* worst possible quality, an offset of -1 indicates that this region
|
||||
* should be encoded with the best possible quality anyway. Intermediate
|
||||
* values are then interpolated in some codec-dependent way.
|
||||
*
|
||||
* For example, in 10-bit H.264 the quantisation parameter varies between
|
||||
* -12 and 51. A typical qoffset value of -1/10 therefore indicates that
|
||||
* this region should be encoded with a QP around one-tenth of the full
|
||||
* range better than the rest of the frame. So, if most of the frame
|
||||
* were to be encoded with a QP of around 30, this region would get a QP
|
||||
* of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
|
||||
* An extreme value of -1 would indicate that this region should be
|
||||
* encoded with the best possible quality regardless of the treatment of
|
||||
* the rest of the frame - that is, should be encoded at a QP of -12.
|
||||
*/
|
||||
AVRational qoffset;
|
||||
} AVRegionOfInterest;
|
||||
|
||||
/**
|
||||
* This structure describes decoded (raw) audio or video data.
|
||||
*
|
||||
@@ -389,7 +458,6 @@ typedef struct AVFrame {
|
||||
* that time,
|
||||
* the decoder reorders values as needed and sets AVFrame.reordered_opaque
|
||||
* to exactly one of the values provided by the user through AVCodecContext.reordered_opaque
|
||||
* @deprecated in favor of pkt_pts
|
||||
*/
|
||||
int64_t reordered_opaque;
|
||||
|
||||
@@ -522,6 +590,8 @@ typedef struct AVFrame {
|
||||
int decode_error_flags;
|
||||
#define FF_DECODE_ERROR_INVALID_BITSTREAM 1
|
||||
#define FF_DECODE_ERROR_MISSING_REFERENCE 2
|
||||
#define FF_DECODE_ERROR_CONCEALMENT_ACTIVE 4
|
||||
#define FF_DECODE_ERROR_DECODE_SLICES 8
|
||||
|
||||
/**
|
||||
* number of audio channels, only used for audio.
|
||||
|
||||
@@ -0,0 +1,343 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Mohammad Izadi <moh.izadi at gmail.com>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_HDR_DYNAMIC_METADATA_H
|
||||
#define AVUTIL_HDR_DYNAMIC_METADATA_H
|
||||
|
||||
#include "frame.h"
|
||||
#include "rational.h"
|
||||
|
||||
/**
|
||||
* Option for overlapping elliptical pixel selectors in an image.
|
||||
*/
|
||||
enum AVHDRPlusOverlapProcessOption {
|
||||
AV_HDR_PLUS_OVERLAP_PROCESS_WEIGHTED_AVERAGING = 0,
|
||||
AV_HDR_PLUS_OVERLAP_PROCESS_LAYERING = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
* Represents the percentile at a specific percentage in
|
||||
* a distribution.
|
||||
*/
|
||||
typedef struct AVHDRPlusPercentile {
|
||||
/**
|
||||
* The percentage value corresponding to a specific percentile linearized
|
||||
* RGB value in the processing window in the scene. The value shall be in
|
||||
* the range of 0 to100, inclusive.
|
||||
*/
|
||||
uint8_t percentage;
|
||||
|
||||
/**
|
||||
* The linearized maxRGB value at a specific percentile in the processing
|
||||
* window in the scene. The value shall be in the range of 0 to 1, inclusive
|
||||
* and in multiples of 0.00001.
|
||||
*/
|
||||
AVRational percentile;
|
||||
} AVHDRPlusPercentile;
|
||||
|
||||
/**
|
||||
* Color transform parameters at a processing window in a dynamic metadata for
|
||||
* SMPTE 2094-40.
|
||||
*/
|
||||
typedef struct AVHDRPlusColorTransformParams {
|
||||
/**
|
||||
* The relative x coordinate of the top left pixel of the processing
|
||||
* window. The value shall be in the range of 0 and 1, inclusive and
|
||||
* in multiples of 1/(width of Picture - 1). The value 1 corresponds
|
||||
* to the absolute coordinate of width of Picture - 1. The value for
|
||||
* first processing window shall be 0.
|
||||
*/
|
||||
AVRational window_upper_left_corner_x;
|
||||
|
||||
/**
|
||||
* The relative y coordinate of the top left pixel of the processing
|
||||
* window. The value shall be in the range of 0 and 1, inclusive and
|
||||
* in multiples of 1/(height of Picture - 1). The value 1 corresponds
|
||||
* to the absolute coordinate of height of Picture - 1. The value for
|
||||
* first processing window shall be 0.
|
||||
*/
|
||||
AVRational window_upper_left_corner_y;
|
||||
|
||||
/**
|
||||
* The relative x coordinate of the bottom right pixel of the processing
|
||||
* window. The value shall be in the range of 0 and 1, inclusive and
|
||||
* in multiples of 1/(width of Picture - 1). The value 1 corresponds
|
||||
* to the absolute coordinate of width of Picture - 1. The value for
|
||||
* first processing window shall be 1.
|
||||
*/
|
||||
AVRational window_lower_right_corner_x;
|
||||
|
||||
/**
|
||||
* The relative y coordinate of the bottom right pixel of the processing
|
||||
* window. The value shall be in the range of 0 and 1, inclusive and
|
||||
* in multiples of 1/(height of Picture - 1). The value 1 corresponds
|
||||
* to the absolute coordinate of height of Picture - 1. The value for
|
||||
* first processing window shall be 1.
|
||||
*/
|
||||
AVRational window_lower_right_corner_y;
|
||||
|
||||
/**
|
||||
* The x coordinate of the center position of the concentric internal and
|
||||
* external ellipses of the elliptical pixel selector in the processing
|
||||
* window. The value shall be in the range of 0 to (width of Picture - 1),
|
||||
* inclusive and in multiples of 1 pixel.
|
||||
*/
|
||||
uint16_t center_of_ellipse_x;
|
||||
|
||||
/**
|
||||
* The y coordinate of the center position of the concentric internal and
|
||||
* external ellipses of the elliptical pixel selector in the processing
|
||||
* window. The value shall be in the range of 0 to (height of Picture - 1),
|
||||
* inclusive and in multiples of 1 pixel.
|
||||
*/
|
||||
uint16_t center_of_ellipse_y;
|
||||
|
||||
/**
|
||||
* The clockwise rotation angle in degree of arc with respect to the
|
||||
* positive direction of the x-axis of the concentric internal and external
|
||||
* ellipses of the elliptical pixel selector in the processing window. The
|
||||
* value shall be in the range of 0 to 180, inclusive and in multiples of 1.
|
||||
*/
|
||||
uint8_t rotation_angle;
|
||||
|
||||
/**
|
||||
* The semi-major axis value of the internal ellipse of the elliptical pixel
|
||||
* selector in amount of pixels in the processing window. The value shall be
|
||||
* in the range of 1 to 65535, inclusive and in multiples of 1 pixel.
|
||||
*/
|
||||
uint16_t semimajor_axis_internal_ellipse;
|
||||
|
||||
/**
|
||||
* The semi-major axis value of the external ellipse of the elliptical pixel
|
||||
* selector in amount of pixels in the processing window. The value
|
||||
* shall not be less than semimajor_axis_internal_ellipse of the current
|
||||
* processing window. The value shall be in the range of 1 to 65535,
|
||||
* inclusive and in multiples of 1 pixel.
|
||||
*/
|
||||
uint16_t semimajor_axis_external_ellipse;
|
||||
|
||||
/**
|
||||
* The semi-minor axis value of the external ellipse of the elliptical pixel
|
||||
* selector in amount of pixels in the processing window. The value shall be
|
||||
* in the range of 1 to 65535, inclusive and in multiples of 1 pixel.
|
||||
*/
|
||||
uint16_t semiminor_axis_external_ellipse;
|
||||
|
||||
/**
|
||||
* Overlap process option indicates one of the two methods of combining
|
||||
* rendered pixels in the processing window in an image with at least one
|
||||
* elliptical pixel selector. For overlapping elliptical pixel selectors
|
||||
* in an image, overlap_process_option shall have the same value.
|
||||
*/
|
||||
enum AVHDRPlusOverlapProcessOption overlap_process_option;
|
||||
|
||||
/**
|
||||
* The maximum of the color components of linearized RGB values in the
|
||||
* processing window in the scene. The values should be in the range of 0 to
|
||||
* 1, inclusive and in multiples of 0.00001. maxscl[ 0 ], maxscl[ 1 ], and
|
||||
* maxscl[ 2 ] are corresponding to R, G, B color components respectively.
|
||||
*/
|
||||
AVRational maxscl[3];
|
||||
|
||||
/**
|
||||
* The average of linearized maxRGB values in the processing window in the
|
||||
* scene. The value should be in the range of 0 to 1, inclusive and in
|
||||
* multiples of 0.00001.
|
||||
*/
|
||||
AVRational average_maxrgb;
|
||||
|
||||
/**
|
||||
* The number of linearized maxRGB values at given percentiles in the
|
||||
* processing window in the scene. The maximum value shall be 15.
|
||||
*/
|
||||
uint8_t num_distribution_maxrgb_percentiles;
|
||||
|
||||
/**
|
||||
* The linearized maxRGB values at given percentiles in the
|
||||
* processing window in the scene.
|
||||
*/
|
||||
AVHDRPlusPercentile distribution_maxrgb[15];
|
||||
|
||||
/**
|
||||
* The fraction of selected pixels in the image that contains the brightest
|
||||
* pixel in the scene. The value shall be in the range of 0 to 1, inclusive
|
||||
* and in multiples of 0.001.
|
||||
*/
|
||||
AVRational fraction_bright_pixels;
|
||||
|
||||
/**
|
||||
* This flag indicates that the metadata for the tone mapping function in
|
||||
* the processing window is present (for value of 1).
|
||||
*/
|
||||
uint8_t tone_mapping_flag;
|
||||
|
||||
/**
|
||||
* The x coordinate of the separation point between the linear part and the
|
||||
* curved part of the tone mapping function. The value shall be in the range
|
||||
* of 0 to 1, excluding 0 and in multiples of 1/4095.
|
||||
*/
|
||||
AVRational knee_point_x;
|
||||
|
||||
/**
|
||||
* The y coordinate of the separation point between the linear part and the
|
||||
* curved part of the tone mapping function. The value shall be in the range
|
||||
* of 0 to 1, excluding 0 and in multiples of 1/4095.
|
||||
*/
|
||||
AVRational knee_point_y;
|
||||
|
||||
/**
|
||||
* The number of the intermediate anchor parameters of the tone mapping
|
||||
* function in the processing window. The maximum value shall be 15.
|
||||
*/
|
||||
uint8_t num_bezier_curve_anchors;
|
||||
|
||||
/**
|
||||
* The intermediate anchor parameters of the tone mapping function in the
|
||||
* processing window in the scene. The values should be in the range of 0
|
||||
* to 1, inclusive and in multiples of 1/1023.
|
||||
*/
|
||||
AVRational bezier_curve_anchors[15];
|
||||
|
||||
/**
|
||||
* This flag shall be equal to 0 in bitstreams conforming to this version of
|
||||
* this Specification. Other values are reserved for future use.
|
||||
*/
|
||||
uint8_t color_saturation_mapping_flag;
|
||||
|
||||
/**
|
||||
* The color saturation gain in the processing window in the scene. The
|
||||
* value shall be in the range of 0 to 63/8, inclusive and in multiples of
|
||||
* 1/8. The default value shall be 1.
|
||||
*/
|
||||
AVRational color_saturation_weight;
|
||||
} AVHDRPlusColorTransformParams;
|
||||
|
||||
/**
|
||||
* This struct represents dynamic metadata for color volume transform -
|
||||
* application 4 of SMPTE 2094-40:2016 standard.
|
||||
*
|
||||
* To be used as payload of a AVFrameSideData or AVPacketSideData with the
|
||||
* appropriate type.
|
||||
*
|
||||
* @note The struct should be allocated with
|
||||
* av_dynamic_hdr_plus_alloc() and its size is not a part of
|
||||
* the public ABI.
|
||||
*/
|
||||
typedef struct AVDynamicHDRPlus {
|
||||
/**
|
||||
* Country code by Rec. ITU-T T.35 Annex A. The value shall be 0xB5.
|
||||
*/
|
||||
uint8_t itu_t_t35_country_code;
|
||||
|
||||
/**
|
||||
* Application version in the application defining document in ST-2094
|
||||
* suite. The value shall be set to 0.
|
||||
*/
|
||||
uint8_t application_version;
|
||||
|
||||
/**
|
||||
* The number of processing windows. The value shall be in the range
|
||||
* of 1 to 3, inclusive.
|
||||
*/
|
||||
uint8_t num_windows;
|
||||
|
||||
/**
|
||||
* The color transform parameters for every processing window.
|
||||
*/
|
||||
AVHDRPlusColorTransformParams params[3];
|
||||
|
||||
/**
|
||||
* The nominal maximum display luminance of the targeted system display,
|
||||
* in units of 0.0001 candelas per square metre. The value shall be in
|
||||
* the range of 0 to 10000, inclusive.
|
||||
*/
|
||||
AVRational targeted_system_display_maximum_luminance;
|
||||
|
||||
/**
|
||||
* This flag shall be equal to 0 in bit streams conforming to this version
|
||||
* of this Specification. The value 1 is reserved for future use.
|
||||
*/
|
||||
uint8_t targeted_system_display_actual_peak_luminance_flag;
|
||||
|
||||
/**
|
||||
* The number of rows in the targeted system_display_actual_peak_luminance
|
||||
* array. The value shall be in the range of 2 to 25, inclusive.
|
||||
*/
|
||||
uint8_t num_rows_targeted_system_display_actual_peak_luminance;
|
||||
|
||||
/**
|
||||
* The number of columns in the
|
||||
* targeted_system_display_actual_peak_luminance array. The value shall be
|
||||
* in the range of 2 to 25, inclusive.
|
||||
*/
|
||||
uint8_t num_cols_targeted_system_display_actual_peak_luminance;
|
||||
|
||||
/**
|
||||
* The normalized actual peak luminance of the targeted system display. The
|
||||
* values should be in the range of 0 to 1, inclusive and in multiples of
|
||||
* 1/15.
|
||||
*/
|
||||
AVRational targeted_system_display_actual_peak_luminance[25][25];
|
||||
|
||||
/**
|
||||
* This flag shall be equal to 0 in bitstreams conforming to this version of
|
||||
* this Specification. The value 1 is reserved for future use.
|
||||
*/
|
||||
uint8_t mastering_display_actual_peak_luminance_flag;
|
||||
|
||||
/**
|
||||
* The number of rows in the mastering_display_actual_peak_luminance array.
|
||||
* The value shall be in the range of 2 to 25, inclusive.
|
||||
*/
|
||||
uint8_t num_rows_mastering_display_actual_peak_luminance;
|
||||
|
||||
/**
|
||||
* The number of columns in the mastering_display_actual_peak_luminance
|
||||
* array. The value shall be in the range of 2 to 25, inclusive.
|
||||
*/
|
||||
uint8_t num_cols_mastering_display_actual_peak_luminance;
|
||||
|
||||
/**
|
||||
* The normalized actual peak luminance of the mastering display used for
|
||||
* mastering the image essence. The values should be in the range of 0 to 1,
|
||||
* inclusive and in multiples of 1/15.
|
||||
*/
|
||||
AVRational mastering_display_actual_peak_luminance[25][25];
|
||||
} AVDynamicHDRPlus;
|
||||
|
||||
/**
|
||||
* Allocate an AVDynamicHDRPlus structure and set its fields to
|
||||
* default values. The resulting struct can be freed using av_freep().
|
||||
*
|
||||
* @return An AVDynamicHDRPlus filled with default values or NULL
|
||||
* on failure.
|
||||
*/
|
||||
AVDynamicHDRPlus *av_dynamic_hdr_plus_alloc(size_t *size);
|
||||
|
||||
/**
|
||||
* Allocate a complete AVDynamicHDRPlus and add it to the frame.
|
||||
* @param frame The frame which side data is added to.
|
||||
*
|
||||
* @return The AVDynamicHDRPlus structure to be filled by caller or NULL
|
||||
* on failure.
|
||||
*/
|
||||
AVDynamicHDRPlus *av_dynamic_hdr_plus_create_side_data(AVFrame *frame);
|
||||
|
||||
#endif /* AVUTIL_HDR_DYNAMIC_METADATA_H */
|
||||
@@ -542,6 +542,21 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
|
||||
# define AV_WN64A(p, v) AV_WNA(64, p, v)
|
||||
#endif
|
||||
|
||||
#if AV_HAVE_BIGENDIAN
|
||||
# define AV_RLA(s, p) av_bswap##s(AV_RN##s##A(p))
|
||||
# define AV_WLA(s, p, v) AV_WN##s##A(p, av_bswap##s(v))
|
||||
#else
|
||||
# define AV_RLA(s, p) AV_RN##s##A(p)
|
||||
# define AV_WLA(s, p, v) AV_WN##s##A(p, v)
|
||||
#endif
|
||||
|
||||
#ifndef AV_RL64A
|
||||
# define AV_RL64A(p) AV_RLA(64, p)
|
||||
#endif
|
||||
#ifndef AV_WL64A
|
||||
# define AV_WL64A(p, v) AV_WLA(64, p, v)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The AV_COPYxxU macros are suitable for copying data to/from unaligned
|
||||
* memory locations.
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* LZO 1x decompression
|
||||
* copyright (c) 2006 Reimar Doeffinger
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_LZO_H
|
||||
#define AVUTIL_LZO_H
|
||||
|
||||
/**
|
||||
* @defgroup lavu_lzo LZO
|
||||
* @ingroup lavu_crypto
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/** @name Error flags returned by av_lzo1x_decode
|
||||
* @{ */
|
||||
/// end of the input buffer reached before decoding finished
|
||||
#define AV_LZO_INPUT_DEPLETED 1
|
||||
/// decoded data did not fit into output buffer
|
||||
#define AV_LZO_OUTPUT_FULL 2
|
||||
/// a reference to previously decoded data was wrong
|
||||
#define AV_LZO_INVALID_BACKPTR 4
|
||||
/// a non-specific error in the compressed bitstream
|
||||
#define AV_LZO_ERROR 8
|
||||
/** @} */
|
||||
|
||||
#define AV_LZO_INPUT_PADDING 8
|
||||
#define AV_LZO_OUTPUT_PADDING 12
|
||||
|
||||
/**
|
||||
* @brief Decodes LZO 1x compressed data.
|
||||
* @param out output buffer
|
||||
* @param outlen size of output buffer, number of bytes left are returned here
|
||||
* @param in input buffer
|
||||
* @param inlen size of input buffer, number of bytes left are returned here
|
||||
* @return 0 on success, otherwise a combination of the error flags above
|
||||
*
|
||||
* Make sure all buffers are appropriately padded, in must provide
|
||||
* AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes.
|
||||
*/
|
||||
int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVUTIL_LZO_H */
|
||||
@@ -339,7 +339,7 @@ av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
|
||||
* @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
|
||||
* correctly aligned.
|
||||
*/
|
||||
av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
|
||||
int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
|
||||
|
||||
/**
|
||||
* Reallocate the given buffer if it is not large enough, otherwise do nothing.
|
||||
@@ -363,10 +363,10 @@ av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
|
||||
* @endcode
|
||||
*
|
||||
* @param[in,out] ptr Already allocated buffer, or `NULL`
|
||||
* @param[in,out] size Pointer to current size of buffer `ptr`. `*size` is
|
||||
* changed to `min_size` in case of success or 0 in
|
||||
* case of failure
|
||||
* @param[in] min_size New size of buffer `ptr`
|
||||
* @param[in,out] size Pointer to the size of buffer `ptr`. `*size` is
|
||||
* updated to the new allocated size, in particular 0
|
||||
* in case of failure.
|
||||
* @param[in] min_size Desired minimal size of buffer `ptr`
|
||||
* @return `ptr` if the buffer is large enough, a pointer to newly reallocated
|
||||
* buffer if the buffer was not large enough, or `NULL` in case of
|
||||
* error
|
||||
@@ -397,10 +397,10 @@ void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
|
||||
* @param[in,out] ptr Pointer to pointer to an already allocated buffer.
|
||||
* `*ptr` will be overwritten with pointer to new
|
||||
* buffer on success or `NULL` on failure
|
||||
* @param[in,out] size Pointer to current size of buffer `*ptr`. `*size` is
|
||||
* changed to `min_size` in case of success or 0 in
|
||||
* case of failure
|
||||
* @param[in] min_size New size of buffer `*ptr`
|
||||
* @param[in,out] size Pointer to the size of buffer `*ptr`. `*size` is
|
||||
* updated to the new allocated size, in particular 0
|
||||
* in case of failure.
|
||||
* @param[in] min_size Desired minimal size of buffer `*ptr`
|
||||
* @see av_realloc()
|
||||
* @see av_fast_mallocz()
|
||||
*/
|
||||
@@ -418,10 +418,10 @@ void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
|
||||
* @param[in,out] ptr Pointer to pointer to an already allocated buffer.
|
||||
* `*ptr` will be overwritten with pointer to new
|
||||
* buffer on success or `NULL` on failure
|
||||
* @param[in,out] size Pointer to current size of buffer `*ptr`. `*size` is
|
||||
* changed to `min_size` in case of success or 0 in
|
||||
* case of failure
|
||||
* @param[in] min_size New size of buffer `*ptr`
|
||||
* @param[in,out] size Pointer to the size of buffer `*ptr`. `*size` is
|
||||
* updated to the new allocated size, in particular 0
|
||||
* in case of failure.
|
||||
* @param[in] min_size Desired minimal size of buffer `*ptr`
|
||||
* @see av_fast_malloc()
|
||||
*/
|
||||
void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size);
|
||||
|
||||
@@ -340,6 +340,14 @@ enum AVPixelFormat {
|
||||
AV_PIX_FMT_GRAYF32BE, ///< IEEE-754 single precision Y, 32bpp, big-endian
|
||||
AV_PIX_FMT_GRAYF32LE, ///< IEEE-754 single precision Y, 32bpp, little-endian
|
||||
|
||||
AV_PIX_FMT_YUVA422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, big-endian
|
||||
AV_PIX_FMT_YUVA422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, little-endian
|
||||
AV_PIX_FMT_YUVA444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, big-endian
|
||||
AV_PIX_FMT_YUVA444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, little-endian
|
||||
|
||||
AV_PIX_FMT_NV24, ///< planar YUV 4:4:4, 24bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
|
||||
AV_PIX_FMT_NV42, ///< as above, but U and V bytes are swapped
|
||||
|
||||
AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
|
||||
};
|
||||
|
||||
@@ -416,6 +424,8 @@ enum AVPixelFormat {
|
||||
#define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE)
|
||||
#define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE)
|
||||
#define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE)
|
||||
#define AV_PIX_FMT_YUVA422P12 AV_PIX_FMT_NE(YUVA422P12BE, YUVA422P12LE)
|
||||
#define AV_PIX_FMT_YUVA444P12 AV_PIX_FMT_NE(YUVA444P12BE, YUVA444P12LE)
|
||||
#define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE)
|
||||
#define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE)
|
||||
#define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE)
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_TX_H
|
||||
#define AVUTIL_TX_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct AVTXContext AVTXContext;
|
||||
|
||||
typedef struct AVComplexFloat {
|
||||
float re, im;
|
||||
} AVComplexFloat;
|
||||
|
||||
enum AVTXType {
|
||||
/**
|
||||
* Standard complex to complex FFT with sample data type AVComplexFloat.
|
||||
* Scaling currently unsupported
|
||||
*/
|
||||
AV_TX_FLOAT_FFT = 0,
|
||||
/**
|
||||
* Standard MDCT with sample data type of float and a scale type of
|
||||
* float. Length is the frame size, not the window size (which is 2x frame)
|
||||
*/
|
||||
AV_TX_FLOAT_MDCT = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
* Function pointer to a function to perform the transform.
|
||||
*
|
||||
* @note Using a different context than the one allocated during av_tx_init()
|
||||
* is not allowed.
|
||||
*
|
||||
* @param s the transform context
|
||||
* @param out the output array
|
||||
* @param in the input array
|
||||
* @param stride the input or output stride (depending on transform direction)
|
||||
* in bytes, currently implemented for all MDCT transforms
|
||||
*/
|
||||
typedef void (*av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride);
|
||||
|
||||
/**
|
||||
* Initialize a transform context with the given configuration
|
||||
* Currently power of two lengths from 4 to 131072 are supported, along with
|
||||
* any length decomposable to a power of two and either 3, 5 or 15.
|
||||
*
|
||||
* @param ctx the context to allocate, will be NULL on error
|
||||
* @param tx pointer to the transform function pointer to set
|
||||
* @param type type the type of transform
|
||||
* @param inv whether to do an inverse or a forward transform
|
||||
* @param len the size of the transform in samples
|
||||
* @param scale pointer to the value to scale the output if supported by type
|
||||
* @param flags currently unused
|
||||
*
|
||||
* @return 0 on success, negative error code on failure
|
||||
*/
|
||||
int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type,
|
||||
int inv, int len, const void *scale, uint64_t flags);
|
||||
|
||||
/**
|
||||
* Frees a context and sets ctx to NULL, does nothing when ctx == NULL
|
||||
*/
|
||||
void av_tx_uninit(AVTXContext **ctx);
|
||||
|
||||
#endif /* AVUTIL_TX_H */
|
||||
@@ -79,7 +79,7 @@
|
||||
*/
|
||||
|
||||
#define LIBAVUTIL_VERSION_MAJOR 56
|
||||
#define LIBAVUTIL_VERSION_MINOR 22
|
||||
#define LIBAVUTIL_VERSION_MINOR 31
|
||||
#define LIBAVUTIL_VERSION_MICRO 100
|
||||
|
||||
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Submodule moonlight-common-c/moonlight-common-c updated: e60a7ef75f...dbedf938d4
@@ -47,6 +47,7 @@ SOURCES += \
|
||||
$$COMMON_C_DIR/src/AudioStream.c \
|
||||
$$COMMON_C_DIR/src/ByteBuffer.c \
|
||||
$$COMMON_C_DIR/src/Connection.c \
|
||||
$$COMMON_C_DIR/src/ConnectionTester.c \
|
||||
$$COMMON_C_DIR/src/ControlStream.c \
|
||||
$$COMMON_C_DIR/src/FakeCallbacks.c \
|
||||
$$COMMON_C_DIR/src/InputStream.c \
|
||||
|
||||
+2
-1
@@ -11,7 +11,7 @@ win32:!winrt {
|
||||
SUBDIRS += AntiHooking
|
||||
app.depends += AntiHooking
|
||||
}
|
||||
!winrt {
|
||||
!winrt:win32|macx {
|
||||
SUBDIRS += soundio
|
||||
app.depends += soundio
|
||||
}
|
||||
@@ -22,3 +22,4 @@ CONFIG += debug_and_release
|
||||
# Run our compile tests
|
||||
load(configure)
|
||||
qtCompileTest(SL)
|
||||
qtCompileTest(EGL)
|
||||
|
||||
+1
-1
Submodule qmdnsengine/qmdnsengine updated: c23673fdb4...488954c9b4
Executable
+48
@@ -0,0 +1,48 @@
|
||||
BUILD_CONFIG="release"
|
||||
|
||||
fail()
|
||||
{
|
||||
echo "$1" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
BUILD_ROOT=$PWD/build
|
||||
SOURCE_ROOT=$PWD
|
||||
BUILD_FOLDER=$BUILD_ROOT/build-$BUILD_CONFIG
|
||||
DEPLOY_FOLDER=$BUILD_ROOT/deploy-$BUILD_CONFIG
|
||||
INSTALLER_FOLDER=$BUILD_ROOT/installer-$BUILD_CONFIG
|
||||
VERSION=`cat $SOURCE_ROOT/app/version.txt`
|
||||
|
||||
command -v qmake >/dev/null 2>&1 || fail "Unable to find 'qmake' in your PATH!"
|
||||
command -v linuxdeployqt >/dev/null 2>&1 || fail "Unable to find 'linuxdeployqt' in your PATH!"
|
||||
|
||||
echo Cleaning output directories
|
||||
rm -rf $BUILD_FOLDER
|
||||
rm -rf $DEPLOY_FOLDER
|
||||
rm -rf $INSTALLER_FOLDER
|
||||
mkdir $BUILD_ROOT
|
||||
mkdir $BUILD_FOLDER
|
||||
mkdir $DEPLOY_FOLDER
|
||||
mkdir $INSTALLER_FOLDER
|
||||
|
||||
echo Configuring the project
|
||||
pushd $BUILD_FOLDER
|
||||
qmake $SOURCE_ROOT/moonlight-qt.pro PREFIX=$DEPLOY_FOLDER/usr DEFINES+=APP_IMAGE || fail "Qmake failed!"
|
||||
popd
|
||||
|
||||
echo Compiling Moonlight in $BUILD_CONFIG configuration
|
||||
pushd $BUILD_FOLDER
|
||||
make -j$(nproc) $(echo "$BUILD_CONFIG" | tr '[:upper:]' '[:lower:]') || fail "Make failed!"
|
||||
popd
|
||||
|
||||
echo Deploying to staging directory
|
||||
pushd $BUILD_FOLDER
|
||||
make install || fail "Make install failed!"
|
||||
popd
|
||||
|
||||
echo Creating AppImage
|
||||
pushd $INSTALLER_FOLDER
|
||||
VERSION=$VERSION linuxdeployqt $DEPLOY_FOLDER/usr/share/applications/com.moonlight_stream.Moonlight.desktop -qmldir=$SOURCE_ROOT/app/gui -appimage || fail "linuxdeployqt failed!"
|
||||
popd
|
||||
|
||||
echo Build successful
|
||||
@@ -1,7 +1,10 @@
|
||||
./configure --extra-cflags="-mmacosx-version-min=10.11" --install-name-dir=@loader_path/../lib --enable-pic --enable-shared --disable-static --disable-all --enable-avcodec --enable-decoder=h264 --enable-decoder=hevc --enable-hwaccel=h264_videotoolbox --enable-hwaccel=hevc_videotoolbox
|
||||
rm -rf /tmp/ffmpeg
|
||||
mkdir /tmp/ffmpeg
|
||||
./configure --prefix=/tmp/ffmpeg --extra-cflags="-mmacosx-version-min=10.13" --install-name-dir=@loader_path/../Frameworks --enable-pic --enable-shared --disable-static --disable-all --enable-avcodec --enable-decoder=h264 --enable-decoder=hevc --enable-hwaccel=h264_videotoolbox --enable-hwaccel=hevc_videotoolbox
|
||||
make clean
|
||||
make -j4
|
||||
codesign -s 45U78722YL libavcodec/libavcodec.dylib
|
||||
codesign -s 45U78722YL libavutil/libavutil.dylib
|
||||
codesign -s "$SIGNING_IDENTITY" libavcodec/libavcodec.dylib
|
||||
codesign -s "$SIGNING_IDENTITY" libavutil/libavutil.dylib
|
||||
codesign -vv libavcodec/libavcodec.dylib
|
||||
codesign -vv libavutil/libavutil.dylib
|
||||
codesign -vv libavutil/libavutil.dylib
|
||||
make install
|
||||
@@ -1,3 +1,3 @@
|
||||
./configure --toolchain=msvc --enable-cross-compile --enable-pic --enable-shared --disable-static --disable-all --enable-avcodec --enable-decoder=h264 --enable-decoder=hevc --enable-hwaccel=h264_dxva2 --enable-hwaccel=hevc_dxva2
|
||||
./configure --toolchain=msvc --enable-cross-compile --enable-pic --enable-shared --disable-static --disable-all --enable-avcodec --enable-decoder=h264 --enable-decoder=hevc --enable-hwaccel=h264_dxva2 --enable-hwaccel=hevc_dxva2 --enable-hwaccel=h264_d3d11va --enable-hwaccel=hevc_d3d11va --enable-hwaccel=h264_d3d11va2 --enable-hwaccel=hevc_d3d11va2
|
||||
make clean
|
||||
make -j4
|
||||
@@ -1,3 +1,3 @@
|
||||
./configure --toolchain=msvc --enable-pic --enable-shared --disable-static --disable-all --enable-avcodec --enable-decoder=h264 --enable-decoder=hevc --enable-hwaccel=h264_dxva2 --enable-hwaccel=hevc_dxva2
|
||||
./configure --toolchain=msvc --enable-pic --enable-shared --disable-static --disable-all --enable-avcodec --enable-decoder=h264 --enable-decoder=hevc --enable-hwaccel=h264_dxva2 --enable-hwaccel=hevc_dxva2 --enable-hwaccel=h264_d3d11va --enable-hwaccel=hevc_d3d11va --enable-hwaccel=h264_d3d11va2 --enable-hwaccel=hevc_d3d11va2
|
||||
make clean
|
||||
make -j4
|
||||
@@ -1,4 +1,6 @@
|
||||
BUILD_CONFIG="release"
|
||||
QT_59_COMMIT="9181b082be53c64daa83f36c7093a783fd07b464"
|
||||
QT_514_COMMIT="609d4aaccb503298e7fa9cef45e0ddc4c4afd63c"
|
||||
|
||||
fail()
|
||||
{
|
||||
@@ -26,21 +28,56 @@ mkdir $BUILD_FOLDER
|
||||
mkdir $DEPLOY_FOLDER
|
||||
mkdir $INSTALLER_FOLDER
|
||||
|
||||
echo Initializing Steam Link SDK
|
||||
source $STEAMLINK_SDK_PATH/setenv.sh || fail "SL SDK initialization failed!"
|
||||
|
||||
echo Configuring the project
|
||||
pushd $BUILD_FOLDER
|
||||
qmake $SOURCE_ROOT/moonlight-qt.pro || fail "Qmake failed!"
|
||||
echo Switching to Qt 5.9 SDK
|
||||
pushd $STEAMLINK_SDK_PATH
|
||||
git fetch origin --unshallow
|
||||
git clean -f -d -x
|
||||
git reset --hard
|
||||
git checkout $QT_59_COMMIT || fail "Unable to checkout $QT_59_COMMIT"
|
||||
popd
|
||||
|
||||
echo Compiling Moonlight in $BUILD_CONFIG configuration
|
||||
echo Initializing Steam Link SDK for Qt 5.9
|
||||
source $STEAMLINK_SDK_PATH/setenv.sh || fail "SL SDK initialization failed!"
|
||||
|
||||
echo Configuring the project for Qt 5.9
|
||||
pushd $BUILD_FOLDER
|
||||
qmake $SOURCE_ROOT/moonlight-qt.pro QMAKE_CFLAGS_ISYSTEM= || fail "Qmake failed!"
|
||||
popd
|
||||
|
||||
echo Compiling Moonlight for Qt 5.9 in $BUILD_CONFIG configuration
|
||||
pushd $BUILD_FOLDER
|
||||
make -j$(nproc) $(echo "$BUILD_CONFIG" | tr '[:upper:]' '[:lower:]') || fail "Make failed!"
|
||||
popd
|
||||
|
||||
echo Staging Moonlight for Qt 5.9
|
||||
mkdir -p $DEPLOY_FOLDER/steamlink/apps/moonlight/bin
|
||||
cp $BUILD_FOLDER/app/moonlight $DEPLOY_FOLDER/steamlink/apps/moonlight/bin/moonlight59 || fail "Binary copy failed!"
|
||||
|
||||
echo Cleaning build directory
|
||||
rm -rf $BUILD_FOLDER
|
||||
mkdir $BUILD_FOLDER
|
||||
|
||||
echo Switching to Qt 5.14 SDK
|
||||
pushd $STEAMLINK_SDK_PATH
|
||||
git clean -f -d -x
|
||||
git reset --hard
|
||||
git checkout $QT_514_COMMIT || fail "Unable to checkout $QT_514_COMMIT"
|
||||
popd
|
||||
|
||||
echo Initializing Steam Link SDK for Qt 5.14
|
||||
source $STEAMLINK_SDK_PATH/setenv.sh || fail "SL SDK initialization failed!"
|
||||
|
||||
echo Configuring the project for Qt 5.14
|
||||
pushd $BUILD_FOLDER
|
||||
qmake $SOURCE_ROOT/moonlight-qt.pro QMAKE_CFLAGS_ISYSTEM= || fail "Qmake failed!"
|
||||
popd
|
||||
|
||||
echo Compiling Moonlight for Qt 5.14 in $BUILD_CONFIG configuration
|
||||
pushd $BUILD_FOLDER
|
||||
make -j$(nproc) $(echo "$BUILD_CONFIG" | tr '[:upper:]' '[:lower:]') || fail "Make failed!"
|
||||
popd
|
||||
|
||||
echo Creating app bundle
|
||||
mkdir -p $DEPLOY_FOLDER/steamlink/apps/moonlight/bin
|
||||
cp $BUILD_FOLDER/app/moonlight $DEPLOY_FOLDER/steamlink/apps/moonlight/bin/ || fail "Binary copy failed!"
|
||||
cp $SOURCE_ROOT/app/deploy/steamlink/* $DEPLOY_FOLDER/steamlink/apps/moonlight/ || fail "Metadata copy failed!"
|
||||
pushd $DEPLOY_FOLDER
|
||||
|
||||
@@ -40,7 +40,7 @@ popd
|
||||
|
||||
echo Compiling Moonlight in $BUILD_CONFIG configuration
|
||||
pushd $BUILD_FOLDER
|
||||
make $(echo "$BUILD_CONFIG" | tr '[:upper:]' '[:lower:]') || fail "Make failed!"
|
||||
make -j$(sysctl -n hw.logicalcpu) $(echo "$BUILD_CONFIG" | tr '[:upper:]' '[:lower:]') || fail "Make failed!"
|
||||
popd
|
||||
|
||||
echo Saving dSYM file
|
||||
|
||||
@@ -9,9 +9,11 @@ set ARCH=%2
|
||||
rem Convert to lower case for windeployqt
|
||||
if /I "%BUILD_CONFIG%"=="debug" (
|
||||
set BUILD_CONFIG=debug
|
||||
set WIX_MUMS=10
|
||||
) else (
|
||||
if /I "%BUILD_CONFIG%"=="release" (
|
||||
set BUILD_CONFIG=release
|
||||
set WIX_MUMS=10
|
||||
) else (
|
||||
if /I "%BUILD_CONFIG%"=="signed-release" (
|
||||
set BUILD_CONFIG=release
|
||||
@@ -77,7 +79,7 @@ popd
|
||||
|
||||
echo Compiling Moonlight in %BUILD_CONFIG% configuration
|
||||
pushd %BUILD_FOLDER%
|
||||
nmake %BUILD_CONFIG%
|
||||
%SOURCE_ROOT%\scripts\jom.exe %BUILD_CONFIG%
|
||||
if !ERRORLEVEL! NEQ 0 goto Error
|
||||
popd
|
||||
|
||||
@@ -206,15 +208,6 @@ if !ERRORLEVEL! NEQ 0 goto Error
|
||||
7z a %INSTALLER_FOLDER%\MoonlightPortable-%ARCH%-%VERSION%.zip %DEPLOY_FOLDER%\*
|
||||
if !ERRORLEVEL! NEQ 0 goto Error
|
||||
|
||||
if /i "%APPVEYOR%"=="true" (
|
||||
echo Pushing artifacts
|
||||
appveyor PushArtifact %INSTALLER_FOLDER%\MoonlightSetup-%ARCH%-%VERSION%.exe -FileName MoonlightSetup-%ARCH%-%BUILD_CONFIG%.exe
|
||||
if !ERRORLEVEL! NEQ 0 goto Error
|
||||
appveyor PushArtifact %INSTALLER_FOLDER%\MoonlightPortable-%ARCH%-%VERSION%.zip -FileName MoonlightPortable-%ARCH%-%BUILD_CONFIG%.zip
|
||||
if !ERRORLEVEL! NEQ 0 goto Error
|
||||
appveyor PushArtifact %SYMBOLS_FOLDER%\MoonlightDebuggingSymbols-%ARCH%-%VERSION%.zip -FileName MoonlightDebuggingSymbols-%ARCH%-%BUILD_CONFIG%.zip
|
||||
)
|
||||
|
||||
echo Build successful for Moonlight v%VERSION%!
|
||||
exit /b 0
|
||||
|
||||
|
||||
Binary file not shown.
@@ -23,6 +23,18 @@
|
||||
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." Schedule="afterInstallInitialize" />
|
||||
<MediaTemplate CompressionLevel="high" EmbedCab="yes" />
|
||||
|
||||
<Property Id="MPSSVC_START">
|
||||
<RegistrySearch Id="MpsSvcStart"
|
||||
Root="HKLM"
|
||||
Key="System\CurrentControlSet\Services\MpsSvc"
|
||||
Name="Start"
|
||||
Type="raw" />
|
||||
</Property>
|
||||
|
||||
<Condition Message="Setup cannot proceed because the Windows Firewall service has been improperly disabled or stopped. You must start the Windows Firewall service (MpsSvc) to continue. If you would like to disable Windows Firewall properly, use the Windows Firewall options in Control Panel.">
|
||||
<![CDATA[Installed OR MPSSVC_START="#2"]]>
|
||||
</Condition>
|
||||
|
||||
<?if $(var.Platform) = x64 ?>
|
||||
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
|
||||
<?else ?>
|
||||
|
||||
Reference in New Issue
Block a user